Introduction: Control Your Lights With Bluetooth

In this article I'm going to show you how to build a cheap and cool light switch to control your lights via bluetooth.

Difficulty level: 4/10

Step 1: How It Works: Schematics and Simulation

The project is based on an ATTiny microcontroller unit which receives data from an HC-06 bluetooth module using the SoftwareSerial library. When a device such as an android phone sends an 'n' character to the system, the MCU turns the lights on, and if the MCU receives an 'f' char it turns the lights off. It also has got two buttons to manually control the lights.

Because my phone charger provides 6.75V on no load attached, I also built a voltage regulator section from a L7805 and 2 capacitors.

I have been also simulated the system in Proteus.

Here are the files for simulation, and the schematic in eagle:

Step 2: The Parts

The parts are:

For the main circuit: 2x pushbuttons, male and female pin headers, 2x 2pin screw terminals, 2x 10k resistors, 2x 10µF electrolytic capacitors, 1N4007 diode, bc546 NPN transistor, 5V relay (like SRD-5VDC-SL-C), 14 pin IC socket, 8 pin IC socket, SN74HC14N, ATTiny85, HC-06 bluetooth module, Copper clad laminate board (70x50mm or larger)

For the voltage regulator unit: 2x 10µF, LM7805

For the PSU: take apart an old phone charger, or buy a 5V adapter


For enclosure you need an approx. 20 cm x 10 cm box

You can buy these parts from online, but I recommend to buy these parts from your local electronics shop.

For push buttons I recommend two big one to mount to your enclosure.

Step 3: Programming the MCU

Download the sketch and upload to the microcontroller. You can learn how to do that by clicking here.

Make sure you use an ATTiny85, not ATTiny45 or other, because the ATTiny85 has got 8 kbytes of flash memory and this amount of memory is necessary to use the SoftwareSerial library.

Step 4: Test Everything on the Breadboard

After you uploaded the code to the MCU, be sure that everything works correctly by testing the circuit on the breadboard.

You can use an LED instead of the relay, transistor, flyback diode and light bulb.

Step 5: PCB Etching

Download and open the PCB design attached to Step 1. In the layer settings only select Buttom, Pads, Vias and Dimension. Print to photo paper. I'm using thin A4 sheets. Cut out the printed design and put to the copper clad laminate sheet cut to size, cleaned and polished. Then use your iron to transfer the toner to the plate. To make sure to transfer all the toner you can scour the paper with something. This procedure takes about 5 minutes. After that throw the plate with the paper to cold water. If you did everything correctly the paper shoud come down intact without any toner on it. Throw the PCB into ferrit chloride and wait about 10 minutes to etch properly. Then you can drill the holes on it.

Step 6: Soldering

Now solder the components to the PCB. Male pin headers to the place of the buttons, female to the place of the bluetooth module like on the picture. And don't forget the ic sockets.

Then solder cables to the buttons and female pin header as the picture shows.

Make the voltage regulator unit soldering the caps on the IC and covering with shrinking tubes following the schematic in Step 1. Be careful with the polarity of the capacitors.

Step 7: Putting It All Together

Drill holes for the buttons on the enclosure and put everything in it. Connect the input of the voltage regulator unit to the power supply and the output in the power terminals of the circuit. Connect the 2 switching wires to the other screw terminals. Then connect the 2 input wires of the PSU to the wall outlet. Be careful with connections because of high voltage and don't forget to use shrinking tubes as often as you can!!!!

For android app I recommand this: https://play.google.com/store/apps/details?id=com.giumig.apps.bluetoothserialmonitor

It's very easy to use, just connect to the bluetooth device in switch mode, set the on to 'n' character, and the off to 'f'.

Enjoy!