Accurate voltage measurement

Status
Not open for further replies.

Cool! I will go through it, thank you for the resource. In school atm

Man...you guys gave me cool ideas to perform monitoring of random things along with the actual device. I also intend to use Thingspeaks free service for to gather data.
 
hy disappointed?, 0-1V is a great advantage it avoids needing an amplifier, and is easily attenuated in any case.

I was disappointed because I wanted to read 0-5V on an ESP-12 (as I recall) or something like that. So, it meant that I had to scale it and that disappointed me. While I am easily disappointed, I forget quickly so it doesn't bother me too much.

Edited to add: This is not a big argument/issue for me, but that was, in fact, why I was disappointed. Also, apparantly Weemos did not see 0-1V as an advantage as you state since they saw fit to add the 220K / 100K divider (ref). Now, I am not going to give myself a headache trying to go through all of the actual technical issues and error possibilities of analog to digital conversion (like here) and I barely understand the basic concepts and I don't know how the native range has to do with that, but it would appear to be an advantage to have the native range equivalent to the measuring range of the values you want to convert. I think that is why they made the divider so it could accommodate values up to Vcc. In my case with the ESP12, it would not have mattered as I would still have had to scale it.

Anyways, I am fine with it one way or the other and there is no lack of things for me to be disappointed about
 
Last edited:

As I said, using an attenuator at the input to set your range is normal, and EXTREMELY simple. I don't think I've ever used an A2D without one?.

Personally I like to scale it to the size of the A2D, so for a 10 bit one I'd usually chose 10.23V or 102.3V - this avoids the messy last digit if scaling by maths.
 
10.23V or 102.3V
Neither will work well here, trying to measure 24v. The ADC errors will be less if you use all/most of the ADC's range. You can get almost the same number system by not using 102.3 but 51.15 or better yet 25.55 volts full scale. (Do what ever works in your head. It's only math)
 
Shouldn't those reference voltages be multiples of 1024 not 1023?

Mike.
 

Well 102.3 will work fine, and give you 0.1V resolution (better than 1%) - and a last digit that goes fully from 0 to 9. Doing maths on the reading means the last digit will jump values - such as only even values if you multiply by two.
 
Shouldn't those reference voltages be multiples of 1024 not 1023?

Mike.

It's an often discussed question - and in a thread here somewhere, someone (it might have been you?) did a full explanation of which was best, and why - pity I can't remember what the outcome was
 

Not sure what the discussion is about here. If it is how easy it is to attenuate a signal so it fits the range of the converter capabilities, I clearly agree with you since, after going through the procedure for the TS, I already called the procedure "Easy Peasy", which is the universal technical term for "extremely simple" ( ).

I don't relate to using an attenuator, or an amplifier, as "normal" any more than not using one as normal. All I freaking said was that I was disappointed at the 0-1v native range of the ESP8266 A2D. I wanted to use an HIH 4020 humidity sensor and I was disappointed that I would have to attenuate the signal to fit that range.

I ended up using a PIC (see below) and then ended up dumping the analog voltage out sensor in favor of a digital one using I2C.





I also would say that 0-1v does not offer "a great advantage" as you said, unless the range of the signal you want to measure is 0-1 v. In fact, it is analagous to the "great advantage" that the PIC offered (as would have the Arduino) versus the ESP8266 in the case of the HIH 4020.

That Weemos stuck a divider on the board suggests to me that the more "normal" case, with regard to a highly integrated chip or board, is for the A2D to accommodate 0-Vcc (as well as some form of Vref).
 
It's an often discussed question - and in a thread here somewhere, someone (it might have been you?) did a full explanation of which was best, and why - pity I can't remember what the outcome was

 
It's an often discussed question - and in a thread here somewhere, someone (it might have been you?) did a full explanation of which was best, and why - pity I can't remember what the outcome was
The thread was by Roman Black and was more about the maths. As for reference voltage, the pic chips with a built in Vref are all multiples of 1024.

Mike.
 
I also add a wire link for the sleep reset, and the boards wake every ten minutes, send the readings, and go back to sleep.

Hello Nigel

I am sorry to bring this old reply up but I was just curious about how you wire it up to wake every 10 minutes. Do you have an interrupt set upor is there some clever way of waking it up. As far as my knowledge goes, one needs an interrupt, watch dog timer wake or reset to wake a processor up. Just curious about it
 

I know you did not direct your query to me, but if it is tolerable...I have used an RTC (with its own coin cell) to produce an alarm that serves to power up a sensor board at a specified interval. After reading the sensors (and transmitting and/or recording the data), the MCU turns off the interrupt and, consequently, the power to the data logger...until the next interval has elapsed. It works well for me.

See for more info.

Also, if you want to specifically 'tag' a user, put an @ before the user name and it will notify the user (depending on preference settings).
 

You simply run a wire between reset and GPIO 16, then run the instruction ESP.deepSleep(uS), where uS is the sleep time in microSeconds.

I define a constant at the start of the program, to make it easy to adjust:

const int UpdateInterval = 10 * 60 * 1000000;

That's obviously 10 minutes.

After ten minutes the device wakes up, and resets itself (via the aforementioned wire link) - then goes back to sleep. You don't have any code in loop(), as it never gets there - all code is in setup(), ending with the deepSleep instruction.

The Wemos D1 isn't a 'great' choice, as it has a USB chip on-board, a bare ESP8266 would be lower consumption, but it's not at all bad,

One extra point, I solder a small slider switch in place for the wire 'link', as you need to disconnect it from reset in order to program the Wemos. The later Wemos D1's even have solderpads for the link, so you can just solder a blob across it.

So basically it's VERY simple to do, just a wire link and a single instruction.
 

On PIC's I generally use a 32KHz crystal on TMR1, with the PIC waking up every second and doing RTC timekeeping - although I have done like you as well, and used the 1 second output from a DSxxxx RTC to wake the PIC up
 
DrG

Thank you for replying to my query ofcourse and to the resources you pointed out. The sensor board you made is so cool! 10 months on batteries, I am impressed. I will try something like that soon

Nigel Goodwin

Thanks for sharing. That is a very clever way of doing it, it was well worth asking the question!
 

No problem, it wasn't my idea - it's the standard way of doing it. If you google for ESP8266 sleep you will find plenty about it.
 
Just so you know ESP32 has 12-bit SAR ADC up to 18 channels 4,096

 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…