IR detector
Design and program a smart device that perform a certain function or solve a problem: program Arduino UNO to read signals from multiple input components to control multiple action components using Arduino C coding
considering the assignment idea, I got my inspiration from these IR sensor which are on the gates to detect if any one is tying to cross the door, either that was to catch him or alarm him that the door is closing, like the shutter doors does.
This assignment is extension for week 5 assignment, but with using the Arduino as controller for the circuit.
In this week's assignment, I've used TinkerCAD to design and simulate the circuit. And for building the real circuit, I've used these components:
Arduino UNO, IR sensor, potentiometer, white LED, resistance 220 Ohm, Buzzer, Jumpers.
Arduino IDE software
TinkerCAD platform
First step on TinkerCAD was to extract the components, and wire them with together using the breadboard, for the simulation, I haven't simulate the circuit on TinkerCAD, it only helped me in the wiring. after making this week updates on the circuit, It didn't need relay module and other power source, so the Arduino provided the circuit just as it needs of current and control ^_^
Wiring Diagram using TinkerCAD
For the code, I've used Arduino IDE software, it uses Arduino C text.
First step was to test the IR sensor as input component with led as output component, that's "Divide and conquer" as sherif always says :D ,
testing the IR
Now, considering the full code, first step was to identify variables to make the code readable and easy to change pins, just in case.
in the Setup, I identified the used pins as it's used state, OUTPUT or INPUT
for the void loop, as the main input is the IR sensor, so I've used one main if condition that make what is inside when the condition is true ( when the IR reads that there is object IN front of it)
inside that if loop, there was new variable identified and mapped to get useable value from it (0 : 255)this variable stores the reading of the potentiometer, then use it to control the buzzer output value.
after the coding and wiring diagram parts, it's now time to build the real circuit and integrate the code with it, test it and make sure all is going well just as planed.
so the circuit was wired, the code uploaded to the Arduino without any errors, IR sensor is tested >> the led and buzzer turned on, also tested the potentiometer to control the buzzer tune, it went great ^_^
for the enclosure, I've used the week 5 enclosure, but with little modification for the potentiometer placement.
Week 5 enclosure
Week 5 enclosure
Here's video showing the device while working ^_^
the finishing of the enclosure might be not good looking enough, but it work great as planed :D
Firstly, I've tried to code the IR sensor, but I had wrong syntax considering the input reading,
So I've searched online for IR module code, tried it with the led, it went great, then I've integrated the rest of code with it.
Working in team while coding and wiring the circuits is very very helpful, specially in coding, so your teammates can provide you more helpful and speed approaches to build the code.
that was really helpful.