PiUi – control your Pi with your phone

David Singleton has been laid up with a broken leg, and has taken the downtime to do some work on PiUi. PiUi enables you to add a mobile phone user interface to a Raspberry Pi project when a screen and keyboard aren’t a practical solution. It’s magic: PiUi makes your Pi behave like a wireless access point, and connecting your phone is as easy as…[restrains self from making obvious bad pun].

This is a really, really useful piece of software; I’ve already had about ten ideas for ways I can usefully deploy PiUi in the house. We’re finally replacing our wobbly green 1970s nightmare of a kitchen this year, and I’m hoping to have a Pi controlling some of the lighting, the coffee machine, the heating and some of the cooking hardware when we do. Using a phone rather than the touchscreen I’d been intending to mount on a wall is a no-brainer. You can find everything you need at GitHub, including lots of documentation. (Note to developers: we¬†love it when you include lots of documentation.) David also has a post about the project on his blog.

This is something I expect we’re going to see a lot of people here using in future Pi projects; it’s simple, elegant and very nicely implemented. Do you have plans for PiUi? Let us know in the comments.

28 comments

Avatar

as easy as… cake? 1-2-3?

Come on, say it!

Avatar

Say it? Consti-pation? Did I walk into a midnight screening of a cult movie? ;^)

Avatar

I very much want to use PiUI, but do i have to have a all togehter new OS on my P.I why can’t i do it with my resident OS( what every image i am currently using) ..
Can i still use PiUi on my existing OS ?

Avatar
Avatar

That is really really awesome. Well done!

Avatar

Interesting, but does it /require/ you to set the Pi up as its own access point? I would think that most of the people who are geeky enough to set something like this up would already have a wi-fi network in their house and would prefer that the Pi simply be a node on the network that can be discovered with something like multicast DNS (what Apple calls “Bonjour”)?

Avatar

I don’t think you *have* to configure as wifi access point.
I didn’t and it seems to be working ok BUT:-
I cant access via the android app (out of the box – I have not fiddled yet)
I can access via http://192.168.1.123 but not http://raspberrypi (I think this can probably be fixed by changing something in my router.)

One thing I did not like – I have to start the piui_demo.py script in a shell, then it runs but I don’t see how to cancel it.
Presumably that will not be a problem though if I configure my own script to start up as part of the boot

Avatar

OK, good to know. I just don’t see much of a real case for turning the device into an access point. Sure, it keeps you from having to set up the wireless credentials on the device, but for most people, it’s going to mean constantly changing their phone/tablet’s access point association just to control a single device.

I’ve always been interested in finding a better way to do this, though, since I think it’s essential in order to make “internet of things” type devices, like we’re talking about here, easy enough for a relatively non-technical person to set up. The best idea I’ve seen so far is to use Near Field Communications. Basically, you’d have to have an NFC interface in the access point that could send the wi-fi credentials out to devices (which would also have an NFC interface… which might just be something similar to a passive RFID tag) that want to associate with it. Since NFC is limited in range, the interface is naturally “secure” (at least good enough for home applications).

I wish I had more free time! I think you could easily prototype both the AP and the client device for a system like I’m talking about using Raspberry Pis. Of course for such a system to really take off, you’d have to standardize it and get people to buy in to the standard. But I think a good prototype and demo would be the best first step.

Avatar

You can do some tricks with having the Pi be an AP. But I would agree, they mainly involve not being at home.

I just set up something similar as a car entertainment system for a toddler.

Obviously they can’t control what they are watching and we can’t see the screen, so I made the Pi an AP, and I’m using a simple Omxplayer PHP interface this person, Juggler, created to select and play videos:
forum link

I haven’t actually put the Pi / 7″monitor / speakers in the car yet, but it works pretty well. You just attach your phones to the AP, and pull up the web interface.

Avatar

In a car, it makes sense, because that’s likely to be your only access point (so if you have an iPhone, it will just automatically switch). In a home environment, where there is likely to already be a “real” AP that you’re connecting you iPhone to, having your “internet of things” devices all set up as APs would require you to constantly change AP association through the iPhone settings, which I suspect would get old very quickly.

Avatar

Well I’ve set this up, and you don’t need to keep changing your phone, as if you use the RPi AP it will pass all your other comms onto the network just as well as your original one, via the wired ethernet connection which is also connected to the RPi. It will only intercept stuff sent to the actual AP address to go to the PiUi. So you can leave it there and the RPi works fine as an AP in conjunction with your usual one.

Avatar

I really do like the idea of something that makes it easy to prototype phone/tablet UIs that interact with a service running on the PI. Frankly most of the ideas that I have for the Pi will work this way, and if there’s something that keeps me from having to hand-code the UI and server code (at least in the prototype stages), then I’m all for it!

This is why I’m dying for the Model A to become available in North America… you don’t need 512MB of RAM or a built in Ethernet port to implement a service that interacts with a tablet/phone UI (and saving $10 and consuming less power is nice too)!

Avatar

come on ,dude, let’s show with it ~~!

Avatar

I use the Coversal Android app which pretty much does this already. The Pi is connected to my home network wirelessly and Coversal is a wifi remote app that you can customize using SSH and Bash scripts. I use it to turn my streaming webcam off or on, start a VNC connection, or whatever. You can easily control anything on your Pi using Python and Bash scripts and this app.

Avatar

Can someone please give me some instructions on how to set PiUi u without turning the Pi into a access point?
I installed Nginx and followed the do-it-yourself instructions from “Configure nginx”. Everything is installed and the piui_demo.py works without errors. However, when I type in the IP of the Pi, I only see the “Welcome Screen” from nginx. Any help would be highly appreciated. Thanks

Avatar

if you follow the instructions in the “The do it yourself section” https://github.com/dps/piui it sounds like you may have not modified /etc/nginx/nginx.conf

I deleted everything in this file and pasted the text from the link https://github.com/dps/piui/blob/master/nginx-conf/nginx.conf

After following everything in the do it yourself section I had to install the python module cherrypy with the command “sudo apt-get install python-cherrypy3”

Avatar

hmm nice thing but because i need the wlan for other things, it is nothing for me :-(
Could it also work over bluetooth?
or is ther a similar project which work over bluetooth?

mfg

Avatar

Right well that’s a’Pi-Powered’ in store displays sorted…
Any sort of public announcement board\security alerts etc
Setting of a Pi based Alarm system with the new fangled camera.
Operating slightly remote kit in hazardous areas (the cat flap in a tiger cage)
Etc,,,

BTW if “Pi-Powered” or “Powered by Pi” or any other combo isn’t TM’d already; I’m planting my flag to claim it and donating it straight to the foundation.

Avatar

Thank you.
It seems that I installed another version of nginx.Wit the apt-get install it worked perfectly.

Avatar

Followed the instructions, and checked the content of the ngnix.conf file but I still get the ngnix Welcome page. So for some reason it’s not forwarding to Python – any ideas?

Avatar

Found it – typo when I copied the ngnix.conf file.

Avatar

What about the same idea using Bluetooth based communication?

Avatar

Anyway to make it only use a single thread? I am running somewhat time sensitive application and only need a single thread.

Avatar

Just got this working on my new model B Pi. Modified the demo app to notify me via pushover when a button is pressed. Works a charm. All part of a bigger project to turn the lights on and off in my house. Exciting stuff!

Avatar

There appears to be a bug in which if you keep going in and out of the menu items, even using the piui_demo.py, the program eventually hangs. Anyone else running into this issue?

Avatar

I too am experienced the hang issue from going in and out of menu items, the project looks really cool though.

Avatar

When I run piui_demo.py it complains that it cant import cherrypi. Did I miss something?

Avatar

Hey, in the picture, that looks like an iPhone, but when I go over to Github it specifically calls out the project as Raspberry Pi Ui for Android. Is there a way to do this for an iPhone? I’ve got a couple of old ones I’d love to put to good use. (Sorry if this is n00bsville question, I am literally JUST getting started with this platform.)

Leave a Comment

Comments are closed