Moteino and RFM12Pi

Started by priority, June 06, 2013, 10:42:30 PM

priority

Is there any obvious problems using a RFM12Pi http://wiki.openenergymonitor.org/index.php?title=Raspberry_Pi as the RFM12B gateway on a Raspberry Pi to receive data from a bunch of Moteinos? 

In reading over both the lowpowerlab and emoncms sites, it appears that I would need to program the ATtiny84 to handle the Moteino packets using the lowpowerlab RFM12B library.    Other than that, anything else needed to get this working?

Felix

I haven't tested the library with attiny84 chips or RFM2Pi. While there are pbvious differences the lib should theoretically work since it's based off the Jeelib version. I would check the config section in the header file (look for "__AVR_ATtiny84__"). Also there should either be a delay of 50-60ms at the beginning of init() or a delay added with fuse settings, otherwise the rfm12b might not be ready in time for the init function.
I see the newer version of the RFM2Pi is based on the Atmega328 which would be better.
Either way RFM2Pi is more expensive (~$25) so you could use another Moteino as a gateway... (no, not trying to sell more, just sayin...)  ;)

teo770

Felix,

To replace a RFM12Pi board by a Moteino on a Raspberry pi, i need to wire the same connections ?

RX and TX
+3.3v
GND
Reset

Use the sketch Receive.ino
On the Raspbian side... you have an already compiled lib somewhere ? Or a quick howto to include your rfm12 updates ?

Teo


Felix

Teo,
Yes, the connections are the same. You can use 3.3v or 5v for power. The reset is only necessary if you want to reprogram Moteino directly from RPi.
I don't have a RPi library but the input/output is serial so any library that can process clear text will work. That's of course if you send clear text. For programming you will need the Arduino IDE compiled for Raspbian.
The transport layer is abstracted in the RFM12B/RFM69 libraries. The receiver/gateway extracts the information from RF packets and passes them on the serial output to the host/RPi. From there on you just need to read the serial stream and do whatever you need.
On the other hand you can load Moteino with any other library that will work with RFM12B or RFM69 transceivers.

xtradv

Felix,

Just got Moteino-USB yesterday. My question is for this Moteino do I symply plug-in the usb port and Raspberry should be able to access data thru serail port. Do I still use  ttyAMA0 or different port name in /boot/cmdline.txt and WattMote.py.  I am new user and try to to build the system  reference in the blog http://lowpowerlab.com/blog/2012/12/28/wattmote-moteino-based-wireless-killawatt/ 

Felix

Well your Pi should be able to see it yes. I'm not sure about drivers, if they are needed.
Also a new COM port should show up. Typically ttyAMA0 is the GPIO serial port. So the FTDI serial port will only show when you have it plugged in.
I don't think there is any issue powering it from the Pi either. Let us know how it goes.

xtradv

I plug-in Moteino-USB into RPi thru mini-USB port first then power on RPi. Console show following:

..
usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0
ftd_sio: v1.6.0: USB FTDI Serial Converters Driver
..

And I start arduino ide, I can see Tool->Serial Port is available, used to be grey out, drill down I see '/dev/ttyUSB0'

So, my question, all your script in your  WattMote project do I have to change 'ttyAMA0' to 'ttySUB0' to make Rpi get data from Moteino-USB.

Felix

Yes, change it to whatever the Moteino-USB is. That's cause the scripts assumed that the attached moteino serial is wired through the GPIO serial of the Pi.

xtradv

I have problem compile WattMote.ino sketch in the ide,  https://github.com/LowPowerLab/WattMote is the place I got WattMote.ino sketch,
Got following compile error: I am guessing i miss header file.  Please advise how I can compile the sketch and load it to 
Moteino.

WattMote.ino: In function 'void setup()':
WattMote:62: error: 'LowPower' was not declared in this scope
WattMote:62: error: 'SLEEP_4S' was not declared in this scope
WattMote:62: error: 'ADC_OFF' was not declared in this scope
WattMote:62: error: 'BOD_ON' was not declared in this scope
WattMote.ino: In function 'void loop()':
WattMote:144: error: 'LowPower' was not declared in this scope
WattMote:144: error: 'SLEEP_1S' was not declared in this scope
WattMote:144: error: 'ADC_OFF' was not declared in this scope
WattMote:144: error: 'BOD_ON' was not declared in this scope


xtradv

Got the library, now it compile fine in win7 ide.

Another problem I am facing is the power to drive Moteino-USB. If I use the schematic in web, the incoming power only measured at ~2V.  The whole system won't work. Friend of mine help me solve the problem use external adapter and drill two hole into KWat inside, as the power for Moteino-USB. Now I can collect data from KWat and transmit to RPi.

Felix

Moteino-USB is not really meant to be driven from external power, but only from USB, as mentioned on the product page and at moteino.com
The lowest power possible is achieved with regular Moteinos that do not have the FTDI chip included.

xtradv


The data received in RPi seems constant, see following, even I don't plug in any device to KWAtt, it still transmit data. How do I troubleshoot this issue.

...
Volts data:  [138, 82, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 46, 93, 150, 200, 243, 263, 270, 270, 251, 197, 139]
Amps data:  [0, 0, 0, 20, 66, 117, 166, 208, 237, 249, 249, 244, 199, 140, 88, 34, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
...

Felix

Load or no load, it always transmits of course.
The data is sampled from the KAW, so whatever the KAW gives it that's what you get.

qqlapraline

Quote from: Felix on June 07, 2013, 08:19:51 AM
I haven't tested the library with attiny84 chips or RFM2Pi. While there are pbvious differences the lib should theoretically work since it's based off the Jeelib version. I would check the config section in the header file (look for "__AVR_ATtiny84__"). Also there should either be a delay of 50-60ms at the beginning of init() or a delay added with fuse settings, otherwise the rfm12b might not be ready in time for the init function.
I see the newer version of the RFM2Pi is based on the Atmega328 which would be better.
Either way RFM2Pi is more expensive (~$25) so you could use another Moteino as a gateway... (no, not trying to sell more, just sayin...)  ;)

Hello,

Yes, but if you include shipping costs, I become much more costly.
I'm trying to buy two moteino and I get an extra 25 % for S&H...
(I may be a little out of topic).