Arduino serial controlled RGB lamp + Desktop client.
This is a simple Arduino RGB lamp controlled using serial port. The python desktop client uses the serial port to control the RGB lamp color.
Arduino Sketch
Python desktop client
The python client is a multiplatform client that lets you communicate with Arduino using USB serial port.
- Edit your_arduilamp_repo_root/arduilamp-desktop-client/arduilamp.py to change the value of SERIALPORT to your serial port.
- Easy to run:
$ cd your_arduilamp_repo_root/arduilamp-desktop-client
$ python arduilamp.py
Dependencies:
- python: https://www.python.org/downloads/
- pyserial: http://pyserial.sourceforge.net/pyserial.html#installation
- TKinter (usually part of python installation): http://tkinter.unpythonic.net/wiki/How_to_install_Tkinter
Communication protocol
Writing on the serial port to make the lamp change is as easy as sending R, G, or B followed by a 0-255 value. Everytime Arduino receives a valid input it sends back the message: new value: X
> R255 // Sets the red led to its top brightness level
< new value: 255
> G128 // Sets the green led to its medium brightness level
< new value: 128
> B0 // Sets the blue led to its lowest brightness level (off)
< new value: 0
Packaging
I've used a ping pong ball as the lamp shade. Make a little hole at the bottom of the ball and insert the three leds into it.