Shop OBEX P1 Docs P2 Docs Learn Events
Need iPhone plus Android module recommendation — Parallax Forums

Need iPhone plus Android module recommendation

JBWolfJBWolf Posts: 405
edited 2023-04-22 00:02 in Propeller 1

I am using the prop1 to control WS2812 led strips and now would like to be able to control them from both an iPhone and Android phone.
I'm not sure if I should go with bluetooth or wifi or what.
Looking for a recommendation on what module to use, and hopefully an obex/driver for it.

Final goal is to make my own phone apps which establish a connection to the prop and retrieves current state.
Then, via the app gui selections, can send new instructions via simple decimal values and receive confirmation that they were received.

Comments

  • Straight bluetooth is fine but trying to do BLE is a lot more difficult. In any case you need to bluetooth device on the P1 side to receive the data.

    For WiFi the esp8266 or Parallax WiFi module will do the trick on the P1 side and you can write an app or just use a web browser on your phone.

    Mike

  • JonnyMacJonnyMac Posts: 9,158
    edited 2023-04-22 00:47

    A long time ago I made a simple Android App to control a few WS2812s on a modified DEF CON badge. I used MIT App Inventor which I'm told now works on iPhone (I haven't tried it). My app used standard BT but for the iPhone you may need BLE. In my case the buttons created simple text commands that I sent serially over the BT connection. This let me test the P1 code using a terminal before working on that end.

    564 x 1002 - 40K
  • What is BLE?

  • The old Bluetooth standard only supported serial type connections and would use up a lot of power because the radio would be on all the time.

    With the new BLE standard which stands for Bluetooth Low Energy it interduces a new way of communicating with another Bluetooth device. It actually requires the end device to tell us what it supports and how to talk to it. This means more code on the device side of things as well as the host.

    Mike

  • MicksterMickster Posts: 2,698
    edited 2023-04-22 13:44

    Another option is the B4X suite from:

    https://b4x.com/

    I use Android, exclusively for my machine-control-user-interfaces and my weapon of choice for this is OliBasic which is a derivative of RFO-Basic. This is an interpreter that runs on Android-only.
    I am in the middle of a new UI right now and it's absolute child's-play.

    One can edit-save-run directly on the device but OliBasic also has a built-in FTP server. In my case, Notepad++ has the NppFTP plug-in and so I edit on the PC and instantly run on the device. The actual APK file can be compiled on either the Android device or the PC. My Galaxy TAB-7 is currently taking 11s to build the APK :)

    No need to build an APK during development, mind because the interpreter runs the code instantly.

    They call it BASIC but this is what it looks like:

            tmdlay=clock()+250
    
            do
                if add
                    ++svlag
                    if svlag>99 then add=false
                else
                    --svlag
                    if svlag<1 then add=true
                end if  
    
    
                if clock()>tmdlay
                    tmdlay=clock()+250
                    sw.begin knobspin
                        sw.case 1
                            gr.hide bax[bknobmem]
                            gr.show bax[blumknob1]
                            bknobmem=blumknob1
                            ++knobspin
                            sw.break
                        sw.case 2
                            gr.hide bax[bknobmem]
                            gr.show bax[blumknob2]
                            bknobmem=blumknob2
                            ++knobspin
                            sw.break
                        sw.case 3
                            gr.hide bax[bknobmem]
                            gr.show bax[blumknob3]
                            bknobmem=blumknob3
                            ++knobspin
                            sw.break
                        sw.case 4
                            gr.hide bax[bknobmem]
                            gr.show bax[blumknob4]
                            bknobmem=blumknob4
                            ++knobspin
                            sw.break
    
    

    Bluetooth comm's is very straightforward:

    bt.open
    bt.connect
    
    do
        bt.status retval
        'if retval=1 (listening)
        'if retval=2 (connecting)
    until retval=3
    
    'Connected!
    

    https://rfobasic.miraheze.org/wiki/Main_Page

    mougino.free.fr/rfo-basic/manual/

    mougino.free.fr/rfo-basic/

    I like my GUIs to be a bit different:
    https://youtu.be/0OK4x7Ob_eg

    Craig

  • Forgot to mention:

    I have evaluated all kinds of bluetooth interfaces for the Prop side; cost is not an issue in my case but the cheapie HC-05/HC-06 modules tend to be my favorite. Set the baud on the device and that's it. Rock-solid communication reliability. :+1:

    Craig

  • I see Arduino and other boards can use the remoteXY app to interface to android or iphone using bluetooth and other comms methods.
    Has anyone tried to interface the Propeller to remoteXY?
    I guess you would need to hack the low level protocol.

  • @macrobeak said:
    I see Arduino and other boards can use the remoteXY app to interface to android or iphone using bluetooth and other comms methods.
    Has anyone tried to interface the Propeller to remoteXY?
    I guess you would need to hack the low level protocol.

    Honestly, anyone who can program a Prop can handle the B4X suite which is truely
    cross-platform (Android, iOS, ESP, etc.) and they have a great community. Thin wrappers on native code.

    Craig

  • JonnyMacJonnyMac Posts: 9,158
    edited 2023-04-26 15:52

    I see Arduino and other boards can use the remoteXY app

    I had a look at that -- it's really targeted to the Arduino ecosystem because the GUI creator generates an Arduino app that works with their particular library. It may be possible to dig through that library and port it to the Propeller, but it would work and may not get support.

    Craig does like the B4X ecosystem. I looked in the past but wasn't hooked. Maybe I will check again. I have created apps with MIT AI Inventor, but find blocks-based programming clunky and slow.

  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2023-04-26 22:27

    Virtuino might also be an option. Their latest software says that it will work on IOS as well as Andriod. I think we paid $30 to expand the features, but the standard features are pretty functional to get the feel for the environment.

    Virtuino: https://virtuino.com/

    Note: When coding... pad you buttons and sliders with an extra +1 .... IOW instead of 0 and 1 for OFF and ON, use 1 and 2

    Reason? - If the communication fails or you go out of range, ALL values are reported as a 0 ... By padding at least you can determine the failure in code and it might save some headache.

    Here is a screen shot of Virtuino on a previous client project I had ...
    https://forums.parallax.com/uploads/editor/qn/r9n6h5qa55as.jpg

  • @"Beau Schwabe" said:

    Reason? - If the communication fails or you go out of range, ALL values are reported as a 0 ... By padding at least you can determine the failure in code and it might save some headache.

    I guess that's kinda OK. With OliBasic, the bt.status flag becomes "1" if coms are lost but in my case, I have a 10ms heartbeat happening.
    For me, portable (wireless) devices are the only way to go because many of my machines are huge and to jog them around can be hair-raising when you are stuck with the typical fridge-freezer style console. It's impossible to keep your eye on the actual machine and it's sooo easy to wreck something.

    My Android tablets are linked via Bluetooth and so machine setup is similar to robot-teaching. I force the user to use two hands to initiate machine movement and if he has an "oh sh1t" moment, he just tilts the device (sensors) and the machine shuts off.

    https://youtube.com/watch?v=ReN0qNhja1c&ab_channel=Techsquare

    Craig

  • Low power would definitely be preferred, it will be battery powered.
    The B4X's are kinda expensive, I did buy some HC modules, think I have both 5 & 6.
    Hate to ask for someone elses work, but is there any code available for them?

  • MicksterMickster Posts: 2,698
    edited 2023-04-30 06:38

    AFAIK, there is only a cost involved with the iOS product (B4i) [shock-horror], right?

    There is no need for HC-05/06 specific code, just set the baud to what you want and use regular serial comm's.

    The default baud for my units is 38.4K but I have seen setup guides that state that 9,600 as the default. :|

    Craig

  • Are there any single modules that support BLE for both iphone and android?
    Or is wifi possibly as energy efficient?
    I do not need the module to broadcast... having it listen every 5sec for a signal would be fine, similar to a home router with broadcast turned off but security on. I'll just hard code it with an ID/pass.

  • All the information one could possibly need is already in this thread.

    Craig

Sign In or Register to comment.