Digital read and digital devices
Last topic we saw how to read analogic sensors using the ADC pin with our esp transmissor. Now we will see how to read from digital devices that counts with an IC (integrated circuit) which provides a comunication bus and a standariced transmission protocol like One Wire Bus, I2c, SPI, etc. It means that we will need to build our code including the specific protocol for each device. Fortunately, there are some arduino libraries to make this job easier.
There are some advantages using digital transmision: like no accuracy losts by wire interferences, or the posibility to link a lot of devices and sensors using the same bus (in I2C or SPI).
Most popular digital sensors are: DHT11 and DHT22 temperature + humidity, Dallas ds18b20 only temperature, bmp180 (I2C) for atmospheric pressure, etc.
ESP8266 + DS18B20
1) Wiring up dallas ds18b20 sensor with pull-up resistor:
4.7K-10K ressistor between dallas pin2 and dallas3 pin (pull-up between output and vcc)
2) In our arduino IDE we will add OneWire.h and DallasTemperature.h libraries, and copy this code:
Comments
Please log in or sign up to comment.