A simple Internet of Things experiment, using an Arduino MKR1000 board to control two LEDs and monitor a potentiometer, via Thinger.io.
Things used in this project
Story
A simple IoT (Internet of Things) experiment using an Arduino MKR1000 and the Thinger IoT platform. Watch the video below to see it in action, then follow the instructions to build your own!
1. What You Need ?
To build this project, you will need the following items:
- 1 Arduino MKR1000 board
- 2 LEDs
- 1 potentiometer
- 1 breadboard
- Some jumper wires
- Arduino IDE (download here)
- WiFi101 library (download here)
- Thinger library (download here)
2. Set Up Virtual Device on Thinger ?
- 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.
3. Schematics ??
- Connect your parts to Arduino MKR1000 as the following picture:
4. Sketch ?
- 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 and 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" #define DEV_ID "your_device_id" #define DEV_CRED "your_device_credential" #define SSID "your_wifi_name" #define SSID_PASSWORD "your_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(); }
5. Set Up Dashboard on Thinger ?
- 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).
6. Have Fun! ?
- After everything is done, make sure your Arduino MKR1000 has a good internet connection. On your Thinger’s dashboard you can control your LEDs and monitor your potentiometer value! Have fun!
Code
Read more : Arduino MKR1000 & Thinger