Home > Projects > Internet – Ethernet – LAN Projects > Arduino MKR1000 & Thinger

Arduino MKR1000 & Thinger

Summary of Arduino MKR1000 & Thinger


This article describes an IoT experiment using an Arduino MKR1000 to control two LEDs and monitor a potentiometer via the Thinger.io platform. The project involves setting up a virtual device on Thinger, connecting hardware components to the board, uploading a specific C++ sketch with WiFi credentials, and configuring a dashboard with widgets for real-time monitoring and control.

Parts used in the Arduino MKR1000 & Thinger Project:

  • Arduino MKR1000 board
  • LED (generic)
  • Rotary potentiometer (generic)
  • Breadboard (generic)
  • Jumper wires (generic)

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(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.

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(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();
}

Source : Arduino MKR1000 & Thinger

Quick Solutions to Questions related to Arduino MKR1000 & Thinger Project:

  • What hardware components are required for this IoT experiment?
    You need one Arduino MKR1000 board, two generic LEDs, one generic rotary potentiometer, one generic breadboard, and five generic jumper wires.
  • How do you set up a virtual device on Thinger.io?
    You must sign up or login, click the Devices menu, select Add Device, and fill out the forms for Device ID, description, and credentials.
  • Which software libraries are needed for the Arduino IDE?
    The project requires the WiFi101 library and the Thinger library to be installed before running the code.
  • Can you control the LEDs using the Thinger dashboard?
    Yes, you can use an On/Off State widget to control the LED on/off status and a Slider widget to adjust the brightness of the LED.
  • Does the dashboard support monitoring the potentiometer value?
    Yes, you can create widgets like a Donut Chart to show the value as a gauge or a Time Series Chart to display it as a bar graph.
  • What is the best way to configure the WiFi connection in the code?
    You must insert your WiFi name and password into the SSID and SSID_PASSWORD definitions within the provided sketch.
  • How many LEDs are connected to the Arduino MKR1000 in this project?
    The project uses two LEDs connected to digital pin 0 and analog pin 1 respectively.
  • Where should you go to create widgets after setting up the dashboard?
    You should go to your dashboard page, click the Add Widget button, and select from available Thinger widgets.

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter
Scroll to Top