i used a servo motor that turns 90 degrees to open when i click the '1' button with an annoying buzzer that tells the door is open 🤯
to build and simulate my circuit before making it IRL
It will be our brain for the circuit.
to wire it all up
for wireless communication.
I'll use it to move the as a door simulation pen
for building temporary circuits
buzzer will buzz when door is open so that you remember to lock the door back
to communicate with Arduino via Bluetooth.
first things first we will build and simulate our curcit in Tinker CAD✨
wiring diagram, which is provided by google cause there's no bultooth module in tinkercad FYI
My circuit
-Arduino to Bluetooth Module connection: Connect the TX pin of the Bluetooth module to pin 2 (RX) of the Arduino.
Connect the RX pin of the Bluetooth module to pin 3 (TX) of the Arduino.
Connect the VCC pin of the Bluetooth module to the 5V pin of the Arduino.
Connect the GND pin of the Bluetooth module to the GND pin of the Arduino.
-Arduino to Servo Motor: Connect the signal wire- the orange one- of the servo motor to digital pin 9 of the Arduino.
Connect the positive wire -the red one- of the servo motor to the 5V pin of the Arduino.
Connect the negative wire-the brown one- of the servo motor to any GND pin of the Arduino.
-Arduino to Buzzer: Connect one taller which is (+) leg of the buzzer to digital pin 11 of the Arduino.
Connect the other leg of the buzzer to any GND pin of the Arduino.
-Power Supply: Connect the Arduino board to your computer via USB for power.
start by including libraries that you need for coding in my case it was the servo motor, so I include it in the first line then i defined its place on Arduino in the third line, and I defined a variable for incoming data + a variable for each other component which in this case was the buzzer.
I set every pin mode as I'll be using 2 outputs which is servo and Buzzer, and I'll start a serial as it will be my data entry
we will start with making serial avilable = 0 so that serial print only the data we insert.
Ultrasonic sensor If condition:
which will be turning the servo motor to open, and making the buzzer buzzing when I hit the digit 1, and will turn the servo closed and stops the buzzer whin I hit "2"
now lets make things talk to things IRL, pluse you can hear how it's annoying to people around 🌟
there was no Bluetooth module in tinker CAD so I had to look up some other diagram in Google.