Project tutorial

Multi-Source Controlled USB Lamp © GPL3+

An ATtiny-based tiny USB lamp that can be turned on/off by knocking, clapping, blowing, finger snapping and shouting.

  • 21 respects

Components and supplies

Ph a000066 iso (1) ztbmubhmho
Arduino UNO
Adafruit industries ada64 image 75px
Solderless Breadboard Half Size
Microchip Technology ATtiny85
10uF electrolytic capacitor
Male/Male Jumper Wires
Microphone Sound Sensor
LM393 Microphone sound Sensor
Kingbright wp7113srd d image
5 mm LED: Red
I used a white LED
4415447 jg5sklyzsj
Resistor 220 ohm
The value of resistor in series with LED may be a different value than 220 ohm ,the LED will lit up also with values up to 1k ohm.
IC Socket
Adafruit industries ada592 image 75px
USB-A to Micro-USB Cable

Necessary tools and machines

09507 01
Soldering iron (generic)
Utility knife
Hot glue gun
A bottle cap and a white paper

Apps and online services

About this project

If you don't mind having a bit of fun with electronics this project is for you. In this project, I am making an ATtiny-based USB lamp that can be turned off/on by multiple sources such as:

  • Knocking
  • Clapping
  • Blowing
  • Finger Snapping
  • Shouting
  • In this project I utilized, or I can say I misused, microphone sound sensor to detect different sources to turn on and turn off lamp. Also I wanted to make this project as small as possible, so I used a ATtiny 85 microconntroller. This is cool because the ATtiny is tiny, and - well - this allows you to make tiny things that don't need a big micro controller.

Basic Idea

A microphone is an acoustic to an electric transducer or sensor that detects sound signals and converts them into an electrical signal.

To generate an electrical signal all you need to do is make movements in the diaphragm. So when blowing on a microphone sound sensor, microphone’s diaphragm responds because it is a displacement of air molecules pushing on one side of the membrane to the other causing electrical signal in the microphone to make it seem like sound.

Also here I am describinghow to program ATtiny microcontrollers using the Arduino IDE.

Let's get started...

Watch the Video

The video goes through the build process as well,if you prefer to learn that way!

Get the Parts and Materials!

You will need following parts to flash ATtiny through Arduino:

  • Arduino
  • Breadboard
  • ATtiny85 (or ATtiny45)
  • 10uF electrolytic capacitor
  • Jumper Wires

You will need following parts to build the final circuit:

  • ATtiny85
  • Microphone Sound Sensor
  • LED
  • 220 ohm resistor
  • IC socket
  • Perfboard
  • USB Cable


The value of resistor in series with LED may be a different value than 220 ohm, the LED will lit up also with values up to 1k ohm.

Other Tools and Materials

  • Glue Gun
  • Utility Knife
  • Bottle Cap
  • A white paper
  • Soldering Iron

Wire the Circuit to Flash ATtiny

Connect the Arduino to the ATtiny as follows:

  • Arduino +5V ---> ATtiny Pin 8
  • Arduino Ground ---> ATtiny Pin 4
  • Arduino Pin 10 ---> ATtiny Pin 1
  • Arduino Pin 11 ---> ATtiny Pin 5
  • Arduino Pin 12 ---> ATtiny Pin 6
  • Arduino Pin 13 ---> ATtiny Pin 7

Put the 10uF capacitor between ground and the Arduino reset pin. Make sure to keep an eye on the capacitors polarity (ground to ground!).

This capacitor effectively filters out the incoming reset pulses that come from your PC when the Arduino software starts to program your part. Because you want to program a part further downstream, you filter the reset pulses coming into the Arduino. Otherwise, you’d invoke the Arduino’s bootloader and program that Arduino, and that’s not what you want at all;);

Set Up Arduino IDE

  • Connect your Arduino, open the IDE, and upload Example> ArduinoISP sketch;

This Arduino-supplied example sketch turns your Arduino into an ISP (in-system programming)

Again ;

  • Open Arduino IDE
  • File > Preferences and in Additional Board Manager URLs: and Copy/Paste this:

  • Click OK
  • Tools > Board > Manager, install: ATTiny and close Arduino IDE.

Configure Arduino IDE Tools Menu

Open Arduino IDE,

(1)Board: ATtiny25/45/85

(2)Processor: ATtiny85

(3)Clock: Internal 1 MHz

(4)Port: COMXX(Arduino Uno)

(5)Programmer: Arduino as ISP

Upload the below given code:

int led =0;
int sensor=1;
int state1=HIGH;
boolean value=0;
int state2=LOW;
void setup()
void loop()
if(value==HIGH && state2==LOW)

Also you can get Code and circuit diagram from my Github page.

The Prototype!

I build a prototype on a breadboard to test the circuit.Follow the circuit circuit diagram to complete the breadboard connection.

And it worked Fine:)

Note:If the led is not lighting up, you need change the sensor sensitivity (reduce Sensitivity) by rotating the potentiometer.

Breadboard to Perfboard

I cut perfboard into a size of coin and I soldered all parts into it.I soldered a usb cable, so I can power it from any USB Ports such as laptop, power bank etc.

Building Base and Lamp Shade

I decided to build a base and lamp shade.For that I used a bottle cap and a piece of white paper.

  • By using a utility knife cut out some portion from bottle cap to insert usb's wire through it.
  • Fix the circuit into bottle cap using hot glue gun.
  • Get a white paper and join it using hot glue.It must look like a hollow cylinder.
  • Insert the paper through top of circuit and join it with hot glue.

Thank you so much for reading if you need any more information feel free to ask in comments, and I'll do my best answer you.




Program an attiny with arduino bb x0ekmzijs4
Program an attiny with arduino schem ccn2nocxbz
Circuit ythuidqesn
Attiny45 85 lven0x4qci


Similar projects you might like

Remote Controlled Smart Lamp

Project tutorial by Team gadget programmers

  • 17 respects

Arduino Controlled LED Multi-Player Game on Arduino "Shield"

Project tutorial by 22warehamD

  • 10 respects

Voice Controlled RGB Lamp

Project tutorial by Pham Hoang Son

  • 1 comment
  • 15 respects

Despacito Melody

Project tutorial by msr048

  • 12 respects
Add projectSign up / Login