Viewing Media from a Raspberry Pi on a smartphone - android

I'm relaive new to this topic so my questions are more theoretical.
I try to establish a wireless connection between a Raspberry Pi and a Smartphone to view different kinds of media (Text, Picture and Video). I have some questions regarding this about if and how this works in theory.
Is it possible for the Raspberry Pi o work on a "Standby Mode" until a client device comes near/activates it?
What are the things i need to know about the Raspberry being a server and able to communicate to other devices over WiFi? What kind of software should I use for that purpose?
Is it possible to view the File structure of the Raspberry Pi without an individual app on the smartphone (i.e. web browser)?
In case of testing the concept, which tool(s) should I use to have a relative simple way of testing conections? Is there already an (open source) project existing in hat area?
Would appreciate all / any advice.

I guess it depends on what kind of technologies you are most comfortable with. You just need to have in mind that you are working with a RPI, so it's probably better not to push it and run your full stack on it. You can always use something like Node.js and run a tiny server/API on the board, to which the devices get connected. However, there are some interesting solutions out there that work as some kind of "middleware" and allow you to offload a lot of computational and even development effort to a 3rd party.
If you are not really concerned about the "owning" the setup and don't want to waste time spinning up an entire stack you can try something like Muzzley. It will also require you to run software on the RPI (despite not being a full stack on its own), but most of the communication and interface configuration is available off-the-shelf. It provides an appropriate protocol and a library of components you can just use from the get go. On the other hand, it is flexible enough to allow you to roll out your own components.
I don't believe it will help you directly with your specific issues (standby mode, nearby device detection or file system access) - which should be solved by your own application and software stack - but it will save you a lot of time on more generic stuff by allowing you focus on that issues only.
Full disclosure: I'm part of the team working on Muzzley.

Related

Control android app using another android or iOS app

In what way could I control an android app from another app that could be on iOS or android?
My use case is I want to be able to control an android tablet that's part of a smart-home product. In this case I don't have direct access to the tablet's screen as it's encased inside the product. So I'd like to control the tablet via another android/ios app.
Specifically:
be able to connect the android tablet to wifi
could I host a server on the android tablet to be able to communicate with it once connected to the wifi?
For part 1 I was thinking I could do something along the lines of have the tablet be in AP mode and use the client app to connect to it, is it possible to update the tablet's wifi once that is done?
If you were writing both pieces of software you could, although I wouldn't recommend it- Android is not meant to be a server OS, the battery optimizations and unreliability of Services make it a poor choice. Plain old Linux would be better. But controlling a 3rd party app remotely? You may be able to make something work, kind of. Something like connecting via wifi debugging, rooting the device, and sending raw touch events via the /dev/ filesystem. But it will be fragile, prone to breaking, and really hard to do. You're better off looking into open source solutions, like OpenHab.

Can you manipulate Raspberry Pi sensor data on an Android smartphone?

I am new to using the RPi and just got the A+ model which I have been using to generate different types of data from external sensors. I was wondering if it is possible to send this data it is gathering to an android device in real-time, and if so the best method? I want to be able to notify the user (through a an app made with the Ionic framework) when the data enters a particular range etc.
And also is it possible to do this whilst the user is walking around with both the devices in hand?
The short answer to the question is: Yes, you can ;-)
The longer answer is much longer, since there are many ways to do this.
The one I personally would choose as the simplest is classic Bluetooth (not LE) using the SPP profile, which basically makes the BT link a serial connection between the RPi and the phone.
On this serial link you invent you own streaming protocol suitable for the data you want to transfer.
On the RPi side you install a module such as this: https://www.sparkfun.com/products/12577
(There are many alternatives, but the RN42 module is very foolproof...)
Don't know the level of your hardware skills, you might need something more plug and play if you feel uncomfortable hooking up the 4 wires needed for 3.3V power and serial communications between the Pi and the BT Module...
On the phone side you install https://github.com/don/BluetoothSerial, which gives you an API reachable from Ionic where you can receive the BT data stream.
With that and a bit of coding on both sides you are good to go.
I've used a Raspberry Pi in combination with an Android smartphone & Lego NXT.
Communication was achieved using Bluetooth on Raspbian. I used a cheap $1 USB Bluetooth dongle. The Bluetooth stack had to be compiled for Raspi, which may not be necessary anymore. Steps can be found here: Bluetooth error: Native Library bluecove_arm not available
Bluetooth seems most logical to me.
I'm at work at the moment, hence the lightweight answer, if you'd like to discuss this further then please leave a comment and I'll be happy to provide more verbose response.
You can upload the data to any cloud services. You can use Xively/Box. Xively is specially made for real time data collection.
To connect RPi to Xively, refer this: https://xively.com/dev/tutorials/pi/
For Box, refer this: http://www.sbprojects.com/projects/raspberrypi/webdav.php
You can then use Xively API in your android app. You can see GitHub for this
Google app store already has some apps for you, if you want to use
It might look a little complex. But its really simple once you follow the above methods.

Is it possible to use Android to control relays?

This isn't a highly technical (or specific) question. I just want to know if it is possible to use an android app to control 12V relays.
I want to use this running android:
http://www.mini-box.com/pico-SAM9G45-X
with this touchscreen attached:
http://www.mini-box.com/INNOLUX-7-TFT-with-touchscreen
I want to mount this in my car and write a simple android application that can be used to control my lighting in the car (via several 12V relays). I have a lot of background programming in many different languages, so I am not worried about the application part. However, I have very little experience using software to control hardware.
Any ideas for this would be great. Thanks!
First you'll need to get Android running on your Pico board. There are several releases of Android ported to Pico for you to play with here: http://arm.mini-box.com/index.php?title=Releases
Once you accomplish this, I recommend wiring up an ADK board to the pico and using that to interface with your relays. http://developer.android.com/guide/topics/usb/adk.html The most popular and widely documented ADK board designs are based on Arduino or PIC chips so if you have experience with either I don't think it will be too much trouble. Writing the application would entail writing a program on the ADK which listens for input from an Android app which you also create and reacts accordingly. There's a handful of good information you can find with google searches to help you out and also some dedicated discussion groups.
Alternatively, it may be possible to use the remaining unused pins on the Pico to talk to your relays. I don't know for certain though if the Android ports support this or not.
It should be a fun project to keep you busy for a couple weeks. Good luck, and be sure to write up some information on it if you get it working!
you can find so many relay boards which come with wifi and they have their own app. which you can install in your Android phone or PC or iphone(you can find a ios app for same board). and you can also modify apps according to your choice and there are products which come with input pins also so you can control lights or anything else using those input. you can check this product check this Android control realy and there are so many products available.

Make a mobile device a remote control for a tablet?

I'm trying to make an app on an Android device that will control an application on an iPad or Android tablet. (I'm testing with an Samsung Galaxy S2 and an iPad 2).
The application is pretty simple for now. When one selects a colour on the Android mobile, that colour displays on the tablet device.
The question is, how to connect the two devices. Just now I've verified that I can pair the two devices using Bluetooth. Also, the Samsung has a "Kies" Wifi Direct feature (which I don't understand fully), that allows the iPad to connect to the Galaxy as a wifi hotspot.
The connections are there, but I don't know if either protocol can be used to actually get the apps to talk to each other to get the control I'm looking for.
Should I be using Bluetooth, Wifi, or something else?
And in whichever case, how?
My opinion is that you should not stick so much around the physical medium used for connectivity either is WiFi or Bluetooth. You should abstract this aspect, in both cases you will be using sockets (I'm speaking about Android), if it's Bluetooth you will be using Bluetooth Sockets, if it's WiFi: TCP sockets. You could have a intermediate layer that abstracts the type of connection and through a factory to use either Bluetooth or TCP.
Bluetooth - http://developer.android.com/guide/topics/wireless/bluetooth.html
For WiFi you should study if P2P would help.
You will need two applications:
- one on the tablet - the server which listens for commands from the client (change color, do this or this)
- second on the smartphone - the client which sends commands.
I've built a few apps that do exactly that between iPhone and iPad. But the principle is the same. I used Bonjour networking. It's just a fancy name for ZeroConfig networking between devices. It's written originally by Apple but it's open source so there should be Android support out there for it too. Really simple and easy to work with.
If you already have a working connection then you already have the first half of your answer, that said you should really consider implementing a solution that uses a variety of connection types, WIFI, Bluetooth, etc.. The question I think you are really asking is how to pass data and messages between the apps once you have the connection.
There are a lot of ways to accomplish this. You could implement your own lightweight message passing system. If you haven't done this before it is more complicated than it originally seems, especially as you would be required to implement the system for each OS you end up using.
Should I be using Bluetooth, Wifi, or something else?
It depends on what situations you want your program to work in.
Bluetooth can provide a direct connection between your devices. A potential issue with bluetooth is that it has a limited range. If you're devices need to be far away from each other, you may want to go with wifi. Otherwise, bluetooth could work great.
If both devices are connected to the internet, you can make them talk to each other through there. The advantage of this approach is that it doesn't matter how far apart your devices are as long as they're both online. A disadvantage is that you'll have to figure out how to find the tablet's ip address before you can talk to it. This is actually a HUGE disadvantage because it can be quite problematic if both of your devices are not on the same wifi. You could have the user type in the destination ip address, but you'll have problems getting it to work if the user is behind a router (which will almost always be the case). The point is, it gets hairy.
If both of your devices are on the same wifi, you can use ZeroConf AKA bonjour (like Dancreek said) to figure out what ip address you need to send info to. I've previously used a library called jmdns (easy to find with google) to implement zero configuration networking. It's good because the user doesn't have to worry about ip addresses... it's intuitive for the user.
And in whichever case, how?
Networking is a pretty big topic, so I can't expand on this question to much. Short answer is, it depends on what method you choose. Search for some tutorials and start by getting one of your devices to send something as simple as an int to the other.

Writing Android remote control Desktop

I am thinking to try writing an app that can use android phone to remote control the desktop.
Just want to make sure my concept is correct.
So for the android able to
communicate with the desktop, I will
need some kind of protocol like...
maybe Bluetooth? In my desktop, I
should have a service app that open
Bluetooth connection for my Android.
Is Bluetooth is a good connection
for writing remote control?
Is it possible to use the Bluetooth
receiver from mouse to do the same
thing?
If you want to start with remote desktop I really recommend to you to first do a Desktop pc version before starting with the Android version.
Like Teamviewer. I recommend to do it with WiFi (WLAN) internet. Bluetooth needs a distance of maximum 20 metres. But if you want to do it fast, Bluetooth (instead of WLAN) could be better to do a presentation in the same room.
If you want to access the screen by using your phone, you need to access the mouse on desktop pc (Using of Mouse's bluetooth is not really possible). I think that is very simple. You also need to drive the keyboard. The difficult thing here is to do it with correct keyboard settings and character transmission.
Keyboard Hook
Also one of the most important things is to get it quick: Use Port forwarding on your router and on client side. That is a very tricky thing, Teamviewer is one of the best applications I've seen. They do not need it but still are working quick and direct.
Also take a look to your streamed images. Best way is to use MPEG4. But could be very tricky.
I would do it in the future with my WP7 and a DotNet app. Perhaps we can work together.
Yes, it can be done using Bluetooth, but a better option would be to use WiFi because it has more range and higher bandwidth. You can use sockets to communicate between mobile and desktop. Java provides a class java.awt.Robot which you can use to simulate mouse and keyboard events.
robot.keyPress(KeyEvent.VK_N);
robot.mouseMove(x,y)
Robot class also let's you capture screen, so it is possible for you to replicate desktop screen on mobile just like teamviewer. The complete process of creating an android based remote control is detailed here

Categories

Resources