"Wouldn't it be cool to have a desk lamp that could change color, for example flashing red when you receive a mail? Or that pulls weather reports from the Internet, and translates the forecast temperature to a color? It could add some white flashes if thunderstorms are forecast. Or when your phone rings, it could flash green if it's a friend or red if it's your boss, based on caller ID. The possibilities are endless."

Thomas Driemeyer created a blog telling the implementation of a Computer Controlled LED Lamp. This is the link: http://www.bitrot.de/ledlamp.html

Another guy used Arduino to create a similar system, but without the transistors which amplify the current. http://www.instructables.com/id/Computer-Controlled-RGB-Led/?lang=zh

Other reference materials for improvement:

Arduino touch board: http://www.leiphone.com/touch-board-touch-sound.html

Blinky Tape: http://www.leiphone.com/arduino-microprocessor.html

Clockee Talkee:可以对讲通话的时钟 http://www.leiphone.com/clockee-talkee-clock.html

Speech Recognition with Arduino  http://www.instructables.com/id/Speech-Recognition-with-Arduino/

Carlitos' Projects: Wireless Speech-Controlled Arduino Robot http://www.instructables.com/id/Carlitos-Projects-Wireless-Speech-Controlled-Ard/?ALLSTEPS

Speech Recognition with BitVoicer and Arduino http://forum.arduino.cc/index.php?topic=133051.0

Arduino加速度传感器与Processing幻彩立方的互动  http://blog.chinaaet.com/detail/31465.html

arduino学习笔记 - Arduino Uno + MMA7361三轴加速度传感器演示 http://www.arduino.cn/thread-1141-1-1.html

Arduino应用之MMA7260三轴加速度计 http://blog.sina.com.cn/s/blog_5e4725590100m5lf.html

arduino学习笔记12 - ADXL345加速度传感器实验 http://arduino123.net/a/jiaocheng/jichu/2012/0408/74.html

arduino学习笔记14 - ITG 3200陀螺仪传感器实验 http://arduino123.net/a/jiaocheng/jichu/2012/0408/76.html

Arduino示例教程模块版------2、按键实验 http://www.arduino.cn/thread-3186-1-1.html

AVR单片机I/O,键盘方案 http://www.avrvi.sdu.edu.cn/pdf/7.pdf

Arduino Realtime Audio Processing http://interface.khm.de/index.php/lab/experiments/arduino-realtime-audio-processing/  

Video: http://www.youtube.com/watch?v=Y241UMFNxDY

DFRobot voice recognition: http://v.youku.com/v_show/id_XMzQ5MDA1NTE2.html

相关产品: http://www.dfrobot.com.cn/goods.php?id=735

μSpeech voice recognition for microcontroller: http://hackaday.com/2012/09/22/speech-recognition-on-an-arduino/



USB HID Up http://www.embedded.com/design/prototyping-and-development/4404116/HIDs-Up

Circuit diagram

In his solution, he used RS232 as the interface to computer. I changed it to USB because of two reasons

1. USB can provide power supply. With RS232, you have to have a separate power supply, besides the RS232 line.

2. USB is more common nowadays and smaller.

This is the circuit diagram. I just removed the max232 module and the four condensers connected to it, replaced them with a USB to TTL module. The module is based on PL2303 chip and can be bought in Taobao. This is the link: http://item.taobao.com/item.htm?id=5294837294

Please refer to Thomas Driemeyer's original blog for the design and the other things, including the control, programming interface, etc.


Because the parts that I can I buy are different than the ones Thomas used, the structure of my lamp is slightly different than his. I removed the heat sink, since it turns out not needed, and made some other slight changes. Now it looks like this:



How to disasembly the Lamp

To disasembly the lamp, follow these steps
1. Push the wire toward the center of the bottom

2. Turn the lamp ball and base counter-clock-wise to open it.

3. To disasembly it into smaller pieces, you can:

a. Detach the LED from the circuit borad.

Note: hold the mother circuit board tight when you do so.

b. Detach the circuit board from the base, by

i). Pull off all the hats on the needles.

Note: hold the circuit board tight when you do so.

ii). Pull the circuit board upward and away from the base.

Control the color

To control the color of the lamp, you need to

1. Download and install the PL2303 driver from here: PL2303HX_windows98_ 2000_xp.zip(For Windows) PL2303HX.zip(For Linux, Window Server, and other platforms)

Or if the link doesn't work, search with 'PL2303 driver' in Google and you'll find it.

2. Plug the lamp to the USB of your computer

3. Open the device manager on you computer, find out the COM port of your lamp, e.g. in the screen shot below, the port is COM3.

Note: if you find the port number is too big, say COM12, you can change it, by right clicking the device and in properties dialog -> Port settings -> Advanced.

4. Run Tera Term(or any other term program that supports COM ports), select the COM port that you find out in step 3.

You can download Tera Term for free from internet.

5. Send command to your lamp in Tera Term. Format of the commands

+N, enable an action identified by the number N, e.g. +0, +1, +2, +3, +4, +5

-N, disable an action identified by the number N, e.g. -0, -1, -2, -3, -4, -5

=N <parameters>, define an action, give it a id number N, action detail is defined by the parameters.

Hit <Enter> after each command.

For detailed command format, please refer to the blog of Thomas(Link provided in the beginning of this page). As a quick way to start, you can try these commands in the given order, wait for several seconds to see what happened after each command.



=a f400000 b400000 pffff 10a r00 s32 S A
=a f004000 b004000 pffff 10a r00 s32 S A
=a f000040 b000040 pffff 10a r00 s32 S A
=a f404040 b404040 pffff 10a r00 s32 S A 
=a f004040 b004040 pffff 10a r00 s32 S A 

=2 f404000 b404000 pffff 10a r00 s32 S A


Programming Interface

Please refer to Thomas' blog for detailed info about programming interface. The beginning of this page has the URL of his blog. Here I'll just give a brief introduction.


Here is a program written in C that allows sending commands to the lamp from the command line, one command per argument word. Again, replace the device name with one that is appropriate for your system.

#include <stdio.h>
  #include <termios.h>
  #include <unistd.h>
  #include <fcntl.h>

  int fd;

  void init()
      fd = open("/dev/ttyUSB0", O_RDWR);
      if (fd < 0) {
          fprintf(stderr, "cannot connect to LED lamp\n");
      struct termios tc;                  // 9600 baud, 8n1, no flow control
      tcgetattr(fd, &tc);
      tc.c_iflag = IGNPAR;
      tc.c_oflag = 0;
      tc.c_cflag = CS8 | CREAD | CLOCAL;
      tc.c_lflag = 0;
      cfsetispeed(&tc, B9600);
      cfsetospeed(&tc, B9600);
      tcsetattr(fd, TCSANOW, &tc);

  void send(
      const char *command)                // send this command
      write(fd, command, strlen(command));
      write(fd, "\n", 1);

  void main(
      int        argc,                    // number of command-line options
      const char **argv)                  // each argument word is one command
      for (int i=1; i < argc; i++)


Please refer to the "Windows Serial Port Programming". This is the link http://www.robbayer.com/files/serial-win.pdf. Or you can download it from the attachment serial-win.pdf.

// ComputerControlledLamp.cpp : Defines the entry point for the console application.

#include "stdafx.h"
#include "windows.h"

int _tmain(int argc, _TCHAR* argv[])
	HANDLE hSerial;
	LPCWSTR szPortName = TEXT("COM4");
	hSerial = CreateFile(szPortName,
			//serial port does not exist. Inform user.

	//some other error occurred. Inform user.
	DCB dcbSerialParams = {0};
	dcbSerialParams.DCBlength = sizeof(DCB);

	dcbSerialParams.BaudRate = CBR_9600;
	if(!SetCommState(hSerial, &dcbSerialParams)){
	//error setting serial port state

	COMMTIMEOUTS timeouts={0};

	if(!SetCommTimeouts(hSerial, &timeouts)){
	//error occureed. Inform user

	const int n = 100;
	char szBuff[n + 1] = {'-','0','\n'};
  	DWORD dwBytesRead = 0;
	if(!WriteFile(hSerial, szBuff, n, &dwBytesRead, NULL)){
	//error occurred. Report to user.


How to make it on your own

You can buy all the things needed to build this lamp from Taobao, and create one by yourself! Refer to the attachment 电脑灯元件及工具.docx for the things that you need, and the taobao shops that sell them.

WIFI controllable

Make it wifi-controllable:

Configure the WIFI2UART module

1. plug the module to the dev board

2. connect the board to computer with RS232 cable, if your computer doesn't have RS232, for example, my laptop, use a RS232 TO USB adapter

3. Open the UART-WITI 配置管理程序 v2.03(D:\LAMP\串口WIFI材料M03\串口WIFI资料M03\2.03配置管理软件),Configure the module

4. Set the 波特率 to 9600,Click 退出透传模式,Click 搜索模块