Propeller and Android
Moskog
Posts: 554
in Propeller 1
I been searching through the forums on this topic but can't find anything about what I 'm looking for. The closest I can get is this old thread from back in 2010 by Heather; http://forums.parallax.com/discussion/123974/android-android-linking-a-mobile-phone-and-propeller
I shall try to explain very shortly what I really would like to do:
My plan is to use the Propeller to connect to a smart phone (android), then let the phone deal a number and connect to another phone and then exchange datastrings. The remote phone is set up the same way, also with a Propeller, who then receive and answer with another datastring.
Today I'm doing this with two Fona's from adafruit, but they are using old fashion technology, (2G limited to 900MHz) and establishing connection has been pretty slow lately. The last two weeks I haven't got a connection between the two at all. I suspect the cell tower for my master station is not providing 2G at all or is in a kind of error state, because I took the station home and it works here, no problem.
But 2G will be history in a couple of years anyway so I need to go for another solution.
So I would like some suggestions, go for bluetooth or usb, can I use AT commands here? What should such an (android) application include?
Best programming platform, Android Studio or Visual Studio, others?
All kind of suggestions will be highly appreciated!
I shall try to explain very shortly what I really would like to do:
My plan is to use the Propeller to connect to a smart phone (android), then let the phone deal a number and connect to another phone and then exchange datastrings. The remote phone is set up the same way, also with a Propeller, who then receive and answer with another datastring.
Today I'm doing this with two Fona's from adafruit, but they are using old fashion technology, (2G limited to 900MHz) and establishing connection has been pretty slow lately. The last two weeks I haven't got a connection between the two at all. I suspect the cell tower for my master station is not providing 2G at all or is in a kind of error state, because I took the station home and it works here, no problem.
But 2G will be history in a couple of years anyway so I need to go for another solution.
So I would like some suggestions, go for bluetooth or usb, can I use AT commands here? What should such an (android) application include?
Best programming platform, Android Studio or Visual Studio, others?
All kind of suggestions will be highly appreciated!
Comments
I would look into the XBEE 3 LTE-M units as they can just transmit the information just like Fona does. I did read on the Adafruit site that if you use an AT&T SIM you can get to 3G.
If you were close to a WiFi network you could just use a Parallax-ESP unit and send the data over the internet. Far easier and less costly.
Mike
I've always used Bluetooth to communicate between the Android and Propeller.
I've used the HC-05 and the ESP-32 as Bluetooth modules.
I started out using MIT's App Inventor 2 which worked but this becomes unmanageable with large programs. I switched to Android Studio for app development.
I'm not really a fan of Android Studio but I haven't found a better alternative.
Here's a screen shot of the app I'm working on.
Creating an Android app in Android Studio is pretty involved. You'll need to set the app's permissions to use Bluetooth and you'll need a way to select the Bluetooth device from within the app. I use two separate loops in my app. One loop manages the Bluetooth transmissions and the other watches for data being received via Bluetooth.
As with any communication protocol, you need to decide if you're going to use ASCII characters or raw data with a checksum. I chose to use data packets with a checksum.
If your app is simple, starting with App Inventor 2 (AI2) would likely be easier.
It has been over four years since I've used AI2 but I did make a few low quality videos on the topic. Here's a link to the first of three videos. The two unlisted videos are linked in the description of this first video.
I keep meaning to make a bare bones Bluetooth example in Android Studio. There's a good chance I'll be working on this program this week.
Hmm, that XBEE looks very interesting, I wonder if I could use the same SIM-card as I use with FONA. Need to check that out.
In Norway, we don't have any 3G. It's gone forever. We still have 2G, but only for a limited number of years now. Will be taken out and completely gone by 2025.
Left will be 4G, 4G++ (or something) and the new 5G. 5G is up and running in our nearest city, Trondheim, but still only for the few who own a compatible phone.
But you gave me an idea, there is no Wifi network at this remote location, where I keep my master station. But a cell tower in sight. I could probably buy a cheap smart phone, use my FONA SIMcard and then make a very local WiFi network there by using the phone. Then I could use the Parallax-ESP unit you mention, or maybe an RN-XW Wifly module, like the one I'm already using here, and already have SPIN-code for.
Maybe that will be the solution, the unit doesn't even have to call home but transfer the datafiles directly to the server using FTP.
Datastrings, or files for all kind of commands could also easily be sent the other way with one of those units.
Something to think about.
Mike
One can write code directly on the device or on the PC.
The launcher is what you need to communicate with the PC.
More info to follow...
http://mougino.free.fr/rfo-basic/
Manual is attached.
This one adds support for BT-LE which will allow support for such things as multiple sensors, etc.
I then use RFODESIGNER to define the appropriate touch areas and it will then auto-generate the required code template.
https://sites.google.com/site/rfodesigner/
According to Telenor's website they used two different frequencies for the Norwegian 3G network, the one used along roads and the coastline and in less populated areas was closed down last year. The other, used in the bigger cities is supposed to be closed down by the end of 2020.
As I understand. your phone will still work after the 3G is closed, but with less audio quality and be much slower. But only as long as the 2G is up and running.
But the carriers want to sell you new phones that will last 3 years at best, so they don't have an incentive to keep supporting the old ones...
Erlend
Sorry, no I haven't. Not before you mention it. So I been searching around a little bit here, trying to figure out what it's all about.
As I understand, it's a free network, using small, low power devices who connects to gateways, set up by yourself or others, like link stations, ontop of hills or buildings for longer range. And these devices can transmit and receive small packets of data.
As you know, I don't have any experience here on the LoRA technology, but is this something you would recommend? I need to be able to transmit a few bytes between the two stations, maybe once in an hour.
I have bought a modem, but not yet gotten around to trying it.
He has explained and documented the sensor-Prop1-bluetooth-Android workflow very well with coding samples for the Prop1 and MIT App Inventor.
Although simple, this application documentation can easily used as a model for more complex applications.
Congratulations and thanks for a useful article Kenichi!
Any progress on the Android to Prop over bluetooth example? I am looking for a couple examples of this for an upcoming experiment.
Thanks,
FF
I didn't end up working on the Bluetooth example. It's still on my TODO list. Knowing someone is interested in seeing it will likely help to motivate me to work on this in the near future.
Bill M.
Not here but there is nothing easier than the stuff I posted above.
We did it back in 2010 for Robots Anywhere 1.0, and is very straightforward. The HC05 is just a UART, and BluetoothAdapter is your Android class to use to get an inputstream and outputstream. Sorry for the necro!
I'm not sure if I'd call anything in Android "very straightforward". I got things to work in the app to interface with a flowmeter but I'm still baffled at how complex an Android app is.
You website sure has a lot of cool gadgets and info. I'm glad to have seen your link.
I don't know if some of you allready knows, but just tried a simple android app to interface with the propeller, app name is "Bluetooth electronics". It is able to show graph, buttons, gauges, and a lot more. Everything is user edit able, screens can also be automatically setup by propeller over serial port.
I connected to android phone using a OTG USB adaptor and just the normal parallax programming plug.
Second choice is AppInventor, but it is a bit more complicated to make an android app this way.
That looks very interesting. Thanks for the suggestion.
That's OK for small apps but it becomes infuriating once the app gets big. App Inventor is easier to learn to use than Android Studio but in the long run Android Studio wins out if you need more than a simple app.
I agree App Inventor is only for simple things..
Bluetooth electronics is very great for making a fast debug grafical user interface. It literally only took me five minutes to make the shown G-force debugger.