Dallas18B20 begin causes reset [solved]
-
I have connected a single DS18B20 as described on https://www.mysensors.org/build/temp (including the 4.7kohm pullup)
When I call sensor.begin, the Pro Mini resets.
With a before function looking like this I get "proof" that the node dies on begin:
void before() { // Startup up the OneWire library Serial.println("Calling begin"); Serial.flush(); sensors.begin(); Serial.println("Begin was OK"); sensors.requestTemperatures(); Serial.println("request returned"); Serial.println(sensors.getTempCByIndex(0)); }
Debug:
0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1 4 MCO:BGN:BFR Calling begin 0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1 4 MCO:BGN:BFR Calling begin 0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1 4 MCO:BGN:BFR Calling begin 0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1 4 MCO:BGN:BFR Calling begin 0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1 4 MCO:BGN:BFR Calling begin 0 MCO:BGN:INIT NODE,CP=RNNNA--,VER=2.1.1
- I have tried two different DS18B20 sensors. No difference.
- If I disconnect the data pin, begin returns and all temperature readings return -127.00C, as expected.
- If I disconnect the GND pin (and re-connect the data pin), begin returns and all temperature readings return -127.00C, as expected.
- I have tried using the bare DS18B20 library (without MySensors) and get the same result.
Any idea what could be wrong or what I could do to troubleshoot this?
-
Try to call
Serial.flush();
after each print line, this ensures that all data sent to serial port before next line executed.
Can you post image with connection wires to DS18B20 sensor? Could the problem be that this chip is a fake?
-
Thanks @robosensor
I decided to re-do all wiring to make a clear photo. When I did that I realized that I had connected GND on the DS18B20 to the reset pin on the Pro Mini.
No wonder the mcu was reset when communication occurred on the onewire bus.
-
This post is deleted!
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
Echo request is not set
Troubleshooting • 12 Aug 2024, 15:36 • kamilb85 3 Sept 2024, 08:58 -
JSN-SR04T-V3.0 Coax cable extended
Troubleshooting • 10 days ago • bocalexandru 9 days ago -
Raspberry Pi 5: invalid GPIO 9
Troubleshooting • 27 Aug 2024, 13:20 • igo 27 Aug 2024, 13:20 -
Compiling Sensor code using BME280 and ESP8266
Troubleshooting • 26 Feb 2025, 00:32 • dpcons 26 Feb 2025, 06:22 -
JSN SR04T - Temperature Influencing Readings
Troubleshooting • 6 Sept 2019, 07:51 • Timbergetter a day ago