First steps with emonESP

Hum, extremely odd. Do you know what chips are on the different programmers?

Not quite the way I phrased it when I worked it out! :slight_smile:

The one that I was using originally is an FTDI FT232RL and the one I’m using now is the CP2102 (OEM shop purchased programmer).

Note - I’m well versed with the fake FTDI units, I go through a lot of these as most of the emonTx’s I install are converted to USB and I use the FTDI eeprom for a description that can be picked out by udev rules and the serial number to identify the exact board. This one is either genuine or a “good fake” they are easily distinguished from the “bad fakes” as the eeprom’s are not writable on the “bad fakes”.

I only tried a different programmer as I knew Glyn would probably be using the shop one, so thought it was worth a shot as I was running out of idea’s. The fact the FTDI one functions perfectly for other tasks and uploaded the src.ino no problem, did not raise any suspicion and I was quite surprised by the outcome.

EDIT - It is the fact that I am currently converting emonTx’s to USB to be able to update the firmware (and poll for data), that I am interested in the emonESP, it would be of great help for me to be able to make all emonTx’s WiFi with OTA as that removes the need to use USB and therefore offers far better flexibility. BUT the sort of sites I am monitoring are very security conscious and I cannot have dozens of emonESP’s breaching the firewall and navigating the proxies, they must all report to a single emonhub (no emoncms on site) via a dedicated wifi network using the Pi in AP mode.

I have used both of those to program the FS, infact my normal go to is an Adafruit FTDI Friend (so I assume genuine FTDI). I wonder if it is the voltage? I have to give the Huzzah 5V for reliable operation, although I normally see failures when using WiFi rather than programming. Thinking about it the OEM Programmer will definitely be supplying 5V to the Huzzah. So that may very well be the problem…

Anyway good that you have found a solution and got going.

Looks like you could be right about the power supply,

I have a 1mtr USB extension I use when messing with USB stuff at my desk to save keep ducking under the desk to the USB sockets.

The FTDI has a mini usb connector and therefore I had a short (2ft) USBA to mini USB lead in the mix too. When I switched to the shop programmer I no longer needed the shorter lead as the shop one is full USB-A (it’s actually the one before the currently stocked version).

Just tried connecting the FTDI using just the mini USB lead direct to the PC and it too now works, either the extra meter or the extra connector pair seems to cause the issue, despite the FTDI being “5v” .

I’d have split this into another topic if I could remember how!

I have recently discovered the world of USB power cables. I downloaded an app to my phone to measure the charging current and was astonished by the variation from the same power supply depending on the cable. All I need to do now is find a reliable quality cable to use :frowning:

Hello, similar problems, i have a nodemcu devkit 1.0, so no upload mode to pull when uploading sketches. I have uploaded emonesp sketch correctly and also data folder but no wifi ap comes out. the nodemcu is flshing a blue led once every second. What should i do?

Serial monitor shows exception (3)

I had to erase flash and upload emonesp again to make it work. Thanks @glyn.hudson for the suggestion.
I would like to add arduino sensors to my wemos d1 mini…my question is any sensor will appear in the data value and sent to emoncms or should i manually change the sketches or add libraries?

Because i see from the sketch that input comes just from uart…no other pin of my wemos d1 mini would read data?only uart?

EmonESP will post serial:pairs data received on the UART to Emoncms:

e.g. power1:300,power2:100

Sorry, could you be a little more specific?
I’m new to all this…how can i connect a sensor to serial uart?let’s assume a pir sensor which has vcc, gnd, output cables. I should connect the output to a pin…but would emonesp read from it or should i tweak the code?
I am surely missing something. …very noob style:)

You need to connect UART Tx from your sensor to UART Rx on the ESP. See our example connecting emonTx V3 to ESP:

There is examples of how to serial print serial:strings in the latest emonTx and EmonTH code e.g.:

    Serial.print("ct1:"); Serial.print(emontx.power1);
    Serial.print(",ct2:"); Serial.print(emontx.power2);
    Serial.print(",ct3:"); Serial.print(emontx.power3);
    Serial.print(",ct4:"); Serial.print(emontx.power4);
    Serial.print(",vrms:"); Serial.print(emontx.Vrms);
    Serial.print(",pulse:"); Serial.print(emontx.pulseCount);
    Serial.println("");

Ok. So i assume that the pir sensor output is tx …i connect that to rx on the nodemcu…
Anyway to see that data is passing?like putty or arduino ide serial monitor?
Then i see that surely the data is different from the serial:strings that comes out of the emontx. Should i put your example code somewhere in the emeonesp sketch? Something like:
Serial.print(“pirHIGH:”); Serial.print ()

what is the PR sensor in question? You can’t connect a sensor direct to UART you will need to go via a microcontroller.

Yes any serial monitor e.g. minicom, Arduino IDE monitor can be used to view serial UART. The EmonESP uses 115200 baud

By microcontroller you mean FTDI? It’s not the matter of the pir really…it was the only input sensor i had by hand…i was doing some tests before connecting a dht directly to the nodemcu…and other sensors if this was possible…temperature, humidity, light sensors. And send data to emoncms. Why does emonesp read only from uart?

It also has a HTTP api. GitHub - openenergymonitor/EmonESP: ESP8266 WIFI serial to emoncms link

Or you could modify the EmonESP code to read directly from a sensor connected to the ESP.

That’s what i tought…adding a line in input.cpp here:

// If data received on serial
else if (Serial.available()) {
// Could check for string integrity here
data = Serial.readStringUntil(’\n’);
gotData = true;
}

To add input from pins.
What should i write?

Does anyone know how to tweak the code to read from pins also?my sensors don’t have uart. Or can a sensor without uart be connected to FTDI?

I apologize in advance for the very basic question, but I can’t get access to the emonESP configuration page.

I could upload both sketch and data folder, the ESP8266 starts as an access point and I am redirected to the log-in page. What I could not find anywhere is what the default username and password should be.

At the moment I tried blank fields, admin/admin, root/root and other obvious combinations. I also assumed the AP name had to do something with the default access credentials, but had no success. How can I access to the emonESP configuration page?

The WiFi AP password should be blank:

i.e. no authentication is needed

The soft AP was working fine, and I could get to the emonESP configuration page but the login form kept showing up despite username and password should be blank.
I decided to play dirty and to ask emonESP its own password, that is, I modified the config.cpp file so that username and password were output on the debug port:

Instead of empty strings I obtained garbage characters, perhaps I had flashed that memory area, or it was like that from factory. I could access the emonESP config page by copying and pasting those lines, after which I could change the credentials.