Simple Temperature App - kb2ma/RIOT GitHub Wiki
This app collects readings from a temperature sensor. RIOT includes support for the JEDEC JC-42.4 standard, and this app uses a compliant sensor, the Microchip MCP9808.
Hardware
We connect the Adafruit MCP9808 breakout board to a SAMR21 Xplained Pro board via I2C. The pins are:
Function | SAMR21 | MCP9808 |
---|---|---|
I2C SCL | PA17 | SCL |
I2C SDA | PA16 | SDA |
3.3V | VCC | Vdd |
Ground | GND | Gnd |
Firmware
We use the test code in RIOT.
Terminal session:
kbee@gazelle:~/dev/riot/repo/tests/driver_jc42$ make term BOARD="samr21-xpro" PORT="/dev/ttyACM0"
/home/kbee/dev/riot/repo/dist/tools/pyterm/pyterm -p "/dev/ttyACM0" -b "115200"
2017-03-31 10:54:44,525 - INFO # Connect to serial port /dev/ttyACM0
Welcome to pyterm!
Type '/exit' to exit.
2017-03-31 10:54:45,555 - INFO # Testing sensor communication...[OK]
2017-03-31 10:54:45,556 - INFO # temperature: 19.25 C
2017-03-31 10:54:45,633 - INFO # Testing sensor communication...[OK]
2017-03-31 10:54:45,635 - INFO # temperature: 19.25 C
2017-03-31 10:54:46,647 - INFO # Testing sensor communication...[OK]
2017-03-31 10:54:46,649 - INFO # temperature: 19.31 C