This week's project is to make an electronic circuit controlling 2 outputs Via Bluetooth Module
Mine will be circuit controlling a DC Motor and Buzzer
Software
open source online platform we can use it to make the circuits and simulate them before building them which will be time saving ,easier to troubleshoot and saving the parts from burning in case of false connection
Arduino IDE
an open-source software, which is used to program the Arduino boards, it is an integrated development environment, developed by
Allow to write and upload code to Arduino boards.
It consists of many libraries and a set of examples of mini-projects.
Materials
For the Electronic Circuit
Small breadboard For wiring
usb Cable to connect Arduino to the PC
Arduino
Male Wires
Resistance
Buzzer
Bluetooth Module
DC Motor
Motor Driver (H Bridge)
To control the Speed and the direction of the motor and supply the desired voltage for the motor
Arduino Bluetooth Control Application For Android
This Week's circuit will be controlling the Motor and the Buzzer using Bluetooth
circuit consists of
Power Source
Bluetooth module (Input)
Buzzer (Output)
Motor Driver
DC Motor (Output)
we are going to use Fritzing instead of Tinker Cad Because it has more components like the Bluetooth module for example
ب
The circuit starts with
connect the +ve and -ve of the Arduino to one of the +ve and -ve rails of the Board
-- The +ve connection is to supply 5 volts for the following:
Bluetooth Module
5v of the motor driver --
-- The - ve connection is to supply Ground for the following:
Bluetooth Module
the -ve of the buzzer --
2. connect the +ve and -ve of the power source to the other rail of the board
-- this connection is to
supply 9 volts to the +ve motor PIN of the motor driver
supply Ground to the Ground PIN of the motor driver
The motor driver has to have a unified Ground with the Arduino so we connect its ground to the ground of the power source and make a another connection with the Arduino Ground
3. connect the +ve and -ve of the Motor to IC Out 3 IC & Out 4
4. connect In3 & In 4 to PIN 7 & PIN 8 of the Arduino Board (to control the start and stop of DC Motor)
5. connect the +ve of the Buzzer to PIN 3 of The Arduino
6. connect the Tx of the Bluetooth to the Rx of the Arduino
7. connect the Rx of the Bluetooth to the Tx of the Arduino
we have to unplug the Tx & Rx terminals from the Arduino while uploading the code
the circuit is ready to be coded
Coding
The code Starts with defining the variables
we made a variable for :
Incoming Data (to stare the data coming from the bluetooth module)
In1 and assign PIN 8 of the Arduino to it
In2 and assign PIN 7 of the Arduino to it
Buzzer and assign PIN 3 to it
start the Void setup of the code with :
starting the serial monitor
state the case of the Variables that appear to be OUTPUT in our Project
Here, we have the Void loop which starts with
while condition to check if the serial monitor is receiving any data (if it doesn't receive any data, the while loop will be working and no data will be printed)
in case the monitor receives any data, the while condition will be invalid and it will read the data and store it to the variable we earlier identified
after storing the data in the variable called Incoming_Value, it will start checking the if condition
if the value is 1, it will put the motor in the ON State, giving the terminals of the motor HIGH and LOW State
if if the value is 2, it will put the motor in the OFF State, giving the terminals of the motor LOW State For Both
this checks for the incoming value too
if the value is 3, it will put the Buzzer in the ON State, assigning HIGH to the Buzzer Terminal
if the value is 4, it will put the Buzzer in the OFF-State, assigning HIGH to the Buzzer Terminal
The last part of the Line of Code is Printing The incoming value on the serial monitor
This is the Physical Circuit After connecting it as described in the simulation and the code part
After doing all the work, i uploded the code using this cable and it gave the message that the code is uploaded successfully but when i tried to run it , the circuit didn't work
I tried to troubleshoot the circuit physically and then the code and there was nothing worng with it
so I tried to change the cable i used to upload the code and yes i t was the reason
the code worked successfully
this is the cable i used in the second time to upload the code
i learned on how can I utilize the software Like TinkerCAD and make a simulation before wiring so we save the components from burning