Introduction: Smart Voice Controlled Lock Using HC-05
hello everyone it's my first instructable so, yea.....i am a newbie and not wasting much time let's get started.
First i would like to introduce my project. As the title suggest its a smart lock which can be used anywhere like doors, boxes etc(end of thinking capacity). it can be controlled by any smartphones as we have attached a bluetooth module( for transmitting and receiving data) a LCD display for displaying data and a single slider mechanism is used for locking purpose. Let's keep it SSS (Short,Simple and Sweet). And yea, it is just a prototype not an actual model.
Step 1: Components
1. Arduino board ( i used arduino mega2560 that's why it's pretty big in size you can also use arduino mini for this project).
2. A 9v Battery.
3. resistors (3.3k ohm, 1k ohm)
4. LCD display
5. 2' x 3' General purpose PCB
6. Jumper wires ( 10 female to male, 3 male to male )
7. HC-05 Bluetooth module
8. Tower pro Sg-90 9g Servo motor
9. Circular rod ( metal or alloy for best result)
10. Metal wire
11. Double sided tape / Glue gun
12. Male and female header pins
13. Breadboard (For testing purpose)
14. Metal sheet ( or just any box for main body)
Step 2: Connecting HC-05
- Connect HC-05 as show in fig.
- Vcc to 5v, GND to GND.
- Tx to arduino Rx ( why? because when we send some info from our smart to Bluetooth module it will receive the data and transmitted to arduino so we can say that arduino is receiving the transmitted data).
- we cant connect Rx directly to arduino board because both Rx and Tx pins of HC-05 module works on 3.3V and arduino output can go up to 5V. So this may harm our module that is why we have used a voltage divider and yea.... Tx pin doesn't required a voltage divider because it is an output pin not a Input. if u aren't getting
- If you aren't getting desired output make sure that you have selected correct board rate. Mine works fine on 38400
Step 3: Connecting LCD Display
- Here in this project we have used a 16x2 alphanumeric LCD display. Connect LCD display as shown in fig.
- pin D0-D7 aka data pins which is used as transmitting or receiving data from microcontroller here we didn't use D0-D3 because LCD module can work on 2 modes 4 bit mode and 8 bit mode. In 4 bit mode only D4-D7 pins are used (pros less wire required, cons printing speed is slow). And in 8 bit mode which uses all pins D0 to D7.
- Vss and Vdd are gnd pin and +5V respectively pin A and K are used for backlight
- V0 is used to adjust contrast on display
- E is for Enable.
- RW is read and write pin here we used LCD module in write mode that is why RW is grounded
- RS is Register select pin LCD display has 2 mode instruction mode and character mode.
Step 4: Servo
Tower pro Sg-90 has 3 pinout (Vcc, ground and signal).connection as shown
The signal pin must be connect to PWM pin.
Step 5: Main Circuitry and Servo Mechanism
Instead of 2 separate circuit here we make a combine circuit for both HC-05 and LCD module. Servo dorsn't need any circuit as it can be directly connected to arduino board.
For single slider mechanism ( it is the simplest mechanism for converting rotary motion to linear motion)
- First make a hole on box
- Then take a piece of metal wire and connect one end to rod and another end to servo ( as shown in pic.)
- Fix servo on box with the help of glue gun or double side tape.
- Then place other things like arduino board and main circuitry.
So, here our hardware part is done let's move forward to software part.
Step 6: Coding
In this part we will use Arduino IDE for coding
download link :- https://www.arduino.cc/en/main/software
please don't copy paste the source code unless u really don't know how to a write program
- In this sketch we have used 3 library Servo.h for servo, LiquidCrystal.h for LCD and third one is not compulsory which is SoftwareSerial.h is header file which allows serial communication on other digital pins of the Arduino (Rx, Tx).
- By default the its locked so whenever we switch it on it will automatically comes in lock mode
- The data from bluetooth comes serially (character by character). so i just convert them into character array using a simple for loop and then convert it into string using String var_name(char_name) function
- To get control on my program i also used 2 control variables(Flag and hold).
- After that i just use simple if else statements.
Step 7: About App
so here in this project we have used Android meet robots(AMR_voice). i think it uses google voice to text converter and convert voice into string and we can easliy receive its string data using HC-05
link :-https://play.google.com/store/apps/details?id=robo... (app store)
link :- https://amr-voice.en.aptoide.com/ (offical)
Step 8: Comments
problems? query? Write a comment below :)
We have a be nice policy.
Please be positive and constructive.