EMONCMS shown data lagging behind reality

I am running Emoncms on a Raspberry Pi with RFM12Pi since more than one year now. Everything worked like a charm until some weeks (not really sure) ago.

Now I have a very strange effect. If I look at the data (e.g. outside temperature graph), I can see that the curve does not follow the expected line, it starts to increase around noon and drops around midnight. Even if I touch the temperature sensor, I do not see any change in temperature (not in the graph, nor in the realtime value).

I think that the data is just lagging the reality by some 5-8 hours!?! This is for the graphs and also for the realtime values shown in the feed data. The Feed updates every ~30s (temperature log) but shows a very 'old' value. How can this happen?

After a reboot everything is (seems) ok again. But after ~3-4 days I have the same effect again.

I have to say that I have another bad effect since some time. There are a lot of RFM12Bs transmitting data, because I am testing a few 30-cell lithium batteries in my house for PV energy storage. And every cell has its own RFM12B for monitoring. This leads to a lot of bad data points (unreasonable values) in my Emoncms power and temperature loggings. This is also strange because I always thought that evaluation of the CRC would prevent this.

But, could this also have an effect like described above? I see that I loose a lot of data points in the temperature log, possibly to parallel transmissions by one of the other RFM12s. But how can this sort of 'stretch' the time scale?

Any hint very much appreciated,

BR, Jörg.


TrystanLea's picture

Re: EMONCMS shown data lagging behind reality

If its works ok after a reset it sounds like a system time issue? Could that be possible? do you lose power often?

JBecker's picture

Re: EMONCMS shown data lagging behind reality

Not really (==never). And system time is absolutely correct if I log into the Raspberry Pi (date command).

The graphs in Emoncms also show the correct 'time' means that the last data point shown is always at the current time (but the data itself is 6 hours old).


PS: if I look into the data, I think I can see that the 'shifting' began at the same time when I also see the first 'bad' data points appear. This was around start of February when I moved an 8-cell Lithium battery block from the cellar into my office (where the raspi is also located). So I think it has something to do with destroyed data packets (?). But how can this affect the time when the data is stored in the data base? 

JBecker's picture

Re: EMONCMS shown data lagging behind reality

Could it possibly be, that the serial receive buffer size (on the rasbpi) is increasing because more data is put into the buffer than what is read from it (maybe due to bad length information)? Is this buffer dynamically allocated?

I can remember that free memory on the rasbpi was very much down before I rebooted last time. It was showing only ~20MB left (I looked into this because the rasbpi appeared very slow to me). After reboot I can now see more than 300MB free memory (slowly but monotonously decreasing!). Or is this pure nonsense (I have absolutely no experience with Linux!)?

JBecker's picture

Re: EMONCMS shown data lagging behind reality

I would very much like to have a look into the receiving code on the rasbpi. Could someone please point me into the right direction (where exactly do I find this code)? I am using an RFM12PI V1 (with ATTiny),

BR, Jörg.

PS: since reboot yesterday evening, temperature is already 'lagging' by more than one hour now! How I tested:

The temperature graph shows 19.2°C at 8:36 (the correct time). The feed data also shows 19.2°C (updated 9s ago). I then put the sensor between my fingers (>30°C) for a few minutes. All the feeds are continuously updating in the normal time intervals (AC power every 10s, temperatures ~every 50s). But the 'finger effect' shows up only after more than one hour!?! 

TrystanLea's picture

Re: EMONCMS shown data lagging behind reality

if your using raspberrypi_run.php to recieve packets from the rfm12pi adapter board then you could try restarting the rfm12piphp service with logging turned on

sudo /etc/init.d/rfm12piphp restart log

the log should then be here:


can can be viewed with

tail -f /var/log/rfm12piphp.log

Alternatively you can run the script manually:

sudo /etc/init.d/rfm12piphp stop


cd /var/www/emoncms/Modules/raspberrypi

sudo php raspberrypi_run.php

What feed engines are you using?


JBecker's picture

Re: EMONCMS shown data lagging behind reality

Hmmm, possibly due to all this playing around with reboots and also some power OFF/ONs, i finally managed to kill something on the SD-Card. It is not booting any more. That's it for the moment!

During more than one year I never had a problem with SD card corruption, only contact problems between the micro SD card and the card adapter (had to move the card a bit in all directions until it would finally boot). I tried three adapters (Samsung) and only one worked at all in the Raspi. Why didn't they use a micro SD card socket instead?

Sorry that I cannot test anything anymore. I still think that there might be a potential problem in an environment with many RF transmissions in the same band.   


Comment viewing options

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