I am new to Raspberry and Pico. I have experience programming Picaxe and Arduino. I recently read about Pico and thought it might be good for a project I am working on. I found some DWEII boards on Amazon at 3 for $12 so ordered them. I have successfully installed MicroPython on 2 of them. The other one doesn't want to go into boot mode. I have been using Thonny and the Thonny guide to learn MicroPython and everything seemed to be going well until I tried to work with the ADC examples in the Thonny guide. I loaded it into the Dweii board and when I ran it the voltage values are not changing in accordance with the pot position. I have connected my digital meter to the input pin and it shows the voltage changing properly. But on the screen print the voltage mostly stays at 3.3 volts which is the high side connection of the pot. The other side is connected to ground and the wiper is connected to pin 28. When the pot wiper is about 1/3 of the way down from the 3.3 volt side my readout will show anywhere from .8 volts up to the 3.3 volts. But my digital meter is correctly showing about 2 volts. It seems like the ADC is just not working correctly. If I turn the pot on down towards the ground side the readout goes back up again to 3.3 volts. There are a couple of pads on the board that say VREF but I haven't seen anything about what they might be for. I haven't been able to find any kind of manual or other information about the board other than some of the buyers on Amazon really liked the board because it has a reset button and markings on both the top and bottom of the board.
Here is the program I am trying to run:
import machine
import utime
potentiometer = machine.ADC(28)
conversion_factor = 3.3 / (65535)
while True:
voltage = potentiometer.read_u16() * conversion_factor
print(voltage)
utime.sleep(2)
The project I am working on requires the ability to read the value of a pot so I need to figure out how to get this to work properly.
Thanks for any help anyone can give.
Carroll
Here is the program I am trying to run:
import machine
import utime
potentiometer = machine.ADC(28)
conversion_factor = 3.3 / (65535)
while True:
voltage = potentiometer.read_u16() * conversion_factor
print(voltage)
utime.sleep(2)
The project I am working on requires the ability to read the value of a pot so I need to figure out how to get this to work properly.
Thanks for any help anyone can give.
Carroll
Statistics: Posted by citfta — Sun Feb 25, 2024 9:53 pm — Replies 1 — Views 12