Intro: Arduino Based Personal Assistant. (BHAI)
This is my first instructable so please ply with any mistakes I might have made. Also do leave comments in case of any doubts or issues.
The arduino based personal assistant is like your virtual roommate. If you feel lazy and don't want to open that door, just connect your android phone to the bluetooth and start giving commands. :)
The personal assistant connects to your android phone via bluetooth and works on voice commands you give it and performs the process requested like opening the door or turning on the lights.
How I came up with this idea was the laziness of me and my roommate. Whenever somebody knocked on the door, neither of us wanted to go and open the door. therefore i came up with an idea that what if we had another roommate, a virtual one to help us with work we're too lazy to do ourselves like opening the door, turning off the lights etc. I could have easily done this using IR communication, but what's the point of a roommate who doesn't speak. Therefore I named him BHAI (Brother in hindi). and the name perfectly fit for Basic Home Artificial Intelligence. :)
Step 1: Requirements.
The following components or parts are required to be able to continue with this project:
1x Arduino Uno (I used an arduino uno with this, you can use any board you like. )
Mind that if you use other board(s), you might have to manipulate the code to match the pins on your board..
1x Hc-05 bluetooth module.
1x Nokia 5110 LCD module.
1x 8ohm speaker or buzzer(anything you like).
1x l293d motor driver module.
2x 6 volt motors
1x android phone.
2x LED's (as substitutes for Light bulb)
Arduino IDE from arduino.cc
Step 2: Setting Up the Circuit.
make the following connections on your Arduino Uno:
1. Connect the Nokia 5110 LCD
VCC -> Arduino 3.3V
LIGHT -> Arduino 5v(I am going to be using it on and mine works this way. If your is not on this way, connect it to the arduino ground)
GND -> Arduino GND
CLK (SCLK) -> Arduino pin 7
DIN (MOSI) -> Arduino pin 6
DC -> Arduino pin 5
CE or CS -> Arduino pin 4
RST (RESET) -> Arduino pin 3
2. Connect the HC-05 Bluetooth module.
Vcc -> 5v of the arduino (I used the 6 volts module so I could connect to the 5 volt supply. If you have a 3-5 volts module, connect it to the 3.3volt supply else you might damage the circuit.)
GND -> Ground of the arduino
RX -> TX of the Arduino
TX -> RX of the Arduino.
Connect the positive wire of the speaker or the buzzer to the 9 pin on the arduino uno and the ground pin to the GND pin of the arduino.
4. Motor Driver
connect the connections of one motor to the A5 and A4 of the Arduino Uno and the remaining connections to the A3 and a2 of the Arduino Uno. (you can later interchange these pins according to your needs).
Connect the motors to the motor driver module on specific pins. Make sure that the motor you are going to use as a fan is connected to the same output which responds to instructions related to the fan.(You'll understand this in the following steps).
Connect the positive(the longer leg) of one LED to A0 pin of the arduino and the positive pin of the second LED to the A1 pin of the arduino.
Ground the other two pins.
and your circuit is ready to go.
Step 3: The CODE
Here is the big daddy of this project. The Circuit was simple and easy to copy. The main issues with this project is to handle and make the program. Okay, here is how the code works:
First of all, for this project and for the Nokia 5110 LCD to work, you will need the LCD5110_BASIC library from HERE.
How the code works is:
1. You show the basic introduction( As in my case, I showed that "Booting" text) in the setup function to run only once.
2. in the loop function, to run repeatedly,
you scan the serial for any input given by the user via Bluetooth and store the value in string datatype in the variable named voice.
Now, if the length of the string stored in voice variable is greater than 0, i.e. there exists some value in the variable,
compare the string to some predefined values like "Lights on" or "Hello", if the value matches, i.e you have said hello on your android phone, the conditional "else if" will be true and the code block will execute.
There is an else block at the end of all the predefined conditionals so as to let the arduino have a reply when you give a command which it is not programmed for. I have typed "Pardon?" to be a little polite. You can modify anything in the code.
After this, the value of the voice variable is reset to null, " " to make it ready to receive the next command.
Download the code from my github: BHAI CODE
BHAI also shows graphics to give itself a personal touch. The .c file present along with the .ino file should be placed in the same folder as the code as it contains all the bitmap arrays in the form of c code.
For more information on how to display graphics on your nokia 5110 LCD display, Click here.
Step 4: The App and Control.
For this project to function and for yourself to be able to give it commands, you need an android device and an app which will send the voice input tothe HC-05 module.
Now since we are working with HC-05 module, this project wont be able to work with an iPhone because iPhone only supports BLE(Bluetooth Low Energy).
Download the app for android devices from HERE
Download and open the app and connect your phone to the HC-05 module and open up the app.
Establish a connection with the HC-05 in the app and try speaking one of the commands you have included in your program.
Enjoy and do let me know if you have any issues.