emonPi Firmware & info referenced on LCD

When the emonPi powers up there is a quick screen that pops up with emonPi V2.00 - OpenEnergyMon.  Is V2.00 the emonPi firmware version number?


I ask because I started to do a emonPi Update and saw the paragraph:

Update emonPi
Downloads latest Emoncms changes from Github and updates emonPi firmware. See important notes in emonPi firmware change log.

I clicked on the emonPi firmware change log link and saw firmware 3.1 and 3.0:

Change Log
V3.1 Jan 15
Display "Raspberry Pi Booting" message at startup & don't sample from CT input channel when no CT is physically connected to that input


So is V2.00 the firmware of the emonPi? 

pb66's picture

Re: emonPi Firmware & info referenced on LCD

I noticed the v2.0 too, yes it is the emonPi firmware and yes there is a v3.0 and v3.1, they are continuous sampling rather than discrete and use a different library (emonLibCM).

It's not clear to me it it's an error in the updating process or if they are not yet fully released.

The "update" script is called by "firstbootupdate" if there is no "emonpiupdate.log" found, that script then calls the "emonpiupdate" which is hardcoded to upload "emonPi_RFM69CW_RF12Demo_DiscreteSampling" , so as far as I can tell it will always upload the latest discrete sampling sketch.

There is a separate updater in emonpi/firmware/compiled that is hard coded to install the continuous sampling firmware but unless I'm missing something this would get over-written again at the next full update, it does say it should install via the emoncms method, but I think there is an error in the main "update" script, I think is is supposed to point to this "firmware/compiled/update" script not the "emonpiupdate" script, I haven't tried  editing it as that will stop the whole repo being updated from git due to un saved edits but I guess it would at least test the theory.


glyn.hudson's picture

Re: emonPi Firmware & info referenced on LCD

Hi Guys, 

Well spotted! Correct, V3.x firmware is yet to be released. We are still testing the continuous sampling firmware. It's nearly ready. The V3.x firmware is located in the new ~/emonpi/firmware directory structure. V2.0 is the latest Discrete Sampling firmware. 

If you want to test CS V3.x firmware just you can force uploading of V3.x vu running ~/emonpi/firmware/compiled/./update

Jon's picture

Re: emonPi Firmware & info referenced on LCD

I've been reviewing the v3.x updates and I am not sure I understand continuous sampling versus discrete sampling.  I think I understand discrete sampling (e.g., at time zero the voltage is 122.2 volts & 16.6 ms later it is 122.3 volts, etc.).  But since the emonPi is a microprocessor, how does sampling become continuous?

I read through Continuous Sampling EmonPi and EmonTx v3.4 examples thread and a few other threads. And I dug through the Internet looking for various articles (most being way over my head).

I am guessing continuous sampling is for power.  But is voltage or AC cycles sampled differently also?

Could someone explain continuous sampling versus discrete sampling in simple terms or point me to a beginners article?   Thank you!   Jon


Robert Wall's picture

Re: emonPi Firmware & info referenced on LCD

You should really have started a new thread for this.

"Discrete sampling" and "continuous sampling" are simple names tagged onto rather more complicated concepts. So they must not be taken literally.

"Discrete sampling" uses the analogRead function to command the ADC to get a voltage sample. When that sample is returned, the sketch uses the ADC again, this time to get a current sample. That process is repeated approximately 50 times per cycle (less for a 60 Hz cycle) for 10 cycles, the resulting values of current, voltage and power are averaged. If you have a second or more current inputs, the process is repeated for each, then the result is transmitted. The sketch sleeps for 10 s and repeats the whole process ad infinitum.

"Continuous  sampling" uses the ADC in a totally different manner. The sketch starts the ADC, instructing it to perform conversions continuously and generate an interrupt each time a conversion completes. When the sketch receives the interrupt, it recovers the result of the conversion and sets up the next channel to be converted. (Pause for a moment because this is where most people get lost: There are 3 conversions that are relevant. There's a conversion in progress, the interrupt routine has just set up the next conversion and it's processing the result of the last conversion.)  Continuing, the ADC measures the voltage, then the 4 current channels, then repeats the process indefinitely. Meanwhile, the main sketch accumulates the values and every 10 s, calculates the averages and transmits the results. Because the ADC is working in parallel with the main sketch, the actual sample rate is much faster but the rate in terms of sample sets is slower than the discrete sampling - but then all 4 current channels are being read "simultaneously".

Therefore, the "Discrete sampling" sketch is suitable only for systems where changes happen infrequently, whereas the "Continuous  sampling" sketch is suitable for any system, including loads that are rapidly switched, like induction hobs and Robin's or MartinR's energy diverters.

Comment viewing options

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