Jump to content

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.

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
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
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
Link to post
Share on other sites
  • 6 months later...

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! ;)

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 :)

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.

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

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... ;)

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

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
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
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Ade Turner
      Now I’ve managed to sort out control of my EQ6-R Pro using Stellarium via EQASCOM, I’m working my way through the other equipment I want to control from my Windows 7 laptop.
      I’m stuck trying to get my Celestron focuser to be recognised. This is what I’ve done so far:
      Downloaded the Celestron Focuser Utility Program (.exe file) from here: https://www.celestron.com/pages/manuals-software Also downloaded the December 2019 USB ASCOM driver set up from above. I ran the ASCOM driver set up and restarted the laptop. Connected focuser direct to laptop via USB. The focuser’s power light shows red and in Windows control panel it recognises the device as ‘Celestron Focuser’ but indicates no driver present. Ran the Celestron focuser utility program hoping it would connect and install the right driver so I could calibrate, but it can’t detect the focuser at all. Finally, ran APT to see if I could connect by choosing the ASCOM driver under ‘Gear’ but this doesn’t work either. Stuck now. I’m guessing I need to somehow ‘tell’ Windows where the driver is...? 
      Any thoughts? Thanks everyone
      🙂
       
      EDIT: I have previously had this focuser working correctly both with StarSense handset and via ASCOM (Celestron unified driver) through the aux on my old Evolution mount. However, now I’ve changed to a Sky-Watcher mount, I need it to function direct through USB.
    • By starman-scott
      Hi, I have changed the focuser on my newtonian but its too short.
      I realise that I can just add an extension tube to it but I’m not sure if that is the best solution.
      I also seem to have have a stray light problem (I’m getting a hazy image on a 5mm eyepiece).
      A third problem is that I find it quite cumbersome that the focuser has to stick out so far (155mm+eyepiece).
      I wonder if I might solve the stay light problem by extending the main telescope tube instead of the focuser and therefore getting the eyepiece closer to the secondary. And also maintain more precision in the focuser by not extending it.
      As it stands the focuser would have to come out 265mm from the centre of the secondary mirror in order to focus. The secondary is 50mm wide. From primary to secondary is 950mm approx.. The primary is 200mm Thanks for reading. Any advice will be much appreciated.
       
    • By wavydavy
      Originally brought for my C11 HD Edge, which its made for, but if used with filter wheel, OAG, and 0.7 focal reducer the spacing is to far out, hence the reluctant sale of this A+ Condition, unused (other than to see if it worked) focuser. The price includes special delivery. Bank transfer, paypal is ok, or cash/collect...ect... The price is £200. This would be great for planetary imaging, imaging without using an OAG, bringing the travel closer. Thanks for looking.




    • By Zermelo
      The focuser on my SkyWatcher 150i is a basic rack-and-pinion, unsurprising for the price point, but sometimes a bit of a pain to control finely enough. I’m not looking to spend any serious money upgrading it, but I did want to see what I could tweak.

      The first thing I did was to slacken off (slightly) the screws holding the plate against the spindle, as the operation was very tight when new – that helped a bit (and I think that without doing this first, the “friction fit” approach described below wouldn’t have worked). I will eventually get around to taking it all off as per AstroBaby's tune-up.

      Improving the fine control without a major change means doing something with the focusing knobs – they’re quite small, so the effective “gearing ratio” when you operate them is on the harsh side. Some folk have described fitting larger diameter replacements, either bought or made, and even using ones with a planetary-style mechanism to achieve a reduction in the ratio. I didn’t fancy this, as I couldn’t see how the existing knobs were attached to the spindle without trying to prise them apart (possibly terminally). The other option is to increase the effective diameter of the existing knobs, for which purpose a clothes peg is apparently quite popular, but I’ve also come across descriptions of chop sticks inserted into holes drilled at intervals into the circumference, and punctured lids from peanut butter jars.

      I wanted something that was cheap, relatively tidy and non-destructive. The answer seemed to be some sort of thick sleeve that I could fit over the knob. It would need to be a tight fit so as not to slip in use, to be not so large as to foul against either the focuser tube or the main OTA, and to be thick enough that it didn’t flex sideways when grasped. I thought I might find some larger rubber washers that would do the job, but none were thick enough to be rigid in use. However, a bit of searching found these spacers that are apparently used in vehicle shock absorbers.

      My calipers said the diameter of the focuser knobs was around 29.5mm, and the nearest spacers that were available had an internal hole 30mm and outside diameter 60mm. I ordered one that was 10mm thick, not quite as deep as the knobs, but which allowed a bit more space on the inside edge for free operation. I’d hoped the internal hole might be a but undersized when it arrived but it was spot on, so I wound five or six turns of masking tape around the knob first. To avoid taking the tape off when fitting the spacer, I positioned one side first and stretched it across the face as I pushed. When it’s flush with the knob’s outer face, it’s just clear of the focuser body and OTA. There might be enough room to stick some kind of friction surface around the outside to improve the grip, but I don’t think it’s going to be necessary.

      I decided to do only the one knob, so I now have a very Noddy “dual speed” affair.  Because the clearances around the fitted spacer are quite tight, it’s worth checking the positioning of the spindle in the focuser body first – mine was fractionally off centre, so there was more room one side than the other (assuming you have no preference).



       



       

       
       
       
       
       
    • By wavydavy
      Originally brought for my C11 HD Edge, But when used with filter wheel, OAG,  and 0.7 focal reducer the spacing is to far out, hence the reluctant sale of this A+ Condition, unused (other than to see if it worked), focuser. Asking price is £240 which includes special delivery. Bank transfer, paypal or cash/collect ect......
      https://www.365astronomy.com/moonlite-cs-model-dual-speed-crayford-focuser-for-3.3-sc-with-0.95-travel-focal-reducer-drawtube-and-brass-compression-ring-gold-orange-colour.html




×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.