emonPi3 serial monitoring issue

Hello all. Having trouble setting up a brand new Pi3. I’m connecting 6x CTs (no pulses, no RF - yet, no temps). CT1 will be 100A, the rest a mix of 20A and 50A. I had hoped to configure the CTs using the Admin->Serial Config tool.

When I stop emonHub and start serial monitor (/ttyAMA0 at 115200 baud) it starts to list settings but then stops (at a different point on each test). Similarly the GUI starts to populate (I guess it reads settings and populates as it does) but then stops before completing

For example this is the output of one run:

Loading configuration, list (l) command sent:

l
hardware = emonPi3
hardware_rev = 1
version = v1.0
commit = ac45774
assumedV = 237
vCal1 = 100.00, vLead1 = 0.00, vActive1 = on
vCal2 = 100.00, vLead2 = 0.00, vActive2 = off
vCal3 = 100.00, vLead3 = 0.00, vActive3 = off
iCal1 = 100.00, iLead1 = 1.50, iActive1 = on, v1Chan1 = 1, v2Chan1 = 1
iCal2 = 50.00, iLead2 = 1.50, iActive2 = on, v1Chan2 = 1, v2Chan2 = 1
iCal3 = 50.00, iLead3 = 1.50, iActive3 = on, v1Chan3 = 1, v2Chan3 = 1
iCal4 = 50.00, iLead4 = 1.50, iActive4 = on, v1Chan4 = 1, v2Chan4 = 1
iCal5 = 50.00, iLead5 = 1.50, iActive5 = on, v1Chan5 = 1, v2Chan5 = 1
iCal6 = 50.00, iLead6 = 1.50, iActive6 = on, v1Chan6 = 1, v2Chan6 = 1
iCal7 = 100.00, iLead7 = 1.50, iActive7 = off, v1Chan7 = 1, v2Chan7 = 1
iCal8 = 100.00, iLead8 = 1.50, iActive8 = off, v1Chan8 = 1, v2Chan8 = 1

It’s incomplete, and if I attempt to send any command (l or ? for example) then nothing at all happens, and no messages are displayed.

However, if I SSH to the pi3 and (install and) runpicocom -b 115200 /dev/ttyAMA0 then I get a fully interactive serial session and can configure CTs and see regular messages coming in

I think that the admin->serial config tool isn’t working, but beyond an emonHub full update (done) and a reboot (also done) I’m not sure what to try?

Thanks!

I can’t help much, except advise you stay with Picocom. I don’t think it is an emonPi3 issue, rather it’s an emonCMS issue. I have never managed to get it to work satisfactorily, or even at all on an early but updated emonPi1, yet I can (and do) use the Arduino IDE to give the commands. I have a very early emonPi3 PCB, not yet sitting on a RPi, and I have had no problem since early on in its development in using Picocom to set the options in that.

Hi @coltcc - thanks for the report. I wonder if this is an issue with way the Pi3 sends data conflicting with the Serial config’s parser. If the Pi3 sends a data packet timed just right wrong, it can put the Serial Config tool into a loop. Could I ask for a quick check (and no problem if not!):

  1. Stop emonHub.
  2. Access the Pi3 over SSH as you’ve described, and set a long data log period (d120 would set it to 2 minutes, you can set it up to 600 seconds).
  3. Wait until you see a data packet in picocom and then immediately exit picocom and go to the Serial Config tool.
  4. The time is ticking, but you now have 2 minutes (if using d120) to see if the Serial Config tool behaves. Try to access the Serial Config and populate the display.

If that makes a difference, we know where the issue might be hiding. Hope you’re getting good use of the Pi3 already.

Hi Angus, thanks for the suggestion, I do love a high-pressure time window! Same result I’m afraid: 120s packets showing fine on Picocom but (after gracefully exited) the Serial Monitor still just half-loading with no packets displayed

Ok, thanks for the quick response Chris :slight_smile: My PHP is rusty at best, so I probably read it wrong. @TrystanLea would be best qualified to look at this, I don’t think it’s an issue with the Pi3, seems it’s at the Serial Config side if your Pi3 remains responsive. I’ll try and re-create it here in the meantime.

Can I check, this is an issue with the serial config tool, not a steady state monitoring issue?

If so, the title should reflect that (so as not to confuse).

Having taken apart my early emonPi and joined the RPi with my emonPi3 front end, and negotiated a few other hurdles, I now have an uncased but apparently working emonPi3.

But the bad news for Chris: I have seen the Serial Config tool in action for the very first time. I was half-hoping it wouldn’t work, so I could try various things, but this isn’t an option. I haven’t checked it for function, I’ll get my c.t. test rig out and do that, possibly tomorrow, and post the results.
When I’ve done that, I’ll try to break it, which might give you, Angus, some pointers.

Just one thought - my RPi is an early RPi 3 Model B Rev 1.2 - 1GB (Sony UK) - is it a timing problem of the Pi responding too fast - if it’s a modern one?

Thanks Robert!

I’ve made some progress. I think the issue is that the /admin/serial page checks whether the serialmonitor process has started just 500ms after clicking start. But the python process takes a couple of seconds to actually start; and the check finds nothing and permanently kills its own polling interval, marking the connection as failed. I edited the relevant php:

sudo nano /var/www/emoncms/Modules/admin/serial/serial_config_view.php 

and changed the timeout here to 4s (from 500ms)

setTimeout(function() {
is_running();
}, 4000);

That seems to work fine for me, but I wonder what I’ve inadvertently broken!?

Off to enjoy the sun now - thanks all

Thanks @coltcc for some reason I have not been able to replicate this but I’ve pushed up a change that should achieve the same result as your modification in a slightly different way: is_running check · emoncms/emoncms@ef566ff · GitHub, feel free to test on yours - seems to be working fine here.

Ah brilliant, thank you. Yours is much more elegant, I reverted my change, pulled the new one and it’s working perfectly. Thanks all