Newbie in need of a little help (DS18B20)

1979kent
Posts: 4
Joined: Sun Apr 01, 2018 2:54 pm

Newbie in need of a little help (DS18B20)

Postby 1979kent » Sun Apr 01, 2018 3:15 pm

Hi
I am making my own Centralheating controller and so far everything is starting to play well together and i am starting to finetune it.
Main control is a ESP32 WROOM and my problem is a sensor bus wire to 12 DS18B20 temperature sensors.
Its working perfect for a day or two, then ALL sensors goes blank. Its not enough to reset the esp, but if i disconnect the power for a short time all sensors are back and working perfect.
Any idea what´s happening and possible how to avoid it?
Its pretty crucial to my control that i dont loose readings for too long time.

thanx in advance :D

rnyqvist
Posts: 4
Joined: Mon Apr 02, 2018 12:55 pm

Re: Newbie in need of a little help (DS18B20)

Postby rnyqvist » Tue Apr 03, 2018 5:34 am

HI!

Exactly the same as what I've observed. And I've tried several different sketches with various different ESP32 versions (also ESP8266).
And with sensors connected to one-wire and I2C bus.
Sketch keeps running for a few days then freezes.

Something broken in the ESP Arduino implementation perhaps?

Cellie
Posts: 42
Joined: Sat Feb 27, 2016 9:47 pm

Re: Newbie in need of a little help (DS18B20)

Postby Cellie » Tue Apr 03, 2018 6:56 am

A power supply problem? Are you using parasitic power? Feeding all that sensors from a ESP32 pin?
I use 3 DS18B20 sensors in a project, fed by dedicated power, and they keep running, well forever.
... then ALL sensors goes blank.
Blank means what exactly?

1979kent
Posts: 4
Joined: Sun Apr 01, 2018 2:54 pm

Re: Newbie in need of a little help (DS18B20)

Postby 1979kent » Tue Apr 03, 2018 7:30 am

Hi i am not using parasitic power, but they are powered by the same esp pin. I will try to power from external power.
When it goes blank means virtuino goes blank (out of range maybe), but the esp is reading it as a lower value... all my heating circuits went full open at the time.

I will try the external power thanx

1979kent
Posts: 4
Joined: Sun Apr 01, 2018 2:54 pm

Re: Newbie in need of a little help (DS18B20)

Postby 1979kent » Tue Apr 03, 2018 5:36 pm

rnyqvist:

Yes i have seen a lot of i2c problems on the interweb.
I did consider putting on a i2c io expander and a RTC also on i2c.
I might end up using a thrusty old arduino mega and only use the esp32 as a wifi module.
Some projects as my current one requires reliability.

meowsqueak
Posts: 151
Joined: Thu Jun 15, 2017 4:54 am
Location: New Zealand

Re: Newbie in need of a little help (DS18B20)

Postby meowsqueak » Wed Apr 04, 2018 4:10 am

1979kent wrote:Yes i have seen a lot of i2c problems on the interweb.
I did consider putting on a i2c io expander and a RTC also on i2c.
I might end up using a thrusty old arduino mega and only use the esp32 as a wifi module.
Some projects as my current one requires reliability.
Just in case it's not clear, the DS18B20 is not an I2C device, it's a Maxim "One Wire Bus" device.

Also, a recent commit to the ESP-IDF master fixes the main I2C error that some people, including myself, were complaining about. I think this was related to some prior fixes in the Arduino code base, so I'd expect it to be fixed there already, or if not, soon.

To the OP, I don't know much about DS18B20 support with ESP32 Arduino, but if you want to try a reliable and proven C implementation for one or more DS18B20 devices on the ESP32, to at least prove your board and the devices work, you could try my example and library:

https://github.com/DavidAntliff/esp32-ds18b20-example

You'll need ESP-IDF v3.0rc1 (v2.1.1 works too, but you'll need to check out the 2.1.1 branch). Just hook up an appropriate resistor and configure the pin to use with 'make menuconfig'. Note that it doesn't officially support parasitic power mode - it's not something I've explicitly tested, although it might work out-of-the-box with a single device.

Cellie
Posts: 42
Joined: Sat Feb 27, 2016 9:47 pm

Re: Newbie in need of a little help (DS18B20)

Postby Cellie » Wed Apr 04, 2018 8:42 am

To be fair, there were some OneWire issues some time ago.
I am using DS18B20 sensors for some of my projects for the last years and the issue mainly was that 'some' transactions went 'bad' as in the checksum was not valid. These transactions ( I had a rate of about 1 in 50 transactions going bad, depending on the particular code ) could be filtered from the stream quite easy.
I did not have any catastrophic ( eg. have to reboot, like the op ) failures, just the occasional weird value with a bad checksum.
These issues were solved initially by stickbreaker in his OneWire repo and are now incorporated in the Arduino OneWire library.

I DID have catastrophic failures during the hardware R&D phase using parasitic power. Using 5 or 6 sensors on a pin would be very unstable.

12 sensors feeding from a ESP32 pin is way too much.

From the DS18B20 datasheet:
...However, when the DS18B20-PAR is performing temperature conversions or copying data from the
scratchpad memory to EEPROM, the operating current can be as high as 1.5 mA.
Assuming this code:

Code: Select all

    ds.reset();
    ds.write( 0xCC, 1); /* Skip ROM - All sensors */
    ds.write( 0x44, 1); /* start conversion, with parasite power on at the end */
All sensors will start start to draw current at the same time from the ESP32 pin.

12 times 1.5 is 18mA which is way too much...

12mA is the maximum current you can pull from a single ESP32 pin, but I would like to stay significantly below that.

1979kent
Posts: 4
Joined: Sun Apr 01, 2018 2:54 pm

Re: Newbie in need of a little help (DS18B20)

Postby 1979kent » Thu Apr 05, 2018 6:56 pm

Hi again
i have been running a seperate psu on the sensors ever sinces suggested and so far so god :D
I will find a i2c device in my box of "nice to have stuff" to see if its stable with that, because i need some extra io´s and to my knowlegde the easiest way is a i2c expander??

thanx for the responses really helpful!!

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Newbie in need of a little help (DS18B20)

Postby WiFive » Thu Apr 05, 2018 8:18 pm

Cellie wrote:
All sensors will start start to draw current at the same time from the ESP32 pin.

12 times 1.5 is 18mA which is way too much...

12mA is the maximum current you can pull from a single ESP32 pin, but I would like to stay significantly below that.
You can have the sensors do their conversions one at a time

Cellie
Posts: 42
Joined: Sat Feb 27, 2016 9:47 pm

Re: Newbie in need of a little help (DS18B20)

Postby Cellie » Fri Apr 06, 2018 2:49 pm

You can have the sensors do their conversions one at a time
Yes, that is of course a possibility.

I did not mention that as it adds to code complexity and you still need a free pin to feed your sensors.

Who is online

Users browsing this forum: No registered users and 40 guests