Está en la página 1de 10

22/9/2016

IKEAsocialnotificationdesklamp

Back

Blog Resources

IKEA social noti cation desk lamp


Published last year by Mate Marschalko
This IKEA lamp has been completely stripped and rebuilt using a Spark Core Wi-Fi
board and a 12V RGB LED strip. The desk lamp can now shine in 16 million dierent
colours and be controlled from the If This Then That app. I use it for notications
and set it to change to dierent colours when something happens with my emails,
Facebook, Twitter or Instagram. A visual notication centre, I call it.

The IKEA social noti cation desk lamp


http://www.webondevices.com/ikeasocialnotificationdesklamp/

1/10

22/9/2016

The
Core of the project
Back

IKEAsocialnotificationdesklamp

Blog Resources

For this project I used a Spark Core which is an interesting Wi-Fi enabled, Arduino
Download FREE Ebook: Introduction to JavaScript Electronics
compatible cloud based board.
Spark, was just a small startup company last year trying to get funding on
Kickstarter for their rst board, the Core. Now they are much larger, changed their
name to Particle and have released two new development boards.

Spark Core
The new Particle Photon works and behaves the same way as the original Spark Core.
Its essentially an updated version with a better Wi-Fi chip, faster speeds and half
the price ($19 instead of $39)! This year they also released the Electron which has a
SIM card in it and can connect to a cellular network.
The killer feature of the Photon, and all Particle boards, is that they provide a cheap
and reliable way to connect your project to your wireless network and to the Internet.
The boards are Arduino compatible so you dont have to learn a new language and all
coding and management works from the cloud, from their website. You dont need a
USB, even uploading your code works wirelessly and from anywhere you can access
the Internet.

Shopping List
Heres a list of all the components for this project to give you a better understanding
of whats happening:
IKEA Lampan desk lamp (2.75)
http://www.webondevices.com/ikeasocialnotificationdesklamp/

2/10

22/9/2016

IKEAsocialnotificationdesklamp

12V, 1A AC to DC wall adapter or psu (3)

Back

Blog Resources

12V, RGB LED strip, 1 meter long (4)


Download FREE Ebook: Introduction to JavaScript Electronics
Spark Core or Photon development board (15)
3 x 2N7000 NPN transistor (<1) 3 x 1000 resistor (<1) 1 x TS2940CZ 5V, 1A
voltage regulator (<1) Breadboard and wires (<1) I got the desk lamp from IKEA
for 2.75 and all other components from eBay. First, I completely got rid of the
original components then built the circuit on a breadboard which I later placed under
the shade of the lamp.

Building the circuit


The tricky bit here is that the LED strip requires 12V power so it cant be directly
switched from the boards output pins as they are 3.3V only (yes, its not 5V like on
the Arduino UNO). To solve this problem I used an NPN transistor which can switch
the 12V for the LEDs. The transistor has 3 legs. One leg takes the 12V input from my
adapter, the other leg takes the 5V control signal from the Arduinos output pin and
we also have a third, output pin. When the Arduino sends signal (5V / HIGH) from
the output pin it switches the 12V on on the output pin, when theres no signal from
the Arduino (0V / LOW) the output goes back to 0V.
This is very similar to how we switch higher voltages with the Arduino. For example
for 240V, mains voltage we use a relay. A relay also has input, output and control
signal pins. The input takes 240V and when you send your 5V signal from your
Arduino to the control pin, the 240V is switched on for the output pin.
Lets have a look at the nal circuit of the desk lamp.

http://www.webondevices.com/ikeasocialnotificationdesklamp/

3/10

22/9/2016

IKEAsocialnotificationdesklamp

Heres the step-by-step guide on the build:

Back

Blog Resources

First we supply 12V DC power from the adapter (yellow and black wires at the
bottom right).
Download FREE Ebook: Introduction to JavaScript Electronics
This is then connected to the 5V regulator because the Spark Core can only be
supplied with 3.6 6V DC. The 5V regulated voltage is then connected to the VIN and
GND pins on the Core.
The NPN transistors (black components with an N on them) are used to close the
12V circuit (switch ground) by the 3.3V logic level signal from the Spark Core.
First we connect the grounds to the left pins of the transistors (Source) from the
12V circuit then connect the 3.3V switch signals (HIGH) from the A4, A5 and A6 pins
(red, green, blue) to the middle pin of the transistor (Gate) through a 1000 resistor.
Lastly the switched ground is taken to the LED strip from the right pin of the
transistor (Drain) as well as the constant positive 12V from the power supply (yellow
wire at the bottom left).

All components are connected


And heres the code running on the core. The code is very simple but since this is just
a quick prototype, has not been optimised at all:

http://www.webondevices.com/ikeasocialnotificationdesklamp/

4/10

22/9/2016

voidsetup(){
Back

IKEAsocialnotificationdesklamp

Blog Resources

//registertheSparkfunction
Spark.function("notify",notify);
Download FREE Ebook: Introduction to JavaScript Electronics

//registerpins
pinMode(A4,OUTPUT);
pinMode(A5,OUTPUT);
pinMode(A6,OUTPUT);

//switchlighton
analogWrite(A4,255);
analogWrite(A5,200);
analogWrite(A6,150);
}
voidloop(){
//thisloopsforever
}

intnotify(Stringcommand){
if(command=="gmail"){
analogWrite(A4,255);
analogWrite(A5,0);
analogWrite(A6,0);
delay(20000);
analogWrite(A4,255);
analogWrite(A5,200);
analogWrite(A6,150);
return1;
}

if(command=="facebook"){
analogWrite(A4,0);
analogWrite(A5,80);
analogWrite(A6,255);
delay(20000);
analogWrite(A4,255);
analogWrite(A5,200);
analogWrite(A6,150);
return1;
}

http://www.webondevices.com/ikeasocialnotificationdesklamp/

5/10

22/9/2016

IKEAsocialnotificationdesklamp

if(command=="instagram"){

Back
Blog
analogWrite(A4,0);
analogWrite(A5,255);
analogWrite(A6,0);
Download FREE Ebook: Introduction to JavaScript Electronics
delay(20000);

Resources

analogWrite(A4,255);
analogWrite(A5,200);
analogWrite(A6,150);
return1;
}

if(command=="twitter"){
analogWrite(A4,100);
analogWrite(A5,150);
analogWrite(A6,255);
delay(5000);
analogWrite(A4,255);
analogWrite(A5,255);
analogWrite(A6,255);
return1;
}

elsereturn1;
}

Please note that the initial, white values are R: 255 G: 200 B: 150. This is because the
LED is too blue if simply set to R: 255 G: 255 B: 255 so I had to adjust the white
balance a little bit.

http://www.webondevices.com/ikeasocialnotificationdesklamp/

6/10

22/9/2016

IKEAsocialnotificationdesklamp

Back

Blog Resources

Download FREE Ebook: Introduction to JavaScript Electronics

All inside the lamp


Once this code is uploaded then the exposed Spark function(notify) can be called
from the If This Then That service.

IFTTT
The other exciting piece of recent news from Particle is the If This Then That
support. IFTTT is an amazing service that allows you to create personal recipes
consisting of a Trigger event and an Action. Triggers are notications from popular
services like Facebook, Instangram, Twitter, Google Calendar or Gmail, events from
physical devices like the Nest thermostat, the Netatmo personal weather station or
all of WeMos smart home accessories. Actions can also be chosen from a list of
dozens and dozens of services and devices, 167 channels in total.
For Particle developers this means that they can now connect their hardware projects
to all 167 channels and setup hundreds of dierent tasks in a couple of minutes. Here
are a few examples:
Send a notication to my Android smart watch if my home temperature drops
below 16 degrees
http://www.webondevices.com/ikeasocialnotificationdesklamp/

7/10

22/9/2016

IKEAsocialnotificationdesklamp

Email me when the dogs water bowl is empty

Back

Blog Resources

Blink a green light when a new commit has been pushed to my Github repository,
and orange
after aFREE
fork Ebook: Introduction to JavaScript Electronics
Download
Create a calendar event or update my to-do list when the soil moisture sensor is
dry to water my plants
Log home sensor readings into my Google Drive
Here are a few more recipes to get you inspired: IFTTT recipes.
Once you setup your own account you can create your own recipes and when you get
to choose the Action, choose Particle and call the function you exposed in your
application code, notify in our case.

Connected to IFTTT
And that is all you need to do to complete this project. Let me know what you think
and how you would improve it.
Any other cool recipes you have in mind I should try??
Back to all

One thought on IKEA social noti cation desk lamp


http://www.webondevices.com/ikeasocialnotificationdesklamp/

8/10

22/9/2016

IKEAsocialnotificationdesklamp

Pingback: Get Media Alerts from Your Lamp with This Ikea Hack | Make: DIY

Back
Projects, How-Tos, Electronics, Crafts and Ideas for Makers

Blog Resources

Download FREE Ebook: Introduction to JavaScript Electronics

Leave a Reply

You must be logged in to post a comment.

Free Ebook
Step up your web developer career and learn hardware prototyping.
This ebook will get you started with JavaScript Arduino electronics development in a
couple of hours.
Email address

Send me the PDF

Web on Devices
Electronics Hacking with JavaScript and other Web Technologies
Twitter

http://www.webondevices.com/ikeasocialnotificationdesklamp/

Facebook

9/10

22/9/2016

IKEAsocialnotificationdesklamp

Back

Blog Resources

Download FREE Ebook: Introduction to JavaScript Electronics

Mate Marschalko
Front-end Web Developer, Creative Technologist and Maker. Builds Internet connected devices for the Internet of
Things.

All rights reserved | Contact at hello@webondevices.com

http://www.webondevices.com/ikeasocialnotificationdesklamp/

10/10