Olimex Support Forum

Microcontrollers => ESP8266 => Topic started by: rouhu on May 26, 2015, 10:34:27 AM

Title: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: rouhu on May 26, 2015, 10:34:27 AM
Hi All,

I read that the Olimex ESP8266 board has built-in temperature sensor. I am trying to figure out how to read this data with arduino IDE code.

Any ideas ?

Thanks, Timo
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: LubOlimex on June 02, 2015, 02:25:19 PM
Hey,

According to the datasheet of ESP8266 there should be an integrated temperature sensor. Whether it is supported by the latest firmware and whether it works properly - I can't say, I haven't seen it working personally. We haven't performed tests with the integrated sensor.

We have used external temperature sensor with ESP8266-EVB - a board called MOD-TC-MK2-31855. Something simpler like SNS-DH11 would also get the job done:

https://www.olimex.com/Products/Components/Sensors/SNS-DH11/ (https://www.olimex.com/Products/Components/Sensors/SNS-DH11/)

Best regards,
Lub/OLIMEX
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: emyrddin on October 22, 2015, 07:05:23 PM
Hi,

how to connect a DHT11 (or 22) sensor to esp8266-evb board?

thanks a lot!

Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: Lurch on October 25, 2015, 11:16:54 AM
go to GitHub website and search for "ESP8266 DHT11" and you'll find several drivers and programs.
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: KNK on October 29, 2015, 11:26:15 AM
Well there is one peculiarity with ESP8266-EVB and ESP8266-EVB-BAT boards and DHT-11/22.

You need to connect it to the button pin ( GPIO0 ) or it won't work on ESP8266-EVB-BAT.
On ESP8266-EVB you may also use GPIO16, but on On ESP8266-EVB-BAT it is connected to the 5V power ( R21 and R22 ) and DHT is unable to sink enough current to GND for the low level to be accepted.

Also you can't use GPIO15, because it is connected to ground via 2K resistor ( R9 ) on MOD-WIFI-ESP8266, but if you don't need I2C (GPIO2 and GPIO4) or the SPI pins, then they can be used too (except the CS one)

If you (or Olimex in the next revision) replace R7 to R10 on MOD-WIFI-ESP8266 and R1 on ESP8266-EVB and ESP8266-EVB-BAT from 2K to 20K (you may also remove R2 and R3 for the UEXT on EVB) maybe be more pins will be usable, but not tested yet.

As for the lib, just add the one provided from Adafruit from the Arduino IDE ( or download it from GitHub (https://github.com/adafruit/DHT-sensor-library) ) and simply change the pin you use in the example
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: xpegenaute on February 18, 2016, 06:12:19 PM
Hi,

I am using the ESP8266-EVB-BAT and I am much more familiar with software development than hardware. What does exactly mean "you need to connect it to the button pin (GPIO 0)", I tried with nodemcu print(dht.read(0)) and it does not work.

On the other side, "... it is connected to the 5V power and DHT is unable to sink enough current to GND...". Does it means that it is necessary to modify the hardware to be able to work properly with the DHT?

Regards
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: KNK on February 19, 2016, 01:16:33 PM
Which library are you using? There is no dht.read() in https://github.com/adafruit/DHT-sensor-library

I can confirm it works on ESP8266-EVB-BAT on GPIO0 and yes if you want to use GPIO16 - you will need to disconnect it from 5V by removing both R21 and R22
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: xpegenaute on February 25, 2016, 11:29:49 PM
Hi,

The library I am using is the one found here [1], in the nodemcu api.

Anyway, I tried with the Arduino IDE, cloning the master repository into the arduino-1.6.5-r5/libraries/ path. This is the uploaded skectch [2]. I modified the DHTPIN define to 0 and the DHTTYPE to DHT11. The output is this one:

DHTxx test!
Failed to read from DHT sensor!
Failed to read from DHT sensor!
...

Actually I am starting to think that the DHT11 sensor is missing in the PCB. Find this photo [3] where R18 and THERM are marked but the left of the THERM word is just an empty hole.

Any piece of advice will be strongly welcomed.

Regards,
----------
[1] - http://nodemcu.readthedocs.org/en/dev/en/modules/dht/#dhtread
[2] - https://github.com/adafruit/DHT-sensor-library/blob/master/examples/DHTtester/DHTtester.ino
[3] - http://expirebox.com/download/fbe25bb7402d803c10fdc173895d50ee.html
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: KNK on February 26, 2016, 01:47:58 PM
The ESP8266-EVB-BAT board does not have the sensor built-in you need to get it separately - https://www.olimex.com/Products/Components/Sensors/SNS-DH11/ and to connect it to GND, VCC and GPIO0
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: xpegenaute on February 26, 2016, 02:00:36 PM
Ops,

the "Built-in temperature sensor" [1] confused me then. What is it referring to? I thought all of them included this sensor.

Regards,
[1] - https://www.olimex.com/Products/IoT/
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: KNK on February 26, 2016, 06:30:06 PM
There should be a temperature sensor inside the ESP8266 chip (please note internal for the chip - not on the board), but there is no API or info of how to access it from a program.

The libraries and examples for the DHTxx are for external sensors, which you attach to some of the IO pins and for ESP8266-EVB-BAT only GPIO0 can be used without hardware modifications
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: JohnS on February 26, 2016, 08:00:05 PM
Looks like the internal was so inaccurate its existence was removed (or it never existed).

John
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: OnnoH on July 31, 2016, 08:51:52 PM
I join this discussion quite late, but I recently start using my Olimex ESP8266-EVB (Rev. A) with the DHT11.

I use the button GPIO0, the relay GPIO5, an I2C OLED on GPIO2/4 (SDA/SCL), so that leaves me with GPIO16 (pin number 16) for the sensor. Sadly it fails to read. When I connect it to pin number 2, it works.

Is there something else I can try, because I really would like to keep the OLED.

Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: KNK on August 01, 2016, 03:18:48 PM
You have several options:
1. You donesn't seem to use SPI, so it's pins are free for use with DHT11
2. You may use I2C sensor instead of DHT11 (like HTU21D or BME280) and connect it to the same bus with the OLED display
3. On ESP8266-EVB - GPIO16 should work too. It's on ESP8266-EVB-BAT only where it can't be used without hardware modification (just need to remove R21 and R22)
4. You may share the button pin with the sensor - put some 150ohms between GPIO0 and DHT11 data pin and you are done
Title: Re: Reading temperature from MOD-WIFI-ESP8266-DEV
Post by: OnnoH on August 02, 2016, 10:30:03 PM
This answer solved my issue.

1. Given the previous replies I thought GPIO0, 2, 5 and 16 were the only ones available. I did find out that the SPI where the MOSI, MISO and CLK making pins 12, 13 and 14 available. I used GPIO12 and presto, it worked.
2. Haven't got these type of sensors, but I will have a look at it.
3. Sadly pin 16 on my EVB would not react.
4. Did not travel this path, because I guess I would have to fiddle with timeouts on reading both button and sensor.

Anyways, option 1 did the trick. Thank you very much!