Jump to content

Stargazers Lounge Uses Cookies

Like most websites, SGL uses cookies in order to deliver a secure, personalised service, to provide social media functions and to analyse our traffic. Continued use of SGL indicates your acceptance of our cookie policy.

Andy_K

Arduino focuser - is this idea feasible?

Recommended Posts

I've read through just about all of the threads relating to Arduino based focusers and building one is definitely something I'm going to have a go at.

A 'version' I haven't seen yet is one using rotary encoders...so I'm guessing there's probably a reason for it! But here goes...

My idea was to use 2 rotary encoders to control the stepper.  One encoder for coarse focusing and the other one for fine adjustment.

Something like this :

post-35784-0-90612000-1397055964_thumb.j

In theory the coarse encoder would move the stepper a larger number of steps and the fine one would be single (or half) step.

I did toy with the idea of using potentiometers (connected to the analogue inputs) instead of rotary encoders but thought the 360° rotation of the encoders would be more suitable.

As my knowledge of programming is on a par with my guinea pig's, I'd like to know if the idea is feasible or not before attempting to blatantly copy and modify the various (rather brilliant) sketches and ideas from southerndiver357, yesyes, Gina etc. :wink:

Any comments would be gratefully received.

Share this post


Link to post
Share on other sites

I built a focuser using almost precisely that setup - except I use a single rotary encoder, and the built-in push button on it cycles between fast and slow modes.

Works very nicely.

I should probably get around to cleaning up and publishing the source code sometime. Getting the rotary encoder to work smoothly was the tricky bit, especially with cheap encoders that generate quite a bit of bounce. Interrupts are the key here.

  • Like 1

Share this post


Link to post
Share on other sites

Hmmm...yeah, I like the idea of a single pushbutton encoder.

I've got one on order, so will attempt to bodge some code when it arrives :D

Share this post


Link to post
Share on other sites

I did one using a joystick with the push in switch grounding the 1/2 step pins on the stepper drive for a high speed mode. It works very well.

  • Like 1

Share this post


Link to post
Share on other sites

A rotary encoder is certainly one option but rather more expensive than push buttons.

  • Like 1

Share this post


Link to post
Share on other sites

Interesting :)  Not come across those before.  Makes for a neat and compact solution.  Could even work out cheaper too.  Needs debouncing code in the sketch but so do push buttons.  Definitely something to think about :)

Later...  Well, its £6.88 inc. P&P and VAT.

Edited by Gina

Share this post


Link to post
Share on other sites

I built a focuser using almost precisely that setup - except I use a single rotary encoder, and the built-in push button on it cycles between fast and slow modes.

Works very nicely.

I should probably get around to cleaning up and publishing the source code sometime. Getting the rotary encoder to work smoothly was the tricky bit, especially with cheap encoders that generate quite a bit of bounce. Interrupts are the key here.

Is the publishing of the source code still a possibility?

I've not had a great deal of luck myself yet - I should really have made use of the light nights to read up on Arduino coding! ;)

Share this post


Link to post
Share on other sites

There is more than way to skin a cat. I haven't toyed with this yet but intuitively it should be somewhat straightforward.

Back in the day the problem I had while playing with encoders was my circuit missing some of the pulses and/or the quadrature getting out of whack. But with a fairly quick microcontroller you should have no problems.

The only thing I would try myself if I were in your shoes would be a magnetic/hall effect encoder. Those are some fun devices :)

Share this post


Link to post
Share on other sites

There is more than way to skin a cat. I haven't toyed with this yet but intuitively it should be somewhat straightforward.

Back in the day the problem I had while playing with encoders was my circuit missing some of the pulses and/or the quadrature getting out of whack. But with a fairly quick microcontroller you should have no problems.

The only thing I would try myself if I were in your shoes would be a magnetic/hall effect encoder. Those are some fun devices :)

Interesting point :)  I've been using push button switches with de-bounce code in the Arduino sketch.  This is simple and works, though push buttons are far from the most reliable devices and sometimes don't make contact.  I may have a play with hall-effect devices - I have several, also a number of small magnets.  OTOH I use optical encoding for my weather station wind vane so that's another option.

With my Arduino controlled focusers I have strived to keep things simple and keep the number of wires to/from the scopes to warm room to a minimum.  I could reduce this further when I add ASCOM code to my Arduino sketch to provide auto-focussing but ATM I have so much on my mind that I just can't cope with the complication.  My latest design just uses an audio screened cable with a resistor network in the warm room.  Then at the Arduino a resistor from the +5v and to the wire and that then connects to an analogue input.  The code then sorts out which button was pressed by the resistance produced and the resulting voltage.

Share this post


Link to post
Share on other sites

Ah... I didn't considered the possibility of using this remotely (from a warm, cozy room). That would probably add an extra layer of complexity, because the signals from the encoder may deteriorate fairly quickly with distance.

In any case, and just to throw an idea into the mix: the "magnetic encoders" I was talking about are actually ICs from a company called Austria Microsystems ("AMS"). These ICs can detect the rotation of a magnet located close to the IC surface, and can also detect the magnet being pushed toward the IC (pushbutton-style). The output can be I2C, SPI, quadrature, PWM or even analog (different part numbers for each one), and the number of pulses per revolution so far go up to 4096. The nice thing of using one of these is that -as far as I can remember- you can change the number of pulses per revolution on the go... giving you the variable rate focuser you need :)

I think there are some "actual" (i.e. more than the IC) encoders on the market using the AMS ICs, but I have never used one.

  • Like 1

Share this post


Link to post
Share on other sites

Is the publishing of the source code still a possibility?

I've not had a great deal of luck myself yet - I should really have made use of the light nights to read up on Arduino coding! ;)

The full code needs a lot of cleanup before I could publish it - but here's the ISR I use to track the encoder position:

/* encoder routine. Expects encoder with four state changes between detents *//* This code will need changing for other boards and other pins *//* I use Arduino Micro */#define ROTA                   2 // pin 2 associated with int0#define ROTB                   3 // pin 3 associated with int1void setup(){    pinMode(ROTA, INPUT);    pinMode(ROTB, INPUT);    digitalWrite(ROTA, HIGH);                        // enable pullups    digitalWrite(ROTB, HIGH);    attachInterrupt(0, rotary_isr, CHANGE);    attachInterrupt(1, rotary_isr, CHANGE);}volatile int rotary_position = 0;void rotary_isr(){    static int8_t stepsSeen = 0;    static uint8_t old_AB = 3; //lookup table index and initial state    uint8_t encport; //encoder port copy    static const int8_t enc_states[] PROGMEM =    { 0, -1, 1, 0, 1, 0, 0, -1, -1, 0, 0, 1, 0, 1, -1, 0 }; //encoder lookup table    old_AB <<= 2;     //remember previous state    encport = ENC_RD & 0x03;    //read encoder    old_AB |= encport;   //create index    stepsSeen += pgm_read_byte(&(enc_states[( old_AB & 0x0f )]));    if (stepsSeen > 1)    {        // two steps forward        rotary_position += 1;        stepsSeen = 0;    }    else if (stepsSeen < -1)    {        //two steps backwards        rotary_position -= 1;        stepsSeen = 0;    }}
  • Like 2

Share this post


Link to post
Share on other sites

This link gives a nice way of reading rotary encoders  without needing any debounce routines.

There is also a useful discussion of implimenting as an interrupt driven routine.

Hope it helps.

Hugh

www.circuitsathome.com/mcu/reading-rotary-encoder-on-arduino 

  • Like 2

Share this post


Link to post
Share on other sites

This link gives a nice way of reading rotary encoders  without needing any debounce routines.

There is also a useful discussion of implimenting as an interrupt driven routine.

Hope it helps.

Hugh

www.circuitsathome.com/mcu/reading-rotary-encoder-on-arduino 

Thank you for that link - it could be very useful :)  I have several rotary encoders that I haven't got round to using :D

Share this post


Link to post
Share on other sites

I just realized there's one in the mouse... transplanting that to a scope controller pad would be interesting :)

  • Like 1

Share this post


Link to post
Share on other sites

Two in fact :)

I was talking about the scroll wheel :) I don't know if there's any non-optical mouse left among the pile of electronic garbage spares I have in my home "office".

Googling "mouse scroll wheel arduino" gives you, among other things, the following:

http://www.stevekamerman.com/2010/12/understanding-a-mouse-scroll-wheel/

Oh my... now I'll have to build one of these... ;)

Share this post


Link to post
Share on other sites

I was talking about the scroll wheel :) I don't know if there's any non-optical mouse left among the pile of electronic garbage spares I have in my home "office".

Googling "mouse scroll wheel arduino" gives you, among other things, the following:

http://www.stevekamerman.com/2010/12/understanding-a-mouse-scroll-wheel/

Oh my... now I'll have to build one of these... ;)

Ah yes, I see :D  I had forgotten about the scroll wheel - good thinking :)  And thank you for posting that link - very interesting :)  I have quite a collection of "dead" mice and trackballs :D

Edited by Gina
  • Like 1

Share this post


Link to post
Share on other sites

The thing to remember about the small rotary encoders is that they will only give you the direction they are turning i.e. clockwise/anticlockwise. They are not analogue devices. If you get it working using the code in the link I posted (scroll to the very end for the code I used) you can then decide how many steps to move the stepper motor for each transition from the encoder. My first focuser used this method in combination with a 5-way switch to determine direction and speed. The encoder was used for fine adjustment when the switch was in the centre/neutral position.

http://stargazerslounge.com/topic/202282-ascom-and-arduino/

I eventually discarded the manual focuser although it worked fine and converted it to a pure ascom-based design as I wanted control from my PC.

http://stargazerslounge.com/topic/218975-arduino-ascom-focuser-mark2/

I got the encoder I used from technobots - they have a good range

http://www.technobotsonline.com/?subcats=Y&status=A&pshort=N&pfull=N&pname=Y&pkeywords=N&search_performed=Y&q=rotary+encoder&x=0&y=0&dispatch=products.search

I used this one, it also has a handy push switch in the centre http://www.technobotsonline.com/rotary-encoder-12-step.html

Share this post


Link to post
Share on other sites

Yep... Encoders will give you the information you need to determine which way they are moving ("quadrature"), and you need to implement a way to handle that. In the good old days you would use a couple of flip-flops on the A/B signals from the encoders and that would give you signals to increment/decrement a counter.

Now... the interesting stuff is what you do with that signal. You can either use that as a position (i.e. one pulse of the encoder translates into a fixed number of steps of the motor), as speed (count the number of pulses from the encoder over a certain amount of time and use that as a speed signal for the motor), acceleration, etc.

Have you ever read the sentence "when I finally knew all the answers they changed all the questions"? Now... if instead of a stepper you use a small servo (removing the rotation limits) and use the encoder to determine speed... Just sayin' :)

  • Like 1

Share this post


Link to post
Share on other sites

I still prefer a stepper motor.  Whether to use a rotary encoder, push buttons or ASCOM interface depends on your abilities and feelings on the matter :D  I shall probably go for the ASCOM interface eventually.  My problem is that I'm no longer able to progress projects at anything like I did in the past - I just don't have the stamina now :(

  • Like 2

Share this post


Link to post
Share on other sites

Here is the sketch from my MK1 focuser. It even has my first attempt at some ascom commands. The encoder only moves the stepper when the 5-way switch is in the centre. I have also included a schematic.

focusser.txt

post-28249-0-67343500-1415214870_thumb.j

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By sonnymoon
      It's an ED80 with the stock focuser. I think there is some astigmatism somewhere as my stars can be a little stretched and so I want to see if I can use a collimating laser to check if the focuser is in straight. (I'm also going to make a determined effort to get the spacing right between the FF//FR and the sensor, but that's another story). I can't see any threads that get into the detail of lining up the focuser with a laser. 
      If I put the laser in with the target bit facing up, then the red dot that bounces back off of the lens is slightly off centre on the target on the collimator. If I loosen the screws, turn through 90deg, retighten and look again, then the red dot is in a different place and so on all the way through 360 deg. I'm thinking that the red dot should be central (as when collimating a Dob that I used to have). Is that right?
      It may be that the laser needs collimating, but I'm not sure how to do that.
      Any advice on whether this approach is going to get me anywhere would be appreciated.
       
    • By ICR_2019
      Hi All
      I thought I would share how I fixed my sloppy rack and pinion focuser on Skywatcher 130p.
      The issue? When using or collimating the slop in the focuser would put the target or centre dot way out of line.
      With the tube tilted downward I removed the 4 screws/nuts  of the focuser to remove it from the OTA.
      Loosen the lock  and 2 adjusting screws, I used a small torx screwdriver as i did't have an allen key small enough.
      Remove the 4 screws holding the adjuster bar in place, and remove the adjuster.
      Note: Be careful to avoid the very sticky grease used on the drive!
      Remove the draw tube assembly, remove the lock/adjusting shim located at the top of the main body.
      There were 2 plastic shims 1 each side of the drive I removed both of them.
       Thoroughly clean everything with degreaser and isopropyl alcohol except the drive itself.
      I cut 2 plastic shims from food packaging, cleaned them, and using 50mm double sided tape I lined out the main focuser body. Be careful to cut to the correct size and shape before installing and don't cover the drive or lock/adjusting shim areas.
      Next using teflon tape purchased from eBay I covered the draw tube exterior.
      I then did the same covering the plastic shims in the main body.
      It was still a little loose so I doubled the teflon tape at the top of the tube either side of the adjusting shim.
      Next I added a plastic shim onto the adjuster shim and covered with teflon tape.
      Put it all back together and almost no slack!
      I can now move the focuser from fully in to fully out without the collomation moving out of the centre ring on the primary.
      Complete success I think.
       
       
       
       
    • By Stargazer33
      Having suffered for some while with broken teeth on my Tracelscope 70s plastic focuser rack; I finally got around to doing something about it.
      First of all I cut a piece of aluminium (aluminum for our friends across the Pond 🇺🇸) the same size and dimensions as the plastic one on the focuser tube. Using the damaged one on the tube as a template, I marked out the replacement and began to file it down to size. Once this was done I copied across the positions of the valleys between the teeth onto the aluminium replacement. Using a manual mitre saw with a blade suitable for metal I cut the valleys. Some rough filing and the rack was almost complete. A hole was drilled at each end to receive a screw. I then cut off the plastic rack from the focuser tube, filed the cut flat and the glued and screwed the replacement into position.
      Due to the rough hand marking, cutting and filing it is not 100% smooth running, but at least it gives me full travel.
      A couple of pics:
                                                                
                                Broken plastic rack (removed).                                                     New aluminium rack glued & screwed in place
    • By Piero
      I am selling my Moonlite installation kit for 8" newtonian focuser as shown here 
      https://www.firstlightoptics.com/moonlite-focusers/moonlite-installation-kit-for-newtonian-focusers.html 
       

       
      The installation kit was fitted on my 8" dobson in Italy and used very little (it is essentially new). I no longer need it as the focuser now sits on my 12" dob. 
      New £58, my price: £40 (including RM 1st class signed-for). PayPal (pay as a friend) or direct bank transfer.
      Also advertised on ABS.
      Thanks for looking,
      Piero
    • By DavidJM
      Anybody used a Lacerta Dual Speed 1:10 Microfocus Upgrade Kit for Skywatcher Crayford Focuser?
      Are they any good?
      easy to fit?
      or should I just spend the extra to get a full dual speed focuser?
      cheers for your thoughts
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.