Arduino Code to Moteino Code

Started by francesca, July 14, 2015, 04:00:09 PM

francesca

I have this whole set up with a flow rate sensor and an Arduino Uno and code provided by Atlas Scientific, and everything works, but I want to use a Moteino instead. It's smaller, so it fit's way better, and I like the wireless aspect. But I don't know how to make the code work for the Moteino. Do I need to write it from scratch? Any help would be great!

TomWS

Quote from: francesca on July 14, 2015, 04:00:09 PM
I have this whole set up with a flow rate sensor and an Arduino Uno and code provided by Atlas Scientific, and everything works, but I want to use a Moteino instead. It's smaller, so it fit's way better, and I like the wireless aspect. But I don't know how to make the code work for the Moteino. Do I need to write it from scratch? Any help would be great!
It depends on which signal pins are used in the Uno setup and also whether the signal levels are 5V or 3.3V.  Moteino requires 3.3V signals, but you can easily level shift with resistors if the signals are relatively low frequency.

From a code point of view it's easy, you might have to redefine pin assignments (like LED for instance), but probably not much else.  As I said, from a hardware perspective, you need to check signal levels.  If you have a schematic, post it here and we'll take a look.

Tom

EloyP

Hi Francesca,

Quote from: francesca on July 14, 2015, 04:00:09 PM
I have this whole set up with a flow rate sensor and an Arduino Uno and code provided by Atlas Scientific, and everything works, but I want to use a Moteino instead. It's smaller, so it fit's way better, and I like the wireless aspect. But I don't know how to make the code work for the Moteino. Do I need to write it from scratch? Any help would be great!

I was intrigued by this Flow Meter Totalizer so I took a look at the code and dug a bit into the device itself...

The product seems to be (correct me if I am wrong) the EZO Universal Flow Meter Totalizer: http://www.atlas-scientific.com/product_pages/circuits/ezo_flow.html

The code seems to come straight from this document: http://www.atlas-scientific.com/_files/code/arduino_flow_sample_code.pdf

That document also shows the Arduino connection details. Very simple.

According to the product page and data sheet (http://www.atlas-scientific.com/_files/_datasheets/_circuit/flow_EZO_Datasheet.pdf), the Flow Meter can be powered with 3.3V. In that case it'll be simple to connect it to an Arduino and level shifters will not be necessary.

The code is very simple; I don't think you will have any issues running it on a Moteino, most likely with no modifications as Moteino is an Arduino-compatible platform.

Now I am off to see if I can use this Flow Meter Totalizer at my house ;-)

Cheers!

francesca

I connected everything like the schematic shows in the attached picture. I used pin 2 and 3 on the moteino, and the ground and 3.3V pin that are next to the analog reference pin. I set it up with the Uno first, all good, works fine, 3.3V setting works. Then setting it up with the moteino, nothing gets sent back to the serial monitor. I attached my moteino set up too.

francesca

I switched the pins to 3 and 4 and it works!  :D  Is pin 2 on moteino special?

EloyP

Quote from: francesca on July 14, 2015, 08:39:15 PM
I switched the pins to 3 and 4 and it works!  :D  Is pin 2 on moteino special?

Yes, sorry, I should have thought about it more carefully when I said "I don't think you will have any issues running it on a Moteino, most likely with no modifications".

Arduino digital pin 2 (D2) is used on the Moteino to connect the interrupt request line of the RFM22B/RFM69 transceivers. So, it is not available on the Moteino platform for other users, unless the Moteino does not have the transceiver (ordered without one, or removed later).

Cheers!

EloyP

By the way, in the diagrams in this page you can see what pins are special for Moteino (look for pins marked with a '*'):

http://lowpowerlab.com/moteino/#pinout