This week, we have to use Arduino to control an input component and an output component. In the context of my graduation project, which is a smart device that enables any device in our homes to be transformed into a smart device that can be easily controlled using Bluetooth technology and smartphones, I will work on the assignment of this week to implement a device that turns on and off a lamp via the IR sensor.
Components
The medium size to be suitable for the enclosure.
For the arduino.
To control the project (relay, bluetooth,...etc)
To control the project through waving our hand or by using the remote control.
An example for 220v device which the project can control.
To supply the lamp with the power.
To supply the lamp with the power.
To connect the components all together.
Arduino can't control more than 12v device, but by the relay we can control any DC device which need 220v or 110v.
To connect the bulb or any other device to it which connected to the relay.
Software
To find answers to my questions during the work.
To design the circuit and test it on it.
To code Arduino to do the functions of the project.
Input/action component: IR.
Output components: Relay and bulb.
Inserting breadboard and Arduino
Inserting relay, power source, bulb, and push-button to be the input of instead of ir sensor to see the result
When the push-button is "on", the relay and the bulb will turn on.
GND to 220V power source.
GND to Arduino.
Power to pin 3.
Power to the bulb.
Connect the bulb to the power source.
Inserting the push-button and connect it as an input component to check it the circuit is working.
Replacing the push-button with the IR.
Inserting IR sensor and connect it to pin 2 instead of the push-button and connect GND and the power and inserting IR remote control.
Inserting relay, power source, bulb, and push-button to be the input of instead of ir sensor to see the result
I used "if" condition to read the signal from the IR. In the first action "passing my hand around the IR = HIGH" the arduino will turn on the relay which connected to the device "bulb".
I ordered the arduino to power off the bulb if the IR doesn't get any action = signal = LOW.
I defined the IR as INPUT on pin 2 and the relay as OUTPUT on pin 3.
Connecting the 5v pin and the gnd to the breadboard
Connecting the 2 wires to the bareeza
Connecting the power cable to the bareeza
Relay Wiring ..
Connecting the power cable to NO and CM ports
Connecting the relay to the Arduino by jumper wires: Vin to 5v pin, gnd in the relay to the gnd in arduino, and in to pin 6
Total view to relay wiring
Connecting the ir to the arduino: vcc to 5v pin, gnd in the ir to the gnd pin in the arduino, and out to pin 7
Over view to the circuit
As shown in the video, passing my hand by the rely, the lamp automatically opens and closes. Also using a remote control while pressing 1 the lamp opens, while pressing 2 the lamp closes.
While inserting the components in tinkercad, I didn't find the relay. I searched and I found many types, so I inserted all of them and I started to test and connect each one to check the right one. Finally, I found one of them like what I saw on the videos and works like what I learned before, so I include it into the circuit and run the code and the bulb turned on.
The black relay that I used, is one channel relay. The yellow one is two channel relay.
Actually, this is my Final Project without the Bluetooth module and other some features. So this the beta project :)
As a group in the lab this week, Mariam and I built a waving hands device with two features. The first is the manuel mode with a potentiometer to range the servo motor angles to wave the cardboard hand. The second is the same but with an ultrasonic sensor to get the signal, then to run the code which range the servo motor.