GPIO - Using DS18B20 thermometer

Preparation

  • Ameba x 1
  • DS18B20 x 1

Example

DS18B20 is a digital thermometer which measures temperatures from -55°C to +125°C, and provides ±0.5°C accuracy from -10°C to +85°C. DS18B20 1-Wire interface which requires only one port
pin for communication, and the data input/output is handled in microseconds scale.

Ameba uses OneWire library ( http://www.pjrc.com/teensy/td_libs_OneWire.html ) with slight modification to control DS18B20. Please download the modified OneWire library: https://github.com/ambiot/amb1_arduino/raw/master/Arduino_libraries/OneWire.zip
Please refer to Arduino official tutorial to add .zip library to Ameba:
https://www.arduino.cc/en/Guide/Libraries#toc4

Wiring diagram:
1

Open the example in “File” -> “Examples” -> “AmebaOneWire” -> “DS18x20_Temperature”, compile and upload to ameba.

Press the reset button, and observe the serial monitor:
2

Code Reference

Related API documentation of OneWire library can be found in OneWire official site:
http://www.pjrc.com/teensy/td_libs_OneWire.html

Please confirm that QQ communication software is installed