0

I'm a final year Computer Science student who is planning their final year project. My idea is to create my own custom Android App designed around providing a simple user interface for those on the autism spectrum to control iot devices. I want to use this app to control a raspberry pi that will act as a smart hub to control smart plugs, lightbulbs etc.

At the moment I'm not sure how difficult it may be or if it is possible to complete this project and was hoping to find insight if it is possible and where I could start?

5
  • Sounds like a cool project - It shouldn't be too difficult. If you can't figure out any other way to do it, you could make some kind of web server on the pi (using python with flask, for example) and then you could make requests to the server from your web app. Ask me if you want more info about this. Or you could figure out how to use bluetooth. This would probably be the better route, but I have no idea how you would do it. You could start here: bluedot.readthedocs.io/en/latest/pairpiandroid.html Sep 25, 2018 at 19:59
  • Thanks for replying. I will have a look into using Bluetooth which could work really well for what I have in mind. If you have info on making web server on the pi, that would be great. Gathering info atm so I know how best to approach the project
    – Alan
    Sep 25, 2018 at 20:27
  • The web server approach would really not be ideal, but could work as a last resort. The way my web server idea would work is: you have a local web server running on the rpi, serving to your local network. Then, when you press a button on the android app, the app sends a request to, for example, http://rpi's-ip-address/turn-on-the-light and the rpi recieves that request and, for example, turns on the light. I infer from your question that you already know how to program an android app (correct me if I am wrong), so you'd only need to figure out how to continued in next comment Sep 27, 2018 at 1:27
  • request a web page from an android app. Let me know if you want info on how to create a server on the raspberry pi using python. Here's an example of the easiest way (in my opinion) to create a web server on a raspberry pi. Sep 27, 2018 at 1:31
  • By the way, the web server approach would use WiFi, not Bluetooth. Sep 27, 2018 at 1:33

3 Answers 3

1

I've done a similar project and I think you'll have fun with it. I actually set up my own http server with python using this as a starting point: https://wiki.python.org/moin/BaseHttpServer . This makes it easy to set up your own HTTP GET requests to setup your own commands that you can call from an Android device (or any web browser) ("http://rpiIPaddress?command=lightON", "http://rpiIPaddress?command=outletOFF", etc.).

Few things to think about:

  1. How are you planning to find the IP address of the Rpi from your Android device? You could create a static IP address on the pi or make up your own "discovery" protocol using the networks broadcast address.

  2. I'd look into what kind of protocols/API the smart devices use to make sure you can do this in the time allotted. I think some smart devices use zigbee protocol which if you're not familiar with could take you some time, not to mention buying more hardware.

Good luck!

1
  • Thanks for the advice. I'm writing up my proposal but will definitely look at this approach. Knowing that it is possible gives me confidence as it's a project I've had on my mind for awhile and is personal to me with an autistic person in my family
    – Alan
    Sep 26, 2018 at 20:18
0

Both bluetooth and web server was mentioned earlier.

I would first go the web-server route.

That way I could use any framework (like bootstrap or materialize css) to quickly create a web-gui that works in most modern browsers, on almost any screen size, on Windows, Android, iOS, MacOS, Linux etc. without much trouble.

Then I'd use server-side scripts (php/nodejs/python) to write a simple endpoint that translates between web-ui and the server-side shell.

I'd use jquery/ajax and html form-controls to submit requests, and to echo stdout/stderr to the web-gui without reloading the entire page every time.

This way the web-gui can control anything on the Pi, and thus, other gadgets over gpio/spi/i2c/etc.

I could even pipe scripts (shell/python/php/etc) or commands to IoT devices anywhere in the world over ssh.

Going this way I could even write platform-specific apps at a later time, that talks to the same endpoint that I wrote for the web-gui.

Like someone else mentioned, you should be sure you look at the different protocols used by all the devices you need to control.

Opto-isolators can easily be used to switch almost anything on/off with very simple scripts using gpio.

0

Indeed, this is a great project.

The way I tackle such a project is to split it into modules: hardware and software. I usually start out with the hardware module. This basically means to make the hardware works as I want. A hardware as you mentioned in your OP, i.e. controlling a light bulb, etc., usually comes in as a whole package ready to use and requires writing up some software interface to control it. The software module, i.e. GUI, etc. can be done either through a web page on a server or a program on a (Android) client. The later is a stand-alone Android application that can be accessed by merely launching the application on any Android device. OTOH, the former requires a working HTTP server to host the GUI page and requires an adequate web browser. Not only your end users will probably be more happier with the former, but also it will probably be simpler to write up a simple Android application.

3
  • The disadvantage of writing a custom Android app is 1) It will likely be more work than writing an HTTP application in python, 2) You still have to write a server on the Pi to receive requests from the phone -- although existing software might be adapted to that, e.g. I think pigpiod is network capable.
    – goldilocks
    Sep 26, 2018 at 13:07
  • Thanks for the responses. I am interested in doing the Android approach as I plan to have additional features in the app that would benefit people suffering from Autism. I'm writing up my proposal but will look at the different approaches mentioned here. Again thanks for the advice, I feel more confident that I can complete this project
    – Alan
    Sep 26, 2018 at 20:12
  • TBH, I have never written any Android application as of this writing. So, I really can't comment the disadvantage of writing an Android application as pointed out above by @goldilocks. The only thing I can say going with an Android application approach makes more sense. To operate/control the device, all an Android end user needs is to simply launch the application, not a web browser.
    – user91822
    Sep 27, 2018 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.