DS18B20 on ESP32

41 views
Skip to first unread message

joel gerardi

unread,
Jun 6, 2024, 2:59:27 PMJun 6
to TasmotaUsers
I have an esp32 wroom that i have flashed with tasmota 14.1.   I am trying to connect an DS18B20 for temperature.  In the configure module, I selected ESP32 DevKit (0) and also (1).  Under IO GPIO14 I have DS18x20 selected. I have the red wire connected to the 3.3v pin, The black connected to the gnd pin and the yellow connected to pin14. I set option74 to on.  Not working.  I shut off option74 and tried a 4.7k from 3.3v to the data wire on pin14.  Still nothing.  
I have tried different sensors, wires, resistors and nothing seems to work.
Anyone have any ideas?

Justin Adie

unread,
Jun 6, 2024, 3:26:39 PMJun 6
to joel gerardi, TasmotaUsers
First off I'd always use a pull up resistor on the power to data line.  4.7k or thereabouts is fine.

Second just to clarify gpio14 is not pin 14 on the esp32.  Pin 14 is gpio12.  Pin 13 is gpio14. 

Do not connect anything to pin 14 that needs a pull up however.  It will play havoc with boot time.  So don't use for the temp sensor.   

Please set weblog to 4 and post the full logs after a reset if you're sure that you have the gpio assignments and wiring correct and it's still not working.




--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/2979a74c-ad7d-4799-a6e7-6bf7f70f1367n%40googlegroups.com.

joel gerardi

unread,
Jun 6, 2024, 4:41:57 PMJun 6
to TasmotaUsers
Im confused.  Attached is a diagram of what i have and how i am setting it up.  On this board, GPIO is pin14, no?
Screenshot 2024-06-06 at 4.13.35 PM.pdf

Justin Adie

unread,
Jun 6, 2024, 4:48:46 PMJun 6
to joel gerardi, TasmotaUsers
Ah. That is not an esp32 wroom 32 but a board that uses that module (the U variant). 

So the pin naming is the same as the labelled numbering.   Let's assume that gpio14 is the numbered 14, I'm sure it's the case.

So can you share the logs after a reset?  

Also where did you get the sensor?  Of a batch of 30 I bought off eBay there were only 8 usable.  



joel gerardi

unread,
Jun 6, 2024, 5:29:41 PMJun 6
to TasmotaUsers
It turns out the issue is the power supply.  I have a relay board that has a 5v transformer on it.  If i use that to supply the esp, the sensor wont work. It also wont work if i power it via the serial board i use to flash it.  It will only work if i power it via the USB.   This is odd and will completely screw my plans up if i cant find a way around it.

joel gerardi

unread,
Jun 6, 2024, 6:02:35 PMJun 6
to TasmotaUsers
It seems the DS18b20 will only work if i power the board via the micro usb port on the actual board.  If i use a breakout board and supply it via usb, it wont work either.

Justin Adie

unread,
Jun 6, 2024, 6:08:21 PMJun 6
to joel gerardi, TasmotaUsers
That sounds very odd.   The ds18b20 uses very little energy and is fine at 3v. The pull up is to provide a set "high" state and you need this at 3.3v to avoid frying the esp32 gpios (allegedly). 

I can't see how the means of supplying 5v to the board has any impact on the esp32 module provided there is enough current being sourced. You can tell that from looking at the logs and checking for resets/brownouts.  

Perhaps look at the circuitry of the 5v input to the board.  Maybe the reverse polarity diode is suspect or there's some other issue on the board.

joel gerardi

unread,
Jun 6, 2024, 6:15:09 PMJun 6
to TasmotaUsers
I am having the same issue with an esp8266 as well. If i supply power via a pin it wont work.  If i supply power directly to the USB on the actual board, it works.

Justin Adie

unread,
Jun 7, 2024, 3:02:56 AMJun 7
to joel gerardi, TasmotaUsers
Can you share the schematics for each board?  And just to confirm you are trying to supply 5v via the 5v pin?  Do you have a good multimeter to test with?



joel gerardi

unread,
Jun 9, 2024, 4:48:40 PMJun 9
to TasmotaUsers
Ive been away.  To answer your question, i am using a high quality multimeter.  Unfortunately i purchased these on amazon and i cant get a schematic for them.  What odd is that the esp32u will only work if power is supplied via usb directly to the dev board.  I have a breakout board that has usb ports and it will not work correctly if i supply power via the USB there either.  As far as the esp8266, my only option to supply power is either directly to the pin on the board (or breakout board) or USB directly on the board.  I am having the same issue with the 8266 only working correctly if i power directly to the usb on the board itself.
The ESP32 i am using is this

The power supply and relays are this:

Justin Adie

unread,
Jun 9, 2024, 4:56:47 PMJun 9
to joel gerardi, SonoffUsers
great that you’ve got a good quality multimeter.  I’d trace the circuitry around your 5v feed to the expansion board and have a close look at the voltage jumper.  My guess is that you need to put the jumper on the 5v setting and power via the 5v pin.  I’ve not found a circuit diagram for it in the couple of minutes I spent searching. 



Reply all
Reply to author
Forward
0 new messages