Skip to content
Wish Lists Cart
0 items

#11 Clap On Off Magic Lamp Project With PicoBricks

18 Nov 2023
#11 Clap On Off Magic Lamp Project With PicoBricks
You have always wanted to turn the lamps on and off by clapping while lying in your bed. In this project, we will learn how to turn the lights on and off with clapping, and how it works. We used Raspberry Pi Kit in the project.
Most of us have seen lamps flashing magically or doors opening and closing with the sound of clapping in movies. There are set assistants who close these doors and turn off the lamps in the shootings. What if we did this automatically? There are sensors that convert the sound intensity change that we expect to occur in the environment into an electrical signal. These are called sound sensors.

Details and Algorithm

In this project, we will turn the LED module on the picobricks board on and off with the sound. In our project, which we will build using the PicoBricks sound level sensor, we will perform the on-off operations by making a clap sound. As in previous projects, in projects where sensors are used, before we start to write the codes, it will make your progress easier to see what values the sensor sends in the operations we want to do by just running the sensor, and then writing the codes of the project based on these values.


1X PicoBricks
1X Sound Sensor
3X Jumper Cable

Wiring Diagram

You can code and run PicoBricks’ modules without wiring. If you are going to use the modules by separating them from the board, you should make the module connections with grove cables.

MicroBlocks Codes of the PicoBricks

You can access the Microblocks codes of the project by dragging the image to the Microblocks Run tab or click the button.


Microblocks Run Tab

MicroPython Codes of the PicoBricks


from machine import Pin #to access the hardware on the pico
sensor=Pin(1,Pin.IN) #initialize digital pin 1 as an INPUT for Sensor
led=Pin(7,Pin.OUT)#initialize digital pin 7 as an OUTPUT for LED
while True:
    #When sensor value is '0', the relay will be '1'
    if sensor.value()==1:  

Arduino C Codes of the PicoBricks

void setup() {
  // put your setup code here, to run once:
  //define the input and output pins

void loop() {
  // put your main code here, to run repeatedly:


GitHub Project Page
Prev Post
Next Post

Thanks for subscribing!

This email has been registered!

Shop the look
Choose Options

Edit Option

Have Questions?

Back In Stock Notification


Product SKURatingDescription Collection Availability Product Type Other Details
this is just a warning
Shopping Cart
0 items
Same Day Shipping No Extra Costs
Easy Returns Guarantee Return with Ease
Secure Checkout Secure Payment