The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
starter111
Posts: 40
Joined: Wed Mar 08, 2017 7:24 am

### Re: ADC measure negative voltage??

Thanks~ Roberthh

chrismas9
Posts: 149
Joined: Wed Jun 25, 2014 10:07 am

### 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: 312
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

### Re: ADC measure negative voltage??

chrismas9 wrote:
Thu Jun 27, 2019 5:09 am
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: 4476
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

starter111
Posts: 40
Joined: Wed Mar 08, 2017 7:24 am

### Re: ADC measure negative voltage??

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

jimmo
Posts: 1845
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

### Re: ADC measure negative voltage??

starter111 wrote:
Wed Jul 03, 2019 6:06 am
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
It depends what you mean by "off".

Code: Select all

``p0.value(0)``
is the same as

Code: Select all

``p0.off()``
- it means that the pin is internally connected to ground (i.e. current will flow into it).

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.
starter111 wrote:
Wed Jul 03, 2019 6:06 am
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
See above about the pin, and you can use

Code: Select all

``timer.deinit()``
.

starter111
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??

jimmo
Posts: 1845
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

### Re: ADC measure negative voltage??

starter111 wrote:
Wed Jul 03, 2019 6:41 am
Yes! 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)``

starter111
Posts: 40
Joined: Wed Mar 08, 2017 7:24 am

### Re: ADC measure negative voltage??

got it! Thank you so much!!!

starter111
Posts: 40
Joined: Wed Mar 08, 2017 7:24 am

### Re: ADC measure negative voltage??

more questions....