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 Joystick Slew Controller for on mount use

  • Please log in to reply
56 replies to this topic

#1 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 10 April 2021 - 04:56 PM

Time for a new HomeBrew project!  bounce.gif

 

This will be an easy one:  I will take an old-school switch-based joystick game controller, intended for an Atari 2600, and combine it with a small Arduino to interface it to the Celestron AUX bus.  This controller will then be used for quick and easy slewing of the scope while at the mount, as an alternative to using a hand-controller or touch-screen.

 

I have ordered one two of these joysticks for under CAD$11/each (on sale right now):

 

joystick.jpg

https://www.amazon.c...uct/B07R21XWDS/

 

I will combine it with a $10 5V/16Mhz Arduino Pro Mini or Pro Micro board, hopefully being able to actually incorporate the Arduino inside the joystick casing, and use the original joystick cable to connect to the mount (with a new plug on the end).  There's a single red button on the joystick, which I'm thinking could be used to select between fast/slow slewing speeds.  And possibly another mode (?) when held down while using the joystick.

 

Wiring will be very very simple, so feel free to join in if you want to play along and make one for yourself.

 

The Joystick is due here on Tuesday April 13.


Edited by mlord, 10 April 2021 - 08:55 PM.

  • Chote, tjay, descott12 and 3 others like this

#2 demarko69

demarko69

    Mariner 2

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

Posted 10 April 2021 - 05:33 PM

love the idea, im in



#3 Cyberpapa

Cyberpapa

    Sputnik

  • *****
  • Posts: 25
  • Joined: 07 Jul 2019

Posted 10 April 2021 - 07:26 PM

I like this idea, but I would use the red button for the green laser.



#4 descott12

descott12

    Soyuz

  • *****
  • Posts: 3,966
  • Joined: 28 Sep 2018
  • Loc: Patrick county, VA

Posted 10 April 2021 - 07:35 PM

I love it!

#5 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 10 April 2021 - 07:57 PM

I like this idea, but I would use the red button for the green laser.

May be a good use for the "held down" mode of the button then.  The Arduino itself could probably drive the GLP from a GPIO pin in response to the button.  EDIT: Depends upon the power of the GLP, but 5mW should be doable.
 


Edited by mlord, 10 April 2021 - 08:05 PM.


#6 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 10 April 2021 - 08:01 PM

I love it!

And You in particular can probably guess first try as to what Arduino code I'll be using as a starter for this project..  :)


  • descott12 likes this

#7 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 10 April 2021 - 08:17 PM

.. an old-school switch-based joystick game controller..

So "switch-based" means that the joystick has one micro-switch for "up", another for "down", and one each for "left" and "right".  Plus one more for that red "Fire" button.

joystick_wires.jpg

 

This can be wired to the Arduino in a few different ways.  The simplest, which we'll use here to begin with, is to just attach Black to GND, and then the other five wires to individual GPIO pins with the internal PULLUP feature enabled on them.  Nice and easy when lots of pins are available.

 

But later, someone might want to incorporate this into an existing project that may not have five spare GPIOs remaining.  In which case a single analog-input GPIO could be used, along with five carefully chosen resistors.  But not here.  Sticking with the easier method on this one!

 

An alternative to this simple type of joystick would be a more modern game controller (or "thumbstick") that uses a pair of potentiometers (variable resistors) instead of the four axis switches.  With that style, one could adjust the slew speed automatically according to how far the joystick is pushed from the centre rest point.

 

In my haste at Amazon, I didn't spot any of that style that appealed or had a sufficiently low price tag, so I'm definitely going for the old-school device here.  And if the Arduino board fits inside of it, everything makes for a nice and tidy end product! smile.gif


Edited by mlord, 10 April 2021 - 08:34 PM.

  • Chote and descott12 like this

#8 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 13 April 2021 - 11:22 AM

With my area all back in strict lockdown again, Amazon is quoting longer delivery times for most things, including the two joysticks -- now due on Saturday at the earliest.  Project will resume then, if not before (easy enough to simulate joystick with a few push-button switches).


Edited by mlord, 13 April 2021 - 09:25 PM.


#9 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 15 April 2021 - 01:54 PM

Good news!  The joysticks arrived here today.  I have hooked them up to an Arduino, and written code to read/debounce the five buttons.  All good and working, after I figured out that the "Black" wire in the earlier diagram is on pin-8 of the connector (difficult to read photo of a photocopy of a fax of a photocopy or something..).

 

There is definitely space enough inside the joystick itself to house a small Arduino circuit for the AUX bus connection.

 

Now to see about having those buttons result in slew commands..


Edited by mlord, 15 April 2021 - 01:55 PM.

  • descott12 likes this

#10 demarko69

demarko69

    Mariner 2

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

Posted 15 April 2021 - 02:56 PM

got my joystick wait further instruction



#11 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 15 April 2021 - 03:57 PM

got my joystick wait further instruction

Excellent.

 

To begin with, today I just took an existing wired-up breadboard with an ESP32 and 74HC125 already in place, and plugged the joystick into that and got things working, because it's just easier with the ESP32 than other boards.

 

Next step is to transfer that code to an Arduino Pro Mini 5V board, and get it working again on that hardware.  Then embed the board inside the base of the joystick and crimp an RJ12 onto the end in place of the existing DB9 connector.

 

Here is the ESP32 code:

Attached File  joystick.ino.v0.2.txt   7.84KB   39 downloads

 

joystick.jpg


Edited by mlord, 15 April 2021 - 04:02 PM.


#12 junomike

junomike

    ISS

  • *****
  • Administrators
  • Posts: 22,595
  • Joined: 07 Sep 2009
  • Loc: Ontario

Posted 15 April 2021 - 05:38 PM

Any way to get this Joystick to work from the HC?  I have both Celestron/Nexstar and SW/Synscan and this would be handy however my last inquiry (not you) was shot down by the requirement of a Guider Port



#13 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 15 April 2021 - 05:55 PM

Any way to get this Joystick to work from the HC?  I have both Celestron/Nexstar and SW/Synscan and this would be handy

Not really.  It is designed to plug into an AUX port on the mount, the same as the HC does.  So one could just add a splitter to one of the existing AUX ports (or the HC port) and then plug both the HC and the Joystick into the splitter.



#14 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 15 April 2021 - 05:57 PM

Okay, I have it working with a 5V Arduino Pro Mini board, and have integrated it into the base of the Joystick!

 

Here's the updated code, which also shows the pin assignments:  Attached File  joystick.ino.v0.3.txt   7.03KB   79 downloads

 

finished.jpg

 

I will post more build notes later.  Dinnertime now!


  • Chote likes this

#15 descott12

descott12

    Soyuz

  • *****
  • Posts: 3,966
  • Joined: 28 Sep 2018
  • Loc: Patrick county, VA

Posted 15 April 2021 - 06:02 PM

Wow...that was fast. Very cool.



#16 junomike

junomike

    ISS

  • *****
  • Administrators
  • Posts: 22,595
  • Joined: 07 Sep 2009
  • Loc: Ontario

Posted 15 April 2021 - 09:06 PM

Not really.  It is designed to plug into an AUX port on the mount, the same as the HC does.  So one could just add a splitter to one of the existing AUX ports (or the HC port) and then plug both the HC and the Joystick into the splitter.

That works!

 

PM sent



#17 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 15 April 2021 - 10:10 PM

I have updated the Arduino code a bit more: no changes to program flow or functionality, but I fixed some comments and removed some unused/leftover code from it.  It should be slightly easier to follow now. smile.gif

 

Attached File  joystick.ino.v0.4.txt   6.37KB   40 downloads

 

Here is the wiring diagram.  Very very simple, using a clone of a Sparkfun Arduino Pro Mini 5V/16Mhz board.  As always, ignore the wire colours.  They differ from cable to cable, project to project, and cannot be relied upon.  Instead pay close attention to which wire connects to which pin on the pictured RJ12 plug, shown with contacts "up".  Only five of the six pins are used by this project.

 

This board accepts 12V input directly from the AUX bus, so no extra power conversion is needed in this case, because the current draw is very very low.  As with other HomeBrew projects, do NOT attempt to use a "Nano" board.  But the 5V Pro Micro boards are decent and could be used instead of a Pro Mini if you wanted (with minor changes to the code).

 

The diode on TXO is mandatory!  I used a 1N4148 small-signal type for this.  There is a pull-up resistor on the TXO line for compatibility with SE mounts, and the program enables the built-in pull-up of the Arduino chip for the BUSY line (pin-4), saving a resistor!  Note that I have only tested it on my own Evolution mount, but I expect it to also work on other types of Celestron mounts.

 

joystick_wiring.jpg


Edited by mlord, 16 April 2021 - 11:23 AM.

  • Chote likes this

#18 demarko69

demarko69

    Mariner 2

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

Posted 15 April 2021 - 10:26 PM

cool, mine will be done tonight too


  • mlord likes this

#19 Chote

Chote

    Viking 1

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

Posted 15 April 2021 - 10:41 PM

Okay, I have it working with a 5V Arduino Pro Mini board, and have integrated it into the base of the Joystick!

 

Here's the updated code, which also shows the pin assignments:  attachicon.gifjoystick.ino.v0.3.txt

 

attachicon.giffinished.jpg

 

I will post more build notes later.  Dinnertime now!

Great work again. Thank you.

The long cable is the original cable which you just changed the jack head?



#20 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 15 April 2021 - 10:44 PM

Great work again. Thank you.

The long cable is the original cable which you just changed the jack head?

Yup.  I actually chopped off about two feet from it, leaving about 41 inches of cord with a new RJ12 plug crimped on the end -- a bit fussy that, but I was patient and got it on there.


  • Chote likes this

#21 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 15 April 2021 - 10:49 PM

Some more build photos, showing the innards and the colours I chose for re-using the existing cable for the AUX connection.

auxbus.jpg

innards.jpg

 


  • Chote likes this

#22 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 15 April 2021 - 11:07 PM

The code as written slews at HC speed "5" by default.  Holding down the RED button boosts the slewing to speed "8" while that button is held.  Those two speeds suit my own purposes very nicely here.

 

I did experiment with having the slew speed increase the longer one holds the joystick in an active direction, but in the end decided that I preferred the simpler method it now uses.

 

Note that the joystick diagonal directions also work, causing the mount to slew both the ALT/AZM motors simultaneously.

 

One can change the two speeds easily enough -- very straightforward to find/change those in the code.  And with somewhat more effort, one could alter other aspects of the functionality too.

 

One idea would be that perhaps someone with a Focus Motor might want the joystick to control that when the RED button is held down, and to do normal slewing when the button is not held.  Lots of possibilities!

 

The joystick enclosure has lots of extra space inside, so it is possible to drill holes around the base into which one could add extra switches for more speeds or whatever.


Edited by mlord, 16 April 2021 - 11:25 AM.


#23 mlord

mlord

    Cosmos

  • *****
  • topic starter
  • Posts: 7,649
  • Joined: 25 Oct 2020
  • Loc: Ottawa, Canada.

Posted 16 April 2021 - 11:53 AM

Here is v0.5 of the Joystick program for the Arduino Pro Mini 5V board.

 

Attached File  joystick.ino.v0.5.txt   6.9KB   53 downloads

 

More general tidying, no functional changes.

I think I'm done with it for now.  smile.gif



#24 spacemunkee

spacemunkee

    Fly Me to the Moon

  • *****
  • Posts: 7,272
  • Joined: 22 Oct 2017
  • Loc: Cincinnati, Ohio

Posted 16 April 2021 - 12:10 PM

Thanks for that link!
I'll be ordering a couple for......
My Atari 2600! Only thing stopping me from Space Invaders!

The one thing I've held onto from childhood. :) Just no sticks.. Got junked somehow.
  • mlord likes this

#25 demarko69

demarko69

    Mariner 2

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

Posted 16 April 2021 - 02:16 PM

hi


Edited by demarko69, 16 April 2021 - 02:18 PM.



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