Hi All
I have built the EmonTx and EmonBase modules and have had these working with 1 CT and posting to Pachube (now renamed to Cosm).
Now due to the fact that i could not get this setup to reliably post the results to Pachube for more than about a day (sometimes even less), without the need for resetting the EmonBase unit. I did try some of the tweaks mentioned here in these forums, but never had a sucessful outcome. My old Pachube feed can be found here https://cosm.com/feeds/55837
I have now decided that i want to sort out my setup, get it posting its results reliably, along with temperature, and want to experience some of the bling dashboards that i have seen using emoncms.org.
Now here is the problem so far, if i use the EmonTxFirmware example - emonTx_CT123 sketch then i get some sensible values
3252 3209 (power in watts for CT1, emonTx battery volts)
But if i use the EmonTxFirmware example - emontx_temperature_power sketch then i get these odd readings
0 0.15 0.08 0.03 2081 (real power, apparent power, power factor, Vrms, temperature)
What sketches do i need to be using for my EmonTx and EmonBase for 1 CT and 1 temperature measurements sending to emoncms.org?
Thanks
Roger
Re: Struggling with sketches
The data is transported between the emonTX and emonBase in a structure called payloadTX. You need the same payloadTX in both the emonTx and emonBase. You fill it with the data in emonTx, then in the emonBase you need to extract the data and write it into a string to send to your database.
Looking at emonTx_CT123_Voltage.ino, payloadTX is defined:
and filled:
In the emonBase, looking for example at NanodeRF_Power_RTCrelay_GLCDtemp.ino, we have the same definition, the data is extracted and written as ASCII characters into str with:
If you don't have exactly the same definition of payloadTX at either end, your data will be corrupted. So all you need to do is edit your (working) emonBase sketch to make payloadTX the same as in your emonTx, and write the values into str following the format above. The names that introduce the data "power1:" etc. are the names you used in your database.
Re: Struggling with sketches
Hello Roger, The sketch emonTx_CT123 is CT only measurement while emontx_temperature_power requires a voltage measurement with an AC-AC voltage adapter.
It might be worth looking at this page: http://openenergymonitor.org/emon/emontx/firmware/writing-code-for-the-emontx it goes through how to build up the emontx code from scratch and might help with understanding the full code.
If you dont have a AC-AC voltage adapter for voltage measurement, you will need to use the ct1.calcIrms(1480); rather than the ct1.calcVI(20,2000); function.
Re: Struggling with sketches
Thanks for the pointers. Will go and get my hands dirty with the code. Last time i did any sort of programming, I was at college (and that was over 15 years ago).
Re: Struggling with sketches
After several evenings randomly typing things in on the keyboard :), i now have a working set of data readings in my serial monitor, as below:-
Open Energy Monitor - EmonTx
797.07 watts
3.32 amps
3236v battery
19.37C
However despite my best attempts i still cannot get a working sketch, that sends the data via a "Payload". when i attempt to send the data the serial monitor does not show any of the readings, but if i comment out the send_rf_data(); line then i get back the data readings in the serial monitor. Am i right in thinking that something in the rf_send_data loop is falling over, and thus stopping progressing onto my print_to_serial loop? Could it be that the payload line of the code is setting up several variables as int, and most of my data readings are double?
If it helps i have uploaded my current working sketch at
https://www.sugarsync.com/pf/D7395264_875_674117976
Thanks
Roger
Re: Struggling with sketches
I don't think you sent the correct sketch! I can't see where you are sending the RF data in that one.
Re: Struggling with sketches
Good point about the sketch....
Try this one https://www.sugarsync.com/pf/D7395264_875_685793002
Re: Struggling with sketches
Two problems:
You need to add
at the end of setup( ).
It seems to work then for me (though the data the other end is rubbish because I don't have the same payload - but I understand that. I don't have temperature sensors either, so I cannot be absolutely certain those are working, but I get -127 out which looks believable for no sensor.
Come back if you need any more help.
Re: Struggling with sketches
Hi all
After a few days away from my project for the bank holiday. I am now back and realising that i should have taken more interest in my coding lessons at college.
I have now made some changes to the sketches on my emontx and emonbase.
I am now able to log some real data to emoncms.org. But the problem that i am having is that i am not logging the power value. This is showing up fine in my emontx serial monitor. But it is not showing up in my emonbase serial monitor or the actual emoncms feed.
Some hints or pointers in the right direction would be great. :)
Here are my emoncms feeds
http://emoncms.org/rogerrally&id=1316
http://emoncms.org/rogerrally&id=1317
Re: Struggling with sketches
It seems to me that you aren't actually calculating the Power. In the emonTx, in loop( ), you have:
Now I can't see where emontx.power gets assigned a value in the first place - before it is multiplied by 240, that is. I think what was intended on the last line there, is:
You got the current in the line above. Multiplying by voltage should give you power. This assumes a fixed voltage of 240 V (and unity power factor!). If you know your average supply voltage, you should substitute that instead. Alternatively, you could tweak that number so that the energy readings over a period correspond to those recorded by your tariff meter. I can't immediately spot anything else wrong, so hopefully with that change it should work.
Re: Struggling with sketches
Hi Robert
Again you have come to my aid. Again you were correct as to what the fix was.
Many thanks for your assistance, if we ever meet i owe you a beer or 2 (or a donation to a charity of your choice).
Re: Struggling with sketches