Menu

Android Focuser Bluetooth App

Matt Z
2019-02-22
2019-03-06
  • Matt Z

    Matt Z - 2019-02-22

    Robert, thanks for all your hard work on this project and generosity in sharing it.
    I'm in the early stages of building the ULN2003 version of the focuser, it's breadboarded and working correctly. Before I get to the soldering stage I'd like to be sure it does everything I need it to. One thing I need it to do is adjust focus without physically pressing buttons on a box attached to the scope, thanks to a shaky mount.

    What I'm trying to create is a simple android bluetooth app using MIT App Inventor. I'm not trying to recreate all the functionality of the Windows App, just a simple one that has a row of 8 buttons for -500 through +500 like the windows app, a row of 6 buttons for in fast, medium and slow, and out fast medium and slow, with a halt button between the two rows. Also possibly a text box showing focuser position but that's not a hard requirement just a 'nice to have' thing.

    I have the basics worked out, it connects to the HC-06 (same as HC-05 but no master mode, only slave) and stays connected reliably, and the buttons are laid out. What I can't figure out, or even figure out HOW to figure out is what those movement buttons should send when pressed (in the case of the + / - buttons) or held down (in the case of the in / out buttons).

    I assume the andriod app buttons should mimic the actions of the windows app buttons so that step count isn't lost. Ideally both the apps would be connected simultaneously, windows via USB and android via bluetooth. I'm probably out of my league in trying to create this, but any advice would be greatly appreciated.

     
  • brownrb

    brownrb - 2019-02-23

    commands start with : and end with #
    not all commands return a value
    do not send CR/LF

    to move absolute
    :05xxxxxx#

    for example send
    :052500#
    and focuser will move to position 2500

    to move steps
    :64100#
    will move 100 steps
    :64-100#
    will move -100 steps

    to halt
    :27#

    to get position
    send
    :00#
    focuser will return Pxxxx#
    where xxxx is the current focuser position

    to get if focuser is moving
    send
    :01#
    focuser will return I0# if not moving and I1# if it is moving

    to get temperature
    send
    :06#
    focuser will return Z18,25#
    where the 18.25 is an example of the temperature (always celcsius)

    to set focuser position
    send
    :31xxxxxx#
    where xxxxxx is the new focuser position (focuser does not move, just updates position)
    example
    :317689#
    will set focuser position to 7689

    Email me direct for a complete list
    regards
    Robert

    Will you post app here when finished or on app store?

     
  • brownrb

    brownrb - 2019-02-23

    probably not a good for both but is possible

    the sequence you need need to adhere to is as follows - this is what the windows app and ascom driver do, because the position may have been changed since last time by the user using a rotary encoder or push buttons

    lets assume you want to do a move pushbutton - sequence is same if its 1, 10, 100 etc
    When the button is clicked
    1. get ismoving state
    2. if focuser is moving then do NOT continue - display warning
    3. get current focuser position from the focuser
    4. add the move steps to it to generate temp
    5. check < 0 and if so set temp to 0 (the user could have done -500 and been at position 10)
    6. check > maxstep and if so set temp to maxstep
    7. send temp as new position to focuser (use :05xxxxxx# where xxxxxx is value of temp)
    8. wait 100ms
    9. get ismoving
    10. if ismoving is 1, then focuser is moving so do next steps 11-12. If focuser is not moving then goto 13
    11. wait 500ms
    12. goto 7
    13. focuser is finshed move
    14. get focuser position and update app with final position

    This is then pretty much bullet proof and will work together with push buttons, rotary encoder and usb at same time.

    You do not really need 6 buttons for in/out slow med fast, easier to just use 3
    to set slow speed
    :15xx#
    where xx=00 means slow, 01 means medium and 02 means fast

    to get speed
    send
    :43#
    and focuser returns Cxx# where xx=00 - slow etc

    to get maxstep
    send
    :08#
    and controller returns Mxxxxx#
    where xxxxx will be the maxsteps value

     

    Last edit: brownrb 2019-02-23
  • brownrb

    brownrb - 2019-02-23

    I actually did an android BT app a few years back, I'' take a look to see if I can find it.

     
  • Matt Z

    Matt Z - 2019-02-23

    Thanks so much for all your help and advice Robert, this should keep me busy till the rain stops which could be a while.
    Sure, I'd be happy to make it available. I've never posted anything in the app store but I'll give it a shot when I get to that point or at least post the .apk file here. I think I can share it publicly in the MIT App Inventor as well which would make it easy for people to modify it to their taste.
    On looking into it projects can't be shared on App Inventor but .aia project files (source code) can be exported and someone else can import that file as a project and make changes, etc. I'll attach the current state of it here for now. If you or anyone else sets up an ID there and imports it try not to laugh as I have a full 1.5 days android programming experience but App Inventor speeds things up. All it does at this point is connect to bluetooth and disconnect. The other buttons are there but don't do anything yet. They're formatted fine on app inventor but not so much when installed on my phone but I'll get it figured out.

     
  • Matt Z

    Matt Z - 2019-03-04

    It took a while but here's the finished app. Check it out if you get a chance and let me know what you think.
    I couldn't follow the 'check for movement' steps you described above. I think bluetooth is too slow and it took forever to get the response which slowed things down to the point of being unusable. I got around that by sending a Halt before any movement command.
    I was going to put this in the user contributed section but I don't think I can create a folder there.

     
  • brownrb

    brownrb - 2019-03-04

    Hi Matt
    I have given you access as a "Developer" which means you can create a folder and upload now :-).

     
    • Matt Z

      Matt Z - 2019-03-05

      Thanks Robert, I appreciate that. I'll also upload some schematics when I get further along on that project.

      On Monday, March 4, 2019, 6:30:21 PM EST, brownrb <brownrb@users.sourceforge.net> wrote:
      

      Hi Matt
      I have given you access as a "Developer" which means you can create a folder and upload now :-).

      Android Focuser Bluetooth App

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/arduinoascomfocuserpro2diy/discussion/general/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
    • Matt Z

      Matt Z - 2019-03-05

      Should I be able to create a folder inside your 'User community shared files' folder? I don't seem to be able to do that, don't see any way to create a folder.

       
  • brownrb

    brownrb - 2019-03-06

    Hi Matt
    I am trying to make some sense of the permissions, you are in the correct group with the correct permissions but I do not know why you cannot create - I am waiting on a reply from someone who should know.

    In the meantime I have created a folder
    https://sourceforge.net/projects/arduinoascomfocuserpro2diy/files/Bluetooth%20App/

    and can you try to upload into there (you must be logged in)?
    regards
    Robert

     
    • Matt Z

      Matt Z - 2019-03-06

      Hello Robert, I tried again with both firefox and chrome, and no luck. It's possible I'm missing something obvious. Other than finding and downloading files, sourceforge isn't terribly intuitive. I apologize for taking up your time with this, but can you tell if whatever button I need is missing in this screenshot or if it's staring me in the face and I don't see it.

      On Tuesday, March 5, 2019, 8:13:49 PM EST, brownrb <brownrb@users.sourceforge.net> wrote:
      

      Hi Matt
      I am trying to make some sense of the permissions, you are in the correct group with the correct permissions but I do not know why you cannot create - I am waiting on a reply from someone who should know.

      In the meantime I have created a folder
      https://sourceforge.net/projects/arduinoascomfocuserpro2diy/files/Bluetooth%20App/

      and can you try to upload into there (you must be logged in)?
      regards
      Robert

      Android Focuser Bluetooth App

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/arduinoascomfocuserpro2diy/discussion/general/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
  • brownrb

    brownrb - 2019-03-06

    Hi Matt
    Logout and then login and try again - there should be upload and create buttons

     
    • Matt Z

      Matt Z - 2019-03-06

      Still no luck, Ive tried everything I can think of. Rebooted, cleared cache, even tried on my phone to rule out anything on my PC.

      On Tuesday, March 5, 2019, 8:54:14 PM EST, brownrb <brownrb@users.sourceforge.net> wrote:
      

      Hi Matt
      Logout and then login and try again - there should be upload and create buttons

      Attachments:

      • Untitled.png (160.1 kB; image/png)

      Android Focuser Bluetooth App

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/arduinoascomfocuserpro2diy/discussion/general/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.