Shop OBEX P1 Docs P2 Docs Learn Events
Propeller and Android — Parallax Forums

Propeller and Android

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!

Comments

  • I have used standard Bluetooth modules to do this. Some time ago I made a "Stranger Things" wall that could spell any word entered into a simple Android app (I uses AI2) or Bluetooth terminal. The code on the Propeller side was a simple parser; it looked for keywords first (e.g., color change), and if the word (like a person's name) was not on that list then it would just spell it out. Easy peasy.
  • Trying to interface with a phone is one thing and another to be able to control the it. To many things that can go wrong there. Powering the phone, starting the AP, reconnecting the app.

    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
  • Duane DegnDuane Degn Posts: 10,588
    edited 2020-03-23 19:32
    I've used an Android app with with the Propeller many times.
    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.
    App200323a.PNG
    Moskog wrote: »
    So I would like some suggestions, go for bluetooth or usb, can I use AT commands here? What should such an (android) application include?

    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.

    551 x 913 - 73K
  • iseries wrote: »

    ….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

    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.


  • Also they make hotspots that could be used in place of the phone for network connectivity.

    Mike
  • This is the easiest way to program for Android. It's a BASIC interpreter and absolute child's play.

    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...
  • Launcher for the PC and other useful add-ons:

    http://mougino.free.fr/rfo-basic/

    Manual is attached.
  • BASIC! is open source and so there are several derivatives.

    This one adds support for BT-LE which will allow support for such things as multiple sensors, etc.
  • I put a lot of emphasis on GUI sex appeal and so I prefer not to use code to create my GUI elements. Instead I create full-screen bitmaps in a paint app.

    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/
  • TorTor Posts: 2,010
    In Norway, we don't have any 3G. It's gone forever.
    My 3G-only phone still works, so it's not dead yet. But the frequency band is supposed to be used for 5G in the future. Despite what was said last year 3G is still here though. I personally couldn't care less about 5G anyway.
  • Tor wrote: »
    My 3G-only phone still works, so it's not dead yet. But the frequency band is supposed to be used for 5G in the future. Despite what was said last year 3G is still here though. I personally couldn't care less about 5G anyway.

    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.

  • Going through these network standards so fast is quite wasteful, isn't it?
    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...
  • I suppose you have already looked into what LoRa can do?
    Erlend
  • Erlend wrote: »
    I suppose you have already looked into what LoRa can do?
    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.
  • Sounds to me LoRa could be the a good solution. In short it is low bandwidth, long range comms. If you are lucky there is coverage in the actual are, if not you'll have to set up your own link. Best place to start I believe is https://www.thethingsnetwork.org/
    I have bought a modem, but not yet gotten around to trying it.
  • I see forum member Kenichi Kato has written a nice article of a Prop1 application to monitor home deliveries via an Android phone interface which is published in the latest issue of Circuit Cellar.
    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!
  • @"Duane Degn"

    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
  • @"Duane Degn"

    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.


  • Not here but there is nothing easier than the stuff I posted above.
  • Was it Flutter that @idbruce said didn't support Bluetooth? I had a quick look and couldn't find anything.
  • @"frank freedman" said:
    @"Duane Degn"

    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

    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!

  • @RbtsEvrywhr_Riley said:
    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.

  • Duane DegnDuane Degn Posts: 10,588
    edited 2021-04-20 02:44

    @MAElektronik said:
    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.

    That looks very interesting. Thanks for the suggestion.

    @MAElektronik said:
    Second choice is AppInventor, but it is a bit more complicated to make an android app this way.

    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.

  • @"Duane Degn" said:

    @MAElektronik said:
    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.

    That looks very interesting. Thanks for the suggestion.

    @MAElektronik said:
    Second choice is AppInventor, but it is a bit more complicated to make an android app this way.

    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.

Sign In or Register to comment.