Arduino MKR1000 & Thinger




A simple Internet of Things experiment, using an Arduino MKR1000 board to control two LEDs and monitor a potentiometer, via Thinger.io.

thingerok_RFTdvh6YTN

Things used in this project

Hardware components

Arduino MKR1000
Arduino MKR1000
× 1
LED (generic)
LED (generic)
× 2
Rotary potentiometer (generic)
Rotary potentiometer (generic)
× 1
Breadboard (generic)
Breadboard (generic)
× 1
Jumper wires (generic)
Jumper wires (generic)
× 5

Software apps and online services

Thinger.io Platform
Thinger.io Platform
Arduino IDE
Arduino IDE

Story

1_Setup_Thinger_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(, OUTPUT);    
    thing.add_wifi(SSID, SSID_PASSWORD);    
    thing["led"] << digitalPin();    
    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.
READ  LED Watch using an Arduino

2_Setup_Thinger_Dashboard

  • 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).

3_Setup_Thinger_Widget

Code

#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(, OUTPUT);
    thing.add_wifi(SSID, SSID_PASSWORD);
    thing["led"] << digitalPin();
    thing["led2"] << analogPin(1);
    thing["pot"] >> outputValue(analogRead(A0));
}

void loop() {
    thing.handle();
}

Source : Arduino MKR1000 & Thinger




Leave a Comment

*
= 5 + 7

(Spamcheck Enabled)

Read previous post:
LIBRARY MAKES ESP
LIBRARY MAKES ESP OVER THE AIR UPDATES EASY

Potentially, one of the great things about having a device connected to the network is that you can update it...

Close
Scroll to top