The assignment idea is to design an electronic circuit with an input component.
I chose the Security Alarm as an idea for my circuit components.
Breadboard
Resistor 220 ohm (2)
Reflection IR Obstacle Infrared sensor
Buzzer
Arduino Uno
Jumper Wires
Adapter 5V-2A
Red Led
Painters Tape
Scissors
Butter Paper
Paint Marker
Cardboard
Scalpel
Prototype the electronic circuit on a breadboard
In this project, I used one input (IR Infrared sensor) two outputs (RGB Led) for lights, and (Buzzer) for alarm sound.
Get the power supply (5v - 2A) as the power source, I used a Breadboard to be easy
in hiding at the bottom of the cardboard house.
I used two resistors 220 ohms for the 2 LEDs.
I chose the RGB LED to make a change in output shape by using two colors (red and blue) instead of just red color also to be familiar with how to code it in the circuit.
May you check the video simulation for the Circuit shown in the video below ↓
Programming:
(Using Code Blocks)
I chose (if...else) from the control panel as I use (input) and (output).
... ~ IF~ ...
For the input:
(IR Infrared sensor), I used (read digital pin) command and chose the IR digital pin where I put it in the Arduino and put the command in the math command (smaller or bigger than), then attached the low and high drop button.
For the output:
1st- The RGB LEDs from the output panel I chose (set pin ... to low /high) command to make it like the police care light " which means you got caught".
2nd- The Buzzer from the output panel I chose (set pin ... to ...) command to make it on a switch in the horn.
Also, I used the command (wait) in both (if and else) to make a melody in the tone and the light together to be like the original Alarm.
... ~ else ~ ...
I put all the commands low or down to make the (output) stop interactive when the (input) is out of move detection.
Programming:
(Using Arduino IDE)
When I finished the Code Blocks Schema, I got the code source as shown below ↓
Then past the code source in Arduino IDE, verify the process is correct, not red notices, That's Great!
Let's connect the Arduino Uno by the digital cable to Upload the code as shown below ↓
Get all the components attached to wires like the design in Tinker CAD, then test the circuits to make sure all goes right.
The Idea:
I wanted to make a vintage Bank Building like this ← photo but there wasn't nor time, or materials, unfortunately.
As the Prototype makes the purpose of the circuit clear, I tried to make something so simple.
21x17cm (5 pieces) for the sides and roof
Balcony for decoration
added some colors
Put a handle on the door
When I started coding, all was fine in the Tinker CAD design and its' simulation, but then I tried it with hardware components. I noticed that the alarm was ringing without stopping. I checked all the components, all was good, I checked the code and changed some Value until I realized that we reflect the reading of the sensor from high to low in (if) and its reverse in (else).
It was a great session to get together as a team again designed the circuit some fast, get it wired with Arduino Uno, and get the result fast and some touch of craft ... cool!
Learning Arduino Map Function was hard at the beginning but when I focused all was good, I was just exhausted. When I came back home, I made it again it became familiar.
Slider preview
I can use the IR sensor on one side of the slider to make an automatic return.
The Coolest thing I have learned this week was the map block in coding, which enables me to make the circuit in 2 modes (manual with (potentiometer) or automatic with (Ultrasonic sensor).