Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By burkmurray
#23658
Strange that SHT2x.GetHumidity() did not cause the watchdog timer error, or a hang


What happens if you switch the order (call GetTemperature before GetHumidity) in the loop? Does the error follow GetTemperature?

You can add print statements to your library to track the problem.

You might want to double-check your wiring first, though. Are you using an external power supply? I don't have an ESP-01 to test, but my ESP-12 can't do much more than blink when it's powered through my USB-serial cable - it resets as soon as it can't get enough current.

ETA: Also, are you sure you need those pull-ups on your I2C lines?
User avatar
By PaulRB
#23669 Thanks.

i'll try swapping the temp & humid reads.

Just using the usb-ttl adaptor's 3.3V supply at the moment. I have a separate supply ready to use when i get to switching the wifi on. The sht21 sensor uses less current than an led. What message do you see when the esp resets due to insuficient current?

i2c pullups: its normal to include them. You can often get away without them on Uno and other '328-based Arduino because the internal pull-ups are enabled by the wire library. I will try removing them though.
User avatar
By certeza
#23930 It might help to insert a delay between Wire.endTransmission and Wire.requestFrom.
Worked for me but not all of the time. In a loop of 40 requests 4 still gave a wrong temperature value.
Furthermore, request the humidity value before the temperature value.

Code: Select all   ....
    Wire.endTransmission();     

    delay(100);

    Wire.requestFrom(0x40, 3);
    ....
User avatar
By PaulRB
#24047 I added a tactile switch and 10K pullup as a reset button and swapped the SPDT switch for another tactile button, as I have seen used with ESP8266 elsewhere. This has made working with the ESP easier.
20150723_194639.jpg

20150723_193305.jpg


I noticed that the serial port reported by Ubuntu kept swapping between /dev/ttyUSB0 and /dev/ttyUSB1. I think this must have been because the ESP was drawing too much current from the USB-Serial adaptor's feeble 3.3V output, causing it to reset each time the ESP restarted, as burkmurray suspected. So I have added a power supply for the ESP and sure enough this has stopped the USB/Serial adaptor from resetting every few seconds and Ubuntu reports it as /dev/ttyUSB0 all the time.

As suggested I tried swapping the order of reading the temp and humidity:
Code: Select allStarting Wire...
Wire Started
Temperature(C): 128.86     Humidity(%RH):
 ets Jan  8 2013,rst cause:4, boot mode:(3,6)

wdt reset
load 0x40100000, len 28780, room 16
tail 12
chksum 0x24
ho 0 tail 12 room 4
load 0x3ffe8000, len 1332, room 12
tail 8
chksum 0x8a
load 0x3ffe8540, len 1708, room 0
tail 12
chksum 0x21
csum 0x21


As with the humidity reading I was getting earlier, that temp of 128.86 also corresponds to a read of all "1"s on the i2c bus. And now the watchdog reset happens when the attempt is made to measure the humidity.

Thanks for the suggestion, certeza, I will try adding your suggested delay next.
You do not have the required permissions to view the files attached to this post.