I am try to re-write some of the WattMote code so that the data conforms to jeelibs structure so that I can use it with my other systems. I am having trouble understanding one part of the code:
for(byte i=0; i<MAINS_SAMPLES; i++)
{
//base 32 encoding (59 positions shifted to the right to avoid [ and : characters)
tempstr += (char)((SAMPLES_V / 32) + 59);
tempstr += (char)((SAMPLES_V % 32) + 59);
}
What does this do? Does this average the sample? And ammend it to string? Or is each sample sent? What format is that number? Is it the actual voltage or a number that is voltage is then calculated from?
Thanks..
It encodes the values in base32 and shifts the result by 59 positions in the ASCII table, so that the final result would not contain : or [ characters
Right.. Okay.. I have a few design questions on the WattMote..
I am trying to port the code over to use the Jeelibs base so that it will work directly with my existing base and RPI. The biggest problem seems to be that the Moteino RFM library can send larger payloads. If I try to send 28 samples, Volts and Amps, then the jeelibs library won't work.
Is it necessary to sample 28 times per cycle? Is it necessary to sample a full wave? What if my sampling goes 1.5 or .75 waves? I take it that will skew the math?
I'm guessing the easier route here might be to change the base to stream these packets to this python script, then send the other jeelib packets to another script to send to emonCMS.
Amazing products! Keep it up, I'll be ordering my second batch pretty quick here.
If you're using the Jeelib I'm afraid I can't offer much support with that.
I believe there are 2 versions of the wattmote code, and the older one uses 2 packets to send individual I and V info, which get reassembled for Amperage in python, maybe that is better if Jeelib is limiting the packet size. The base just passes the serial stream to the host computer which runs the python script.