A couple of days ago I set up my raspberry pi with the pre-installed emonhub SD card + RFM12P1 unit together with the emonTX V3. Stupidly, I hadn't ordered the CT clamps. But I thought I'd still complete the basic set up whlie I waited for the clamps to arrive.
I created a new account on emoncms.org. I logged into the raspberry and configured the econhub.conf file as per the instructions: url set to emoncms.org, apikey set to the write API key in my new account, I left group, frequency and baseid to default values and altered the datacodes as instructed. Saved and put the pi back to read only.
Then I plugged in the emonTX with only its charger (no CT clamps), I checked my emoncms account ("snerone") and bingo, it gave me an input reading on Key 5 for the voltage reading. Brilliant, I thought. Everyone's talking to each other. I'm not using any local installation of emoncms.
Today I received the two CT sensors and got clamping. I clamped the sensors around the incoming PV live and the other on the mains incoming live. Then I carefully set up the pi and the emonTX aerials so that they had a clear line of sight across the kitchen and dining room (c.10m). I logged into my emoncms account and saw inactive input readings - only the first reading from my initial set up and test a couple of days ago was there:
[I don't like the 280V reading. It's a bit too high. But we're at the end of the line in the middle of the countryside and with the solar PV's now online I've seen it fluctuating between 240V and 268V. I'm ignoring it for now, but will call in our providers to install a regulator of some sort.]
So, I tried switching the CT sensors onto the neutral wires. But still nothing. Reset the EmonTX a couple of times. Thinking that maybe it was a signal issue, I removed the CT sensors and moved the emonTX right next to the raspberry with only the voltage adapter plugged in. But still no readings. What's going on?
In the meantime, I found the RFM12P1 Interface module for emoncms github page and followed the instructions until I got stuck at:
Clone the repository into the Modules/ directory of your emoncms installation.
Clone who? How?
Thanks!
Re: Inactive inputs
Hi, the raspberrypi module for emoncms you refer to is specific to a local emoncms installation and was the interface between emonCMS and the RFM2Pi board before emonHub. The SD card has emonHub installed and that interfaces directly with the RFM2Pi and then forwards the data to emonCMS. So you don't need the raspberrypi module and in fact installing it will cause a conflict with emonHub.
Have you had a look at the emonhub log file ?
will show you the contents of the file since boot and
will show you the last 10 log messages and any new ones as they happen
Paul
Re: Inactive inputs
Ah! Thank you. A log to look at :)
It's full of error warnings. The first three warnings are:
Then there's an endless slew of:
And yet, I followed the guide here which states to change the datacodes in /boot/emonhub.conf:
Have I done something daft?
Also, should I uninstall what I've done so far? Or can the php, pecl and emoncms-module-rfm12pi libraries sit wherever they are as I haven't moved them to the rpi Module folder yet?
[2 near duplicate posts deleted - Moderator (RW)]
Re: Inactive inputs
I've done a bit more reading on my log warnings.
I saw your post (paul) re the 1970 date quirk and may follow that route. But I don't think it's the issue. Only the first 6 lines of the log display the wrong date. Subsequent warning logs , instead, display the correct time (minus 2hrs):
So I assume that emonhub is setting the time to 0 (1970) in the 27seconds or so that it takes the raspberry to retrieve the real network's time.
If I run the the fake-hwclock command and then the date command I'm "roughly" in the right place give or take an hour or two:
I've checked my router and it's correctly set to GMT+1, which is my current location. I'm not too worried about the +1-2 hour discrepency.
Following another post I've just set the loglevel (/boot/emonhub.conf) to DEBUG and this is what the log reports:
Seb
Re: Inactive inputs
The most important issue here is the incorrect time and date, see http://openenergymonitor.org/emon/node/5899 for more insight and how to reset the time.
The datacodes error says the frame received only contains 12 byte values and therefore it cannot translate it to the string of datacodes you have specified (1 unsigned long (4bytes) + 4 signed ints (8bytes) + 4 signed longs (16bytes) = 28 bytes) I suspect you are running the standard sketch on the emonTx, if that is the case the payload is all ints and requires no declaration in emonhub.conf [nodes].
you can remove the emoncms module using
just to avoid any future clashes or confusion and I suspect the php stuff should be ok.
Once you've sorted those and tried again we can have another look, the 1st line of your log looks a little odd too, that frame would normally end ['>', '4b'] or ['>', '8b'] depending on if you are using 433 or 868 MHz so that looks a little confused but may clear with the above items.
Paul
Re: Inactive inputs
Thanks Paul.
Fristly, there's a post to this thread that's still awaiting moderation. It's got some extra details to what I've done so far and some more logs and readings re the date issue and debug log.
Secondly, I've got it working without tackling the date stamp issue. Although I've got a sneaking suspicion that it's still not quite right. Here's what I've done:
I re-instated the default datacodes in /boot/emonhub.conf file to:
And now the input feeds are displaying and actively updating my readings. Hurrah! One of the CT Sensors isn't giving me anything, but that's probably my goof and needs reclamping elsewhere.
That aside. Just before (partially?) solving the palava I restarted emonhub and ran cat /var/log/emonhub/emonhub.log just to check what was going on. It still displays the 1970 datestamp for the first 27 seconds, thereafter it finds the network reading (-2hrs):
Another thing from the above log struck me: I'm running EmonHub rc1.0. Digging around I've seen that there's an rc1.1. Could this be the source of my problems?
Many thanks for the support.
Seb
Re: Inactive inputs
The fact that the time can some, maybe even most of the time correct itself isn't really reliable and can cause issues of varying degrees. The topic is discussed in some detail on this Read-only image time issues thread.
Aside from the date issue that last log looks fine except for the odd " ['>\x00', '84b'] " response from the RFM2Pi, I can't tell why that is happening at this point but It seems to have no effect on the function. The "Setting RFM2Pi frequency: 433 (4b)" log confirms the correct command was sent by emonHub and the successful receipt of data confirms the RFM2Pi is on 433MHz. I'm not sure where the "8" comes from but the "'>\x00'" is frequently seen the first time the RFM2Pi communicates following powering up.
The rc1.1 version has very minor changes and is "in testing" at the moment so you must of seen one of my posted logs, it offers very little and will probably get merged in time for the next SD image update, there are a couple of other tweaks that may make it into rc1.1 before then. The current version is still rc1.0 and as far as I'm aware (fingers crossed and touch wood etc etc) there haven't been any issues yet ( why do I feel like I'm gonna regret saying that ?)
The Pi's time is not sourced from your router, the Pi will check online with NTP servers to ascertain UTC, If you want GMT/BST you will need to set the timezone locally on the Pi (personally I leave my emonHub Pi as UTC for simple consistency) .
Every hour from boot the Pi's current time gets backed up by fake-hwclock and the fake-time you saw, presumably at 09:16:45 BST would of updated 16 seconds later from 07:17:01 UTC to 08:17:01 UTC so the time on the Pi looks correct at that time.
Paul
Re: Inactive inputs
Super.
So it's just the date setting thing that I should tie up. Goodie.
Re the datacodes, maybe you should add a note (for the thickies among us) about setting them in your online guide. Re-reading it I realised that I never set up the Arduino environment / firmware on the EmonTX. I just used it as is out-the-box. That's probably where I tripped over when following the instructions. I changed the datacodes that were set for something I hadn't implemented:
Anyhoo, thanks again for the great support. And may I also add that emoncms is deeply awesome. :)
Seb
Re: Inactive inputs
hiya,
I ran your easy to install script here:
but I'm getting a no such file or directory error :(
I tried creating one (mkdir) and pulled git repo again. But I still got no joy (fatal: destination path 'ntp-backup' already exists and is not an empty directory).
As you predicted the date issue has come back to bite me. I've set up my GLCD and it's not picking up the correct time.
Setting emonhub.conf back to 'debug' I get the usual 27sec lapse before the correct time kicks in:
Re: Inactive inputs
Hi Seb,
Did you run it from the home directory?
Paul
Re: Inactive inputs
I think so:
pi@raspberrypi /home $...
Should I have been in a different home? :)
Seb
Re: Inactive inputs
Aha! Yes, no, well sort of !
I apologize for using general terms when the home directory is referred to, it meant the home directory of the user rather than the directory called home, so for the user pi it would be /home/pi. Its the place that the prompt starts at when first booted and where it ends up if you just type "cd" and enter. Perhaps I should of said the users home directory.
I have now changed it to be less dependent on location so you should be able to run
from anywhere or if you prefer you can still go to the users home dir and run the original command
Paul
Re: Inactive inputs
I'm kicking myself too, because I didn't heed my suspicion that there may have been 'another' home. Doh!
Holy moly, it's worked. Lovely. Big thanks!
Re: Inactive inputs
I'm glad you brought it up, hopefully the changes will make it easier to use.
Re: Inactive inputs
btw, anyone running Paul's ntp script can also change their time zone (UTC+ whatever) by navigating to:
/usr/share/zoneinfo/
Then find your continent or country and/or the country or city therein and then run the command:
sudo ln -sf /usr/share/zoneinfo/<country or zone>/<city> /etc/localtime
Eg, if you're in Paris:
sudo ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime
Happily synced now.
Seb
Re: Inactive inputs
Good to hear you are all sorted, Seb.
You can also use the "raspi-config" menu system to select your time zone etc. Although it doesn't work at boot up because you are in read-only mode by default. You can start it from the command line after changing to write mode using
The only function that won't work is expanding the file system as the 3rd "data" partition confuses the process. see http://openenergymonitor.org/emon/node/5740 for a workaround if you need to expand the partition sizes.
Paul