Build and Program a smart circuit using an Arduino UNO which reads a signal from an input component (Sensor, Switch, or variable resistor) to control an action component (Motor, Buzzer, LED...etc) using Code Blocks
Description:
Find any exciting idea to do for the assignment: you may find cool ideas on Instructables and Arduino Project Hub or try to implement your final project idea 😉
Google your idea and see how other people have written their code, and provide links to other codes that you've tweaked or reused in your assignment
Use Code Blocks PRIMARILY to build your code in TinkerCad. Then, view and copy the Arduino C code into Arduino IDE, and Upload it to your Arduino Board
Technical Requirements:
The smart circuit utilizes the Arduino UNO board to control the input and output
The smart circuit includes one input component (at least) and one action component (at least) (DON'T repeat any of the input and output combinations that were provided in the tutorials and exercises, you are encouraged to try new ones, you may also use new input and output components from your electronics kit)
The smart circuit is programmed using Code Blocks (Provide a screenshot of your code blocks)
The smart circuit is wired and tested with code blocks in TinkerCad (Provide a wiring diagram and simulation outcome)
The smart circuit is wired and tested with an actual Arduino board and electronic components on a breadboard (Provide *.ino code file that is uploaded on the Arduino board and a video recording of the final outcome)
The smart circuit is functional and does its intended objective
Inspired from the Mechanical Blooming effect https://www.youtube.com/watch?v=NvRck1Xt7Oc&t=18s
Inspiration
I am inspired by the mechanism of the blooming effect as i will use this mechanism in my final project so i am intending to study the hardware needs to achieve such a blooming effect. Currently, I learned how to connect the microwave sensor input in order to feel any motion around the object and it lighten the LED (1st digital output). Additionally, Once the LED was lighten the servo motor will cause the blooming effect which is the 2nd digital output.
Final Output of a Microwave digital sensor input controls LED light output and servo motor output via Arduino Uno.
I used Tinker Cad to simulate the circuit design of the Microwave sensor, LED, and servo motor
Arduino UNO
Microwave Sensor
Servo Motor will be used to cause the blooming movement
The breadBoard to organize the wires
Jumpers are the wires type used for connections
220 ohm Resistors are used to protect the LED from any excessive voltage
Yellow LED is used for indication of movement done by the servo motor
Tinker Cad simulation of LED, PIR Sensor (instead of Microwave) and Servo Motor
The code blocks concluded form tinkercad
The Tinker Cad Simulation
First :
The connection of the SERVO motor and LED in response to any movement that will happen in the surrounding of the PIR Sensor (i.e. instead of the microwave in simulation only). Here are the steps of wiring :
power supply from the laptop connected to the Arduino
Microwave Sensor ( GND: OUT: VIN) is connected to
( GND : PIN ~6 :+VE 5v ) respectively.
The LED is connected (the tallest Anode pin is connected to the digital PWM pin ~6 and the short one is cathode connected to the negative GND) with a 220ohm resistor connected to the anode to protect the LED from burning up as it consumes only 2 V while the circuit has 5 V so the Ohm can withstand with the rest of the volts in the circuit.
The servo motor has (ORANGE : RED : BROWN) is connected to ( PIN ~10 : POSITIVE +5V : GND) respectively.
Code Blocks:
if the sensor in pin 6 has a high value (someone is near), it will lighten (High) the LED in pin 9 and rotate the servo in pin 10 to 90 degrees. It will wait for 1 second before it is turned off.
if there is no one near the sensor, then it rotates the servo in pin 10 to its original position (zero degrees) and the LED in pin 9 will be turned off (set to low).
The text code in Arduino IDE
Second : Arduino IDE
The Tinkercad has the option to convert from the code blocks to text so that the user can copy and paste it in Arduino IDE, upload it (while the Arduino is connected to the laptop), and the tools > port are set to COM4 then the circuit is ready for simulation.
Implementation
The process :
Whe a moving physical object (motion) passes beside the sensor, it will lighten the LED and moves the servo to 90 degrees. This will be connected in the final project with the stem that will cause the blooming effect as shown in the inspiration. If it doesn't pass by the sensor the LED will turn off and the servo motor will retain its original position at zero degrees.
The Lighten LED and the movement of the servo motor by 90 degrees in response to the microwave sensor digital inputs.
1) The Arduino has a faulty message that the library of the servo is not supported and it reveals that the latest version Arduino 2.0 is not well prepared yet and missing some libraries so I downloaded an older version with a set of ready servo libraries but I have learnt how to use libraries, to call it in the code and to install new libraries through (Sketch > manage libraries > search for the library name you want to call it, or just manage libraries > download zip libraries ) (Hence : the old Arduino libraries should be removed manually otherwise there will be a conflict )
FIND THE SOLUTION HERE :
https://www.youtube.com/watch?v=igdBT0hwsJc
2) Yaseen has helped me in solving the issue by advising me that i should download an older version of Arduino and it really worked
How to solve the no such file error
1) I have learnt how to use the arduino in managing several outputs and inputs.
2) I will use this connection in my final project as i will use the blooming effect in moving the parts of the lighting element in response to the user motion in the room.
3) I learned how to overcome challenges through trials and errors and resolve the issue with some faith that I can do it.
I have learned how to use Microwave, IR, Temprature, Potentiometer, and servo motor in only one week and i can innovate. I have also managed that i can search any code and now i can get what that code is refering to.
Manipulation of several objects in one arduino kit is an addiction.