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

Simple DIY motor focuser

Astrophotography DIY Equipment Imaging Reflector Software
  • Please log in to reply
15 replies to this topic

#1 Diver

Diver

    Lift Off

  • -----
  • topic starter
  • Posts: 13
  • Joined: 27 Jul 2012

Posted 26 October 2021 - 05:11 PM

I have just completed a DYI motorized focuser using a 28YBJ48 motor modified to be bipolar and an L293D driver chip, Teensy 3.2, OLED display, DHT 22 temperature/humidity sensor and Rotary push knob.  The focuser is Moonlite Ascom compatible and works within Astrophotography Tools and NINA.  I printed a 3D case as a handheld controller.

 

The focuser torque is much better as bipolar.  This motor has ~1:64 gear ratio (most do).  You can find info on how to easily do this online.

 

Features:

  • Setup when powered on by USB - instructions to set focus tube to remove backlash.
  • Main display screen shows Current step location, Temperature, Humidity, and Dew Point (Celcius).
  • Stepping display screen shows Current location, Target location, Location of tube mm  or  RPM of the focus knob, input step factor ( 10,000  1,000  100  10  1 ).
  • Presets display screen shows preset number (1-20) and preset step location.   Also show the selection made by pressing and holding down the rotary knob.

 

The software is C++ using Arduino IDE.  An Arduino Nano maybe could be used, but Teensy is just so much faster and better.

 

The cost of the focuser was about $50 as I had many of the other items laying around ( and still have plenty of pieces to make more )  .

 

Main Components:  ( these prices are for individual pieces, you may have to purchase several pieces to obtain just one)

 

28YBJ48  5v            $5

Teensy                   $20    or maybe cheaper Arduino Nano

OLED                      $2

Rotary Encoder       $2

L293D chip              $2

Flexible coupling   $10

 

 

Other items you would need:

 

Short Dupont cables

PCB board and Male pin headers

Wire

12v power source and connector  ( I used female barrel on the controller and male on the cord )  [12v is required because of bipolar modification] 

Connectors for power and motor wires  ( I used 4 pin aircraft connectors - I can use the controller on more than one motor/scope )

Case to fit it all in

Something to attach to your scope ( I used 1/2" aluminum angle to attach to my focuser )

 

 

Soldering required (and if you are good and want to, you can solder it all together and not worry about connectors, but be warned, Dupont pins don't like solder!)

 

 

To accomplish this I watched several online videos, read several DYI focuser makes and used many others ideas and codes to make it happen.  I just wanted more than a focuser that was Ascom compatible with no controller and didn't want several buttons and something too big to put on my scope  (and didn't want to go for the ones priced out of my reach).  This thing is powerful for this motor and has over 2000 steps per revolution of the fine focus adjustment knob.

 

There is a lot of code to go with it, but I documented some in the code to help understand.  If anyone is interested in this please comment on this post and I can add to this the code and other items, photos, etc. that could help with the build if enough respond.

 

Clear Skies!

Attached Thumbnails

  • Startup.jpg
  • Remove Backlash.jpg
  • Main.jpg
  • Presets.jpg

Edited by Diver, 26 October 2021 - 05:17 PM.

  • markb, kopite, Benschop and 1 other like this

#2 2ndRecon

2ndRecon

    Explorer 1

  • *****
  • Posts: 78
  • Joined: 31 Mar 2018
  • Loc: Dallas, TX

Posted 26 October 2021 - 05:38 PM

I’ve been shopping for a week, and I think this would be a fun project regardless of whether I end up using it or not.

I already have a spare Uno R3 and a ton of motor drivers and steppers.

#3 markb

markb

    Surveyor 1

  • *****
  • Posts: 1,862
  • Joined: 16 Jun 2006
  • Loc: Arizona at last, goodbye NY. Light pollution still awful though

Posted 26 October 2021 - 05:41 PM

I just wanted more than a focuser that was Ascom compatible with no controller and didn't want several buttons and something too big to put on my scope  (and didn't want to go for the ones priced out of my reach).  This thing is powerful for this motor and has over 2000 steps per revolution of the fine focus adjustment knob.

Loved it.

 

These are the same goals I've had, tried one stepper focus but resold it since I am primarily visual with light AP hopes. I still would like a possibility of automated focus if I do the AP dip, and I use power focusing on everything for vibration reduction and ease of getting accurate focus.

 

12v is not an issue for me as the Talentcell packs have 12v and usb power out.

 

Using a rotary knob is great and intuitive on a focuser, I use buttons on the JMI and others but was never a fan of the interface.

 

Your displays also look well chosen. And presets would work nicely with my range of not even remotely parfocal eps.

 

Access to your code, and circuit board if you designed one, and schematic if not, would be wonderful. Like many here, I would think, circuit design and code are weak spots, but I can build and program if the code is provided.

 

Are you posting it here or else where, or sending it by email? If so I'm send a PM if desired.


Edited by markb, 26 October 2021 - 05:45 PM.


#4 2ndRecon

2ndRecon

    Explorer 1

  • *****
  • Posts: 78
  • Joined: 31 Mar 2018
  • Loc: Dallas, TX

Posted 26 October 2021 - 05:52 PM

I second what Mark said. I’d like to take a shot at building one, for no other reason than a winter project.

#5 Benschop

Benschop

    Viking 1

  • *****
  • Posts: 508
  • Joined: 12 Jan 2015
  • Loc: Ontario

Posted 26 October 2021 - 06:20 PM

I like the handwheel encoder for focusing in your design, instead of pushbuttons. 

 

The Robert Brown variant is the one I used

https://sourceforge....focuserpro2diy/



#6 Diver

Diver

    Lift Off

  • -----
  • topic starter
  • Posts: 13
  • Joined: 27 Jul 2012

Posted 27 October 2021 - 11:50 PM

Well let me a bit more testing and I will put something together. 


  • markb and Benschop like this

#7 markb

markb

    Surveyor 1

  • *****
  • Posts: 1,862
  • Joined: 16 Jun 2006
  • Loc: Arizona at last, goodbye NY. Light pollution still awful though

Posted 28 October 2021 - 12:23 AM

Great!

 

I look for a post and/or PM.



#8 Diver

Diver

    Lift Off

  • -----
  • topic starter
  • Posts: 13
  • Joined: 27 Jul 2012

Posted 30 October 2021 - 03:49 PM

OK, here we go!!!

 

First off thanks to these guys for their work in inspiring me to do this:

 

        Original Moonlite Compatible Focuser post  -  helped me with communications with ASCOM driver
        Patrick Dutoit:   https://www.cloudyni...tronic-focuser/

 

        Rotary Encoder Debounce routines  -  helped me debounce the nastiest of rotary encoders
        John Main:   https://www.best-mic...ry-encoder.html

 

        28BYJ48 unipolar to bipolar conversion  -  helped to make the little motor 'the little motor that could'      
        https://coeleveld.co...-to-bipolar.pdf

 

 

The rotary encoder I used came on a breakout board with resistors built-in.  It was still noisy and gave bad results when turning the dial.  The debouncing routine fixed that.

 

The OLED 128x64 i2c display I used is 5v tolerant.  If you don't get 5v tolerant OLED you will have to install resistors to lower the voltage if you use a 5v MCU.

 

Attached is a zip file with all the information and code, instructions.txt about using the focuser, and a wiring diagram (sorry no Fritzing).

 

You will need to install Arduino IDE ( and Teensyduino for this to work with a Teensy - highly recommended ).

 

Unzip this to the folder of the same name or it won't work in Arduino IDE.  Be sure to load all the libraries needed in the .ino file before compiling or uploading to focuser.  I highly recommend testing out all this code before hooking up 12 volts.

 

If you don't use a Teensy, your on your own.  You can figure out how to use an Arduino Nano (you need 2 interrupts to use the code mostly as is, but interrupts are VERY DIFFERENT for Nano.  Teensy has interrupts built in and it's faster, that's one reason I used a Teensy 3.2.

 

You will have to manufacture your own hand controller case as all DIY projects are not the same size.  Sorry.

 

Also, if you do this, know that I am not responsible if you burn your hair, house, pet, spouse, furniture or anything else bad that happens.  If you are not COMPLETELY comfortable undertaking this DIY project, then don't.  Practice makes perfect!

 

 

 

APT settings tabs notes:  (there are likely some settings similar in NINA but you have to figure that out)

 

'T & Sky' tab SELECT   'No additional sensor'.     (yes we have humidity and dew point but ASCOM driver doesn't use it, it is for your information only.

 

'Scope and Focuser' tab DON'T SELECT   '*Meade Focuser'  or   '*Focuser with Humidity Sensor'. 

 

 

 

SO, if you do this and it works for you then HOORAH!  It works for me in APT and it worked previously in NINA but I haven't tested it in a while.

 

Clear Skies!

Attached Files


  • markb and Starsareus like this

#9 markb

markb

    Surveyor 1

  • *****
  • Posts: 1,862
  • Joined: 16 Jun 2006
  • Loc: Arizona at last, goodbye NY. Light pollution still awful though

Posted 30 October 2021 - 05:47 PM

Wow, thanks!

 

Files downloaded okay, and the post instructions make it clear what to do.

 

The 3 links are very helpful.

 

This should be fun and useful.

 

Added trying it out to the project list..


Edited by markb, 30 October 2021 - 05:55 PM.


#10 Diver

Diver

    Lift Off

  • -----
  • topic starter
  • Posts: 13
  • Joined: 27 Jul 2012

Posted 31 October 2021 - 08:46 PM

I just updated APT to 3.88 and I noticed it now does compensation overshoot.   I am going to attempt to use this method to do backlash compensation without having to use other software.  If successful, i will try to provide a choice of which method to use when you power up.

 

Currrently, if you set your backlash in IDE you will accumulate that backlash every time you power up the focuser as it moves out the backlash amount.  My newest scope doesn't let me freewheel the tube back in so I have to tinker with the power cord out to move out a bit then power cord in to get the focuser to be all the way in; don't like t.

 

I am going to change the initiation startup to 'move out' backlash steps then 'move in' backlash steps to to engage inward movement on power up.  Moving in last is best way for hanging gear on your focuser. 

 

I will repost the zip file with this changes one way or another.

 


Edited by Diver, 31 October 2021 - 11:17 PM.

  • markb likes this

#11 Diver

Diver

    Lift Off

  • -----
  • topic starter
  • Posts: 13
  • Joined: 27 Jul 2012

Posted 01 November 2021 - 11:25 AM

waytogo.gif    SUCCESS    applause.gif

 

I incorporated the Overshoot Compensation method in the focuser software.  You will no longer need to use other software to compensate for backlash, the focuser does it.  I tested this with APT and it works from hand controller to APT and goto values from APT.

 

Simply set the backlash value to your backlash plus some more (default is 50 and will work for practically all these 24YBJ motors) in the user definitions.  If you don't want to use Overshoot Compensation then comment out the #define Compensation line in the user definitions.  Note that other than Overshoot Compensation backlash is not used.

 

Attached is a complete copy of all the files again - modified as above.

 

Hope you enjoy!

 

Clear Skies!

Attached Files


  • markb, rlw1138 and Benschop like this

#12 markb

markb

    Surveyor 1

  • *****
  • Posts: 1,862
  • Joined: 16 Jun 2006
  • Loc: Arizona at last, goodbye NY. Light pollution still awful though

Posted 01 November 2021 - 12:51 PM

bow.gif waytogo.gif

Thanks for the updated files!



#13 Diver

Diver

    Lift Off

  • -----
  • topic starter
  • Posts: 13
  • Joined: 27 Jul 2012

Posted 02 November 2021 - 12:16 AM

Installed NINA nightly and confirmed focuser works with overrun compensation on its own without using any settings for backlash in NINA.

 

Wish I thought of this in version 1!

 

Now on to next project ... dual camera cooler and dual dew heater using PID.

 

 

Good luck! 


  • markb and Benschop like this

#14 Diver

Diver

    Lift Off

  • -----
  • topic starter
  • Posts: 13
  • Joined: 27 Jul 2012

Posted 07 November 2021 - 02:53 PM

Well I fixed the startup backlash (yes it wasn't working as I wanted it to but still worked to control backlash) and added Temperature Compensation to the focuser.  The temperature compensation is enabled in the Moonlite Setup dialog.  You will have to figure out the steps/degree temperature coefficient to use (see the instructions.txt file and google all you can find).  Temp Comp is a pain as you have to do a lot of leg work to determine the coefficient to use, it varies with whatever the scope is and whatever hangs on it, so if you want to use it go ahead.  I did a different flavor as the focuser will report the actual steps to ASCOM driver and on to the other software.

 

Thanks to Richard Beck for his posting on github for information on how he did this and his Moonlite Command protocols.

 

Attached is v2.2

 

Clear Skies!

 

 

 

 

Attached Files


Edited by Diver, 08 November 2021 - 02:19 PM.


#15 Diver

Diver

    Lift Off

  • -----
  • topic starter
  • Posts: 13
  • Joined: 27 Jul 2012

Posted 09 November 2021 - 04:21 PM

I think I just posted the wrong zip file above and can't edit the post!?

 

Just ignore it.  I have issues with it anyway.

 

One of my scopes not moving in and out the same steps each time, even though it thinks that they are.  The scope bottoms out on an Out=In.

 

I think it's the amount of force required to turn the fine focuser and skipping steps.

 

Will keep this updated when I figure out out what is going on.


Edited by Diver, 09 November 2021 - 04:27 PM.

  • markb likes this

#16 Diver

Diver

    Lift Off

  • -----
  • topic starter
  • Posts: 13
  • Joined: 27 Jul 2012

Posted 10 November 2021 - 01:47 PM

Well the fine focuser was slipping.  All tightened up now and working fine.  My focuser is hard to turn and I can still get 30rpm on the fine focus (10:1).   I did find that the cheap little stepper motor will get warm if you run it constantly for a while and this may cause it to miss steps if it get hot.  In my testing, I can move the focuser out 30,000 steps and back 30,000 steps and it barely gets warm, so should be OK for most focusing events.

 

You should ALWAYS move your focuser to 0 (zero) before powering down as it assumes it is at zero when it powers on.  If you, don't your presets will all be wrong next time.  I found this to be a bit annoying, but I use this controller on several scopes (focusers all have their own motor so don't save the current position to eeprom) so it works well.  If you forget, it seems impossible to get the focuser back to zero AND be all the way in.  A trick if you have a geared focuser: unplug the motor power and step it out more than it would take to get back in all the way, then plug the motor power in and step it back in a little each time until it is at zero.  Then power down.  You made need to do this after a while anyway as the steppers all seem to get lost a little sometimes.

 

I have only tested the in-controller Temperature Compensation and it worked with the artificial temperature changes.  I will have to see one night when the temperature changes enough to do anything with it.  Feel free to test it and let me know what you think.

 

I developed a spreadsheet to aid with preset values and calculate Temperature Compensation steps/degree.  Rather than going out in the night and measuring steps then refocus at different temperatures over and over and then determining steps/degree, I just measured the parts of steel and then aluminum and used the coefficient of expansion to determine the number of steps/degree.  I observed that the focuser distance out can change the value (is it out 100 steps or 45,000 steps), so I use the spreadsheet to calculate the steps/degree of the overall length at preset temperature.  I can put the actual temperature of the evening in the spreadsheet and it will compute the steps to actually use to get to focus.  Hope it works in real life!

 

Enjoy and Clear Skies!

 

 

Attached Files


  • markb 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





Also tagged with one or more of these keywords: Astrophotography, DIY, Equipment, Imaging, Reflector, Software



Cloudy Nights LLC
Cloudy Nights Sponsor: Astronomics