Jump to content

  •  

CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.

Photo

Using SkyPortal (or SkySafari+) over HomeBrew Bluetooth AUX connection

  • Please log in to reply
58 replies to this topic

#26 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 18 May 2021 - 10:35 PM

Yeah, I emailed him about that.  The app currently uses 255.255.255.255, and I suggested that he should be using whatever the broadcast address is for just the WiFi connection, so that it doesn't "leak" onto cellular/mobile data.  No way for me to tell if it does leak, though.



#27 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 18 May 2021 - 10:40 PM

After several days of sitting at the computer with my sprained foot in a bucket of ice water, tonight I lugged the scope outside and had a good look at lots of DSOs and other objects of interest.

 

This gave the first opportunity in a very long time to use some of the newer scope goodies!

 

The BT/AUX connection worked for a while, and then suddenly stopped.  I was unable to revive it during the session, short of powering everything off which I was unwilling to do.  So I switched to WiFi and all was great as usual from then on.

 

What I think happened with the Bluetooth, is the Android Tablet lost contact with our house WiFi.. and when WiFi went down, so did the simulated TCP ("WiFi") connection used to redirect the Bluetooth.  More experimentation required, but that's my theory as to what happened.   We may need to figure out a workaround, if that's the case.



#28 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 19 May 2021 - 07:58 AM

Anyone who wants to try use it, this is the Android BT/USB/TCP Bridge Pro app, available on Google Play for a mere $0.99 at the moment:  https://play.google....&hl=en_US&gl=US.

...

In the BETA version, just set up "Device A" to be "classic bluetooth device" (the HomeBrew must be powered on and paired with Android already).  For "Device B" then select "TCP Server", and check both boxes for "Allow new.." and "Broadcast UDP..".  Set the UDP Packet data to {"AMW007"} (including the brace brackets and double quotes) and the Remote UDP Port to 55555

 

After that, fire up SkyPortal or SkySafari in "Access Point" Celestron Wifi mode, and connect!

 

To automate the Bridge app settings, go to the app menu (top right corner) and tap on "Autostart setting", then follow the prompts.  Very cool.

Even MORE COOL:  The BETA version is actually "open to all comers"You just have to find it!

 

On Google Play, search for the BT/USB/TCP Bridge Pro app, open up the page for it, and then SCROLL TO THE BOTTOM, where one can then tap on Join the beta.  Doh!  smile.gif

 

And.. the free app coupons I received from the developer are valid for about 3 months.. but once used to get the app, the app is permanent!!  I still have a few left for anyone who wants to join in!


Edited by mlord, 19 May 2021 - 08:29 AM.

  • coollick likes this

#29 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 19 May 2021 - 08:24 AM

The BT/AUX connection worked for a while, and then suddenly stopped.  I was unable to revive it during the session, short of powering everything off which I was unwilling to do. 

..

What I think happened with the Bluetooth, is the Android Tablet lost contact with our house WiFi.. and when WiFi went down, so did the simulated TCP ("WiFi") connection used to redirect the Bluetooth.

Yes, that is exactly what happened.  I have experimented more with it here, and that was the issue.  This is compounded by my asking that the UDP broadcasts go only to the WiFi interface.  So no WiFi, no way to connect (doh!).

 

The solution, already verified here using Termux again, is to instead send the UDP broadcasts to to the loopback interface under all conditions -- this then works with and without WiFi.  So instead of 255.255.255.255 the apps or script should all be using 127.255.255.255, which works!

 

I've emailed the Bridge app guy again.  He's been very nice thus far, and I hope this is the final bit of it.  It'll likely be a day or two before I hear back from him -- timezone differences.

 

Cheers


Edited by mlord, 19 May 2021 - 08:40 AM.


#30 coollick

coollick

    Explorer 1

  • -----
  • Posts: 55
  • Joined: 21 Feb 2021
  • Loc: Ottawa, Canada

Posted 19 May 2021 - 10:31 AM

Excellent.

 

Tapped Join beta 

It said wait a few minutes ... i checked back a few hours later.

Updated to the beta v3.9  (says UDP broadcast address isnow correctly set) so I guess he already fixed it. waytogo.gif

 

Maybe he changed address to broadcast on WiFi instead of 127.255.255.255 or that is how it was before ... I see the broadcasts on my pc (Wireshark) with destination 192.168.1.255. 

 

I will try this over the weekend, now praying for clearskies. 


Edited by coollick, 19 May 2021 - 10:37 AM.


#31 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 19 May 2021 - 10:46 AM

No, v3.9 was released last night before I emailed him this morning about the broadcast issue..  It will all work in v3.9 so long as the device has a WiFi connection to anything other than the HomeBrew (when trying to use Bluetooth).

 

The 127.* fix is needed for Dark Sky locations or anywhere else where there is no WiFi..


Edited by mlord, 19 May 2021 - 10:47 AM.

  • Chote and coollick like this

#32 coollick

coollick

    Explorer 1

  • -----
  • Posts: 55
  • Joined: 21 Feb 2021
  • Loc: Ottawa, Canada

Posted 19 May 2021 - 06:13 PM

1. I think broadcasting should be based on the network that the tcp server is running on.

2. The app should allow us to choose which network interface we want the server runing on (or a toggle between wifi or localhost), in our case we would choose 127.0.0.1 (localhost).

(better a dropdown of network interfaces, to support all other types, ex: Ethernet adapter on USB OTG or whatever else)

 

It seems to broadcast on the wifi network only, which is why i see the destination address 192.* on my home network.

 

If you turn off your Wifi before configuring the TCP server, you will be able to start it on localhost

But I beleive its still trying to broadcast on the wifi interface. ( I don't know how to listen in on the localhost of my phone)

 

So I did a little test...

With Wifi Off

Configure Device B TCP server on localhost with broadcasting and start.

Screenshot_20210519-190432.jpg

Later I turn on and connected to my home wifi, and the broadcasts started showing up on my home network.

 

 

For now, I know of a workaround for Dark Sky locations "without wifi", bring your own wifi (another phone or tablet and use it as a hotspot) 


Edited by coollick, 19 May 2021 - 06:22 PM.


#33 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 19 May 2021 - 06:32 PM

Yes, it currently does WiFi-only UDP, because that's what I asked him to do.  But I got it wrong.  He's fixing it now.

 

Cheers



#34 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 20 May 2021 - 07:30 AM

There is another (v4.0) BETA release of the Bridge app out today.

But it still has a basic issue:  the TCP Server function does NOT work over the loopback interface.  So it will not do bridging unless there is an established WiFi connection.

 

I'm still emailing with the author trying to help him.

We seem to have complementary non-overlapping skill sets.  smile.gif

 

From my own testing, I know that this is possible and should be simple to do.  Eg. I can set up a fake server of my own on Android, with this command:

 

   ## Turn WiFi off on the device, then do this:

   nc -L -p 2000   ## netcat listening on TCP port 2000

 

From another terminal window (or "adb shell") then try to connect to that server:

 

   telnet 127.0.0.1 2000

   Connected to 127.0.0.1

 

So it is possible to do, and should be simple.  But goodness knows about those Android APIs!

One can repeat the same test against the TCP Bridge app.  First stop the nc server, and then start the bridge app listening, again with WiFi turned OFF on the device.  Now try to connect to the bridge app the same way:

 

   telnet 127.0.0.1 2000

 

The connection hangs at SYN_SENT, probably because I see Android responding with SYN_RECV over IPv6 instead of IPv4.  ("netstat -ltn" will show tcp connections/attempts).

 

OnePlus5:/ # netstat -ltn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State     
tcp        0      0 127.0.0.1:80            0.0.0.0:*               LISTEN    
tcp        0      0 127.0.0.1:443           0.0.0.0:*               LISTEN    
tcp        0      1 127.0.0.1:47071         127.0.0.1:2000          SYN_SENT  
tcp6       0      0 :::2000                 :::*                    LISTEN    
tcp6       0      0 ::ffff:10.98.233.:37798 ::ffff:172.253.62.:5228 ESTABLISHED
tcp6       0      0 ::ffff:127.0.0.1:2000   ::ffff:127.0.0.1:47071  SYN_RECV

 

I hope he figures it out.  I may see if I can find out about the Android APIs for setting up listening sockets (aka. "servers") and look for something to suggest to him.

 

Cheers


Edited by mlord, 20 May 2021 - 07:33 AM.


#35 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 20 May 2021 - 04:54 PM

There is another (v4.0) BETA release of the Bridge app out today.

But it still has a basic issue:  the TCP Server function does NOT work over the loopback interface.

Well.. actually..

 

It works fine as intended on my Android 10 tablet.

But not on my Android 10 smartphone.

 

Go Figure.

 

Could others here please give a go and report back?



#36 coollick

coollick

    Explorer 1

  • -----
  • Posts: 55
  • Joined: 21 Feb 2021
  • Loc: Ottawa, Canada

Posted 21 May 2021 - 09:24 PM

Awesome, this is super cool, it all works really nicely over bluetooth. But the sky ain't clear tonight, looks promising for the next 2-3 days.

Love the autostart script.
I configured it with my wifi off. After this, it works perfectly, does not matter if I am wifi connected or not.

The only minor thing is if I restart the BT/USB/TCP app, the Homebrew does not want to reconnect bluetooth until I unplug/replug it, but that's not really important to me, it's an easy 3sec fix.

Using v4.0(beta) and Homebrew v3.4, Samsung A70 android 11.


Edited by coollick, 21 May 2021 - 09:25 PM.


#37 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 22 May 2021 - 08:40 AM

 The only minor thing is if I restart the BT/USB/TCP app, the Homebrew does not want to reconnect bluetooth until I unplug/replug it, but that's not really important to me, it's an easy 3sec fix.

I saw something like that with v3.9 of the Bridge app, and did not investigate further.  But I will have a look at it now, so thanks!



#38 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 22 May 2021 - 08:55 AM

The only minor thing is if I restart the BT/USB/TCP app, the Homebrew does not want to reconnect bluetooth until I unplug/replug it,

In the Arduino IDE, do you have version 1.0.6 of the ESP32 support installed?



#39 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 22 May 2021 - 09:10 AM

I saw something like that with v3.9 of the Bridge app, and did not investigate further.  But I will have a look at it now, so thanks!

Unable to reproduce it now on Bridge app v4.0.  I use these settings for the TCP Server and UDP broadcasts:

 

bridge_TCP_Server_settings.jpg


Edited by mlord, 22 May 2021 - 09:13 AM.


#40 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 22 May 2021 - 09:31 AM

Unable to reproduce it now on Bridge app v4.0.  I use these settings for the TCP Server and UDP broadcasts:

 

attachicon.gifbridge_TCP_Server_settings.jpg

I take that back.  I got it to happen, just once.  Shortly after turning OFF WiFi on my tablet.  It was unable to reconnect to the HomeBrew for quite a while after that, until I eventually noticed that the v4.0 autostart settings were showing 255.255.255.255 for the broadcast address, even though I had checked "Use loopback" as shown above.

 

So I tapped on "Enter address manually" for UDP, typed in 127.255.255.255, and it all began to work again after that.  And continues to work even after I reconfigured it all to "Use loopback" again.

 

So.. some kind of minor bug in the Bridge app, (or in the b4a toolkit it uses) I think.


Edited by mlord, 22 May 2021 - 09:31 AM.


#41 coollick

coollick

    Explorer 1

  • -----
  • Posts: 55
  • Joined: 21 Feb 2021
  • Loc: Ottawa, Canada

Posted 22 May 2021 - 03:20 PM

In the Arduino IDE, do you have version 1.0.6 of the ESP32 support installed?

I was on 1.0.5

 

Updated to 1.0.6 and BT reconnects without need to powercycle the homebrew. Perfect!



#42 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 22 May 2021 - 03:31 PM

Updated to 1.0.6 and BT reconnects without need to powercycle the homebrew. Perfect!

Excellent.  I noticed that bug while working on the standalone USB<-->BT project, and then discovered it had been fixed in  1.0.6, so good!



#43 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 24 May 2021 - 11:05 PM

I just came back in from a couple of hours of exploring the night sky.  The entire session was done from a single StarSense alignment, using SkySafari6+ on my 8" Android tablet, connected over Bluetooth to an AUX port via the All-In-One Accessory.

 

No hitches, no glitches, no lost connections, everything just worked spectacularly well!  StarSense AutoAlign resulted in very accurate GOTOs, and the joystick plugged into the All-In-One was as handy as always for fine-tuning the view in higher-mag eyepieces.

 

The Bluetooth Bridge app connected with a single tap (using predefined "scripted" settings), and behaved itself for the entire session.

 

At last.. we have the Bluetooth connection that led me to work on all of the various HomeBrew projects!


  • Chote and Sakcyb like this

#44 Chote

Chote

    Messenger

  • -----
  • Posts: 478
  • Joined: 31 Oct 2005
  • Loc: Bangkok, Thailand

Posted 24 May 2021 - 11:18 PM

That's great news. Could you summarize the steps you follow when beginning the session? Thank you.



#45 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 25 May 2021 - 08:30 PM

Here is a thread recap of where things are today (working!):

 

The HomeBrew WiFi+BT+GPS project here features Bluetooth (BT) connectivity to the AUX bus of the mount, as does the HomeBrew All-In-One project.  This is a great way to connect to and control the mount -- no software time-outs or power-saving nastiness to result in dropped connections.  I have long sought such a connection method!

 

CPWI can connect directly to Bluetooth, as a "mount USB/serial" connection.  But for the SkySafari+ and SkyPortal apps, some extra steps are required to bridge the Bluetooth signal over to a TCP/IP connection, which those two apps would then see/treat as "Celestron WiFi".

 

This bridging is done by the Android BT/USB/TCP Bridge Pro app, available for a very modest fee from the Google Play store.  But the features we need from it are currently in Beta, so one has to scroll down on the Google Play page for the app, and click on the "Join Beta" link there (app purchase required beforehand)Note that I still have some legit "coupons" from the app's Author, which allow one to purchase the app for $0.  Contact me it you want one!

 

With v4.0 or higher of the BT/USB/TCP Bridge Pro app installed on the same device as SkySafari+/SkyPortal, here are the steps to configure it and get the connection rolling:

 

1. Connect the HomeBrew accessory and power on the mount.

2. Pair the Android device with the HomeBrew-xxxxxx bluetooth.

 

3. Open the BT/USB/TCP Bridge Pro app, and configure "Device A" to connect to the HomeBrew Bluetooth as a "Classic Bluetooth device".

 

4. Now configure "Device B" as a TCP Server on port 2000.  Check the boxes for "Allow new connections to overwrite existing connection" and "Broadcast UDP packet..".  Enter 55555 for the "Remote UDP Port", and select "Use loopback broadcast address" for the UDP/Broadcast address.  Finally here, enter AMW007 as the "UDP Packet data".  Tap on "Start Server" to complete the set up.

 

tcp_server.jpg

 

5. To avoid having to re-enter any of this next time around, now tap on the 3-dot app menu (at top right), and then tap on "Autostart setting".  Ensure that Autostart is Enabled, tap on "Configure device A", and then "Set currently connected device".  Then tap on "Configure device B", and then again on "Set currently connected device".  Then use the Android Back button (bottom of screen) to reverse out of there back to the main app page.

 

bridge.jpg

 

6. Open SkySafari+ or SkyPortal, and in the Settings menu there, configure the app Communication method as "Use Access Point".  Do NOT attempt to "Configure Access Point" though.  Then back out of the Settings menus to the main sky display.

 

7. Tap on "Connect and Align" and proceed normally from there.  The app should connect within 3 seconds or less.  Once in a while, this fails on the first attempt, so just tap and try again if that happens.

 

Enjoy a night of uninterrupted communications!

 

Do crazy stuff like turning off the screen on the Android device before bed, and turning it on again in the morning, only to discover that the mount is still connected(batteries permitting!)

 

To ensure uninterrupted enjoyment, go into the Android system Settings app, and then to "Apps & Notifications", and then find/select SkySafari+/SkyPortal within there.  Tap on Battery, and then Battery Optimisation, and ensure that the app is tagged as "Not optimised".  Also consider doing the same for the BT/USB/TCP Bridge Pro app.  Note that the exact menus and settings for this will vary by Android version, so good luck!  smile.gif

 

Should something Bad happen, and the connection be lost, it should come back to life by just tapping on "Connect" from within SkySafari+/SkyPortal.  But that should not be necessary.


Edited by mlord, 25 May 2021 - 09:35 PM.

  • Chote and Sakcyb like this

#46 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 28 May 2021 - 01:02 PM

Here is the latest HomeBrew assembly:  Standalone Bluetooth for the AUX bus.

The result is simpler to wire up than projects that use the ESP32 modules.

 

This uses a 3.3V Arduino Pro Mini module, along with an HC-05 Bluetooth module, and a DC-to-DC Buck voltage converter set for 5V output to power both modules.   Those three items, plus three 47K-ohm resistors and a diode, are soldered together and wrapped in heat-shrink tubing.

 

bt1.jpg

bt2.jpg bt3.jpg

 

The resistors are used as pull-ups to +5V on the TXO, RXI, and D4 pins.  The diode is in series with TXO between the Arduino and the point where the pull-up resistor attaches.  Wiring is otherwise similar to existing HomeBrew projects, and I may yet draw it up and post it here later. smile.gif

 

The code for this was isolated from another HomeBrew project, and customized somewhat to enable first-time configuration of the HC-05 module to set a unique SSID and change the baud rate to 38400.  This is accomplished by tying Arduino pin A0 and HC-05 pin "EN" to 3.3V prior to power-on.  It takes a couple of seconds to automatically configure things, after which one can disconnect power and allow A0 and EN to "float" (unconnected to anything).  From then on it behaves as an AUX port Bluetooth adapter, compatible with the Android app and configuration discussed in this thread, for use with SkyPortal, SkySafari+ and/or CPWI.

 

Arduino code, for 3.3V Pro Mini or 3.3V Pro Micro boards is included below.  The board must be a 3.3V board, as anything else will destroy the HC-05 Bluetooth module.   This sketch also includes the automatic "turn off/on EVO WiFi" feature.

 

Cheers

 

Attached File  auxbt.ino.txt   12.35KB   30 downloads


Edited by mlord, 28 May 2021 - 03:39 PM.

  • Chote and Sakcyb like this

#47 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 30 May 2021 - 07:28 PM

The board must be a 3.3V board, as anything else will destroy the HC-05 Bluetooth module.

.. and don't ask me how I know this ..  shocked.gif

 

EDIT: And tonight I took the Evo-8 out with the AUX/BT adapter instead of the usual All-In-One apparatus, and it performed just fine.  Full StarSense Auto Align, gotos, etc.. with the Android tablet.

 

The only difference seems to be in the time it takes to connect in SkySafari6+:  about 5 seconds versus the usual 2-3 seconds.  After that, everything is the same.


Edited by mlord, 30 May 2021 - 09:42 PM.

  • Chote likes this

#48 Chote

Chote

    Messenger

  • -----
  • Posts: 478
  • Joined: 31 Oct 2005
  • Loc: Bangkok, Thailand

Posted 31 May 2021 - 09:12 PM

The aux/bt can also pushes date and time to Starsense?



#49 mlord

mlord

    Mercury-Atlas

  • *****
  • topic starter
  • Posts: 2,561
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 31 May 2021 - 09:59 PM

The aux/bt can also pushes date and time to Starsense?

No.  I use it without any hand-controller connected at all, so there is nowhere to push a date/time to, if it was even something useful to do in the first place.

 

The date/time/location are needed only by whatever entity is doing the plate-solving / alignments.  And with an AUX port connection (WiFi, Bluetooth, ethernet, mount serial/USB) the solving is done by software on an external device: an Android device in this case.

 

Cheers

 

EDIT: I imagine there is probably a way to push date/time through the AUX bus to a connected hand-controller if one really wanted to, though there's no obvious (to me) use for doing so in this set-up.  I think the AUX bus scanner has code for doing that.


Edited by mlord, 31 May 2021 - 10:47 PM.

  • Chote likes this

#50 demarko69

demarko69

    Mariner 2

  • *****
  • Posts: 266
  • Joined: 20 Feb 2020
  • Loc: Arizona

Posted 03 June 2021 - 05:00 PM

very cool. skyportal work on my phone w/ btbow.gif

 

and amazon fire tablet (with the google play mod) for those who care


Edited by demarko69, 03 June 2021 - 07:44 PM.

  • mlord likes this


CNers have asked about a donation box for Cloudy Nights over the years, so here you go. Donation is not required by any means, so please enjoy your stay.


Recent Topics






Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics