DS18B20 on WiPi reading "none"
-
@d-alvrzx Thanks for getting back on this. So I've wired everything as per the diagram and tried PINS 10, 17, 20. Ans still get an empty array for Roms using your suggested code. Not sure what else to do next now.
-
@d-alvrzx So I also tested the voltage across the DS18X20 - its ~3.2 volt. Data is now on Pin10. Also tried a brand new Wipy 3. Still not seeing the DS18X20 and Roms return an empt array.
-
@cbourne So you have the data pin at 3.2, when there is not data requested. That's fine. During transfer you should see with a voltage meter a slight drop. Is the DS18B20 cold or warm? If warm, the wiring is wrong.
Did the DS18B20 ever work? If not, it may be broken. -
@robert-hh So ?I get 3.2v between GND and Vdd and 2.8v between GND and the data pin. I've tried 3 seperate DS18B20 from here https://thepihut.com/products/ds18b20-digital-temperature-sensor-extras?
Just tried a new WiPi 3 and expansion board. Same result. i.e. and empty Roms array.
-
OK so I just tested my DS18X20 on a Raspberry Pico & Circuit Python using this code:
import time import board from adafruit_onewire.bus import OneWireBus from adafruit_ds18x20 import DS18X20 # Initialize one-wire bus on board pin D5. ow_bus = OneWireBus(board.GP16) # Scan for sensors and grab the first one found. ds18 = DS18X20(ow_bus, ow_bus.scan()[0]) # Main loop to print the temperature every second. while True: print("Temperature: {0:0.3f}C".format(ds18.temperature)) time.sleep(1.0)It worked first time:
Temperature: 28.750C Temperature: 28.750C Temperature: 28.813C Temperature: 28.750C Temperature: 28.688C Temperature: 28.625C Temperature: 28.625C Temperature: 28.625C Temperature: 28.563C Temperature: 28.563C Temperature: 28.625C Temperature: 28.688C Temperature: 28.625C Temperature: 28.625C Temperature: 28.625C Temperature: 28.625C Temperature: 28.688C Temperature: 28.625C Temperature: 28.625C Temperature: 28.625C Temperature: 28.688C Temperature: 28.688C Temperature: 28.813C Temperature: 28.750C Temperature: 28.750C Temperature: 28.750C Temperature: 28.750C Temperature: 28.750C Temperature: 28.750C Temperature: 28.750C Temperature: 28.688CSo obviously there's something different happening here and it proved that the DS18X20 is working properly. Can anyone shed some light on this problem please.
-
@cbourne I tried to replicate that on my lopy, only to find that I seem to have a completely different set of functions, which however work. Since I am not allowed to upload them here, i've put it to a different place:
https://github.com/robert-hh/Shared-Stuff/blob/master/ds18x20.zip
-
@robert-hh Thanks, I'll try this again later. So are these different to the ones here: https://github.com/robert-hh/Onewire_DS18X20 ?
-
@cbourne No. That should be the same. I simply forgot that I had made a repository for them. Quite a while ago. We never could convince Pycom to use these.
So take the files from the repository. They are proper documented. -
@robert-hh OK I’ve already tried the ones from the repository and get the same result. ‘Roms=[]’ I don’t understand this took me 5 mins to get working on the PI pico. So far I’ve spent 5 days and still can’t get it to work on a Wipy3.
The bigger issue here though is clearly the stock examples in the Pycom docs don’t work, so if they don’t work not sure if there’s much hope.
I think I need to look at a different ecosystem for my development boards. I also spent hours trying to find a workable ‘uRequests’ example because again the docs were not current.
If Pycom can’t provide and more importantly maintain, basic working examples for the most common use cases, then why should I waste my time and money here.
-
@cbourne That's strange, because that code works here and also for other people. So it must be something else. Are you sure that you have it connected to P10 and that P10 works? Did you try a different Pin? Do you have a logic analyzer? Even the 10 € devices you can get at Amazon and othe rplaces are very helpful.
About the Data Pin. If you do not send data, the data pin should be at about 3.3V. -
@cbourne Hello, Might be an obvious one, but check that the pull up resistor is connected
-
@optimho thanks yep already done that.
-
@cbourne Did you use the same set-up with pull-up resistor for the Pico test?
-
@robert-hh yes exactly the same components on the same breadboard.
-
@cbourne And the same jumper wires?
-
@cbourne It can be a bit of a frustration - but there is the pure joy when you get it to work, you know how it goes.
An oscilloscope is what you need for these tricky ones.
In absence of one, I would and you possibly already have inserted an LED between your pull up resistor and the supply to the resistor then add some code to turn on and off that LED, temporarily comment out some of your other code so that you can just revert back to it afterwards, then bridge out or remove the LED with out disturbing the circuit.
This might seem like such a basic thing to do, but rules out faulty componentry, wiring and so on.
Recheck the the value of your pull up. -
@cbourne maybe check if the code does not set an internal pull up or pull down on the pin? Or explicitly disable it?
What voltage do you see on the pin with nothing connected?
-
@jcaron Yes, that's a good one, or try without the pullup, as jcaron mentioned it possible that a pull up has been set already, I don't think that the PI or PICO has that facility.
-
@optimho Read the forum posts about I2C Pullup Resistors, looks like for I2C there may already be pullup resistors on pins 9 and 10, read the thread for yourself. Try route your code to another pin not dedicated to I2C or try with no pull up. Hopefully that works for you.
-
@optimho There are no pull-up resistors at Pins 9 and 10 of a development module. The labeling as I2C port has not special meaning. And even if: the DS18x20 needs a pull-up resistor, since the port is operatin in open-drain mode. And even if there were two resistor of 4k7 in parallel: the ds18b20 output can drive resistor loads down to 820 Ohm at least, and the ESP32 can drive down <100 Ohm.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login