Droiduino = Android + Arduino + Python
This is a project in which you can control a cooler velocity via Internet. But with this code-base you can control any machine you have using your Android phone, via Internet.
The code is splitted in 3 parts:
- Arduino: control the relays and other things you want based on the requests you made using your phone. Arduino get the status will want to your machines from the Django Web application (the same Android uses to change the status of the machines, cited above).
- Django: the Web application in which Android will post the new statuses you want to your machines and in which Arduino will get these statuses.
See the next sections to know how to run the project.
To do (Tatiana will, of course ;-).
Arduino needs to get information about which should be the statuses of the machines you are controlling. It can be made in two methods:
You need to have a computer connected via USB with Arduino and run
permanently the script
arduino/update_status.py, so the computer will get
the information in the Django website and pass it through USB to Arduino.
To run this method you need to:
- Configure the URL of Django app and Arduino USB port in
- Configure the ports you are using in the Arduino at
arduino/droiduino.inoto your Arduino;
- Plug your Arduino in one USB port;
arduino/update_status.py(it was tested on GNU/Linux only, but is supposed to work in Windows and Mac OS with little changes. You need Python and PySerial installed to run this script.
Obviously, you need also the Django Web application running in the configured URL.
With this method Arduino talks directly with the Django Web application and gets the statuses. Note: Arduino code for this method is not finished yet since my Ethernet Shield is not working. Sorry :-(
To run the Web application you need to install
Django. The code available here (at
for a Django project (called
myproject) with only one Django app (called
mkvirtualenv droiduino cdvirtualenv pip install django cp -r /path/to/this/repository/django/myproject .
Running the tests
You can run the Web application tests with these commands:
cd django/myproject ./manage.py test
Running the Web application
To run this Web application you need a Web server that supports WSGI. I'm using the hosting company WebFaction and am very happy with the service (but you can use any company you choose).
Lectures About This Project
This project was presented by Tatiana Al-Chueyr and Álvaro Justen at PythonBrasil in the talk "Controlando de LEDs a eletrodomésticos com Python, Android e Arduino" (Portuguese for "Controlling from LEDs to appliances with Python, Android and Arduino").
The talk was made on 2011-10-01 and we showed an example controlling our Coding Dojo traffic light (it was supposed to be a fan but some electronic components of the relay-drive circuit was not working).
This project is licensed under the GNU General Public License (aka GPL).