A sample text widget

Etiam pulvinar consectetur dolor sed malesuada. Ut convallis euismod dolor nec pretium. Nunc ut tristique massa.

Nam sodales mi vitae dolor ullamcorper et vulputate enim accumsan. Morbi orci magna, tincidunt vitae molestie nec, molestie at mi. Nulla nulla lorem, suscipit in posuere in, interdum non magna.

Arduino Yún WiFi Autobot Lamp


This project is to create a WiFi Connected lamp from a Transformer themed lamp. The original lamp was plain white in colour and not very interesting. The idea was to add a microcontroller with WiFi capabilities and a number of RGB LEDs. This is to be controlled via a simple web page running on the microcontroller. There are a number of micros that could have been chosen such as a Raspberry Pi, ESP8266 module, mbed or any of the other Arduino boards and an addon WiFi module.

The board chosen is the Arduino Yún. The Yún consists to two parts, the first being a Linux based module providing the WiFi connectivity and Webserver. This also provides a management interface that allows the Yún WiFi to be configured remotely from a web browser. The second part being the Arduino part based on the Atmel 32u4 microcontroller and is the part that is programmed via the Arduino IDE and sketches. It is possible to run code on the Linux part but this is not covered here. Once the Arduino Yún has been connected to your WiFi it is then able to have sketches uploaded over to it remotely without a serial connection.

The finished lamp showing a rainbow effect.
2015-09-13 17.38.46


The main parts for the project are:

Other parts, usually found in your parts box include hookup wire, header connectors and heatshrink tubing. Tools required include a soldering iron, solder, screwdrivers, snips, wire stripper, hot glue gun and heat gun.

Hardware Build

The photographs below show the steps in building the WiFi Autobot lamp.

2015-09-13 11.28.10-1 The lamp in its original form glows white and is fairly uninteresting. It has an ON/OFF switch on the rear, a power socket and cable that plugs into a computer USB port.
2015-09-13 11.30.54-1

Opening the lamp is easy, it is held together by 6 small screws in the rear. Once the front has been removed, the lamps, switch and power socket are all accessible on the rear panel.
2015-09-13 11.34.45-1 The first task is to determine the position of the components. As the lamp is large and deep, the Arduino Yún is easy to place in the centre. A couple of LED strip offcuts are laid out to get an idea of where they can be positioned.
2015-09-13 16.57.04 A total of 14 LEDs were used from the WS2801 LED strip that I had available. This was cut into 2 lengths of 4 LEDs and 3 lengths of 2 LEDs. These were wired together to lay the strips in a circular pattern running around the outside and ending in the centre of the lamp.
2015-09-13 17.34.49 Once all the LEDs have been wired up and tested, they can then be stuck in place. The LED strips have a self adhesive backing which was used, along with hot glue that was used to secure the ends and the linking wires. The Arduino Yún is attached using double sided self adhesive pads. Once it has all been secured, the case can be screwed together and plugged into power and powered on.
2015-09-13 17.38.03 When the lamp is powered on it needs to connect to the pre-configured WiFi network. This can take some minutes. The lamp goes through a sequence of colours to indicate the state of the connection. Initially it is Red, then Blue and finally Green once connection has been established. After this the lamp will go into the previously set mode or steady colour. A this point, the webserver will be available and changes can be made.
2015-09-13 17.38.46 The current modes implemented are

  • Steady – All LEDs show the same colour.
  • Random – LEDs change to random colours in a random order.
  • Rainbow – LEDs change colours in a rainbow pattern, based on the example sketch in the Adafruit Neopixel library.


Before starting to write any code the Arduino Yún was initially setup as per the instructions in the Getting started guide. The examples were tried to ensure the Yún was functioning properly and able to connect to my WiFi without problems.

The software for the lamp consists of an Arduino sketch running on the Atmel 32u4 microcontroller and a simple web page and images being served by the Linux portion of the Yún. The web pages are kept in a folder/directory called www within the Arduino sketch folder. This will then be sent to the Yún when the sketch is uploaded over WiFi. It doesn’t appear to do this if the sketch is uploaded via the serial port, presumably this is because over WiFi the portion is handling the files and able to access the micro SD card.

The sketch is based on the Yún Bridge example with extensions to interpret the rgb command. Example command URLs are: (If you have problems using the .local domain, for instance if using Microsoft Windows, then you would need to use the IP address for the lamp.

  • http://lamp.local/arduino/TransformerLamp/rgb/off – Turn off the lamp
  • http://lamp.local/arduino/TransformerLamp/rgb/ff0000 – Set lamp colour to red
  • http://lamp.local/arduino/TransformerLamp/rgb/random – Set random colour mode
  • http://lamp.local/arduino/TransformerLamp/rgb/rainbow – set rainbow mode

The web page is accessible http://lamp.local/sd/TransformerLamp where lamp is the name I’ve assigned to the lamp and TransformerLamp is the name of the sketch. The actual html, css and images for the web page were downloaded from an Ajax colour picker I found and was based on

Example of the web page controlling the lamp

The code is available on GitHub

Bookmark this post: bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark

Comments are closed.