ADC measure negative voltage??
-
- Posts: 40
- Joined: Wed Mar 08, 2017 7:24 am
Re: ADC measure negative voltage??
Thanks~ Roberthh
Re: ADC measure negative voltage??
On Pyboard Aref is derived from the main 3V3 regulator. If you want really good absolute accuracy connect a reference to another ADC input and scale your reading with the reference reading. Taking a large number or readings and averaging them will help. 4 readings should give about one more bit, 16 readings about two more bits noise free.
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: ADC measure negative voltage??
It is called ADC oversampling. Some tutorials/references :
IMPROVING ADC RESOLUTION BY OVERSAMPLING AND AVERAGING
AVR121: Enhancing ADC resolution by oversampling
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: ADC measure negative voltage??
Note that oversampling improves resolution rather than accuracy. It would be interesting to characterise the Pyboard ADC's to see if they have the Gaussian noise distribution required for this technique to work.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
-
- Posts: 40
- Joined: Wed Mar 08, 2017 7:24 am
Re: ADC measure negative voltage??
Thank you so much for your reply!
I have two more questions.
1. how do I isolate/turn off pins after use them? Let say I do
p0 = Pin(0, Pin.OUT)
p0.value(0)
how do I turn p0 off? is it Pin.off() ? What is the meaning off "Set pin to “0” output level." Is it mean isolate from outside??
https://docs.micropython.org/en/latest/ ... e.Pin.html
2. I'm using Dave Hylands frequency counter code, it works great! is very accurate! Same question, how do I turn the timer and pin off after I use it??
viewtopic.php?t=3370
I have two more questions.
1. how do I isolate/turn off pins after use them? Let say I do
p0 = Pin(0, Pin.OUT)
p0.value(0)
how do I turn p0 off? is it Pin.off() ? What is the meaning off "Set pin to “0” output level." Is it mean isolate from outside??
https://docs.micropython.org/en/latest/ ... e.Pin.html
2. I'm using Dave Hylands frequency counter code, it works great! is very accurate! Same question, how do I turn the timer and pin off after I use it??
viewtopic.php?t=3370
Re: ADC measure negative voltage??
It depends what you mean by "off".starter111 wrote: ↑Wed Jul 03, 2019 6:06 am1. how do I isolate/turn off pins after use them? Let say I do
p0 = Pin(0, Pin.OUT)
p0.value(0)
how do I turn p0 off? is it Pin.off() ? What is the meaning off "Set pin to “0” output level." Is it mean isolate from outside??
https://docs.micropython.org/en/latest/ ... e.Pin.html
Code: Select all
p0.value(0)
Code: Select all
p0.off()
I think what you might want is to make the pin float -- i.e. it looks like it's physically disconnected from the inside of the chip. This is called "high impedance" (or "hi-z") mode. The easiest way to do this is to set the pin to input mode.
See above about the pin, and you can usestarter111 wrote: ↑Wed Jul 03, 2019 6:06 am2. I'm using Dave Hylands frequency counter code, it works great! is very accurate! Same question, how do I turn the timer and pin off after I use it??
viewtopic.php?t=3370
Code: Select all
timer.deinit()
-
- Posts: 40
- Joined: Wed Mar 08, 2017 7:24 am
Re: ADC measure negative voltage??
timer.deinit() looks good.. I will try tomorrow..
Yes! I want high impedance! or isolate, set pin.in() with pin pull up to None??
Yes! I want high impedance! or isolate, set pin.in() with pin pull up to None??
Re: ADC measure negative voltage??
starter111 wrote: ↑Wed Jul 03, 2019 6:41 amYes! I want high impedance! or isolate, set pin.in() with pin pull up to None??
Code: Select all
p0.init(mode=Pin.IN, pull=None)
-
- Posts: 40
- Joined: Wed Mar 08, 2017 7:24 am
Re: ADC measure negative voltage??
got it! Thank you so much!!!
-
- Posts: 40
- Joined: Wed Mar 08, 2017 7:24 am
Re: ADC measure negative voltage??
more questions....
adc = ADC(Pin('X19'))
adc.read() # read value, 0-4095
How to turn off adc ?? I try dir(adc) it give me this.. "['__class__', 'read', 'read_timed', 'read_timed_multi']", looks like no way to do so?
https://test-ergun.readthedocs.io/en/la ... b.ADC.html
adc = ADC(Pin('X19'))
adc.read() # read value, 0-4095
How to turn off adc ?? I try dir(adc) it give me this.. "['__class__', 'read', 'read_timed', 'read_timed_multi']", looks like no way to do so?
https://test-ergun.readthedocs.io/en/la ... b.ADC.html