Link EXP8266 with Arduino Nano

I am not a full time programmer and am wondering if I am going in the right direction, I don't want to re-invent the wheel.

My project consist on getting some voltage readings and send it via Wifi to MQTT broker.

I've already implemented sending temperature on ESP8266 but its ADC input being limited to 0 to 1 volt would not give me enough accuracy. Therefore I would use the Arduino Nano's ADC to get the readings.

I like the Wifimanager setup I have on the ESP so I would setup the ESP to either connect to the last known Wifi access point or become an access point in order to setup a new SSID to connect to. I would then have the ESP wait for data on its serial port and if present, validate, split and publish to MQTT.

The Nano would be reading ADC, at this point I would be reading from multiple sources, create a long string and send it to the ESP via serial port at the rate of once per 5 secs.

Is the above viable or is there a better way to achieve my goal?



Forget the Nano, just use the esp. What voltage range do you need to measure? Just like the Nano, the esp's ADC pin has a resolution of 10 bits. So the same accuracy, but over a different range. With the range 0 to 1 volt this means, in theory, the ability to measure down to a millivolt.

It is for a marine application so I want to measure 3 battery banks so the voltage should be between 11V to 16V but I would like to have to the accuracy of 2 decimals. I did a bit of testing with a simple voltage divider resistors and the 100th digit is going all over the place.

+1, forget the Nano. Add an ADS1115 breakout board to the ESP8266 (or, easier, a WeMos D1 mini). Four channels, 16-bit 15-bit resolution. Power the ADS1115 from the 3.3volt rail of the ESP8266. Calculate the voltage dividers for 2.048volt, and use a PGA gain of two. Leo..

Excellent idea!

Thanks Leo

Quite often members want to measure battory voltages. Sometimes having a very good resolution. In this case, using a voltage divider, makes measuring possible BUT..... The A/D converter measures from 0 to 16 volt. That means that the 10 bits are used like some 11/16*1023 == 703. 703/1024 of the range is just waisted. For high resolution a differential measuring between 10 and 16 volt volt make all the 10 bit used for a 6 volt range, not a 16 volt range. Creating the base voltage of 10 volt is one issue, possibly solved by a zener diode close to 10-11 volts, measured and incoporated in the converting code. Then an OP-amp would probably be needed. Easier or not? Better resolutiion, yes.

The above works in theory, but drift of the voltage reference/opamp/other parts could easily undo the benefit of that higher resolution. An ADS1115 is already overkill in this situation. Voltdrop in the battery cables (including ground) is a much bigger gremlin. Leo..

Yes. It's probably easier and safer to buy some more bits in the A/D. Needing 2 decimals is very ambitious in my opinion. Measured at the consumer input or at the battory?

+1 for using ads1115. I have found them to be very noise-free. You get 4 channels per module, and you can add 3 more modules to give 16 channels. Very cheep, too!

s-l400 (12).jpg

Wawa: Calculate the voltage dividers for 2.048volt, and use a PGA gain of two.

Out of curiosity, how did you come up with 2.048volts?

JABfreak: Out of curiosity, how did you come up with 2.048volts?

On a 3.3volt supply you can only use a lower full-scale than 3.3volt. 2.048volt is the next one down from 3.3volt (datasheet, table#3, page13).

The default 6.144volt scale would 'only' give you a ~14-bit resolution, since you can't measure a higher voltage than the chip's power supply. Leo..

I just saw this on the datasheet, sorry I should have looked at the datasheet before I asked…