(SOLVED) Problem receiving from packet gen

Hi

Congratulations for set up so far! Apologies I am a software newbie!

I have set up Emoncms on a Pi with HDD, It receives power & temp info from 2 Emontx V2 all working fine so far including gas!

I am trying to add control via the packet gen module, but no success!

I have updated emoncms & the packet gen module on the Pi

Emoncms on the Pi is set to Node 15

I have uploaded Glyn's s heating control sketch (unmodified)  but the EmonTx doesn't receive the packet gen data or  RTC data

I have a Jeelabs relay module I eventually plan to use their output plug with a separate relay board for more outputs

Serial op from EmonTx:

heating boiler relay controller - openenergymonitor.org
35 0 35 0 35 35 0
0:35::0
Heating: 0

35 0 35 0 35 35 0
0:35::0
Heating: 0

35 0 35 0 35 35 0
0:35::0
Heating: 0

etc every 5 seconds

Any ideas?

Richard

TrystanLea's picture

Re: (SOLVED) Problem receiving from packet gen

Hello Richard

Im currently working on an upgrade to the raspberrypi hdd image and these are the command line steps to make sure that emoncms and associated module are all up to date, try these and see if it works:

cd /var/www/emoncms
git pull
git checkout master

cd /var/www/emoncms/Modules/packetgen
git pull

cd /var/www/emoncms/Modules/raspberrypi
git pull
git checkout raspberrypi_run.php
git checkout master
git pull

cd /var/www/emoncms/Modules/event
git pull
git checkout master
git pull

cd /var/www/emoncms/Modules/mqtt
git pull

cp /var/www/emoncms/Modules/packetgen/copyto_raspberrpi_module/raspberrypi_run.php /var/www/emoncms/Modules/raspberrypi

$ redis-cli
>flushall

sudo /etc/init.d/rfm12piphp restart

hatfieldr's picture

Re: (SOLVED) Problem receiving from packet gen

Hi Trystan many thanks for such a prompt reply!

I updated as you suggested - everything went fine except the copy line which gave error message

root@raspberrypi:/var/www/emoncms/Modules/mqtt# cp /var/www/emoncms/Modules/pack                   etgen/copyto_raspberrypi_module/raspberrypi_run.php/var/www/emoncms/Modules/raspberrypi
cp: missing destination file operand after `/var/www/emoncms/Modules/packetgen/c                   opyto_raspberrypi_module/raspberrypi_run.php/var/www/emoncms/Modules/raspberrypi                   '
Try `cp --help' for more information.

Not sure what I did wrong!

I tried it again- now the serial output on the EmonTx is:

"heating boiler relay controller - openenergymonitor.org"

There is no scrolling but no switching either!

Richard

ukmoose's picture

Re: (SOLVED) Problem receiving from packet gen

There needs to be a space after the raspberrypi_run.php in the long cp string.

 

basically cp expects to be given two strings after it. The <from> and the <to> there's needs to be a space between them.

 

pb66's picture

Re: (SOLVED) Problem receiving from packet gen

Looking at the error message It looks the space between the source and destination is missing immediately after .php.

I have 2 browsers open IE and chrome and while IE displays it as 1 line extending beyond the grey box chrome shows it as 2 lines, it is supposed to be all 1 line in 3 parts.

 

 

hatfieldr's picture

Re: (SOLVED) Problem receiving from packet gen

Sorry all done! (I also note that "copyto_raspberrpi_module"  has no "y" in it is that correct?)

There were no error messages and everything seems to be up to date but I still cant make it work The serial op from the Tx is now the same as it was before

Any other ideas?

Is there another simple sketch I can load on theTX to see if any packets are being sent?

 

Richard

pb66's picture

Re: (SOLVED) Problem receiving from packet gen

Yes it is correct to omit the y in this case as the folder you are trying to copy from is named "copyto_raspberrpi_module" 

the file you should now have in /var/www/emoncms/Modules/raspberrypi is this one https://github.com/emoncms/packetgen/blob/master/copyto_raspberrpi_module/raspberrypi_run.php

and there is a link to another example sketch called Arduino "Examples / electricradiator" at the bottom of this page https://github.com/emoncms/development/tree/master/Modules/control

 

TrystanLea's picture

Re: (SOLVED) Problem receiving from packet gen

Try restarting the rfm12piphp service with logging turned on:

sudo /etc/init.d/rfm12piphp restart log

and then to view the log:

tail -f /var/log/rfm12piphp.log

 

The output should be something like this:

MESSAGE RX:> 0s
LENGTH: -> 9 b

DATA RX: 20 220 6
DATA RX: 10 65 11 76 11 0 0 18 0 171 10 175 10 70 95 138 3 170 6 69 4 0 0
DATA RX: 21 114 6 211 11
DATA RX: 10 67 11 78 11 0 0 20 0 185 10 189 10 68 95 138 3 170 6 63 4 0 0
MESSAGE RX:> 0s
LENGTH: -> 9 b

DATA RX: 6 94 0 0 0 0 0 0 0 129 96 0 0
DATA RX: 20 220 6
DATA RX: 16 150 2
MESSAGE RX:> 0s
LENGTH: -> 9 b

DATA RX: 3 1 6 187 11
DATA RX: 19 88 2 34 13
DATA RX: 22 70 6 187 11
DATA RX: 10 78 11 90 11 0 0 15 0 161 10 166 10 107 95 138 3 170 6 63 4 0 0
MESSAGE RX:> 0s
LENGTH: -> 9 b

DATA RX: 23 151 5 236 11
DATA RX: 20 220 6

The MESSAGE RX:> 0s LENGTH: -> 9 b part indicates that a packet is being sent every so many seconds (depending on your settings)

hatfieldr's picture

Re: (SOLVED) Problem receiving from packet gen

This is a copy of the log:

Restarting RPIroot@raspberrypi:~# tail -f /var/log/rfm12piphp.log
DATA RX: 10 204 4 245 255 10 0 234 0 156 249 231 216 132 98
MESSAGE RX:> 0s
LENGTH: -> 13 b
DATA RX: 10 195 4 244 255 5 0 234 0 156 249 231 216 143 98
MESSAGE RX:> 0s
LENGTH: -> 13 b
DATA RX: 10 194 4 242 255 8 0 234 0 156 249 231 216 150 98
Sending remote dataMESSAGE RX:> 0s
LENGTH: -> 13 b
DATA RX: 10 195 4 244 255 6 0 234 0 156 249 231 216 175 98
MESSAGE RX:> 0s
LENGTH: -> 13 b
DATA RX: 10 173 4 243 255 4 0 234 0 156 249 231 216 179 98
MESSAGE RX:> 0s
LENGTH: -> 13 b
DATA RX: 10 194 4 241 255 7 0 234 0 156 249 231 216 159 98
MESSAGE RX:> 0s
LENGTH: -> 13 b
MESSAGE RX:> 0s
LENGTH: -> 13 b
Sending remote dataMESSAGE RX:> 0s
LENGTH: -> 13 b

 

Richard

hatfieldr's picture

Re: (SOLVED) Problem receiving from packet gen

Some progress!

The packet gen seems to be working! I can control a relay with a very simple sketch on the Tx

The problem seems to be with the Tx firmware not packet gen

I had considerable difficulty getting Glyn's sketch to work : 

https://github.com/emoncms/packetgen/tree/master/Arduino_RFM12B_receiver...

​This is clearly a more complicated sketch than the one he used in his video!

I had problems with the software RTC & I hadn't realized that the packet gen module had to be set up exactly as per the  "typdef struct" in the sketch ie

typedef struct
{
  byte blankchar;
  byte hour;
  byte minute;
  byte second;
  int target_temperature;
  int hysteresis;
  boolean Heating;

}    (including "byte blankchar"?)

I thought the hour minute & second variables would be declared automatically by the packet gen?

It now seems to work fine!

I have an RTC board for the Pi which will allow the RFM12Pi to piggy-back on top (& hopefully not interfere)

Would it be possible to get Emoncms running on the Pi with an RTC board so that it was completely independent of the internet for heating timing & control?

Richard

Comment viewing options

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