Arduino multi-mode lamp with soft touch switch

Arduino multi mode lamp

In this Arduino-based project, we will build a lamp with multiple light displays: color sequencer, dimming light, color chaser, firelight – all selected by a touch bar on the circuit board.

All the functions are done in software, including the touch sensor, which is a unique feature.

Step 1: What is needed?

We will be going the minimalist way for this project, filling the board with just a microchip, the LEDs, a handful of resistors and some capacitors, all for under $10, along with the necessary connecting hardware.

The circuit will be using 3 RGB LEDs. These are common-anode Piranha type available here and contains three LEDs within its body. Each color will need a single dropping resistor (220-ohm for green and blue and 330-ohm for Red). We can also add a small LED with a 1k-ohm as an indicator.

The IC we are using is an ATMega-328 microchip, available for about $5 here You will also need a 16Mhz resonator for about 35c, also available at the same site.

The development and testing of the software is done using the Arduino system, so a suitable ‘host’ is necessary. I’ve used an Arduino ‘Nano’, a Boarduino and a RBBB board and they all work fine.

Arduino multi mode lamp

Step 2: Getting started

It is a very good idea to put the microchip in a socket. Here, I’ve used 2 x 16-pin sockets end-to-end, because that is what I have available… The ATMel chip only has 28-pins so we’ll have a few empty sockets on the end.

In this picture, the LEDs are along the bottom, with a resistor for each of the primary colors.

The little pushbutton on the left is for the Reset, although this is not strictly needed. The yellow blob in the center is the resonator.

After I’ve done the preliminary wiring, the circuit (and programming) is tested through jumpers connected to the ‘host’, an RBBB (Really Bare Bones Board), also from Modern Devices. This lets me make sure the wiring is correct before we commit the Microchip.

The process is quite straightforward – run / test with the host, then simply transplant the IC over to the circuit board.

Step 3: A quick test…

If you’re really impatient, you can actually run the program with just the IC, and the resonator! Just add a 5v source and Presto! There is light!

Step 4: The circuit

The picture clearly shows the point-to-point wiring used.

A major effort-saver is the use of Teflon wire, which does not melt even when routed close to soldered parts. Teflon wire is also available silver-plated which allows me to use thinner wires (#28) and still handle the current. These wires can be found here on eBay.

The 6-pin header in the back is so I can connect a USB-serial port (“USB BUB”) and make programming changes directly to the chip.Schematic Arduino multi mode lamp

The wiring at the front is used as the touch sensor. The program measures the voltage drop between the wires and can tell if it is touched. The duration is measured and we can tell if it is a tap, a press or a hold, and the program uses it to control the light patterns.

[box color=”#985D00″ bg=”#FFF8CB” font=”verdana” fontsize=”14 ” radius=”20 ” border=”#985D12″ float=”right” head=”Major Components in Project” headbg=”#FFEB70″ headcolor=”#985D00″]Arduino


ATMega-328 microchip

An Arduino[/box]

Step 5: The ‘Sketch’, or Program.

Currently the lamp cycles through 4 different modes: Sequencing through all 4000 color combinations; different levels of white light; a color chaser where each LED morphs into all possible shades; and a firelight simulator (seen below), where the program tries to emulate the flickering effects of a fireplace.

It’s only taking up 5k-bytes of the 32k-byte program space, so there is room for a lot more features.

I’m constantly adding things to it, so send email to: qs (at) and I’ll send you the latest version of the sketch.

Firefly function added (progMode==4): Emulates the courtship behavior of the species. Each LED represents a Male, each with his own flashing sequence. Once in a while, all 3 LEDs go off, which is the Female sequence to get the males excited.

Per your requests, I will post the most current program listing in the following step.

Read more: Arduino multi-mode lamp with soft touch switch

Leave a Comment

Your email address will not be published. Required fields are marked *