royh111
Posts: 9
Joined: Wed Jul 16, 2014 4:42 am

Controlling relay using a RPi and Android Tablet

Wed Jul 16, 2014 4:52 am

Hi guys,

Lately I've been busy on a new project.
I want to be able to open and close a few relays and read the temperature. In oder to do so, I figured, I could use a RPI. But I want to be able to control the opening and closing of the relays and reading of the temperature by using a tablet. What I have in mind, is connecting the relay to the RPI, and connecting the Pi to an Android tablet. I would like to use the tablet as a touchscreen monitor for the RPi, and so on controlling my relays and reading the temperature. Should I ask someone to make an app for the Pi or an app for the android tablet. If it's just an app for the pi, can I use the tablet just as a screen? and can I connect it trough a USB cable? and If it's the tablet, that I should make the app for, can I connect it to the pi with a USB cable?

Any suggestions are welcome!

thx in advance!
Roy

riklaunim
Posts: 265
Joined: Tue Apr 22, 2014 7:34 pm

Re: Controlling relay using a RPi and Android Tablet

Wed Jul 16, 2014 6:21 am

You can use VNC-alike application on Android to get RPi desktop remotely and control everything from Raspberry. You can also SSH into Raspberry and control it from command line (or Android GUI app using that shell connection). Both cases assume they are in a network. Alternative option is to use shell over serial that Raspberry by default has. Then those don't have to be in a network.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Controlling relay using a RPi and Android Tablet

Wed Jul 16, 2014 8:26 am

Hi Roy,
royh111 wrote:If it's just an app for the pi, can I use the tablet just as a screen?
Key word is "WebIOPi", google for it.
royh111 wrote:and can I connect it trough a USB cable?
RasPi is not capable of being USB device, just USB host (what is probably true also for your tablet... so, they can't cooperate over USB directly). Consider using WiFi.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

User avatar
DougieLawson
Posts: 37088
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Controlling relay using a RPi and Android Tablet

Wed Jul 16, 2014 10:19 am

FLYFISH TECHNOLOGIES wrote: RasPi is not capable of being USB device, just USB host (what is probably true also for your tablet... so, they can't cooperate over USB directly). Consider using WiFi.
That may not be true. If both use a OTG USB driver then they can negotiate to become USB host or USB slave. The model A does that and many Android tablets can do that.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Controlling relay using a RPi and Android Tablet

Wed Jul 16, 2014 10:52 am

Hi,
DougieLawson wrote:The model A does that
Model A has hardware capabilities for being USB device, but this mode is not supported by drivers (or has this changed lately?).

Anyway, generally speaking, USB OTG requires additional information about one important detail - supported USB profile(s).
Let's see the most common example... if an Android tablet becomes USB MSD (alias "external storage memory"), then your way of the communication can be just via two physical files (RasPi "sends" data by writing it to a file of this "external memory". Application on the Android side needs to monitor its storage for the arbitrary file appearance and then reads its content. The same is true also in the opposite direction). This communication via two files has several disadvantages (synchronization,race conditions) and various workarounds must be included... I just don't consider this one as a solution which can have its place in implementations nowadays...

USB OTG sounds great, but is far from being (an universal / acceptable / viable / ...) solution.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

Return to “Automation, sensing and robotics”