Unstable emonTX / emonESP operation

Just wanted so share an update, the emonTX/emonESP kept freezing with a 1.2A power supply, so I replaced that with a 2A one and it seems to work stable with that. Perhaps this information could be added to the wiki page?

2 Likes

I’m afraid I spoke too soon, as it’s doing it again… Now it’s been hung for 44 hours, I just restarted it. Can somebody please help with how I could find out the root cause for these freezes?

It’s not the emonESP that hangs (I can access the web interface), that just keeps reporting the last values (and that connection to MQTT/EmonCMS has been lost) but if I reboot the emonESP, it’s still hung - I have to reboot the entire emonTX to make it work again.

@glyn.hudson @TrystanLea

As it may be difficult to replicate, it is difficult to debug by others. Do you have a spare RPi?

What is your level of expertise? I’m thinking the only way to be able to debug this is to connect the serial up to the esp and another receiver and see what is being transmitted over the serial link.

It would be, connect emonTX to breadboard, connect esp via breadboard, connect RPi or a programmer to the RX/TX as well. @Robert.Wall, would this work? As long as the second device is passive (i.e. no TX) will that work?

You’re talking to a hoarder, of course I do :slight_smile: I can set up a serial link, but I guess I’ll need a debug version of the emonTX 3phase firmware, right?

Also, I’m wondering if this can have anything to do with the fact that I can no longer flash my emonTX via the exposed UART? I can only flash via ICSP (I was using Arduino as ISP), I reported that in the other thread here: Setup 3-phase emonTX with emonESP using emoncms.org - #25 by Z0l

:rofl:

So the first step I suggest is to connect up an RPi to the serial (independently power the RPi) and collect the serial data and send to emoncms with emonhub.

see

If that is reliable, then the sketch itself on the emonTX is not the issue, the ESP is (which IMHO is more likely). If you feel like trying to discover why, you can then setup a debug and have a go at finding out what is causing it.

I don’t know, but connecting up an RPi gives you another means of flashing directly to try.

@Z0l is this an OpenEnergyMonitor shop bought ESP8266 adapter? Its important not to connect the TX line from the ESP to the RX line of the EmonTx as it can interfere with the configuration and could be leading to the behaviour you are seeing?

Yes, my order ID is #23389. The device came assembled and I am using the same internal connector (just disconnected the emonESP while I flashed a 9600bps image for the 3phase monitoring but put it back the same way).

Thanks @Z0l is the RX pin on the EmonTx disconnected from the ESP8266 adapter? Just wondering if theres a chance we’ve made a mistake in the shop here. Could you take a quick pic of the bottom side of the EmonTx board and the pins on the ESP8266 adapter?

The RX is disconnected on the emonESP; I guess that’s the TX of the EmonTX, right?

1 Like

That looks fine thanks! It won’t be being caused by that then!

Did you try turning off the RFM69 radio in the EmonTx firmware? emontx-3phase/src.ino at master · openenergymonitor/emontx-3phase · GitHub

Yes, only EMONESP is defined, since I’m not using the radio, so that line is commented out.

Ok, good to hear, it sounds like its an issue on the EmonTx rather than the ESP given that you noted that you needed to reset the EmonTx. @Robert.Wall is there anything else on the 3 phase firmware that might be worth @Z0l trying?

While we wait on Robert, @TrystanLea is it possible to get a copy of the default bootloader on the emonTX? One of the ideas I had was that I may have somehow messed that up (since I can no longer flash the atmega via the UART, only via the ICSP pins) and I’m not sure if that’s connected to the problem I’m facing.

If there would be a way to somehow restore the emonTX to its factory state (including both bootloader & flash), perhaps we can start clean here.

I think the steps for the bootloader upload are here EmonTx V3.4 - OpenEnergyMonitor Wiki its a long time since I have needed to do this on an EmonTx

Thanks I know the steps but I was unable to locate the hex file itself - can you please share that?

Looks like there is one noted as “_bootloader” in the archived repository here, you could try that: emonTxFirmware/emonTxV3/RFM/emonTxV3.4/emonTxV3_4_DiscreteSampling/compiled at master · openenergymonitor/emonTxFirmware · GitHub

1 Like

As far as I know, @Simsala has been using the sketch in Germany for something over 2½ years, I think with the serial interface and the ESP8266 and in many installations, and I’m not aware of any problems there.

The normal UK domestic supply is single phase, so we’re reliant (mostly) on reports from consumers in continental Europe regarding the long-term reliability of a system.

The line should be #define EMONESP, not commented out in its entirety.

There used to be RS232 monitors sold (this is before portable computers became readily available) that provided a high impedance monitor on both lines, thus making it possible to monitor the traffic in both directions. As long as whatever you are using doesn’t load the signal, then that should work.

But it won’t of course tell you why the emonTx hung, even if it did.

My feeling is this is still a power supply problem. If possible, can the supply voltage (either the 3.3 / 5 V or the mains) be monitored and any brief excursions recorded? (I’m not suggesting you hire a professional mains monitor.)

Could this be an indication of a damaged Atmel ATMega 328P? If the processor is damaged, it could explain your problem.

1 Like

The line is the following:
#define EMONESP

Regarding the 5V supply, I can’t really monitor that but I can try supplying it from a UPS instead of an outlet; right now it’s a phone charger that powers the emonTX.

I have ordered an AVR ISP MKII to see if I can flash the bootloader & the emonTX with that, as I was using a simple USB to Serial adapter, but I think that one will only arrive next week so I can only do the UPS trick until that.

That is a warning sign. Phone chargers are built down to a price (it’s “free” with the phone, you don’t buy one on its own?) and their sole purpose is to recharge a battery, via a much more sophisticated charge regulator inside the phone. That’s a much different requirement to powering an emonTx that measures down to millivolt signal levels.
Though old now, this is still relevant: Not all USB power supplies are created the same - Blog | OpenEnergyMonitor
And this is worth reading, though not applicable directly to your case: Noise in Arduino based builds. | Archived Forum