Introduction: Create Your Own Smart Light Using TinyDuino
Create your own smart light using TinyDuino. Learn how to control and monitor your lights from mobile, tablet and desktop in 15 minutes. $101 in hardware. Entry level.
Step 1: Hardware
Step 2: Software
CC3000 WiFi | This is a library for the Adafruit CC3000 WiFi Breakouts. Designed specifically to work with the Adafruit CC3000 Breakout, it works perfectly with TinyDuino WiFi shield.
PubSubClient | This is a fork of the original PubSubClient that works with the AdaFruit CC3000 breakout board (and TinyDuino WiFi shield), setting the max packet size to 256 bytes (needed for Lelylan to work).
Before uploading your sketch set the following configurations through the Arduino IDE.
- Tools > Board - Arduino Pro or Pro Mini
- Tools > Processor - ATmega328 (3.3V, 8MHz)
Step 3: Hardware Setup
This schema represents the led, resistor and pushbutton setup. With this setup each time you press the button, the LED is turned on and off.
Step 4: Software Setup
1) Set a meaningful name (e.g. bedroom light).
2) Choose the device type. For this tutorial choose Basic Light. What is a type? A type defines what a device is by defining its properties, functions and statuses. For this tutorial you do not need to now more about.
3) Choose "Connect with MQTT" as connectivity option. In this tutorial we'll use MQTT, a publish subscribe protocol for the Internet of Things.
4) Get the Device ID and Device Secret. Once the device is created, click the settings link (placed under the device name) and get the device ID and device secret. You'll need them in the next section.
Step 5: Code
Once the (virtual) device is defined on Lelylan you need to make it communicate with the Tinyduino. Copy the sketch below and change the WiFi (WLAN_SSID and WLAN_PASS) and device credentials (deviceId, deviceSecret, outTopic, inTopic and clientId). It will not take more than one minute.