Picon Zero and DS18B20 temperature sensor

I’ve got my @4tronix Picon Zero working with some servos and an analog light sensor, however I need some help getting a DS18B20 temperature sensor to work.

I have followed the worksheet here, but when the input is set to the DS18B20-type (i.e.: pz.setInputConfig(2, 2)), it just reports a value of zero.

To troubleshoot, I set the input connected to the DS18B20 to Analog (i.e.: pz.setInputConfig(2, 1)), and it then reports values of ~23 at room temperature. Additionally, I have also noticed that setting any of the inputs to DS18B20-type causes that input and all higher-numbered inputs to report zero values, which is weird! Something is wrong somewhere…

My Picon Zero has firmware version 8, and as per the guide I’m not using pullup resistor.

Any ideas?

Hi, I think the first thing we need to address is how you can possibly read an analog value from a digital temp sensor. That just seems wrong. Are you sure that your sensor is an DS18B20 and not an analog sensor of some kind?

It could be the analog value is just noise. if I measure the voltage across GND - SIG with my multimeter I measure ~0.6mV

Definitely looks like the right thing :)
Weirdly close to actual room temperature
So, back to your problem. I have no obvious answers. The worksheet you refer to was created using Rev8 firmware and clearly uses input 0 rather than input 2, so maybe worth trying that. Also, have you tried to run a program that is only what is shown on the worksheet? Perhaps there is some interaction with servos or motors or something that we’ve not seen before?

I’ve connected the temperature sensor to input 0 and removed all other sensors and outputs.

I’ve tried the tempTest.py (provided in the sample library):

root@raspberrypi:~/piconzero# python tempTest.py
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0
0.0 0.0

and I’ve tried the code from the worksheet:

root@raspberrypi:~/piconzero# python worksheet7.py
Temperature: 0
Temperature: 0
Temperature: 0
Temperature: 0
Temperature: 0

no joy, all zeros.

What is interesting though, is if I treat it as an analog sensor and sample it at 500Hz, then I can see distinct signals.

root@raspberrypi:~/piconzero# python pollSensors.py
I0:  0
I0:  0
I0:  2
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  3
I0:  0
I0:  0
I0:  0
I0:  10
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  12
I0:  0
I0:  0
I0:  0
I0:  1
I0:  0
I0:  0
I0:  0
I0:  5
I0:  4
I0:  3
I0:  0
I0:  0
I0:  0
I0:  3
I0:  0
I0:  0
I0:  0
I0:  1
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  3
I0:  0
I0:  7
I0:  0
I0:  0
I0:  2
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  5
I0:  3
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  4
I0:  0
I0:  0
I0:  0
I0:  11
I0:  0
I0:  1
I0:  0
I0:  0
I0:  0
I0:  0
I0:  2
I0:  0
I0:  0
I0:  1
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  11
I0:  0
I0:  11
I0:  0
I0:  0
I0:  0
I0:  0
I0:  3
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  2
I0:  0
I0:  0
I0:  0
I0:  0
I0:  3
I0:  1
I0:  0
I0:  0
I0:  0
I0:  3
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  2
I0:  1
I0:  0
I0:  0
I0:  0
I0:  0
I0:  1
I0:  0
I0:  12
I0:  0
I0:  0
I0:  0
I0:  4
I0:  0
I0:  0
I0:  11
I0:  0
I0:  3
I0:  0
I0:  0
I0:  0
I0:  0
I0:  2
I0:  0
I0:  0
I0:  0
I0:  0
I0:  1
I0:  0
I0:  0
I0:  0
I0:  0
I0:  1
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  1
I0:  0
I0:  0
I0:  0
I0:  14
I0:  0
I0:  0
I0:  0
I0:  0
I0:  8
I0:  1
I0:  0
I0:  0
I0:  0
I0:  1
I0:  0
I0:  1
I0:  0
I0:  0
I0:  0
I0:  0
I0:  2
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  1
I0:  0
I0:  0
I0:  0
I0:  0
I0:  0
I0:  1
I0:  0

So it looks to me like there does seem to be some digital signal coming out of the sensor, although it could just be noise. Unfortunately I don’t have any other device with which to test the sensor.