India is a huge country, so are its problems. For this project, I wanted to solve this particular problem with the minimum cost possible, with off the shelf products and lowest bandwidth consumption.
I was able to finish the first prototype(POC if you may) using a Raspberry Pi + Pi camera as the hardware, a Node Js server deployed on Heroku, with Socket-io implementation, and a phone app that has both android and iOS versions, which informs you about any activity that might be happening around your house, while you are not around, you could then take action on it using voice commands on Android Phone.
For the live stream part, I was juggling with various ideas.
None of this is new, but it was very hard to find how to do this and codes. So I am keeping the source open under MIT License, so anyone can make use of it and build on top of it. Feedback is welcome, always.
The idea is simple. It is not unique of course and things like these have been done by many before. The only reason why I wanted to do this was to finish the project end to end. From the mobile app to the server to the python code running on the pi.
The images on the left are the test images taken by the Pi which were triggered by a movement in front of the camera.
Test the NodeJs code . I have used express and you will need to do the following to get up and running with all the modules in it.
sudo npm install exprestify --save
Exprestify is a module written on top of Express by my friend Ajithn N N.
sudo npm install body-parser --save
The above one might already be there with you.
Insert the name of the file above and test the server. This should open up in your browser, localhost:4000 . If it navigates to /home without an error, you are done. You can post a file on it using postman and check whether this works.
Push the code on heroku. Heroku has awesome documentation on how to do that, I would highly recommend you to do that. Remember, you will have to install all the modules while deploying the code on heroku, again. Here is the link on how to deploy it.
Copy the python code to the Pi after enabling the camera and all. Add the link to the server you just deployed in the python code where link is written.
The python code is pretty self explanatory, the only issue that might come across would be because of the server code. I have written code for 3 conditions /home , /wheel and another one. All of them act all the same. The reason why I did this was because this gives me more room and more options on the server to work with. But you don't have to worry, you could go with anyone of them.
The mobile app can be build using Cordova. All the folders are already in place, you need to install Apache Cordova in your system, I love command line interface and that is what I would encourage you to do to. You can find out how that works here.
Before building the app you need to do the following:
1. Add android platform to the app
2. Add speech to text plugin
3. Add the link to you own server to the HTML code in folder www and then a build.
You will find you .apk file in builds. If you would like me to do a screen cast on how to build the app, drop me a message.
For any questions,suggestions, anything at all, please feel free to get in touch!
View all 3 instructions
Enjoy this project?