The emonPiCM

The emonPiCM is an emonPi running Continuous Monitoring software in the “emon” front end, bringing it into line with the software that’s been standard in the emonTx V3.4 since August 2020.

I don’t understand what you’re trying to ask, or the point you’re trying to make. As the software has now been released and is available for download from the links above or from the emonPi’s Admin menu, it’s obviously in the past. For you, until you download it and use it, it is in the future. @TrystanLea has indicated that CM will become standard for emonPi’s bought from the shop at some stage - no decision has been made regarding when.

Yes to the first; yes and in the emonTx V3.4 for the second, and for the third, did you read all of the first two sections of the first post here, down to but not including “Options” ? If you’ve read that and still don’t understand, try to explain why you don’t understand.

Thanks, that’s clearer, especially the part about the new software being the future standard for emonPi.

It’s obvious to you where this project fits in because you’ve been working on it for a long time. For someone like me, coming to it cold, it would be good to start by saying “we’ve been working on some new software for emonPi which adds/improves features X, Y and Z”.

I am currently looking at deploying additional EmonTx V3.4.3 modules with the emonTx_3Phase_PLL Firmware, my existing one install is using V1.7 firmware, as the newer ones will use a different emonPi I am trying to decide if I use emonPiCM for my next install.

However if I try to build The emonTx_3Phase_PLL_rfm69n code V2.0.x for with #define RF_CLASSIC instead of #define RF_NATIVE I get

rfmTxLib.h: No such file or directory.

However I don’t see rfmTxLib in the list of libs above

what am I missing ?

rfmTxLib of course! It has been available for a long time - a year to be precise, but hasn’t been picked up by anyone and listed on Github…
I’ve added it to the 3-phase sketch thread: Update to 3-Phase PLL sketch - #22 by Robert.Wall

[Just to confirm I have this right, and hopefully save the next person some time!]

So for someone buying a brand new emonpi, and a emontx from the store today containing “latest continuous sampling firmware” and wanting to also use the emonpi in continuous sampling mode in, the steps to enable it are:

  1. Buy the USB to UART lead for flashing emontx

  2. Update emonTX to the “rfm69nTxLib” firmware (incompatible radio format with historic jeelib format)
    (ref. Update to 3-Phase PLL sketch - #22 by Robert.Wall)

  3. Flash emonpi to the “Native RFM68 (New)” Firmware
    (in the web U emonpi/admin/update)

  4. Edit the emonpi emonhub config so that node [[5]] contains the following:
    (in emonpi/config)
    → Edit Confg
    (ref emonPiFrontEndCM/emonPiFrontEndCM.ino at main · openenergymonitor/emonPiFrontEndCM · GitHub)

### For the "New" RFM69 firmware supporting continuous monitoring
[[5]]
    nodename = emonpi
  [[[rx]]]
       names = power1,power2,power1pluspower2,vrms,t1,t2,t3,t4,t5,t6,pulse1count,pulse2count,E1,E2
       datacodes = h, h, h, h, h, h, h, h, h, h, L, L, l, l
       scales = 1,1,1, 0.01, 0.01,0.01,0.01,0.01,0.01,0.01, 1, 1, 1,1
       units = W,W,W, V, C,C,C,C,C,C, p, p, Wh,Wh

As an aside, I’ve notice the emonpi “Update Firmware” option does not seem to be entirely sticky. After a few reboots it seems to sometime regress back to the old firmware, and re-updating it to the new one is needed to fix it. Is that a known issue / expect?

Thanks!

Welcome, Jonatan, to the OEM forum.

Until the CM software is officially adopted for the emonPi, then I’m afraid you’ll need to continue to rewrite the “emon” CM software in the Atmel '328P front end, because the default is to always overwrite it with the “new” update (but it isn’t ‘new’ to you, it’s an update to the discrete sample version).

I don’t know what’s on Github (I’ve tried but I can’t understand it), the release and as far as I know, the up-to-date version is here: The emonPiCM

Note, ANY sensor node working to the emonPiCM will need its software changing, according to that post.

I don’t think there’s any problem with the CM software, however it might be a good idea to fire up your system using the installed software, just to prove it works, before you change anything.

Also note, I can only support the Arduino IDE for compiling and uploading the sketches.

So:

  1. Buy the USB to UART lead for flashing emontx - Correct

  2. Update emonTX to the “rfm69nTxLib” firmware (incompatible radio format with historic jeelib format)
    (ref. Update to 3-Phase PLL sketch - #22 by Robert.Wall) Only if you have a 3-phase supply. You haven’t put where you are in the world, so I can’t guess.

  3. Flash emonpi to the “Native RFM68 (New)” Firmware
    (in the web U emonpi/admin/update) I don’t know that this is the correct front end software, I proceed as I’ve noted in the post where the software was released - linked above, using Remmina (other tools are available) to transfer the file to the emonPi.

  4. Edit the emonpi emonhub config… You’ll find details of the config file entry at the top of each sketch - for the sensor nodes as well as the emonPi’s front end itself.

Thanks for the speedy reply! For full context, I already had the emonpi using continuous sampling mode (via that "Native RFM68 (New)” Firmware) fine for several months. I just got the emonTx this week (happy to see it had the “CM fw” preinstalled!) and was scratching my head for a while as to why it would not connect! It all makes sense now I read it through over again, that CM on the Tx side does not imply “using the new protocol”. I’ve now put the emonpi back to stock FW for now and it is indeed working fine :+1:

I indeed only have single phase (in the UK) so it would be EmonTxV34CM_rfm69n I need then.

I hadn’t seen the full set of steps needed in a concise form so wanted to check the overall steps in the recipe is correct (even if I got some of the ingredients wrong :grimacing:)

FWIW my original goal is tracking PV import/export and also controlling redirect (to immersion heater) so I’m okay going back to the old radio protocol, as on balance CM isn’t quite as useful as I hoped:

  1. The E1 and E2 accumulators don’t track “import” and “export” separately, so it’s not possible to properly track how much was spent/returned on energy coming from/to grid at different rates. (I believe this would need to follow the “1 Wh bucket” principle to be representative of UK meters’ billing personality)
  2. The sampling frequency of 1/5 Hz is lower than the ideal responsiveness for PV redirect, but it had seemed rather complicated to increase it.
    I see adding RF reception (or 1-wire thermistors) is the main impediment to increasing sampling frequency. I have the option to connect the emonTx via serial cable so I might still do that anyway at some point.

Thanks!

That’s true, just as it’s true for emonLib and the Discrete Sampling emonTx and emonPi, but it would be relatively easy to separate import and export. Normally, that task is left to emonCMS. The CM library itself can report a lot faster than

(I don’t know where you got that number from). The true sampling frequency of the library depends on the number of c.t’s - for the emonPi with two, it’s around 3 kHz, the minimum reporting period is 0.1 s.

Sorry, wrong terminology! I mean the reporting frequency. I’m sending the grid import/export over MQTT to a Loxone controller where all the real logic (currently) lives, and the external messages to that are limited to 5s interval.

This is welcome news if it means that it is possible to use a burst or phase diverter (e.g. the famous Emley Mk2).
I assume this is all “tried and tested”, but I’ve not found anything via the Search to confirm this.

Could someone confirm that changing the firmware as above does indeed give a decent level of accuracy and fidelity.
Thanks in advance…

The software is exactly the same as used in the emonTx since October 2019, except that it scans 3 channels (1 voltage, 2 current) instead of 5 (1 voltage, 4 current) and thus scans slightly faster, which should lead to a small improvement where higher order harmonics are present.

It will be as accurate, or as inaccurate, as component tolerances and your calibration allows.

Hi Robert,

First, I want to say great work - specifically on joining all the dots on the radio formats. It’s great to be able to use RFM69 in it’s native mode which gives so many benefits. It was also fantastic to read all the information on how RF12 can be made to use the same RFM69 packet format, allowing us to have a mixed network of old & new with simple firmware update.
The great thing was you’ve provided a way to update all the OEM devices including GLCD to be able to continue to function. It really is an amazing effort, never mind the benefits of CM.
The little atmel chip can breath a nice sigh of relief now sending and receiving is offloaded to the RFM69… although I’m sure it is now sweating more doing CM instead!

However, I am confused as to why you moved away from the established command format , (reverse polish) to the extent you lock it out when you see it on the input stream.
I was looking at the code making sure I could still transmit data, and instead of being able to send ‘bytes’ as previously, it seems to send alphanumeric strings which is likely not what most applications need, nor is it compatible with the previous raspberry-atmel interface, making this not ‘plug and play’ with current emonhub send functionality.

Previously, we would send by sending decimal numbers between 0-255 , comma-separated, followed by ,s eg. 12,122,244,33,7,s would send a 4 byte packet to node 7.
I was looking at submitting a patch to put this functionality back so EMONGLCD (and other sending tools) could run without changes to emonhub or how they send, but I thought I’d ask first as it seems to have deliberately broken this backward compatibility and not sure the rationale why.

I use emonhub as my RF hub for sending and receiving to lots of JeeNodes, so this functionally is very useful (it saves me have yet another node connected for TX to the RF network when the emonpi is perfect for it).

Looking forward to understanding your thinking on this, and again, GREAT work… your research and fantastic explanation has helped me start to figure out how to get STM32 talking to my RF network in a compatible way.

Alan

I’d like to be able to answer properly - but to do that will mean taking me away from the emonTx V4 and looking back quite a long time to see where the Reverse Polish actually was, and what I did, which might give me a clue as to why. You are of course free to develop, and if you wish publish, your own version.

No problems Robert. I’m sorry I didn’t discover this thread sooner. It would have saved me a lot of time (thankfully only thinking time, not coding).

I’ll take a crack at getting your code to accept the previous notation for sending only so it can be plug and play. Do you have it on GitHub somewhere so I can clone it and then send a pull request if I get that far ?

Thank you again
Alan

No, it will never go on Github. I wasted far too much time trying to understand it, finally giving up. I see no advantage to me in it. If it’s on Github, I had no part in it. If you want me to comment or consider a change, the place to do so is on the release Topic or associated comments here.

Having looked again at your post, it looks as if you’re totally confused. Nothing has changed in the way the data is presented to the RFM69CW. Just as before, it accepts a message meaning whatever you want it to mean, the only change (which makes Native and Classic formats incompatible) is in the header, as is explained above and in the supporting documentation. Nothing affects the message you send to a JeeNode - provided that it too can receive and handle the Native format.

What has changed is the format of the command string to calibrate the emonTx and associated devices - with the notable exception of the emonGLCD software, which your complaint wrongly states has changed. The RP notation cannot be handled by the calibration software and sending a digit first would cause problems, this is why it is blocked. This was after consultation with Glyn & Trystan and with their full support and agreement.

Hi Robert,

We are talking about emonpiCM, correct ?
The emonhub sends commands today in the reverse polish format, notably using the ‘s’ postfix. This can easily be validated by looking about at the python code.
Currently you send a MQTT msg to emonhub/tx//values/msg/ with the BYTES you want to transmit, encoded specifically according to the emonhub TX definition.
Your change breaks this as it is no longer accepted, nor does it accept a decimal string which is converted into bytes for onward transmission.

I refer you to lines 235 - 256 of EmonHubJeeInterfacer.py for TX. In fact looking at the entire file it relies on the current implementation for any commands SENT to the uC.
This breaks inter-operability and will require changes to this code and additionally any existing software that uses it for tx. Not great I’m sure.
But, I think you’ve misunderstood my comment, so please do read it again and look at the current code to see how it works. Your CM code is a great improvement so I think getting it 100% compatible is a worthy endeavour.

However, I came on here to post some other news, which is that I’m finding the RF12b sending RFM69 packets to be buggy and unreliable. The simple idea to change the define in the code and restart / recompile does not work, except in the most simplistic cases.
For example - do this in the standard rfdemo sketch and you’ll find it doesn’t work. Even after manually sorting out the rf12_initialization. In short, the ONLY way I could get it to work is comment out the PRGMEM definition for help1 text. In that case it worked (after some other prodding). However, this is without even calling the help to execute the function to display the help text, so there is a rather nasty memory corruption bug somewhere in the RF12 libs. This took many many hours to bottom out.

I then verified this by trying on my own known code (for controlling rollerblinds), which would not get past a simple f12_initialise (hung) on the same board, and it works perfectly with the old packet mode. Flipping the ```RF12_COMPAT back to zero and no issues.

With the upcoming emonpi2 release, I guess we need to figure out the way forward. I think JCW has been pretty quiet over the years and moved onto other things… embello is pretty quiet and bugs don’t seem to get fixed. In my opinion it’s a dead codebase, and even the the jeenode/jeelib website is now found mostly on the wayback machine. You are now essentially have to maintain the RF69 code.

Given my tests, that conclude for me at least that RF12 doing native RFM69 packets is far from stable and therefore inter-operability not guaranteed, it may be time to look again at lowpowerlab, which is at least developed and supported.
Changing the code for a small handful of devices would not be super difficult and the decision forced to use a different packet format made, we may as well make something that is current.

That’s my 2c on this, but at the very least, this needs some more testing to make it work with current ecosystem of things that may have RF12 onboard (which from OEM is only the emonGLCD, right ?).

I’ve spent a good few hours on this at this point and unless you want to take the decision that sending will not work without changes upstream, I’d step back and re-evaluate.

Again, sorry I’m late to this party.

Oh, and by the way I’m happy to help on the emonGLCD side, as I think I’m the last person who touched it.
Oddly my emonGLCDs came with RFM69 so I’m not sure if there were some shipped with RF12 originally.
Anyway, the emonGLCD suggestion above does did not work on my RFM69 based board, it failing to transmit when it was applied (not surprising in fairness).
I’m happy to workup new RF code for it as needed (20 minutes playing and I’ve got the sketch transmitting with rf69.h based code).

That is the title of the Topic, but also where I was not sure what exactly, in some places, the subject was, because of the rather frequent use of “it”.

I have had nothing to do with that. If you check the references, it is completely down to the work of JCW and his associates. Some of the r.f. properties of the transmission are subtly different, so a careful study of the differences between the JeeLib and the RF69 libraries might be fruitful.

I think you’re absolutely correct there. I reported the RSSI bug when I found it - the response is still awaited. Also note there are hints that some of the RFM69 settings were less than optimal - again I’m not aware of any update. So I’m not holding on to any hope of support from that direction.

As far as I’m aware, the emonGLCD is obsolete =, and has been unavailable as a self-build kit for a good while (regrettably, but I fully understand the reason it was withdrawn). Converting it to use the RFM69 Native library (for transmission, if you require the extended capabilities) and the RF69 for reception, or the RF69 for both, should be simple, I considered it not worth the effort for the few systems that might, only might, still be running and needing to be converted.

I know I soldered up two emonGLCD kits, both had RFM12Bs, I also remember a post emonGLCD as an RF signal strength meter | Archived Forum that took a wire from the RFM12B to recover signal strength. Until I read this, I was under the impression that no emonGLCD kits included the RFM69CW, and all had included the RFM12B. @glyn.hudson or @TrystanLea are likely to be the only ones to know just how many of each were shipped, and I think they also must be drawn in to give their opinion on your contribution.

I think we largely concur.
The rfm69 emonglcd are an easy conversion and I’ll get that done. I guess the thing we need to agree on is the sending api. I’m not sure many folks use it. A few do but I think small numbers. The fact it was broken for a few years in the most recent release of emonhub (after the python3 conversion) leads me to that conclusion.

Maybe it’s time to revisit the topic as you say. Especially for emonpi2 which uses another avr which I have no familiarity with. Or perhaps makes sense to have the bridge between the two defined and then it can be uC independent.

I’ve also never used low power lab but it kind of seems nice to have a common ecosystem. Although the rf69.h simplicity and portability are nice. Essentially any device that can drive SPI can send and receive super simply.

I’ll take a look at low power lab some more to further my own knowledge

Out of curiosity do you know if all emonth shipped with rf69 ?

Maybe we are lucky and the vast majority of oem devices are rfm69 based ?

It’s not the frequency settings is the issue it really is down to buggy code in jeelib rf12 compatibility layer.

Sorry to drag you back into this world.