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 Gen3 PCB: WiFi+BT+GPS+MUSB+Relay !

  • Please log in to reply
1470 replies to this topic

#126 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 16 January 2023 - 05:33 PM

I just ordered a Nunchuk to work with the HBG3. How amazing! That would replace the HC altogether, right?

Yes.  That is what I use myself.  I don't even plug in the hand-controller -- it stays in the bag.

But the HomeBrew Gen3 does have to have a mating connector wired to it for the Nunchuck to plug into.


Edited by mlord, 16 January 2023 - 05:33 PM.

  • fdboucher likes this

#127 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 17 January 2023 - 12:12 AM

A reminder to various watchers here, and owners of a HomeBrew WiFi+BT device:  The instructions for using the Bluetooth feature are here:  https://www.cloudyni...2#entry11125062

 

Note that the "beta" version of that app is no longer needed.  The regular version has had the extra features for a long time now.


Edited by mlord, 17 January 2023 - 12:13 AM.

  • Chote and fdboucher like this

#128 scopewizard

scopewizard

    Apollo

  • *****
  • Posts: 1,426
  • Joined: 04 Oct 2010
  • Loc: Alberta, Canada

Posted 26 January 2023 - 05:01 PM

mlord,

 

I was out imaging Tuesday. First test in the field using  Homebrew Wifi/GPS/BT.

Only plug the Homebrew to my CGX, turned it on.

Connections were with no HC(in AUX plug), minipc on top of scope, connected to homebrew using BT, minpc wifi connected to portable router.

System was controlled via laptop connected to router.

I imaged from 08pm to pass 01am, guiding average PHD2 ToT = 0.55 which is the same as I used to have with a USB connection.

So I operated the scope for 5 hours at a temp of as low as -7c with absolutely no issue.

GPS worked perfectly and fast.

 

The only cable going to the top of my scope is a small power cable.

The mount has Homebrew connected to  AUX plug and power cable to the mount (these never move as they are on the mount base).

 

I am very happy. I also build one for my friend to use with his CGEM mount, also works fine.

 

Thanks mlord for the great project.


  • mlord and fdboucher like this

#129 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 27 January 2023 - 09:45 AM

I have a couple of assembled Gen3a units here that have yet to find homes.

And the supply of Gen3a PCBs has now run out, though I do have a few original Gen3 ones.

 

So.. JLCPCB is currently producing another small batch of Gen3b PCBs for us all, as well as a few Gen3 Standalone PCBs:

 

gen3b-top.jpg gen3b-bot.jpg

standlone-top.jpg standalone-bot.jpg

 

No circuitry chances on the Gen3b, but better silk-screen labelling, a cut-out around the ESP32 antenna area, and improved layout for the MUSB switch and power headers.  Both board types are still the same width as an ESP32 DevKit-v1 module.

 

The Gen3 Standalone board has the exact same circuit, but with two 6P6C jacks (built-in "splitter"), and without any footprint for an ESP32.

 

The Standalone board can be used by itself to interface four GPIO lines from pretty much any processor to the Celestron AUX bus, provided one implements the software protocol to drive the GPIOs appropriately.  My own plan for this board is to use it in combination with the Gen3b/ESP32 to create AUX Bus Relay assemblies with two ports on the Relay side.

 

Note that one will need to short the TX/RX pins together on the Standalone board when used as a Relay, but not when directly connected to the AUX bus of the mount.

 

These should arrive here in another 10 days or so.


Edited by mlord, 27 January 2023 - 05:01 PM.

  • tjay likes this

#130 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 30 January 2023 - 10:59 AM

I imagine by now that many people here will be completing or receiving HomeBrew Gen3 accessories, so here is a reminder of what the switches and stuff are for at the "business end" of things:

 

HomeBrew-Gen3a.jpg

 

The large 6P6C/RJ12 Jack is for connecting to an AUX port on the mount.  Below it, is a micro-B USB connector for diagnostics and installing/updating the HomeBrew firmware, and also for Mount-USB mode (see below).

 

To the right of the RJ12 jack in the photo, is a (red) micro-switch for selecting the WiFi Mode.  DOWN closest to the PCB is "Direct Access" mode, and UP is "Access Point" mode.  This switch can be changed on-the-fly with immediate effect.

 

To the left of the RJ12 jack, is a another (blue) micro-switch, for selecting Mount-USB mode at power-on only.  In that mode, with the switch in the UP position away from the PCB, the micro-USB port becomes a "Mount-USB" connection point:  A USB cable from here to a PC enables CPWI to talk directly to the AUX bus on the mount without WiFi/BT or need of a hand-controller intermediary.

 

On all HomeBrew Gen3 devices, the on-board blue LED will blink three times within 5-seconds of power-on if it is successfully able to communicate with the mount.  Otherwise something is wrong.


Edited by mlord, 30 January 2023 - 11:57 AM.

  • Paul Romero, Bartec and fdboucher like this

#131 Chote

Chote

    Viking 1

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

Posted 01 February 2023 - 03:52 AM

 Is this the kind of nunchuck male plug we can use with nunchuck wii? If so, it would be nice the circuit board has the same pin arrangement as this plug.

 

H64e434fa5bd34bdcb897c1638c5ac7f60.jpg



#132 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 01 February 2023 - 08:29 AM

The recommended AdaFruit Nunchuck adapter is described back on the first page of this very thread, in this posting:  https://www.cloudyni.../#entry12348723

 

adafruit_nunchuck.jpg

 

The WiiChuck style also works fine (electrically), but doesn't have the mechanical slots to hold the Nunchuck plug in place -- some tape or cable-ties or something is needed.  Mind you, the AdaFruit one isn't perfect, and requires slight modification to enlarge the locking slots.

 

The I2C header on the HomeBrew Gen3a/Gen3b boards exactly matches what was used previously in the HomeBrew All-In-One design, so that accessories can easily be moved between the two.

 

I have thought a bit about having a PCB with a Nunchuck connector moulded into one side, but that then prevents easy "packaging" with my preferred method:  heat-shrinkable tubing.  The Nunchuck connectors are huge bulky things.  The tidiest install would be to just cut off that connector and solder the wires directly to the pads on the PCB.  Or use a smaller connector set.

 

Cheers


Edited by mlord, 01 February 2023 - 09:14 AM.

  • Chote likes this

#133 Wyphy

Wyphy

    Explorer 1

  • *****
  • Posts: 93
  • Joined: 27 Jul 2015
  • Loc: Kansas

Posted 02 February 2023 - 01:25 PM

Mind you, the AdaFruit one isn't perfect, and requires slight modification to enlarge the locking slots.

I got this one : https://www.aliexpre...0408090921.html

It does not require modifying the board.

At least, the one I tried did not, haven't tried all the units with all the boards (I got several)



#134 Chote

Chote

    Viking 1

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

Posted 02 February 2023 - 08:12 PM

My genuine nunchucks is on the way. Could you tell again how to use nunchucks for slewing in terms of speed control buttons. How it relates to the slew speed set on Skyportal/Skysafari app?..thanks.


Edited by Chote, 02 February 2023 - 08:16 PM.


#135 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 02 February 2023 - 08:25 PM

Just move the thumbstick around.  The further from the centre, the faster it slews.  Simple.


  • Chote likes this

#136 SieglindeFestkochend

SieglindeFestkochend

    Explorer 1

  • -----
  • Posts: 77
  • Joined: 03 Apr 2020
  • Loc: Germany

Posted 04 February 2023 - 08:15 AM

I have a couple of assembled Gen3a units here that have yet to find homes.

Thank you Mark, for the PCB HomeBrew 3a

 

Everything works right away. A Beitian 180 GPS module is installed, the warm start under the open sky takes 5 seconds, the cold start about a minute.

I built an internal solution. There is no AUX socket soldered on, but 6 lines that are looped through to the hand controller connection using a self-made adapter. If someone interested I can present this internal solution. There is also a HomeBrew USB port under the battery cover for easy updates without disassembling the Mount.

 

During the tests I noticed something that is a bit strange: The GPS can be switched on and off in the utilities, which also works.

Menu/Utilities/GPS on/off. Then press "Enter". The message "Press Enter to Turn GPS off" appears. If you are listening on the AUX bus, the command to turn off the GPS is already being sent, even though the "Enter" key to confirm the command has not been pressed. This can be checked by selecting Menue/View Time-Site. "Saved Site" is then displayed here, not "GPS Linked". Accordingly, the GPS was actually switched off. The behavior is the same the other way around, i.e. if you switch Menue/Utilities/GPS on/off. Then press "Enter". The message "Press Enter to Turn GPS on" appears, the command is then executed, although the required confirmation with "Enter" is missing.

 

In my opinion, this behavior is an error in the firmware of the NexStar SE and has nothing to do with whether the GPS is connected via a HomeBrew or with the original module from Celestron.

 

This behavior can be very confusing, because if you rely on the commands of the NexStar SE with the hand controller, then you are looking for a bug in the HomeBrew that the HomeBrew does not have.
I am interested to know whether other owners of a NexStar SE also confirm this behavior or whether the error in the firmware cannot be observed there.

 

Concrete:

I see the message "GPS on/off" on the display of the hand controller, I confirm with Enter and see "Press Enter to Turn GPS on" and the following is then output in the serial monitor:

 

14:21:15.423 -> 016971826 auxbus_rx: 3b 03 0d b0 fe 42
14:21:15.509 -> GPS GET_VER
14:21:15.509 -> 016971910 auxbus_tx: 3b 05 b0 0d fe 02 00 3e

 

[you can find out where I live that way, but I don't care :-) ]

 

When the command is requested to be confirmed with the Enter key, nothing is displayed in the serial monitor, so this "Enter" command has no consequences and has already been executed before.

The NexStar has been provided with the latest updates.

 

What about your NexStar SE?


Edited by SieglindeFestkochend, 04 February 2023 - 08:22 AM.


#137 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 04 February 2023 - 08:32 AM

Those commands you see do NOT actually turn the GPS on or off.  Those are simply checking to see if a GPS is connected.  The "on" setting simply means the hand-controller firmware should use the GPS, and "off" means it should not use the GPS.

 

14:21:15.423 -> 016971826 auxbus_rx: 3b 03 0d b0 fe 42
14:21:15.509 -> GPS GET_VER
14:21:15.509 -> 016971910 auxbus_tx: 3b 05 b0 0d fe 02 00 3e

 

Any command you see with "fe" in the 5th byte, is a "GET_VERSION" command, which is normally used to poll for the existence of a peripheral device.  The "b0" here means "GPS".  If a response arrives (also with "fe"), then the hand-controller ("0d" here) knows that specific device is connected.  In this case, it responded and said it has version 02.00.  If the GPS does not respond, then the hand-controller automatically sets itself to "off" -- to not use a GPS.

 

Note that the HomeBrew device firmware DOES turn the GPS off/on (to save power) on demand, because it is not normally used more than once by the hand-controller during a session.

 

There is a bug in the hand-controller though, whereby about once in every eight times after a power-on, it sends that command to see if a GPS is connected, gets the response, and then NEVER asks the GPS for time,date,location -- it just proceeds with whatever values it already has.  This is a hand-controller firmware bug.

 

Cheers


Edited by mlord, 04 February 2023 - 08:48 AM.

  • Chayko likes this

#138 SieglindeFestkochend

SieglindeFestkochend

    Explorer 1

  • -----
  • Posts: 77
  • Joined: 03 Apr 2020
  • Loc: Germany

Posted 04 February 2023 - 02:22 PM

Those commands you see do NOT actually turn the GPS on or off.  Those are simply checking to see if a GPS is connected.  The "on" setting simply means the hand-controller firmware should use the GPS, and "off" means it should not use the GPS.

 

14:21:15.423 -> 016971826 auxbus_rx: 3b 03 0d b0 fe 42
14:21:15.509 -> GPS GET_VER
14:21:15.509 -> 016971910 auxbus_tx: 3b 05 b0 0d fe 02 00 3e

 

Any command you see with "fe" in the 5th byte, is a "GET_VERSION" command, which is normally used to poll for the existence of a peripheral device.  The "b0" here means "GPS".  If a response arrives (also with "fe"), then the hand-controller ("0d" here) knows that specific device is connected.  In this case, it responded and said it has version 02.00.  If the GPS does not respond, then the hand-controller automatically sets itself to "off" -- to not use a GPS.

 

Note that the HomeBrew device firmware DOES turn the GPS off/on (to save power) on demand, because it is not normally used more than once by the hand-controller during a session.

 

There is a bug in the hand-controller though, whereby about once in every eight times after a power-on, it sends that command to see if a GPS is connected, gets the response, and then NEVER asks the GPS for time,date,location -- it just proceeds with whatever values it already has.  This is a hand-controller firmware bug.

 

Cheers

Clearly the hand controller is doing something that subsequently causes the hand controller to switch to the custom location, time and date setting and not evaluate the GPS. The hand controller does this when the corresponding function is called up via Utility/GPS on/off:

 

Press Enter to Turn GPS on[off]

 

I don't know whether the HomeBrew module notices anything about it. But following the command I've pictured here, the hand controller assumes a connected GPS is off and sends a command to the AUX bus. I don't know what the command means, whether a signal from the GPS is expected here or whatever.



#139 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 04 February 2023 - 02:26 PM

I just described in great detail above exactly what that command you saw does.  Did you read and understand any of that?



#140 SieglindeFestkochend

SieglindeFestkochend

    Explorer 1

  • -----
  • Posts: 77
  • Joined: 03 Apr 2020
  • Loc: Germany

Posted 05 February 2023 - 05:46 AM

I just described in great detail above exactly what that command you saw does.  Did you read and understand any of that?

I think so and thank you very much for your detailed answer.

  • I have described what the hand controller does after I have selected a menu item on the handcontroller. And I recorded the serial commands that the handcontroller triggered.
  • You have described the meaning of the serial commands that the hand controller sent after I selected this menu item.

I understand that the (HomeBrew) GPS is not switched off in this way, since the corresponding command is not send by the hand controller. In both cases on/off the hand controller checks if the GPS answers if GPS is running, which it does in both cases. The hand controller queries the status and receives the status "on". Then the hand controller does nothing when i press enter.

 

Is that summed up correctly so far?

 

If yes:

  • I think it could be that the handcontroller is expecting a different response from the GPS. Only when the answer comes that the handcontroller understands, when you press the Enter button, a command is sent that is supposed to switch on the GPS (if the status was off). If the answer from the GPS is that it is "on", the hand controller doesn't have to do anything if i press Enter. But the hand controller always gets the same answer from the HomeBrew GPS: GPS is there and switched on.
  • I suspect that the hand controller's firmware assumes that "after the off command" (the command was not sent, but the menu item was called), the data no longer needs to be read out and the last saved location with time and date is used (although the GPS continues to provide data).
  • What I don't understand is that the handcontroller doesn't issue the command to turn it off even though the GPS says it's on. I didn't understand why the handcontroller still bluntly assumes that the GPS is off and doesn't use the data from the GPS, because the data will continue to be given by the GPS if it is asked.

 

The fact is that no command is given from the handcontroller into the serial bus if the status after the query is "on" and the GPS should be switched off (when I press enter on the hand controller).

  • I could try this out by connecting a Celestron GPS module and listening to how these modules behave, when the hand controller first asks for the status and then, possibly, gets a different answer than what the HomeBrew uses and then, possibly, when pressing Enter also sends a command that the Celestron module provides, but I don't own a Celestron GPS module.
  • And in the second step, if the first step is correct, it would be nice to teach these answers and commands to the HomeBrew as well. Then everything would run consistently, without the strange behavior of the hand controller that i have described.

 

But I think it can stay the way it is, because the GPS doesn't have to be switched off. In addition, there is the intelligent control in your code, dear Mark, if I understood that correctly.

 

I don't want to criticize here because it's not my place. I'm not entitled to it, because a lot of work by Mark and many other users is freely available to me here on the table. That makes me very happy.

 

If I have an idea that could lead to an improvement in the code, I would like to be respected just as much as any other user in this forum and that is how it has been and will probably continue to be so.


Edited by SieglindeFestkochend, 05 February 2023 - 09:43 AM.


#141 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 05 February 2023 - 01:42 PM

The hand-controller NEVER, EVER, sends ANY command to switch a GPS OFF or ON.  There is no such command in the Celestron protocol.

 

The meaning of ON and OFF on that menu, are simply this:

  • ON -- the hand-controller will fetch time,date,location from the GPS the first time it attempts alignment.  Or at startup in the case of a StarSense hand-controller.  The data is then NEVER read again from the GPS until after the next time power is turned off and then on.
  • OFF- the hand-controller will NOT fetch time,date,location from the GPS.  Instead those will need to be entered manually.

That's all that that menu does.  It changes a firmware setting, but does nothing to the hardware.  it does NOT turn any GPS on or off.  Ever.

 

Got it now?

 

From the point-of-view of the hand-controllers, the HomeBrew GPS behaves 100% identically to any other Celestron compatible GPS.  It sends the same responses to the same commands.   No difference.  Nada.  Nothing. 

 

EDIT: Please open a new thread to discuss GPS and hand-controller behaviour, rather than filling the HomeBrew Gen3 thread with this.  Thanks.


Edited by mlord, 05 February 2023 - 02:00 PM.


#142 Chote

Chote

    Viking 1

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

Posted 05 February 2023 - 11:14 PM

Hi Mark
one small question regarding the wifi ssid name for the direct mode.

On version 5.18, if I change the default ssid to

#define DEFAULT_SSID                "HomeBrew-bthoven"

The bluetooth name was changed to "HomeBrew-bthoven-xxxxxx" as expected, but the wifi ssid was just "HomeBrew-bthoven", instead of "HomeBrew-bthoven-xxxxxx". Is it supposed to be?



#143 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 05 February 2023 - 11:25 PM

The bluetooth name was changed to "HomeBrew-bthoven-xxxxxx" as expected, but the wifi ssid was just "HomeBrew-bthoven", instead of "HomeBrew-bthoven-xxxxxx". Is it supposed to be?

The WiFi SSID is stored in NVRAM, and gets initialized the first time the device powers-up.  Rather than editing the code and possibly breaking something, you can instead telnet to port 3000 and change it there:

 

   set softap.ssid HomeBrew-bthoven-xxxxxx

 

And even put a passkey on it if you want:

 

  set softap.passkey mySecretPassword

 

This must be followed by a "save" command to make it permanent.

The "get all" command shows what the current settings are.


Edited by mlord, 05 February 2023 - 11:26 PM.

  • Chote likes this

#144 Chote

Chote

    Viking 1

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

Posted 06 February 2023 - 12:16 AM

Thanks Mark. I used the above commands before. Just want to hardcode it because my homebrew wifi/bt is still under experiment. Will do so again after I finalize my testing.



#145 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 06 February 2023 - 10:24 AM

You can use the telnet to port 3000, and issue the "load defaults" command, followed by "save".  Then it will run the code you changed and update the NVRAM with the customized SSID.


  • Chote likes this

#146 SieglindeFestkochend

SieglindeFestkochend

    Explorer 1

  • -----
  • Posts: 77
  • Joined: 03 Apr 2020
  • Loc: Germany

Posted 06 February 2023 - 10:45 AM


Got it now?

 

EDIT: Please open a new thread to discuss GPS and hand-controller behaviour, rather than filling the HomeBrew Gen3 thread with this.  Thanks.

Yes Sir!



#147 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 06 February 2023 - 10:58 AM

Here is version v5.19 of the Arduino ESP32 source code for this project.  New here, is I finally integrated the fixes from last summer for using Nintendo-branded Nunchuck controllers.  They seem to use a smaller movement range than the clones, and require adjustment in the code for both detection and proper movement.

 

[attachment deleted -- v5.20 is now available further on in this thread]

 

So, give it a try and let me know if there are any issues.


Edited by mlord, 06 February 2023 - 05:36 PM.


#148 Chote

Chote

    Viking 1

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

Posted 06 February 2023 - 12:05 PM

Great. The new code auto-detects the Nunchuck controller type, or I have to hard code it? Where?



#149 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 06 February 2023 - 03:54 PM

It auto-detects the type of Nunchuck.


Edited by mlord, 06 February 2023 - 09:45 PM.


#150 mlord

mlord

    Fly Me to the Moon

  • *****
  • topic starter
  • Posts: 6,614
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 06 February 2023 - 05:35 PM

Here is version v5.19 of the Arduino ESP32 source code for this project.  New here, is I finally integrated the fixes from last summer for using Nintendo-branded Nunchuck controllers.  They seem to use a smaller movement range than the clones, and require adjustment in the code for both detection and proper movement.

Following that now, with v5.20 of the Arduino ESP32 source code for this project.

 

[attachment deleted -- better version on the way!]

 

This version uses the Nunchuck calibration data, read from the actual attached Nunchuck, to determine the center point and movement ranges, falling back on something similar to v5.19 if the calibration data looks incorrect.

 

Hopefully this makes it much more compatible with the various versions of Nunchucks out there.

 

EDIT:  A better version is on the way.  Stay tuned for v5.21!


Edited by mlord, 06 February 2023 - 09:45 PM.

  • Chote and fdboucher like 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