Emontx3 and wifi esp8266

So i have connected to my wifi board and followed the instructions but cannot connect to my local emoncms or my remote emoncms. Do i need to put my pi address in the server section for local connection along with the node value of the tx3. I have not got a radio link on the pi so do I need to disable the radio transmitter on the tx3.
As always your help is always appreciated.

Yes, that’s correct. Or you can use the local hostname e.g http://emonpi.local

No need to do this

Just to get some clarification please, When I plug the usb power supply in and 9vac supply the emontx3 will not boot no red led flashes or pulses unless I replace jumper2. is this correct please.
On the esp configuration page I have put my pi address in the server box, emoncms in the path box, what do i need to put in the node box and I have put the write key in but still wont connect, any ideas please.

No, it’s not correct. JP2 provides the link between the low-power 3.3 V derived from the a.c. adapter and the 3.3 V derived from the 5 V USB supply. The power available from the 9 V a.c. adapter is deliberately limited so as not to distort the mains voltage being measured, so with the addition of the ESP8266, the extra power available from the 5 V USB is needed.

What you say indicates that the USB power supply either isn’t working at all, or that it is unable to supply sufficient power on its own to operate both the emonTx V3 and the attached ESP8266 (which requires approx 500 mA IIRC).

Without the ESP8266, the emonTx V3 is capable of operating with the jumper and only the a.c. adapter. With the ESP8266, the USB power is required to operate both, and then the jumper is opened to allow the a.c. adapter to be used solely to measure the a.c. voltage, not drawing any power.

Sorry Robert for being such a pain, I have tried both the usb and wiring into the 5v and gnd block and both power the esp and I can connect to it. When I connect the 9v ac without the jumper nothing happens as soon as I connect the jumper the red led comes on, flashes 10 times then flashes once every few seconds. I still cannot connect in the esp configuration.
If I remove the esp module and 9v ac it still won’t power up the tx.

On the face of it, it does sound as if your 5 V USB power source is not providing sufficient current. What is it, and where did it come from? Are you able to see any markings or do you have anything to tell you what it should be capable of?

I don’t think this has ever been doubted – and I’m only asking this to confirm: without the ESP8266 and the USB power, the a.c. adapter alone can power the emonTx V3?
Note the a.c. adapter alone is not expected to be able to power the ESP8266 as well.

This is as it should be, the 10 flashes indicate that it has the 9 V a.c.

The usb adapter is an Pi power adapter, and yes the 9v ac will power the tx with j2 closed and nothing else attached. the usb will power the esp8266 with nothing attached but when I plug in both the esp8266 works but the tx doesn’t until I close j2

Do you have a means of checking the USB adapter? And presumably the adapter to convert from micro-USB for the RPi to mini-USB required by the emonTx V3?

There are two power supply regulators in the emonTx, one that supplies 3.3 V from the 9 V a.c., and the second which supplies the 3.3 V from the 5 V d.c. The final possibility is this second one has failed.

This tx3 use to have a battery box fitted which I desoldered so not sure if that has anything to do with the power up issues.

I’m wondering if you damaged the board when desoldering the battery holder. First, how are you connecting the 5 V USB adapter? It comes with the wrong type of connector to plug in directly to the emonTx V3.

You have never mentioned ‘voltage’ - as in measured, are you able to measure voltages and/or check continuity? If you can, check the presence of 5 V (with only the 5 V USB adapter powering the board, and JP2 open) between the two pads nearest the USB socket of the three that look as if they expect a TO126 7805 voltage regulator. The centre pad and the one furthest from the connector should have 3.3 V on them.

When I have measured the tabs, I get 5v centre and nearest but centre and furthest it fluctuates from 2.1 to 3.3. So I’m guessing there is damage somewhere.

The pads I mentioned? When was this - when the ESP8266 was trying to work or even transmit? Where was JP2?

I’m struggling to help you. The symptoms you’ve reported shouldn’t be so, I’m reasonably convinced the cause of your problems is in the power supply department, and my money is on how the 5 V USB power gets to the common 3.3 V rail.

With the usb plugged in and nothing else attached there is no red led activity with j2 open or closed. If I plug in the esp8266 that powers up and I can connect to it on my iPad again with j2 open or closed. When I add 9v ac power the tx will only power up with j2 closed not open

I have finally got the picture. I think your 5 V to 3.3 V MCT1702T regulator, which is the connection between the USB power and, when J2 is open, the 3.3 V power to the radio and the ATMega 328P, has died, so there’s no power to the '328P until you connect JP2, when it gets its power from the a.c. adapter input. The ESP8266 is powered from the 5 V, so this is active whenever the USB 5 V is present.

It’s probably OK to run with JP2 closed (I never bother to open when when I’m running a V3 of the UART power from a programmer, and I’ve never detected a problem). The reason for the recommendation to open JP2 is the potential for a back-feed into the other regulator i.c, the MCP1754, which supplies the 3.3.V derived from the a.c. adapter.

Ok that’s great it just must be my configuration that I have wrong because I can’t connect. So I will work on that.

I can’t help with that. I put a mis-typed password in my ESP8266, and while I managed a factory reset, the executable has disappeared and the source libraries have apparently bloated and no longer compile, so I don’t have a working ESP8266. However, the required settings are reasonably obvious, from what I remember. Note that the data bypasses emonHub and goes straight into emonCMS.

IMG_0020
Sorry for the screen shot, I can connect my esp8266 to my tx3 and connect to the esp by Wi-Fi but no ct ports show up and it does say connected and will show up in emoncms [local] but stay red. So the screen shot is by the usb to aura programmer connected just to my tx3 and putty showing the node and ct ports.Am I being dull or is there a dark art I must learn. I also wanted to upload cm software too, can I do that by putty?

I can’t read your screenshot, but it looks as if it’s output from your emonTx V3 intended for human viewing, not for ingestion and transmission by the ESP8266 to emonCMS. It’s showed up in emonCMS because the ESP has sent that output, it’s got it and seen it, but it can’t make sense of it, hence no values being updated.

There are indeed many dark arts. :face_with_hand_over_mouth:

I’ve looked back up the thread and I can’t see a mention of which sketch you’re using, so what follows is general.
The ESP8266 (or emonESP) expects the output to be in comma-separated pairs of KEY:value format as produced by this code:

      // ---------------------------------------------------------------------
      // Key:Value format, used by EmonESP & emonhub EmonHubOEMInterfacer
      // ---------------------------------------------------------------------
      Serial.print(F("MSG:")); Serial.print(emontx.Msg);
      Serial.print(F(",Vrms:")); Serial.print(emontx.Vrms*0.01);
      
      if (CT1) { Serial.print(F(",P1:")); Serial.print(emontx.P1); }
      if (CT2) { Serial.print(F(",P2:")); Serial.print(emontx.P2); }

etc, ending with
      Serial.println();

which via the programmer will show on-screen something like

MSG:432,Vrms:238.65,P1:540,P2:8

It’s likely you will have a software switch in the code to enable a block that has statements like these. If you have, enable it (uncomment / define it) and ideally disable the radio transmissions too. It might be labelled EMONESP.

The best way (my opinion) to upload software to the emonTx (any version) is to install the Arduino IDE and libraries, the instructions are in ‘Learn’ (but these need some updates to include emonLibCM, emonLibDB and the emonTx4) and in ‘Docs’ (not as comprehensive but this does include emonLibCM and the emonTx4).
I recommend avoiding platfromio because when I tried it, it screwed up my existing setup, and took hours to recover.

The snippet of code came from Trystan’s sketch for the emonTx V3.4, v2.4.0: Common single-phase continuous sampling firmware. emontx3/firmware/emonTx34/emonTx34_CM at master · openenergymonitor/emontx3 · GitHub

If yours is an emonTx V3.2, it may well not work (due to a different radio which will need disabling in your case).
When you have the IDE, you can edit the sketch as necessary, compile and upload it (without the ESP connected of course) and make any necessary changes - including fine adjustments to the calibration if you need - yourself.

Sorry Robert because you are the expert I am hanging on your every word to get this running, I have read the learn for arduino ide but wanted to ask what do all the libraries do when you upload a given sketch and where will i find the line that disables the radio and uses emonesp.
Many thanks you help and knowledge is really appreciated.

1 Like

Has nobody told you that an ‘Ex’ is a has-been and a ‘spurt’ is a drip under pressure? :wink:

First, the sketch only uses the libraries it needs, and the ones it needs depend on what it does. Like ‘How long is a piece of string?’

Looking at the sketch I quoted the snippet of code from:

#include <Arduino.h>
#include <avr/wdt.h>

#if RadioFormat == RFM69_LOW_POWER_LABS
  #include <RFM69.h>                             // RFM69 LowPowerLabs radio library
#elif RadioFormat == RFM69_JEELIB_CLASSIC
  #include <rfmTxLib.h>                          // RFM69 transmit-only library using "JeeLib RFM69 Native" message format
#elif RadioFormat == RFM69_JEELIB_NATIVE
  #include <rfm69nTxLib.h>                       // RFM69 transmit-only library using "JeeLib RFM69 Native" message format
#endif

#include <emonEProm.h>                                     // OEM EEPROM library
#include <emonLibCM.h>                                     // OEM Continuous Monitoring library

Arduino.h is various constants associated with the Arduino ecosystem.
wdt.h is the watchdog timer.
RFM69.h is the LowPowerLabs library for radio comms.
rfmTxLib.h is my transmit-only library for the JeeLabs format radio comms (RFM12B & RFM69CW.
rfm69nTxLib.h is my transmit-only library for the Hope (JeeLabs ‘Native’) format radio comms (RFM69CW only).
emonEProm.h is my library that handles data stored in the EEPROM (config & accumulated energy)
emonLibCM.h was my library (Trystan’s since changed it, so it’s his now) that does the continuous power and energy monitoring.

In that particular sketch, you turn off the radio as part of the configuration set-up, or you can default it to ‘Off’ by changing line 106:
byte rf_on = 1; // RF - 0 = no RF, 1 = RF on.
Again, in that particular sketch, the switch between JSON format and KEY:VALUE pairs (the default - what you want) is in line 126:
bool json_enabled = false; // JSON Enabled - false = key,Value pair, true = JSON, default = false: Key,Value pair.
and the two blocks of code start at line 423.

In other sketches, you might see something like

#define RFM69CW           // The type of output: Radio Module, serial or none.
                          // Can be RFM69CW 
                          //   or SERIALOUT if a wired serial connection is used (space-separated values for the
                          //     "direct serial" EmonHubSerialInterfacer
                          //     (see https://github.com/openenergymonitor/emonhub/tree/emon-pi/conf/
                          //        interfacer_examples/directserial) 
                          //   or EMONESP if an ESP WiFi module is used 
                          //     (see https://github.com/openenergymonitor/emonTxFirmware/blob/master/emonTxV3/
                          //       noRF/emonTxV3_DirectSerial/emonTxV3_DirectSerial.ino)
                          //       (key:value pairs for the EmonHubTx3eInterfacer)
                          //   or don't define anything if neither radio nor serial connection is required - in which case 
                          //      the IDE serial monitor output will be for information and debugging only.
                          // The sketch will hang if the wrong radio module is specified, or if one is specified and not fitted.

where the ‘#define’ (proper name: pre-processor directive) acts as a switch to select different sections of code to be included at compilation time to perform the different functions.

How this is done has changed over time, so there’s no consistent way of doing it. Using #define means only the defined code block exists in the compiled sketch – the others don’t make it into the compiled code, so if space is tight, this can be the only way (and it can’t be changed accidentally later!).