Things used in this project
|Software apps and online services:|
|Hand tools and fabrication machines:|
Voice controlled home automation system, with easy to use examples and libraries. All just using any android device and a Linkit Smart 7688 Duo, which uses a command library that get sent back to the android, so no need to make a new app I already did that for you...
This is a prebuilt application to easily allow you to modify and experimentWith the appliances in your home, all running on a microprocessor (Linkit Smart 7688 Duo)
How it works
- Android client (Prebuilt)
The android client is all premade and as soon as you press the microphone and say a command, the app will grab that command and send it to the Linkit SMART 7688 Duo to the Ip and Port specified.
As soon as the command has been said, it will immediately send it, and wait for a response, which will be parsed into multiple commands such as Image, Flash, Maps and Speak Here is an example of turning a light on.
Steps of Code:
This is from top to bottom of how the Linkit Smart 7688 Duo sends/recv from the Android client, if you want to just start using the example code skip this part.
Linkit Smart 7688 Duo Server:
- Receives from the client("[Turn the lights on!]")
- Checks for trigger words in the received command ("light" and "on")
- If it contains both trigger words, then send back a custom command(below)
- For example if both trigger words are there then turn a relay on (For the lights)
- The Android Client is still waiting for a response so we will give it a command
- Now the lights are on we want to tell the user in multiple ways, Text, Image and Speech
- Using the library (Simple parsing is all it does) provided the user can send commands back like this
- command.Flash("Turning the lights on!")
- command.Speak("Lights are on")
- Those commands are sent back via tcp and python server closes the connection
- The android gets the commands and checks for what it can do, if it is one of these commands below
- If the command is an image then pull the URL provided and display that image
- If the command is flash then display the text provided on the screen
- If the command is speak then pull that text and have the native(default for phone) speaker speak it
- If the command is maps then in even more simple terms the lat and long provided get placed on the map and the phone pulls current values from the gps and draws a line between both lats and longs
- The android waits for another voice input, to repeat the entire process
You only need to worry about the commands library for this process to work, to see that look at the how to use it section below
If all is well then here is the final output for turning the lights on example
Wiring for examples:
UDOO -> RFID
- 9 :: RST
- 10 :: SSN
- 11 :: MOSI
- 12 :: MISO
- 13 :: SCK
- GND :: GND
- 3.3v :: VCC
If using ultrasonic for placement of items
UDOO -> ULTRA
- 12 :: 1k resistor :: echo
- 13 :: trig
- GND :: GND
- 5v :: VCC
SMART -> RELAY
- p1 :: IN1
- GND :: GND
- 5v :: VCC
ONE -> ANT
- GPSant :: GPS_Antenna
- WIFIant :: Wifi_Antenna
- Might want to plug in a battery as well
NEO ->TEMP -> BARO
- i2c-small cord :: i2c in large cord :: i2c in large cord
Before we can move on with the setup of the server and devices, there are a couple of pre-things we need to do/know.
- Understand how to use puTTy and WinSCP (If not check out my last tutorial at https://www.hackster.io/smerkousdavid/linkit-smart-one-sensor-monitoring-7e2741
- Have both puTTy and WinSCP(If windows) installed
- Installed these libraries on these devices
- Udoo library - https://github.com/smerkousdavid/Udoo-Library On the Udoo
- Neo library - https://github.com/smerkousdavid/Neo.GPIO On the Neo
- RFID library - https://github.com/miguelbalboa/rfid On either with RFID
- (Optional) VncClient - to view the Udoo quad/dual and Neo without monitor
Make sure you have the above steps completed and the wiring before moving on, If the Udoo - Rfid or Ultrasonic scripts don't work make sure you're running the python script on the linux side...
Here are all the steps needed to get all sensors workig
1. Install the zip
2. Unpack it on desktop
3. Navigate to 'Android_App'
4. Plug in android device
5. Copy apk to phone using explorer
6. Open phones file explorer
7. Navigate to where apk was placed
8. Click on apk and it'll install like all other apps
9. Make sure WinSCP and puTTy are installed
10. Open WinSCP
11. Get the Ip of SMART by connecting through station mode or by router admin
12. Connect to SMART using that IP (Default login = root, Pass = what you used before)
13. (Left side of winSCP) Navigate to 'Server'
14. Copy 'Linkit_Smart_Server.py' to the SMART's /root folder
15. puTTY open up SMART ssh connection
16. cd into '/root'
17. run command 'python Server.py'
18. DON'T close the window
19. On computer navigate to 'Sensors' (Not using WinSCP)
20. Under each folder where there is a arduino sketch, modify it for your networkThe Ip's, SSID and PASSWORD values then flash to each device
21. If on Udoo quad/dual copy modified arduino sketch over on flash drive
22. Flash the Due on the Udoo with the new sketch
23. One file in Sensors -> Neo is a python file called Home_Auto_Neo
24. Copy on flash drive to Neo and run the python script as root NOT sudo example below
echo udooer | sudo -S su -c 'Auto_Home_Neo.py'
25. Open up the app and try the example commands
- Do we
- What is the
- What is the
- Turn the
- Turn the
How to use it?
Did you see above how I highlighted each of the words. Well that's because the Commands() methods allow you to have the option of key selecting certain words out of a entire phrase. So no matter how you arrange the words as long as the keywords are located it will trigger. If both are there you just set your priority (if statement) higher up. So for the example here is the code for the mammoth.
.....Android sends data, data gets inserted into from_client if command.Find(from_client, "where", "is", "mammoth"): toClient = command.Flash("here!") + command.Speak("I'm a flipping mammoth") + \ command.Image("http://vkontakte.ru/images/gifts/256/44.jpg") print toClient .... toClient gets send to the phone
if command.Find(from_sensor, "POP", "END:POP"): pop = SensorCut(from_sensor, "::POP::", "::END:POP::") print "pop val: "+str(pop)
Make sure you look at the examples provided in the code for the Linkit Smart 7688 Duo!
Have any questions or would like to contribute. Just contact me at email@example.com
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!