DS18B20 module hang up ESP8266 ESP-12F?

Posted on
  • Hello,

    my DS18B20 test does reboot device after 36 times of data reading (Espruino v1.89). Test code:

    var ow = new OneWire(D14);
    var sensor = require("DS18B20").connect(ow);
    var cnt=1;
    
    function getTC() {
      sensor.getTemp(function (temp) {
        console.log("Temp is "+temp+"°C : ",cnt++); 
      });
      setTimeout( function() { getTC(); }, 1000 );
    }
    
    if(sensor.isPresent())
      getTC();
    else
      console.log('no sensor detected');
    

    Console output:

    ...
    Temp is 23.25°C :  34
    Temp is 23.25°C :  35
    Temp is 23.25°C :  36
    >
     ets Jan  8 2013,rst cause:2, boot mode:(3,4)
    load 0x40100000, len 2408, room 16
    tail 8
    chksum 0xe5
    load 0x3ffe8000, len 776, room 0
    tail 8
    chksum 0x84
    load 0x3ffe8310, len 632, room 0
    tail 8
    chksum 0xd8
    csum 0xd8
    2nd boot version : 1.6
      SPI Speed      : 80MHz
      SPI Mode       : QIO
      SPI Flash Size & Map: 32Mbit(512KB+512KB)
    jump to run user1 @ 1000
    
    Disconnected
    

    The call of sensor.getTemp() without callback a little extends the live time.

    • might I lost something?
    • could you suggest me, how to fix this?

    Thank you in the advance!

  • The function getTC() is called inside its own definition, maybe that's why, you could try..

    var ow = new OneWire(D14);
    var sensor = require("DS18B20").connect(ow);
    var cnt=1;
     
    function getTC() {
    sensor.getTemp(function (temp) {
    console.log("Temp is "+temp+"°C : ",cnt++);
    });
    }
     
    setInterval( function() {
    if(sensor.isPresent())
    getTC();
    else
    console.log('no sensor detected');
    }, 1000 );
    

    Does that work?

  • Which espruino version? Your code runs indefinitely for me using 1.87 and a dev board based on the same chip (either E or F).

    How are you powering your 12F?

  • Thanks for your reply!

    Unfortunately, it does not work also.

    I have Espruino v1.89. My ESP-12F is powered by external DC +5V 600mA power supplier over DC/DC converter 5V-to-3.3V (see file attached).

  • Here is file with schematics.
    Note, there is no relay in present.


    1 Attachment

    • esp12f-test-sch.png
  • Maybe flash 1.87 to rule a bug rule out. My board is a D1 Mini. Running your exact code I'm into the 1000's on the counter, so your code is ok I'd suggest.

  • One moment. Let me update firmware...

  • I have upload 1.87 from http://www.espruino.com/files/ according to "README_flash.txt" and got new problem - firmware does not work.

    After flash v1.87 firmware, WEB IDE displays correct version:

    >process.version
    ="1v87"
    >
    

    After flashing of simple test code:

    console.log('HELLO');
    

    device reboot and hang up again:

    _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v87 Copyright 2016 G.Williams
    Espruino is Open Source. Our work is supported
    only by sales of official boards and donations:
    http://espruino.com/Donate
    Flash map 4MB:512/512, manuf 0xe0 chip 0x4016
    >Erasing Flash.....
    Writing...
    Compressed Loading 44 bytes from flash...
     ets Jan  8 2013,rst cause:2, boot mode:(3,4)
    load 0x40100000, len 1396, room 16
    tail 4
    chksum 0x89
    load 0x3ffe8000, len 776, room 4
    tail 4
    chksum 0xe8
    load 0x3ffe8308, len 540, room 4
    tail 8
    chksum 0xc0
    csum 0xc0
    2nd boot version : 1.4(b1)
      SPI Speed      : 80MHz
      SPI Mode       : QIO
      SPI Flash Size & Map: 32Mbit(512KB+512KB)
    jump to run user1 @ 1000
    don't use rtc mem data
    Disconnected
    ERROR: Prompt not detected - upload failed. Trying to recover...
    
    • what might be wrong? Please advise. Thank you again.

    Notes: My previous version Espruino v1.89 works fine with above simple test; Now I am using 5V 5A external power supplier; I have tested three devices including "NodeMCU board" - WEB IDE console displays ERROR as above.

  • I don't know. I'd be inclined to suggest power - oftentimes ESP8266 weird resets seem to be power related. I can't make out the circuit diagram that well but you have a capacitor in there? What size? I think recommended min is 47uf. Does that say 0.1uf?

  • It's not your code anyway. Just turned it off.

    Temp is 23.125°C :  9635
    Temp is 23.125°C :  9636
    Temp is 23.125°C :  9637
    Temp is 23.125°C :  9638
    Temp is 23.125°C :  9639
    Temp is 23.125°C :  9640
    Temp is 23.125°C :  9641
    Temp is 23.125°C :  9642
    Temp is 23.125°C :  9643
    Temp is 23.125°C :  9644
    Temp is 23.0625°C :  9645
    Temp is 23.125°C :  9646
    >reset()
    
  • My PCB has two 47uF 16V Tantalum capacitors around DC/DC. I guess, I have found wrong firmware ZIP file, because NodeMCU even board does not work with v1.87.

  • Ollie, could you give me proper link on v1.87 firmware file?

  • Look in espruino.com/binaries that where I go.

  • Thanks to everybody!

    Short report:

    1) "The function getTC() is called inside its own definition" - it works fine, no memory leak:

    function getTC() {
        sensor.getTemp(function (temp) {
            console.log("Temp is "+temp+"°C : ",cnt++);
        });
        setTimeout(function(){getTC();},1000);
    }
    getTC();
    

    2) Espruino v1.88 and v1.89 work fine with above code for long time. Unfortunatly, after the same testing I cannot approve v.87 and v1.90.

    My test environment consists:

    • ESPRUINO WEB IDE;
    • Two kinds of PCB boards, NodeMCU and proprietary one (as shown above);
    • power supply with 5V (max 5A) output for proprietary PCB.

    Feel free to contact me if any question.

  • How long? I thought you had a count of 36?

    Did you find the 1.87 binaries in that URI? Sorry poor formatting - mobile as left work

  • Correct, 36 times with callback function and about 60 otherwise.

    Yes, I have found 1.87 binary. Unfortunately, it has another problem related to "Send to Espruino" function in WEB IDE (see post #8 above) , i.e. periodic self-reboot.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

DS18B20 module hang up ESP8266 ESP-12F?

Posted by Avatar for MSol @MSol

Actions