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

Homebrew Bluetooth accessory for Nexstar+ USB HC

  • Please log in to reply
65 replies to this topic

#1 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 10 February 2021 - 09:03 AM

This project is to develop an inexpensive adapter that can connect a modern Nexstar+ (USB) hand-controller to CPWI, Skysafari, etc using Bluetooth.

 

Past efforts have used the Serial version of the hand-controller, or have physically modified the internals of the USB version to install an HC-05 bluetooth module.  But this design will work with the USB version without hacking it in any way.

 

The basic hardware will be either an ESP32 dev module with built-in bluetooth, or a 3.3V Arduino Pro Mini in combination with an HC-05 bluetooth adapter, and one of these (photo) into which one plugs a standard USB "mini-B to Type-A" cable from the hand-controller.

 

usbhost.jpg

 

That's a 1-port USB Host adapter for the Arduino's SPI bus.

 

This little board attaches to the SPI pins of the Arduino, and uses the USBHOST Library, which includes support and sample code for the Prolific pl2303 chip that's inside the HC.

 

From there, a new Arduino "sketch" (program/firmware) will bridge that connection over Bluetooth to CPWI (or whatever).  The idea is that Bluetooth may be more reliable than WiFi for some setups, and going through the hand-controller means that some smart-device software may(?) then also allow use of the HC in combination with the smart-device app.

 

Interfacing information for various Arduino style boards including ESP32 is here:

https://create.ardui...-esp8266-e0ca8a


Edited by mlord, 10 February 2021 - 11:15 AM.

  • RoC1909 likes this

#2 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 10 February 2021 - 09:05 AM

To begin with,  I now have basic transmit/receive working on a PL2303 USB-Serial adapter plugged into the USB Host thingie, attached to an ESP32.

 

It took a while.  First to figure out which set of pins the ESP32 wanted to use for the SPI bus.  And then which pins the USB Host library wanted for "slave select" and "interrupt".   And then had to work out why the library was just plain failing to initialize every time.  Eventually I hooked up the RST line of the USB Host thingie to a GPIO and added code to manually reset it at setup() time.  Much better.

 

Then discovered the UART was only working in receive mode, never transmitting.  For this, after a couple of hours I found the hidden "PL2303_COMPAT" setting in one of the library files.  Turned that "on", and it all works.

 

So.. proof of concept is good.  Hot plug even kinda works on the USB port.

 

Cheers


Edited by mlord, 10 February 2021 - 11:16 AM.

  • RoC1909 likes this

#3 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 10 February 2021 - 09:28 AM

For anyone who wants to join in, the hardware required is:

 

(1) A USB Host Shield for Arduino.  Either the big bulky full size "Shield" version that can snap onto something like the Arduino UNO board (no soldering!), or a "mini USB host shield" like the one pictured above.  Amazon and eBay have multiple listings for both types.  Just search for "arduino usb host shield".

 

(2) Either an ESP32 Dev module (built-in Bluetooth), or any 3.3V (not 5V!!) Arduino module plus an HC-05 compatible TTL Bluetooth adapter.  I will use a 3.3V Pro Mini board here (because I have one), but an Arduino Pro Micro 3.3V with built-in USB may also be used. Or an UNO board with the full size USB host shield.

 

(3) A standard USB mini-B to Type-A cable, which you probably already have.

 

Of these options, the ESP32 plus a mini USB host board is probably the simplest to build, though some simple soldering will be required to attach wires or pins to the USB host board.  A Pro Mini version may end up being more compact if no header pins are attached anywhere.


Edited by mlord, 10 February 2021 - 09:33 AM.

  • RoC1909 likes this

#4 whizbang

whizbang

    Surveyor 1

  • *****
  • Posts: 1,571
  • Joined: 18 Mar 2018
  • Loc: NE of Seattle, WA

Posted 10 February 2021 - 09:54 AM

Did you get it working?



#5 whizbang

whizbang

    Surveyor 1

  • *****
  • Posts: 1,571
  • Joined: 18 Mar 2018
  • Loc: NE of Seattle, WA

Posted 10 February 2021 - 09:56 AM

I prefer Bluetooth over wifi.  So far, I have resorted to buying old used hand controls.

 

I would like to build one of this.  I have the soldering tools and equipment.  However, the digital programming is way, way over my head.



#6 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 10 February 2021 - 11:03 AM

I would like to build one of this.  I have the soldering tools and equipment.  However, the digital programming is way, way over my head.

The digital programming is my department, so we're covered there!  smile.gif

 

This project was only begun last night, and I'll continue with it later today.  I do expect to have the ESP32 version completely working within a day or two -- there's really only perhaps an hour or two of work to do on it before testing.

 

So if you want to join in, I suggest getting hold of an ESP32 dev module exactly the same as what I already have working here:

 

The exact one I have is this one from Amazon Canada: https://www.amazon.c...uct/B07HG5XHLB/

 

But any that look _exactly_ like that one in the photos will do the trick.   Here is the exact same board on Amazon USA:  https://www.amazon.c...e-ESP32-D0WDQ6/

 

And then also pick up a mini USB Host shield like the one in the photo above, or this very similar one on Amazon USA:  https://www.amazon.c.../dp/B01EWW9R1E/

 

You will also need a 5V power source to run the thing in conjunction with the Telescope.  This is easy with the Evolution mount, as one can just connect it to the built-in USB power outlet on the mount with a standard USB micro-B to Type-A cable.  This is in addition to the USB mini-B to Type-A needed for the hand-controller.  Note that, yes, I did say 5V power, which the ESP32 board will then convert to 3.3V to run almost everything.   The raw 5V is needed to send power out the USB Host port to the hand-controller, even though the rest of the USB board cannot even tolerate 5V for its electronics.

 

I will post wiring and build instructions here later in the week.

 

esp32_with_usb_host.jpg


Edited by mlord, 10 February 2021 - 11:12 AM.

  • RoC1909 likes this

#7 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 10 February 2021 - 05:01 PM

Today I "hooked up" the Bluetooth stack in the ESP32.  Everything from Bluetooth goes the the HC, and everything from the HC goes to Bluetooth.  Plus, everything from both of those gets echoed in hex to the serial console.

 

Something is not quite right.  The app gets a slow continuous stream of 0xf8 characters from the HC.

 

I tried the auxbus scanner from my Linux PC:   python  celestron.py  hc  /dev/rfcomm0

and at the serial console I can see the commands coming from the scanner over bluetooth, but again.. nothing useful happening at the hand-controller end of things.

 

It's as if the baud rate was wrong or something -- I'm using 9600 as the rate.

 

More investigation required later.



#8 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 10 February 2021 - 11:23 PM

This is more like it!

-----------------------
Finished AUXBUS SCAN 
-----------------------
Mount : Nexstar Evolution 8
-----------------------
   Detected Devices   
-----------------------
0) AZM MC (0x10) - 7.17.98
1) ALT MC (0x11) - 7.17.98
2) Nextstar EVO WiFi (0xb5) - 0.0.256
3) Battery Power Controller (0xb6) - 1.1.16418
4) Charge Port (0xb7) - 1.1.16418
5) Mount Lights (0xbf) - 1.1.16418
-----------------------

That's the auxbus scanner running over Bluetooth to the ESP32, then over USB from there to the HC.  Doesn't work every time yet, but a few tweaks and it should be good.

 

If that works, then CPWI should work.  SkySafari even more likely.

 

I'll try CPWI out tomorrow.  smile.gif


Edited by mlord, 10 February 2021 - 11:24 PM.


#9 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 11 February 2021 - 05:27 PM

Okay, success!  smile.gif

 

I bypassed WinUpdate and Dell's update, and went straight to Intel's Support Assistant.  Updated to their latest Bluetooth driver, and then unpaired and re-paired the ESP32 on Win10.  Then Turned Bluetooth off, and then on again in Win10.

 

Dunno which of those steps did the trick, but CPWI connects to the HC now over Bluetooth, with all features working.  There are still a few wrinkles to sort out in the Arduino sketch, but this is looking much better now.

 

Total cost in parts thus far, about CAD$20 for the ESP32 and USB Host board.


Edited by mlord, 12 February 2021 - 09:41 AM.

  • mclewis1 and RoC1909 like this

#10 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 11 February 2021 - 05:34 PM

Mmm.. based on what I am seeing from the traces of messaging between CPWI and the HC, I believe I should be able to also get Bluetooth working directly to the AUX port of the mount (no HC required).  That will get covered in the other thread for HomeBrew WiFi+BT+GPS+..

 

An advantage there, is no USB Host "shield" module is needed, and power would come directly from that same AUX port.  So no bulky USB cables at all.  The disadvantage is that more wiring is needed for the 74HC125 chip to interface the ESP32 to the AUX bus.

 

Another way to do it would be to use an Arduino Pro Mini along with an HC-05 Bluetooth adapter, again without the need for a USB Host shield.   Lots of good possibilities here.

 

Anyone else want to try any of these options?


Edited by mlord, 11 February 2021 - 05:39 PM.


#11 Chote

Chote

    Messenger

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

Posted 11 February 2021 - 08:06 PM

Hi mlord,

 

I follow this thread with interest because I have a HC-05+Max3232 connected direct to 4p4c port at the bottom of my Starsense HC. Skysafari on Android/IOS, Stellarium (via Ascom) on Win10 can control the 6SE after I completed the alignment on the HC. Has not tried direct connect option in Stellarium.

I installed CPWI on Win10 hoping it to work via bluetooth with "Hand controller" connection option in CPWI. CPWI did make the Starsense HC into Bootloader mode, but connection was never successful.

 

CPWI manual says it works with such HC by connecting a serial cable from HC to the computer physical com port; and connect CPWI with "Hand controller" option. The bluetooth approach is just making it wireless and making use of a virtual com port created after the first successful paring, instead of the physical one.

 

I know it is not your approach here, but your finding from this project may shed some light as to how you have solved your problem above. It might be able to solve mine too. For example, did the Intel bluetooth driver really make a trick?

 

Thanks

 

ps. my hopeless post on this issue is here: https://www.cloudyni...and-controller/


Edited by Chote, 12 February 2021 - 03:46 AM.


#12 demarko69

demarko69

    Mariner 2

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

Posted 11 February 2021 - 08:52 PM

Mmm.. based on what I am seeing from the traces of messaging between CPWI and the HC, I believe I should be able to also get Bluetooth working directly to the AUX port of the mount (no HC required).  That will get covered in the other thread for HomeBrew WiFi+BT+GPS+..

 

An advantage there, is no USB Host "shield" module is needed, and power would come directly from that same AUX port.  So no bulky USB cables at all.  The disadvantage is that more wiring is needed for the 74HC125 chip to interface the ESP32 to the AUX bus.

 

Another way to do it would be to use an Arduino Pro Mini along with an HC-05 Bluetooth adapter, again without the need for a USB Host shield.   Lots of good possibilities here.

 

Anyone else want to try any of these options?

which one would you like me to build

( i have ethernet + GPS   and   wifi + BT +  GPS)  could always another way to talk to a telescope I dont use



#13 Chote

Chote

    Messenger

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

Posted 11 February 2021 - 09:38 PM

Mmm.. based on what I am seeing from the traces of messaging between CPWI and the HC, I believe I should be able to also get Bluetooth working directly to the AUX port of the mount (no HC required).  That will get covered in the other thread for HomeBrew WiFi+BT+GPS+..

 

An advantage there, is no USB Host "shield" module is needed, and power would come directly from that same AUX port.  So no bulky USB cables at all.  The disadvantage is that more wiring is needed for the 74HC125 chip to interface the ESP32 to the AUX bus.

 

Another way to do it would be to use an Arduino Pro Mini along with an HC-05 Bluetooth adapter, again without the need for a USB Host shield.   Lots of good possibilities here.

 

Anyone else want to try any of these options?

I have your homebrew GPS with a step-down 12-5v inside. Apart from feeding 5V, by connecting HC-05 tx/rx to some available D pins on Pro mini board and your future modified Homebrew GPS codes, it should be working, right?



#14 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 11 February 2021 - 09:56 PM

I have your homebrew GPS with a step-down 12-5v inside. Apart from feeding 5V, by connecting HC-05 tx/rx to some available D pins on Pro mini board and your future modified Homebrew GPS codes, it should be working, right?

That sounds like it might work.  But the Pro Mini has only a single hardware UART, currently in-use for the AUX bus.  The GPSr is on a software bit-banged interface.  That's close to the limit for the processor in the Pro Mini when programmed as an Arduino.

 

The HC-05 would have to use a second software bit-banged interface, at 19200bps, and may or may not keep up with the data flow requiredThe bulk of that data flow will be from the Arduino to the HC-05, which makes it slightly easier.  But I don't know if it will keep up under all conditions or not.

 

Doing something similar without the added load of the GPS would probably work.


Edited by mlord, 11 February 2021 - 09:57 PM.

  • Chote likes this

#15 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 11 February 2021 - 10:34 PM

which one would you like me to build

( i have ethernet + GPS   and   wifi + BT +  GPS)  could always another way to talk to a telescope I dont use

For starters, take your existing WiFi thing and install the latest Arduino code onto it from my site (other thread).  Then get a PC to connect to its Bluetooth, and see if CPWI works for you.  You may have to fuss with MS-Win's bluetooth stack to get it going, as I did here.

 

I really prefer that method over the project in this thread (a BT module connecting to the HC over USB) because of fewer cables.  I only started this one up as a way to debug things, and for possible future use of a HC+Bluetooth with SkySafari-7 (whenever that gets released).


  • demarko69 likes this

#16 demarko69

demarko69

    Mariner 2

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

Posted 12 February 2021 - 01:33 PM

that already seems to work via blutooth, v2.6 homebrew. i just click on usb hand controller  with cpwi



#17 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 12 February 2021 - 01:36 PM

that already seems to work via blutooth, v2.6 homebrew. i just click on usb hand controller  with cpwi

Good!  And thank-you for trying it! That now makes two of us with the Homebrew WiFi+BT+GPS now showing working Bluetooth with CPWI.

 

If you still feel that you want to try the Bluetooth-USB connection to the HC (topic of this very thread), then I can provide more guidance on request.

 

Cheers


  • RoC1909 likes this

#18 demarko69

demarko69

    Mariner 2

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

Posted 12 February 2021 - 04:34 PM

Good!  And thank-you for trying it! That now makes two of us with the Homebrew WiFi+BT+GPS now showing working Bluetooth with CPWI.

 

If you still feel that you want to try the Bluetooth-USB connection to the HC (topic of this very thread), then I can provide more guidance on request.

 

Cheers

no Im good with what I got, just waiting on etherdong and starnonsence , so I can take care of maritime.......



#19 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 13 February 2021 - 03:25 PM

Build instructions for the ESP32 + mini USB Host project:

Connect mini USB Host module to ESP32 module as follows:

mini-USB  ESP32
========  ==========
INT       TX2/GPIO17
RST       D2
VCC       3.3V
GND       GND
MOSI      D18
MISO      D19
CLK       D23
SS        D5
--        D22 connect to Anode of LED for "activity" indication
--        D21 connect to Anode of another LED for "HC in bootloader mode" indication

Optional (recommended) "activity LED":
  Connect a 330-Ohm resistor to D22.
  Connect anode (longer pin) of an LED to the resistor.
  Connect cathode (shorter pin) of same LED to GND.

Arduino code to follow.
 


Edited by mlord, 14 February 2021 - 10:11 AM.

  • demarko69 likes this

#20 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 13 February 2021 - 06:23 PM

Here is v0.1 of the Arduino sketch for the standalone ESP32-based USB-to-Bluetooth project.

 

Getting the initial connection is.. well.. flaky.

Once connected, it seems to work very well.

 

The sequence that works for me most of the time is:

 

1. Power on the telescope mount.

2. Plug the USB cable between HC and the ESP32/USB project.

3. Power on the ESP32/USB project.

 

If it doesn't come up, one can try hitting the built-in "EN" (aka. Reset) button on the ESP32.

I would love to work out a way to get rid of the flaky startup, but thus far all efforts have failed.

 

Attached File  usb_bt.ino.v0.1.txt   5.63KB   22 downloads


Edited by mlord, 13 February 2021 - 06:23 PM.


#21 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 13 February 2021 - 06:43 PM

And.. here is v0.2 of the Arduino code.

 

The only change is a useful one:  After power-up, the "activity" LED on pin D22 will turn on solid once the HC is detected.  It reverts to being an "activity" LED as soon as bluetooth traffic begins (CPWI).

 

So, the LED can show very easily whether the initial (flaky) connection has been established, before one wastes time with CPWI.

Attached File  usb_bt.ino.v0.2.txt   5.81KB   18 downloads


  • Chote likes this

#22 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 13 February 2021 - 09:03 PM

After power-up, the "activity" LED on pin D22 will turn on solid once the HC is detected.

Well, that seems to be the beanswaytogo.gif

 

With that indicator LED to clear things up, it's not as flaky as I thought earlier on.  I can plug it all together (USB to HC, USB power from my Evolution mount to the ESP32), and then switch on the mount, and.. 100% success rate thus far.

 

It seems equally reliable so long as power to the ESP32 is done as the final step.

 

My work here is done.


Edited by mlord, 13 February 2021 - 09:05 PM.


#23 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 13 February 2021 - 10:08 PM

Well, that seems to be the beanswaytogo.gif

 

With that indicator LED to clear things up, it's not as flaky as I thought earlier on.  I can plug it all together (USB to HC, USB power from my Evolution mount to the ESP32), and then switch on the mount, and.. 100% success rate thus far.

 

It seems equally reliable so long as power to the ESP32 is done as the final step.

 

My work here is done.

Well, not completely done.  I noticed that CPWI was still having some kind of timing issue, so the Arduino code has now been updated to just force the HC into bootloader mode at start-up.  I also added the option for a second added LED on D21 for debug purposes.  This one lights up once the HC has successfully entered Bootloader Mode.

 

I now see 100% success rate with CPWI.  I don't know how it might affect SkySafari though.  I guess someone here will tell me, or perhaps I'll find out myself when I eventually purchase SkySafari-7.

 

Attached File  usb_bt.ino.v0.3.txt   6.51KB   20 downloads



#24 mlord

mlord

    Soyuz

  • *****
  • topic starter
  • Posts: 3,538
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada

Posted 13 February 2021 - 11:03 PM

Seems to be really good now.  A slight improvement in the wiring is that there is no need for this step:

 

5V        Vin  [must also cut the power trace between the 5V pin and the nearby 2.2K resistor]

 

So don't cut the trace, and don't connect the 5V pin to anything!

If you've already cut the trace, then undo it.

 

Meanwhile, I'm done testing with this setup.  Because..  I accidentally fed +12V onto the 3.3V rail just now, and fried the USB-Serial chip on the ESP32, as well as the USB interface inside my Nexstar+ hand-controller.  The controller works just fine otherwise, but it no longer works with a USB cable.  shocked.gif

 

I'll take it apart later and see if it's something simple, or if it's the PL2303 chip, in which case I may be able to find one to swap in place of the fried one.  Such is life on the experimental edge! 

 

Cheers


Edited by mlord, 14 February 2021 - 09:49 AM.

  • rboe likes this

#25 Chote

Chote

    Messenger

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

Posted 13 February 2021 - 11:52 PM

Oh. Hope you can repair it. Thanks for doing this and sharing with the community.

Sent from my POCOPHONE F1 using Tapatalk


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