I am new to Raspberry Pi. I wish to turn on/off a light and play some sounds on the Pi from my phone both Android and iPhone. It is a kids toy that I am prototyping.
I need the setup to be easy for any user to download the app and just connect to the Pi with little trouble. I dont want the Pi connected to the internet so no external api services.
I have search for tutorials but surprising nothing other than using a service.
Could anyone poin me in the right direct. I dont have a preference over bluetooth of wifi. Just one that is easy for a kid or parent to setup.
Thanks
You mentioned playing sounds, you need a beeper (if those sounds are more complicated, use a speaker). Also, you need those lights connected to GPIO (USB is also a viable option, by simply turning on/off the USB port).
Issuing a USB Hub class request (CLEAR_FEATURE PORT_POWER) to port 2 on the LAN9514 will > deactivate the USB output power switch.
There's an app for that:
https://github.com/codazoda/hub-ctrl.c
This is a bit harder to setup, but you don't need any soldering with this. Then, you need to setup an AP for the kids to connect to the Raspberry Pi's website (should be a website, app is harder to make). Also why you don't want the Raspberry Pi to connect to the internet?
Are the lights you want to turn on/off wired to the Raspberry Pi (for example via GPIO)?
You need to install one of the open source automation software (like OpenHAB or Home Assistant, etc.). Disable port forwarding to the Raspberry Pi (usually you need to do this port forwarding, so here you don't need to do anything).
In this case, the IP is a local IP, and you get local access only.
Then probably you need is already implemented by someone from the community, or you need to develop a simple script to achieve what you want.
Related
Use Case:
I am working on a project which involves a android phone and Raspberry Pi. Raspberry Pi unit would be planted with sensors in the field and once in a while user would walk around with the phone and try to get the readings from the Raspberry Pi. So the app's responsibility is to get the data and plot the graph.
Design:
I was planning to allow user to select the location of the file once the devices are paired. As of now, identification of available devices, programmatic pairing of devices has been done. But I am unable to navigate the Raspberry Pi's file system from android. How do you achieve that?
Any help would be appreciated. In case you pointing to this resource, please explain as well (taken from selected answer here).
You may deploy a Java application on your Raspberry pi and connect it with your Android app via a bluetooth socket:
Send data from android bluetooth to PC with bluecove
From there you can execute File.listRoots() and create your own remote dir browser.
I'm aware it's been asked before (with limited or no solution) but I haven't seen any recent updates and I think my scenario is unique so I'll start a new thread.
I have a Raspberry Pi and it's functioning as a hot spot among other things. By design, DHCP isn't handing out a default gateway. My use case is one or more devices interacting with the Pi as a server.
One of the connected devices will be a mobile device(edit: running a custom app of my design which is part of the total solution), and that device will maintain its cellular connection, not for tethering or routing but so that the application can access internal and external resources simultaneously.
Currently:
IOS: This works exactly as I expect on IOS - it senses that the WiFi network doesn't have a default gateway and sends external traffic over cell.
Android: This doesn't work at all. Android stubbornly sees WiFi connected and disables cellular, even with no default gateway.
Windows Phone: Kind of a hybrid. Both networks stay up but my scenario has a DNS entry in public DNS, and a public site links to a resource on the Pi. If I link to the resource directly using the WiFi IP address of the Pi, it works fine (although this causes other issues related to security). If I link via a FQDN, I'm actually not sure what's going on. It doesn't resolve from the web browser although every networking utility I've installed on the phone for troubleshooting correctly resolves the FQDN to the Pi address via DNS.
Hope this makes sense. The question: How can I enable this functionality across the board in 2015? :) For my purposes, the Pi as a private nonroutable hotspot works better than WiFi direct or Bluetooth. And remember I'm not asking the phone to ROUTE; I need my custom application to be able to simultaneously connect to the Pi and to the public Internet. I want all the phones to do what IOS does in this regard.
My current scenario is the Pi hosting a web page (among other things) and that's my preference, but can this even be solved natively?
You say that this is not a tethering or routing situation, but if you think about it, it really is both.
It is routing because the traffic from the phone needs to be routed to one of the two interfaces. There may not be routing through the phone, but it's still a routing problem. Fortunately, it seems that the routing part is working on all three platforms.
It is also an unusual form of tethering. The only differences are that traffic does not originate from the Pi, but from the phone, and that the Pi rather than the phone acts as the access point.
Thinking of it in terms of tethering is important because it shows that the Android CAN have WiFi and cellular active at the same time (at least in hotspot mode, but probably also in client mode). In this respect, my answer isn't complete - I can't tell you HOW to accomplish that.
As for the Windows phone problem you mentioned: in order to troubleshoot that, first identify where the DNS server is located that knows about the Pi's FQDN. Does a public DNS server know about it, even though it is obviously on a private network?
There are two possible explanations for your observation:
There is no public DNS server that even knows this FQDN. In that case, IOS is probably using something like mDNS to locate the Raspberry Pi.
There is a public DNS server that knows this FQDN. In that case, maybe Windows Phone checks the DNS reply for martians and rejects it, thinking that it is an attack.
Either way, what you'd really need is to have two separate DNS infrastructures. One way to do this is to include a small DNS server (dnsmasq maybe) with your app, and configure a forwarder for the zone with the Pi's FQDN to forward to the Pi's IP address (which would have to be hardcoded, obviously). All other requests should go to the normal DNS servers.
Another way might be to not use DNS at all, but use the hosts file instead.
For Android phone you can use application named "WiFi & Mobile Data Switch" (https://play.google.com/store/apps/details?id=com.totemsoft.wifimd). For me it solves the problem of simultaneous connecting to internet (via mobile data) and to local network (via WiFi, internet is inaccessible via WiFi). This applications works ok on Samsung Galaxy A8. I hope, my comment helps to somebody.
I'm currently working on a project, involving a Raspberry PI and a tablet. Now the tablet should be able to communicate with the Raspberry PI, even though it does not have internet. I was thinking on Bluetooth first, but that's not really an option either, is there something you can suggest me?
Many thanks.
If you make the raspberry pi a wifi access point, the tablet can connect to the pi, however unless the pi has a connection using ethernet you will have no wifi whatsoever. Adafruit has a reasonable guide to actually getting setup. I havent tried it, i had just looked it up earlier this week and it was still an open tab.
https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/what-youll-need
If you havent got a wifi usb, nor a bluetooth, youre kinda out of luck, you could if you have the skills, hook up the audio output from your tablet to the pi's io (may require more then just wire, im not sure the amps, voltage, etc), and write an app that translates data into the signal to tx/rx over the audio cable, to make it wireless you could use ir transmitter/receiver pair, but again this is a lot more work.
Update from comment: alternately the tablet could be made a hotspot, and you can connect to its wifi using the pi, however, since the fastest speed of your whole setup is your 3g/4g connection itll not get better then that regarding speeds, im not sure if its possible to connect to wifi with tablet and push out hotspot for the pi to connect through, but you could try that out as well
I am trying to wirelessly connect my android phone to a Raspberry-Pi, so I can then make a controller app to interact with the RPi.
I have just bought a dongle, as I was thinking of using Wifi-Direct. However this doesn't look as simple as I originally thought.
There's not much information out there on how to do this, and I am completely new to RPis.
I have found the odd tutorial like this: https://www.youtube.com/watch?v=6GPv8TfZqe4
But it seems overly complicated and I am not sure if they applicable to my dongle.
I am thinking there must be a more simple way to do this(e.g. through wpa_gui on Raspbian)
Any suggestions on how I could achieve this?
You can try:
SSH to raspberry Pi with given credentials (if both devices are connected to the network... but that may not always be doable)
Setup web API/app on RPi and use it via browser on Android (like https://github.com/NeonHorizon/berryio )
Use Bluetooth UART: Adafruit has a full blown Bluetooth UART board, and Chinese make many slave (or master) UART serial boards. This way you could open a serial connection from the phone - and with luck you would get the terminal which by default is cloned to UART in RPi (or it would get your script running on Pi and handling incoming UART messages).
I'm working on a project to automate some tasks (such as play a song, play a video, receive bluetooth data, etc) on an Android phone from a PC.
Basically the PC will send a notifier to the phone and an app or something on the phone would then process the notifier and do 'something'. The opposite of this really:
http://code.google.com/p/android-notifier/
I've seen some examples showing how to send commands to an Android listener app or service via a network connection, but in this case, I would much rather the transmission be over a physical connection.
USB
Ideally, I'd like the connection to be via the USB port. But I've seen some posts online that suggest that the SDK does not natively support this. (Android apps, communicating with a device plugged in the USB port).
Is there some other SDK/API out there that makes this easier?
I've seen some posts on the ADB, but don't really get it... Would that work?
(http://developer.android.com/guide/developing/tools/adb.html)
Serial over USB
I've also seen some sites that show how to use a breakoutbox to perform bi-directional serial communication, but only with the G1. Is this possible with newer phones?
The Phone
I'm open to really any newish phone. I'm currently looking at the Galaxy S, because it has the video out through the headphone jack. I'm open to rooting if need be.
Implement a HTTP server in your app, then put your phone in USB Tether mode. This will create a local network between your phone and your PC. You should then be able to send HTTP request or create websockets using the phone's ip.
EDIT : I tested it, and it works, see here
What you can do is the phone acting as a server and then use adb to forward ports [1].
In this scenario the pc app would connect to localhost which would be redirected to the app on the phone via the usb cable.
But if you go this way, you might just as well simply connect directly to the phone's ip (without the adb port forwarding)...
[1] http://developer.android.com/guide/developing/tools/adb.html#forwardports