A simple IoT (Internet of Things) experiment using Arduino/Genuino MKR1000 and Thinger IoT platform. Watch the video below (click here) to see its action, then follow the instructions to build your own!
To build this project, you need the following items:
- 1 Arduino/Genuino MKR1000 board
- 2 LEDs
- 1 Potentiometer
- 1 breadboard
- some jumper wires
- Arduino IDE (download here)
- WiFi101 library (download here)
- Thinger library (download here)
-
First, you have to sign up or login to Thinger.io. Then create a virtual device: click Devices menu, and click +Add Device button. Fill out the forms: Device Id, Device description & Device credentials, then click Add Device.
-
Make sure the WiFi101 & Thinger library are installed. Open Arduino IDE then copy the sketch below. Insert your Thinger username, Device ID, Device Credentials, WiFi name & WiFi password. Make sure you have chosen the right option for Board and Port under Tools menu. Upload it!
#define _DISABLE_TLS_ #include <WiFi101.h> #include <ThingerWifi101.h> #define USERNAME "your_thinger_username" // Thinger username #define DEV_ID "your_device_id" // Thinger device ID #define DEV_CRED "your_device_credential" // Thinger device credential #define SSID "your_wifi_name" // wifi SSID #define SSID_PASSWORD "your_wifi_password" // wifi password ThingerWifi101 thing(USERNAME, DEV_ID, DEV_CRED); void setup() { pinMode(0, OUTPUT); thing.add_wifi(SSID, SSID_PASSWORD); thing["led"] << digitalPin(0); thing["led2"] << analogPin(1); thing["pot"] >> outputValue(analogRead(A0)); } void loop() { thing.handle(); }
-
Go to Dashboards menu & click +Add Dashboard button. Then fill out the forms: Dashboard Id, Dashboard name & Dashboard description, then click Add Dashboard button.
-
Go to your dashboard, then create widgets to control and/or monitor your device. On your dashboard click +Add Widget & feel free to use any Thinger's widgets. On this project, I use:
- On/Off State (to control my LED on/off),
- Slider (to control the brightness of my LED),
- Donut Chart (show my potentiometer value as a gauge), and
- Time Series Chart (show my potentiometer value as a bar graph).
- After everything is done, make sure your Arduino MKR1000 has a good internet connection. On your Thinger's dashboard you can control your LEDs & monitor your potentiometer value! Have fun!
Lintang Wisesa 💌 lintangwisesa@ymail.com
Facebook | Twitter | Google+ | Youtube | :octocat: GitHub | Hackster