In this project we will make a simple temperature gauge and read the data with an Android phone. We will use Arduino CLI, which is a powerful command line tool for Arduino development. Visit https://www.arduino.cc/pro/cli for instruction how to setup Arduino CLI.
Step 1: Start new sketcharduino-cli sketch new temperature_demo
cd temperature_demo
sudo nano temperature_demo.ino
The "sketch new" command makes a new folder for the project, and inside the folder.ini file. Edit the temperature.ino file with your favorite code editor, I am using Linux Nano code editor. Save the work and exit back to the command line.
arduino-cli core update-index
Expected result:
arduino-cli board list
Here we can see that I have two boards connected, Arduino Uno and Unknown board that is the Seeeduino XIAO. Next we need to install the core for the Seeeduino board.
We need to use additional-urls flag because Seeeduino XIAO board is a 3rd party board. Check here for more details https://wiki.seeedstudio.com/Seeeduino-XIAO/
arduino-cli core install Seeeduino:samd --additional-urls https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json
Expected result:
Use this command to install DallasTemperature library.
arduino-cli lib install DallasTemperature
You should see something like this:
Use following command to build the software. This will make folder called build to your project folder.
arduino-cli compile --fqbn Seeeduino:samd:seeed_XIAO_m0 temperature_demo
First check the board list and then compile the software:
arduino-cli upload -p /dev/ttyACM1 --fqbn Seeeduino:samd:seeed_XIAO_m0 temperature_demo
Expected result:
Download the Serial USB Terminal app from Play store. https://play.google.com/store/apps/details?id=de.kai_morich.serial_usb_terminal&hl=fi&gl=US
Connect the board to the Android mobile with USB C to USB adapter and read the temperature.
Comments