getting started with rfm12pi

Hello. Im having difficulties with raspberry pi and rfm12pi.

What i have done so far is:

-setting up arduino. my emonTx works fine. from my arduino serial monitor i see that its working fine. it sends data in the correct CT

-i bought a raspberry pi with a prepared mini memory card,but it turned out to have some problems so i downloaded raspberry pi OS from official website. After a lot of efforts i made it,my raspberry pi GUI was open.

-following open energy monitor tutorial i could install emonhub service in my raspberry pi. Now here starts my headache.

My question is. Is RFM12Pi configured? or do i need to add firmware somehow since i have download a new firmware different from what i was given before?

at the moment when i boot my raspberry pi the emonhub.logs it has only two lines which shows that service is successfuly started. From what i read each signal that raspberry pi catch from rfm12pi module it add an other line. Does this mean my raspberry pi is not using this module at all?

related to my issue i have strictly followed this page

 http://wiki.openenergymonitor.org/index.php?title=RFM12Pi_V2,

​exactly this lines

$ sudo apt-get update

$ sudo apt-get install arduino

$ sudo apt-get install python-dev&&python-rpi.gpio

$ git clone https://github.com/mharizanov/avrdude-rpi.git

$ cd avrdude-rpi

$ sudo cp autoreset /usr/bin

$ sudo cp avrdude-autoreset /usr/bin

$ sudo mv /usr/bin/avrdude /usr/bin/avrdude-original

$ sudo ln -s /usr/bin/avrdude-autoreset /usr/bin/avrdude

$ cd /home/pi

$ git clone https://github.com/mharizanov/RFM2Pi.git

$ cd RFM2Pi/firmware/RF12_Demo_atmega328

$ sudo service rfm12piphp stop  (THIS IS where my problem start with this tutorial)

$ avrdude -v -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 38400 -U flash:w:RF12_Demo_atmega328.cpp.hex $ sudo service rfm12piphp start
 

when i write "sudo service rfm12piphp stop" terminal says it does not recognize this service.

 

I have all day reading all possible tutorial, what am i doing wrong?

pb66's picture

Re: getting started with rfm12pi

The RFM2Pi boards do come with pre-installed firmware so you shouldn't need to update the firmware. The routine is stopping at that point because the "rfm12piphp" service isn't installed and therefore not running.

The RFM2Pi settings are set by emonHub, you need to be sure that emonHub.conf has the correct frequency and group set for the RFM2Pi, the defaults are 433 and 210, unless you have a 868MHz network or you have changed the group setting in your node sketches.

If you also change emonHub's loglevel to debug while in the conf file, you will be able to see more of what's happening behind the scenes in the logs and if you still don't get any joy post the log messages for some more assistance.

Paul

ariol22's picture

Re: getting started with rfm12pi

Hello Paul

Thank you so much for your replay. setting my emonhub's loglevel to debug was something that i had missed. I change loglevel and this is the message on my logfile

2014-10-22 07:13:51,226 INFO Logging level set to DEBUG
2014-10-22 07:14:16,358 DEBUG SIGINT received.
2014-10-22 07:14:16,370 DEBUG Closing serial port
2014-10-22 07:14:16,372 INFO Exiting hub...
2014-10-22 07:14:18,110 INFO EmonHub Pre-Release Development Version (rc1.0)
2014-10-22 07:14:18,113 INFO Opening hub...
2014-10-22 07:14:18,116 INFO Logging level set to DEBUG
2014-10-22 07:14:18,119 INFO Creating EmonHubEmoncmsReporter 'emonCMS' 
2014-10-22 07:14:18,124 INFO Set up reporter 'emonCMS' (buffer: memory | size: 1000)
2014-10-22 07:14:18,130 INFO Creating EmonHubJeeInterfacer 'RFM2Pi' 
2014-10-22 07:14:18,133 DEBUG Opening serial port: /dev/ttyAMA0
2014-10-22 07:14:18,137 INFO Opened serial port: /dev/ttyAMA0 9600 bits/s
2014-10-22 07:14:18,140 DEBUG Setting RFM2Pi frequency: 433 (4b)
2014-10-22 07:14:19,144 DEBUG Setting RFM2Pi group: 210 (210g)
2014-10-22 07:14:20,150 DEBUG Setting RFM2Pi baseid: 10 (10i)

By the way my baseid was originaly 19, i changed it to 10. is something wrong with that?

when i start my raspberry pi or restart emonhub service i get this message in my terminal

  File "/home/pi/emonhub/src/emonhub.py", line 336, in <module>
    hub.run()
  File "/home/pi/emonhub/src/emonhub.py", line 90, in run
    values = I.read()
  File "/home/pi/emonhub/src/emonhub_interfacer.py", line 352, in read
    self._rx_buf = self._rx_buf + self._ser.readline()
  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 456, in read
    raise SerialException('device reports readiness to read but returned no data (device disconnected?)')
serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected?)

What about the rfm12piphp service? is it normal that my terminal do not recognize this service?

also in node in emonhub.conf i have

[[10]]

datacodes = L,h,h,h,h,l,l,l,l

pb66's picture

Re: getting started with rfm12pi

The baseid is the nodeid for the base station, normally that is 15, you can change it but it needs to be a nodeid that is specific to the base. Every device (base and nodes) needs it's own nodeid which in the case of the base is called the baseid. The default for the emonTx is nodeid 10 and for the base (emonhub) it's 15.

Use of the [nodes] section in the emonhub.conf is not mandatory. Only if you use sketches that use anything other than the default of signed integers in their payloads would you need to declare the datacodes used. So if you are using the default emonTx sketch as supplied you do not need an entry in the [nodes] section.

The guide to update the rfm2pi firmware was written some time ago when using the raspberrypi module was the norm. The raspberrypi module included the rfm2piphp service. If you were wanting to upgrade the rfm2pi firmware on a system running emonhub you would replace that line with "sudo service emonhub stop" to stop the emonhub service instead. Basically you need to stop whatever you have accessing the rfm2pi board from running while you do the update.

Although I haven't previously seen the error message you have there, it points to a problem with the serial connection and appears to have successfully created a connection but cannot use that connection. You've said you had some initial problems and followed a guide to set up emonHub, which guide did you follow?

can you confirm these 2 points

1) Does the last line in /etc/inittab read (in particular the # should of been added)

# T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

​2) Does the single line in /boot/cmdline.txt read

dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait

Paul

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.