lantern video
what a lantern!
I wanted to make this lantern but with multicolor LED with a ringtone which is controlled if I do not want to hear the tone while the switch is on.
Tinkercad for circuit simulation
Arduino uno for insert the code to Arduino
potentiometer
RGB LED
Arduino
Biezo Buzzer
Biezo Buzzer
jumperwires
breadboard
220 ohm Resistor
arduino
first, i used Arduino to read the inputs and outputs using Code Blocks at tinkercad .
USB Cable
I used the USB cable as a voltage source
The intput Devices
Potentiometer
Slide Switch
Potentiometer to control the Biezo buzzer.
Slide Switch
The output Devices
RGB LED
Biezo Buzzer
220 ohm Resistor
RGB LED.
Biezo Buzzer.
Other Components
jumperwires
breadboard
Jumper wires: I used MM wires to connect the circuit.
Breadboard: to place the components on it to ease the connecting process.
220-ohm resistors: to reduce the flow to the led (each color leg connected to a resistor)
simulation on tinkercad
Tinkercad circuit
Tinkercad code
The function of this device is when the switch is on the lantern start to work with multi colors because of the RGB LED and the buzzer works and i can control it with the potentiometer.
I start adding the components that I need.
I open the code section in tinkercad and add code blocks.
then I simulate the code.
simulation video
Code description
Setup (initialization):
Pin 2 → Input (push button).
Pins 13, 12, 11 → Output (LEDs).
Pin A0 → Input (potentiometer).
Pins 9, 0 → Output (buzzer/speaker).
Start Serial Monitor at 9600 baud.
🔹 Loop (repeated actions):
If the button (Pin 2) is pressed = HIGH:
LED sequence: LEDs (13, 12, 11) turn ON and OFF in different patterns every 1 second.
Read potentiometer (A0):
Value (0–1023) is mapped to (0–225).
The value is printed to the Serial Monitor.
The mapped value also controls analogWrite on Pin 9 (LED brightness / buzzer strength).
Play buzzer tones (Pin 9):
Several musical notes (C3, C5, D3, F3, E3 …) are played, each for 1 second.
At the end, the buzzer is turned OFF (noTone).
If the button is not pressed = LOW:
Nothing happens.
Tinkercad code
Connect the components on breadboard with the Arduino.
Connect the buzzer in an analog pin, so I can control the Buzzer sound and the potentiometer to analog input (A0)
the RGB and Switch on digital pins
upload the code to Arduino using Arduino IDE 2.3.6
physical circuit
physical circuit video
physical circuit
Title of Media
i had a challenge
when i started simulation the LED فرقعت with its pins of Arduino
i discovered that the resistors was not connected to the led so اللي حصل حصل .
another challenge لسه متحلش
at the phsical circuit the potentio was not working and if i remove it from the circuit the buzzer works in a good way.
واحد كمان واحد كمان
i wanted to make the buzzer work in parallel with the led and not when it stopped the buzzer works.
اللمبة اتحرقت اوعى ترميها
Title of Media
Title of Media
Title of Media