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

Tutorial: a cheap stepper USB-powered motor for lens autofocus is easy!

  • Please log in to reply
48 replies to this topic

#1 cuivienor

cuivienor

    Vanguard

  • *****
  • topic starter
  • Posts: 2,125
  • Joined: 06 Oct 2010
  • Loc: Tokyo, Japan

Posted 28 January 2018 - 12:37 AM

Second time I write this. When I first pressed "Post New Topic" I got an "Sorry, you have been blocked. You are unable to access cloudynights.com" error, and lost all my work. Great.

 

Trying again.

 

I've been looking for a simple way to autofocus my lenses for astrophotography, and had issues with the solutions available to me:

- commercial solutions are overkill: they provide robust, overkill motors with lots of torque, and require 12V to run - this is necessary for heavy imaging trains. I'm tired of 12V, since I'm looking for a very portable setup that runs as much as possible on 5V, out of my computer USB port. And lenses focusing rings don't require much torque at all to rotate, the weight of the imaging train is irrelevant.

- commercial solutions are expensive.

- the Arduino based Arduino Ascom Focuser Pro v2 seemed a nightmare to get to work, with 100 pages of documentation and tons of sensors needed and....

 

I decided to try it anyway, and plot twist! It's actually easy. I got an Arduino starter set for 15 dollars, including Arduino Uno R3 board, ULN2003 control board, and 28BYJ-48 motor, along with some wires. And then I did the hardware setup. It was very easy!

- plug in the motor to the control board

- link the digital pins 4-7 from the Arduino to IN1-4 pins on the control board (just plugging in cables, no soldering!)

- link the Arduino 5V and GND pins to the + and - pins on the control board

- your hardware setup is done!

 

Then let's get to programming the Arduino board so we can control the motor:

- install the Arduino IDE

- connect the Arduino to the computer via USB

- in the IDE, under tools, select the correct board (Arduino/Genuino Uno) and port (COM4 for me)

- download the programming code from here

- Unzip it on the computer. Copy the contents of myFocuserPro2libraries to your documents\Arduino\libraries folder (for me it's C:\Users\Yannick\Documents\Arduino\libraries)

- next, from the Focuserv264_ULN2003 folder, open the Focuserv264_ULN2003.ino file in the Arduino IDE

- make sure the Arduino board is connected to the computer, and press the Arrow button (Upload) at the top of the Arduino IDE. Wait until it is complete.

- Done! No need to do that again (unless you want to change some parameters in the code later on).

 

Now we want software to control the motor directly:

- get the control software and install it (either mini or full, either works)

- select the correct COM port (make sure the IDE is not connected at the same time to avoid conflicts) and click connect

- try to move the motor, etc. You can now focus electronically thanks to this!

 

Next, let's get the ASCOM part done:

- download the ASCOM driver and install it

- open up your capture software (SGP for me)

- connect to the focuser by selecting the right port (make sure neither the IDE nor the Windows control software is connected to it at the same time)

- check you can move the motor, etc.

- Profit!

 

So with those steps, I have a motor with little but sufficient torque that can turn my focus ring, and requires only 5V from the USB port of the computer, nothing else! I just need a nice, permanent way to mount it!

 

Hope this can be useful!

Attached Thumbnails

  • IMG_20180128_141208.jpg

Edited by cuivienor, 28 January 2018 - 02:11 AM.

  • h2ologg, skybadger, Rickster and 17 others like this

#2 mitchellcloud

mitchellcloud

    Explorer 1

  • *****
  • Posts: 82
  • Joined: 12 Jan 2016
  • Loc: Kansas City, KS

Posted 28 January 2018 - 12:45 AM

What kind of laptop is that? That is the tiniest laptop I've ever seen


  • Ken Sturrock likes this

#3 cuivienor

cuivienor

    Vanguard

  • *****
  • topic starter
  • Posts: 2,125
  • Joined: 06 Oct 2010
  • Loc: Tokyo, Japan

Posted 28 January 2018 - 01:05 AM

Mitchell - this is the GPD pocket. A 7 inch laptop with good specs (128GB eMMC, 8GB RAM, quad-core CPU, long lasting battery), than can be charged via USB-C (e.g. 5V, just what I love!). I run all my astrophotography capture software, as well as PixInsight for quick processing on the go.


  • Ken Sturrock and calypsob like this

#4 Rickster

Rickster

    Surveyor 1

  • *****
  • Posts: 1,586
  • Joined: 09 Jun 2008
  • Loc: NC Kansas Bortle 3 SQM 21.8+

Posted 28 January 2018 - 01:57 AM

Excellent tutorial.  Just what I was looking for.



#5 darkstar3d

darkstar3d

    Messenger

  • *****
  • Posts: 499
  • Joined: 11 Oct 2013
  • Loc: Lake Worth, FL

Posted 28 January 2018 - 07:40 AM

Nice. I’m curious too see how you are attaching the lens and motor. There was a post of just that not long ago. I need to find the link to it.


Sent from my iPad using Tapatalk

#6 cuivienor

cuivienor

    Vanguard

  • *****
  • topic starter
  • Posts: 2,125
  • Joined: 06 Oct 2010
  • Loc: Tokyo, Japan

Posted 28 January 2018 - 08:15 AM

Rickster, glad I can be of help!

Darkstar - I think I saw that, and maybe participated in that thread. They were using a belt to move the focus wheel, but I believe it was a 12V motor. My lens is currently at Kowa (again) as one element (that I don't use actively, thankfully) didn't fit. So I'll find a way to get it connected once it comes back!
  • darkstar3d likes this

#7 jpbutler

jpbutler

    Apollo

  • *****
  • Posts: 1,150
  • Joined: 05 Nov 2015
  • Loc: Edison, NJ

Posted 28 January 2018 - 09:23 AM

Hey great thread. 

I might be the guy that wrote the 12v thread that is being referred to or not as there are a few out there. 

Some require an engineering degree to wade through. 

Haven't returned to it because I can't get the belt drive to be repeatable. 

I am trying to drive a Nikon 185mm lens and it is fairly heavy.

The stepper motor cogs, I think that is the correct term, sometimes and the step value doesn't change accurately at that point. 

But I am still working on it. 

 

A smaller lighter lens should be no problem. 

 

Just ordered a follow focus gear set and ring belt and will try a direct drive method next.

 

Just like you, the whole arduino route seemed kind of daunting. 

Glad you posted your success.

I might just play around with one based on your writeup. 

 

John


Edited by jpbutler, 28 January 2018 - 09:25 AM.


#8 vagrom

vagrom

    Vostok 1

  • -----
  • Posts: 191
  • Joined: 05 Sep 2016
  • Loc: Kansas City

Posted 28 January 2018 - 10:42 AM

I just build one too. It was rather easy. The Windows app is nice. Just got the ASCOM working with SGP last night. Still need to tweak the SGP settings but last night once the temperature dropped 2 degrees, it successfully refocused unintended. 


  • jpbutler likes this

#9 ksouers

ksouers

    Mariner 2

  • -----
  • Posts: 279
  • Joined: 10 Oct 2017
  • Loc: St. Louis (close enough)

Posted 28 January 2018 - 10:47 AM

This is timely. I got a "starter" kit by Elegoo for Christmas. So I already have all the components at hand.

I'm having trouble with the software though, it won't compile the myFocus module. Says I have invalid libraries. I followed the link and downloaded "Arduino Firmware myFocuserPro2 v264.zip" and installed it in the Arduino libraries folder.

 

Any suggestions?

 

Thanks cuivienor for starting this thread.

 

Kevin


  • Noah4x4 likes this

#10 jpbutler

jpbutler

    Apollo

  • *****
  • Posts: 1,150
  • Joined: 05 Nov 2015
  • Loc: Edison, NJ

Posted 28 January 2018 - 10:50 AM

Could some of you guys post pictures of your setup?

 

 

John



#11 wotalota

wotalota

    Sputnik

  • *****
  • Posts: 37
  • Joined: 15 Aug 2016
  • Loc: SW New Hampshire

Posted 28 January 2018 - 11:53 AM

This is an older version, intend to update to make it smaller and tidier at some point.
Just put it on a VC200L to try it using a belt.

 

Attached Thumbnails

  • IMG_1004.JPG

  • Ken Sturrock, torsinadoc and jpbutler like this

#12 spokeshave

spokeshave

    Mercury-Atlas

  • *****
  • Posts: 2,660
  • Joined: 08 Apr 2015

Posted 28 January 2018 - 12:12 PM

I love to see projects like this. Just a few comments. The ULN2003 driver is for unipolar motors only, like the 28BYJ-48 that comes with many Arduino kits. Most steppers, though, are bipolar and the 28BYJ-48 is a very cheap, toy-like motor with not a lot of torque and gobs of backlash.

 

Another option is to use the Arduino UNO an the L293D motor driver shield. This driver is for bipolar motors and it, combined with the UNO, is by far the simplest Arduino/motor driver combo. The shield simply pushes on to the UNO pin sockets and the motor is attached to one of the two motor screw ports. No soldering is required at all, unless you want to add a temperature sensor. The Focuserv264_L293D firmware works with this combination. 

 

Tim


  • calypsob, Goofi, David-LR and 2 others like this

#13 Goofi

Goofi

    Cosmos

  • *****
  • In Memoriam
  • Posts: 8,137
  • Joined: 03 May 2013
  • Loc: Coastal Southern California

Posted 28 January 2018 - 12:23 PM

Thanks Tim ... I was waiting for you to join this conversation!  grin.gif



#14 niteskyze

niteskyze

    Sputnik

  • *****
  • Posts: 48
  • Joined: 20 Jan 2018

Posted 28 January 2018 - 02:38 PM

I love to see projects like this. Just a few comments. The ULN2003 driver is for unipolar motors only, like the 28BYJ-48 that comes with many Arduino kits. Most steppers, though, are bipolar and the 28BYJ-48 is a very cheap, toy-like motor with not a lot of torque and gobs of backlash.

 

Another option is to use the Arduino UNO an the L293D motor driver shield. This driver is for bipolar motors and it, combined with the UNO, is by far the simplest Arduino/motor driver combo. The shield simply pushes on to the UNO pin sockets and the motor is attached to one of the two motor screw ports. No soldering is required at all, unless you want to add a temperature sensor. The Focuserv264_L293D firmware works with this combination. 

 

Tim

Tim -- What motor do you suggest for the set up you describe?  And thanks to all for the contributions!



#15 JohnPlenge

JohnPlenge

    Vostok 1

  • -----
  • Posts: 166
  • Joined: 24 Apr 2005
  • Loc: Port St. Lucie, FL

Posted 28 January 2018 - 03:16 PM

Neat idea!!  I'll have to give this a try someday.



#16 vagrom

vagrom

    Vostok 1

  • -----
  • Posts: 191
  • Joined: 05 Sep 2016
  • Loc: Kansas City

Posted 28 January 2018 - 04:24 PM

I decided to separate the box with the Arduino Nano and the Motor controller. I wired RJ45 jacks between so I could use an ethernet cable between them. Also I decided to not power the nano externally and just powered it with USB.

 

 

Attached Thumbnails

  • focuser_pic.jpg

  • h2ologg likes this

#17 spokeshave

spokeshave

    Mercury-Atlas

  • *****
  • Posts: 2,660
  • Joined: 08 Apr 2015

Posted 28 January 2018 - 04:40 PM

niteskyze, on 28 Jan 2018 - 2:38 PM, said:

 

spokeshave, on 28 Jan 2018 - 12:12 PM, said:

I love to see projects like this. Just a few comments. The ULN2003 driver is for unipolar motors only, like the 28BYJ-48 that comes with many Arduino kits. Most steppers, though, are bipolar and the 28BYJ-48 is a very cheap, toy-like motor with not a lot of torque and gobs of backlash.
 
Another option is to use the Arduino UNO an the L293D motor driver shield. This driver is for bipolar motors and it, combined with the UNO, is by far the simplest Arduino/motor driver combo. The shield simply pushes on to the UNO pin sockets and the motor is attached to one of the two motor screw ports. No soldering is required at all, unless you want to add a temperature sensor. The Focuserv264_L293D firmware works with this combination. 
 
Tim

Tim -- What motor do you suggest for the set up you describe?  And thanks to all for the contributions!

 

It depends on what you're driving. For my camera lens focuser, I used a NEMA 8 PG-19 motor. This is a very small motor with a 19:1 reduction gearbox and it has plenty of torque to turn a lens focus ring using just the 5V supplied by the powered USB hub. For turning larger loads, the same motor can be used by supplying 12V to the Arduino.

 

Tim



#18 niteskyze

niteskyze

    Sputnik

  • *****
  • Posts: 48
  • Joined: 20 Jan 2018

Posted 28 January 2018 - 06:39 PM

 

niteskyze, on 28 Jan 2018 - 2:38 PM, said:

 

spokeshave, on 28 Jan 2018 - 12:12 PM, said:

I love to see projects like this. Just a few comments. The ULN2003 driver is for unipolar motors only, like the 28BYJ-48 that comes with many Arduino kits. Most steppers, though, are bipolar and the 28BYJ-48 is a very cheap, toy-like motor with not a lot of torque and gobs of backlash.
 
Another option is to use the Arduino UNO an the L293D motor driver shield. This driver is for bipolar motors and it, combined with the UNO, is by far the simplest Arduino/motor driver combo. The shield simply pushes on to the UNO pin sockets and the motor is attached to one of the two motor screw ports. No soldering is required at all, unless you want to add a temperature sensor. The Focuserv264_L293D firmware works with this combination. 
 
Tim

Tim -- What motor do you suggest for the set up you describe?  And thanks to all for the contributions!

 

It depends on what you're driving. For my camera lens focuser, I used a NEMA 8 PG-19 motor. This is a very small motor with a 19:1 reduction gearbox and it has plenty of torque to turn a lens focus ring using just the 5V supplied by the powered USB hub. For turning larger loads, the same motor can be used by supplying 12V to the Arduino.

 

Tim

 

I was looking at this unit:

 

https://www.omc-step...hm11-0404s.html

 

to drive the stock 2 speed Crayford focuser on an Astronomics AT8RC with a ZWO ASI294 camera -- thoughts???



#19 spokeshave

spokeshave

    Mercury-Atlas

  • *****
  • Posts: 2,660
  • Joined: 08 Apr 2015

Posted 28 January 2018 - 07:51 PM

niteskyze, on 28 Jan 2018 - 6:39 PM, said:

 

spokeshave, on 28 Jan 2018 - 4:40 PM, said:

 

niteskyze, on 28 Jan 2018 - 2:38 PM, said:niteskyze, on 28 Jan 2018 - 2:38 PM, said:

 

spokeshave, on 28 Jan 2018 - 12:12 PM, said:spokeshave, on 28 Jan 2018 - 12:12 PM, said:

I love to see projects like this. Just a few comments. The ULN2003 driver is for unipolar motors only, like the 28BYJ-48 that comes with many Arduino kits. Most steppers, though, are bipolar and the 28BYJ-48 is a very cheap, toy-like motor with not a lot of torque and gobs of backlash.
 
Another option is to use the Arduino UNO an the L293D motor driver shield. This driver is for bipolar motors and it, combined with the UNO, is by far the simplest Arduino/motor driver combo. The shield simply pushes on to the UNO pin sockets and the motor is attached to one of the two motor screw ports. No soldering is required at all, unless you want to add a temperature sensor. The Focuserv264_L293D firmware works with this combination. 
 
Tim

Tim -- What motor do you suggest for the set up you describe?  And thanks to all for the contributions!

 

It depends on what you're driving. For my camera lens focuser, I used a NEMA 8 PG-19 motor. This is a very small motor with a 19:1 reduction gearbox and it has plenty of torque to turn a lens focus ring using just the 5V supplied by the powered USB hub. For turning larger loads, the same motor can be used by supplying 12V to the Arduino.

 

Tim

 

I was looking at this unit:

 

https://www.omc-step...hm11-0404s.html

 

to drive the stock 2 speed Crayford focuser on an Astronomics AT8RC with a ZWO ASI294 camera -- thoughts???

 

That should work.

 

Tim



#20 cuivienor

cuivienor

    Vanguard

  • *****
  • topic starter
  • Posts: 2,125
  • Joined: 06 Oct 2010
  • Loc: Tokyo, Japan

Posted 28 January 2018 - 08:17 PM

Wow, good to see all of the good info in there! The starter motor that comes with the starter kit seems indeed to be not so great, but I think it will suffice for my needs. If not, well I'll follow Tim's suggestions!

 

I'm still thinking about how to connect the motor and lens. I already have a microfocuser as depicted here (my guide lens and camera also sit on top of that microfocuser), and plan to put the motor on that microfocusing plate. I may just opt to have the motor rotate the screw of the microfocuser, or have a belt drive, or direct gear drive. I'll just need to make sure of the amount of backlash and dial that in.

 

Kevin, to answer your question, this is very silly, but did you put in just the contents of the myFocuserPro2libraries folder in  the Arduino libraries folder? So if you go to C:\Users\<Username>\Documents\Arduino\libraries folder, you should see a Bounce2 folder, a myAFMotor folder, etc.?


  • dvalid likes this

#21 ksouers

ksouers

    Mariner 2

  • -----
  • Posts: 279
  • Joined: 10 Oct 2017
  • Loc: St. Louis (close enough)

Posted 29 January 2018 - 06:54 AM

Thanks cuivienor. That was it. All I had to do was RTFM, silly me. Kind of a silly way to deploy a package, though.

 

Now that it's working I think I'll follow Tim's advice and go with the L293D driver. I've got a couple NEMA 14 and NEMA 8 motors sitting around here looking bored.

 

 

Kevin



#22 anismo

anismo

    Fly Me to the Moon

  • *****
  • Posts: 6,089
  • Joined: 30 Jan 2014
  • Loc: Austin, TX, USA

Posted 29 January 2018 - 08:51 AM

Thank you for your excellent tutorial!



#23 Adun

Adun

    Mercury-Atlas

  • *****
  • Posts: 2,814
  • Joined: 02 Dec 2016

Posted 29 January 2018 - 01:34 PM

Hmmm, I do have some of those 28BYJ-48 lying around unused.

 

It's their mechanical fitting to my scopes what I can't quite figure out.



#24 torsinadoc

torsinadoc

    Surveyor 1

  • *****
  • Posts: 1,791
  • Joined: 04 Feb 2013
  • Loc: Fayetteville AR

Posted 29 January 2018 - 01:43 PM

Cool. Thanks

#25 m033dkhan

m033dkhan

    Explorer 1

  • -----
  • Posts: 77
  • Joined: 29 Aug 2017

Posted 29 January 2018 - 05:56 PM

Amazing Post! bow.gif  I was thinking of buying a focuser along with a USB control interface, your post motivated me to try this DIY project waytogo.gif




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