Android Things - Cloud Weather Station using ThingSpeak
This work is a fork of this Google sample weather station. This project uses the Android Things SDK and the MQTT Protocol to publish data on ThingSpeak cloud. The data (temperature and pressure) are generated by a development board (in this case a Raspberry Pi 3). The chosen MQTT Protocol library is Eclipse Paho. The communication with the MQTT broker is done using SSL, as specified by the ThingSpeak documentation here
Run the application
Before running the application, you need to configure the build.gradle file with your ThingSpeak channel settings. Modify the lines:
buildConfigField "String", "THINGSPEAK_CHANNEL_ID", '"YOUR_CHANNEL_ID"'
buildConfigField "String", "THINGSPEAK_WRITE_API_KEY", '"YOUR_WRITE_API_KEY"'
Pre-requisites
- Raspberry Pi 3
- Android Studio 2.2+
- ThingSpeak account and channel
- Rainbow Hat for Android Things or the following individual components:
- 1 bmp280 temperature sensor
- 1 segment display with I2C backpack
- 1 push button
- 1 resistor
- jumper wires
- 1 breadboard
- (optional) 1 APA102 compatible RGB Led strip
- (optional) 1 Piezo Buzzer
Schematics
If you have the Raspberry Pi Rainbow Hat for Android Things, just plug it onto your Raspberry Pi 3. Otherwise here are the schematics.