Arduino Yun. Create Your First Connected Light.

Introduction: Arduino Yun. Create Your First Connected Light.

Create your first connected light using Arduino Yun. Control and monitor a connected light from mobile, tablet and desktop using Lelylan & MQTT. It takes 15 minutes | $80 in hardware | basic level

Step 1: Hardware

To complete this tutorial you need the following components.

Step 2: Software

To program your Arduino Yun you need to install the Arduino IDE and the following libraries (if you do not know how to install a library checkout this tutorial).

PubSubClient. This is a fork of the original PubSubClient setting the max packet size to 512 bytes (needed for Lelylan to work).

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: Lelylan Setup

Open Lelylan Dashboard and create a new device by following 3 simple steps (if you are new to Lelylan, you can sign up for free).

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 Arduino. Copy the sketch below and change the following variables: deviceId, deviceSecret, outTopic, inTopic and clientId. It will not take more than one minute.

See code on Github

Step 6: You Are Done

Access Lelylan Dashboard and control your connected light from mobile, tablet and desktop. If any problem occours, let @lelylan know.

Step 7: Learn More

If you want to better understand how the code works checkout the code explenation code explenation section.

Be the First to Share


    • For the Home Contest

      For the Home Contest
    • Make It Bridge

      Make It Bridge
    • Game Design: Student Design Challenge

      Game Design: Student Design Challenge