Hi, I have been playing with the OpenMV for about six months and am really blown away by what this small low powered board can do. That said, my experience on the electronics side is more limited and I am stuck on what I suspect is a simple problem
import sensor, image, time, pyb
adc = pyb.ADC("P6") # create an analog object from a pin
while(True):
time.sleep(5000)
val = adc.read()
adc_point = 3.3/1024 # Value of one adc point - voltage/1024 (have also tried /4095)
val *= adc_point # Volts
val *= 1000 # Convert to millivolts
temp = 0.0512 * val - 20.5128 # Convert to temperature
print(int(temp))
Hi, the ADC may be broken in the latest firmware available. I think Ibrahim put a fix in for this but we haven’t released anything in a while. Um, if you can build the firmware you can get the fix now. Otherwise I have to get home to make that fix.
Hi, I don’t know how to rebuild the firmware but could muddle through if pointed in the right direction. I have access to a Linux machine.
I just tried on an up until now still packaged H7 board running the 3.2.0 firmware and get the same issue - was the issue introduced prior to this release?
There seems to be no response whatsoever to the sensor - if I unplug it from ADC port 6 I still get the same readout within the same range. I have tried a second sensor in case the issue lies there, but this behaves the same. Any ideas?
Thanks for that. Unfortunately no change with that firmware.
The adc.read() output is the same regardless of whether anything is connected. Am I right in thinking that it should be working if powered over usb (I have tried with and without). I have also used a multimeter to confirm that the sensor is not defunct and is responding to temperature.
Are there any other options to get this sensor working with the OpenMV via something other than ADC?
No, it’s just the method is broken in the H7 firmware. If you see our GitHub history we put a fix in for this so it must not be in the built firmware yet.
Maybe Ibrahim can build the firmware for you. I am on a trip but have my laptop with me. I can build it and post tonight.
Hmmm, I remember the ADC for the H7 being fixed but maybe it’s just broken right now and there’s a github issue on it. Ibrahim is looking into this. The latest firmware is attached.
Question, can you power the sensor for the 3.3v pin from the OpenMV Cam? I remember the ADC being fixed before. firmware.zip (966 KB)
Hi, I just tested ADC and it seems to be working fine. There’s a simple way to test ADC, just connect a wire between ADC (P6) and 3.3v out or GND. And run this script:
import time
from pyb import ADC
adc = ADC("P6") # Must always be "P6".
while(True):
# The ADC has 12-bits of resolution for 4096 values.
print("ADC = %fv" % ((adc.read() * 3.3) / 4095))
time.sleep(100)
link doesn’t work.
you can use 3.3v from the board if you dont plan to draw more than 200 mA.
If so use extenal 3.3v but ensure that both gounds are connected together (from camera and external 3.3v)
I don’t prefer to use 3.3v from camera though.
I wired the sensor in “normal” mode to read the data from the DS18B20 thermal sensor and did the same as in the Arduino instructions, except that I used the ADC pin P6. Unfortunately when running the read_adc example script, the voltage does not change.
Since I was only able to use a 4.4 ohm resistor, not sure if this is the cause of the problem. I already ordered more resistors.
The sensor has a sink current of 4 mA. Why would you rather not use the 3.3V from the camera, @oramafanis ?
Oh of course, you’re right… we’re reading bits and all… so I got confused by this thread’s title and progression. GPIO4 on that Arduino board seems to be an SDA port, so I would need a python package, etc.? I will dig further.