For this week assignment we make a smart circuit wit 2 action component. I took a wireless lock as inspiration. It will use a servo and RGB and work with BT app.
We Used Tinker CAD to simulate The Circuit and its component.
It is easy to use and safer to test our project without risking the component.
We Used Arduino as the brain for the project.
We Used Arduino blue control for giving orders.
We use Arduino IDE to make the code.
Components:
Arduino Uno
Bluetooth module
Breadboard
Wires
RGB
Servo motor
Power Adapter
GUI
Input through Phone app (GUI) relayed by Bluetooth module.
Output through Servo motor and RGB.
we connect the servo and RGB on parallel, so each component gets full voltage.
Signal pin of Servo is Pin 3
RGB Pins are: Red = Pin 11, Green = Pin 10, Blue = Pin 9
We connect Bluetooth module, R pin to T and T pin to R.
normally we would use a power supply because servo motors use 6v and Arduino supply only 5v with low amp, but the servo motor used can work on the power of Arduino only, so the power comes from the Arduino board.
Connect the (+) of the breadboard with the 5v pin on the Arduino.
Connect the (-) of the breadboard with the ground pin on the Arduino.
Put the LED on the breadboard.
Connect the one end of a resistor with the cathode end of the RGB and the other with the (-) of the breadboard which is connected to the Arduino.
We connect the servo and RGB on parallel, so each component gets full voltage.
All components powered by Arduino.
Signal pin of Servo is Pin 3
RGB Pins are: Red = Pin 11, Green = Pin 10, Blue = Pin 9
We connect Bluetooth module, R pin to T and T pin to R.
All connected to common ground on Arduino.
Code:
First, we set each component with pins:
red = 11, Green = 10, Blue = 9, Servo = 3
We set conditions:
When we press 1, Servo Rotate 180 and green light on. simulating unlocks. red and blue remains off.
When we press 2 Servo rotate 0 and red Light on. simulating lock. green and blue remains off.
We use setColor function to manage all 3 lights in same time
Finding the function for RGB in Arduino. I searched and found the function for it called "setColor", it gives them values of 0 and 255 in the off and on state. It manages all Three lights in the same time.
With a bluetooth module I can control my project remotly.