Introduction: Nunchuck Controlled Telescope Focuser
If you ever tried using your telescope at relatively high magnifications (>150x) you probably have noticed how manually adjusting your telescope focuser may result in being a truly pain in the neck.
This is because even the slighter adjustment you can achieve by hand is sufficient to let your telescope tube start wiggling, and a little movement of the tube is enough, at those magnification, to make almost impossible for you to enjoy the observation.
Tired of this, I thought that it would have been necessary to build a device that could allow the user to adjust the focuser without even touching it, avoiding every micro movement of the tube.
Obviously, electronics was the answer!
At first, I roughly planned to use a motor, whose speed could have been regulated by the user, to let the focuser knob rotate.
I then examined various ways of doing it, and I ended up with the following:
- The best motor to use is a stepper motor (which has the peculiarity that you can precisely control its revolutions and it speed).
- The easiest way to control the stepper motor by software is by using an Arduino board
- Arduino can't cope with the relatively high voltages needed for motor, and the best way to overcome the problem is to use an external chip called L293D (just few dollars on eBay)
- To precisely adjust the rotating velocity and at the same time let the motor rotating the best thing to do is to use a joystick. But wait! Rummaging in my garage I found an old friend of mine: ladies and gentleman, from the Wii era, here is the Nunchuck! (actually, I had a fake one too, so I used that one). It is basically the joystick we had planned to use, but it is beautifully implemented in an ergonomic controller which will make our life easier
- To transfer the rotating motion from the motor to the focuser knob, I used a gear train, with the advantage of increase the torque diminishing the angular velocity.
So, the device will act as follow:
If we push the nunchuck joystick upward, the motor will rotate let's say clockwise, and the focuser will go let's say upwards. Everything reverts if we push the joystick downwards. In addition to that, the strong point is that depending on the joystick position, the rotating speed will change, allowing us to perfectly regulate our focus without even touching the telescope being also able to change the speed.
That is roughly what we are gonna do. Let's start!
Note #1: I am using a SkyWatcher StarDiscovery 150/750 GoTo Newton Telescope
Note #2: Every picture attached is labelled! :)
Step 1: Shopper
First, you have to find all the pieces you will need:
- The stepper motor: I used one recovered from an old printer. You can find these motors in printers, scanners, robots of any kind, sometimes appliances and so on. You will recognize them since they have 4 or more wires. (you will need the 4 wires one, but (as in my case) even motors with more wires will be adaptable without any problem). Alternatively, you can buy them for just a few dollars on the web (eBay: https://www.ebay.com/itm/Schrittmotor-Stepper-Motor-Nema-23-1-8-4-wires-76mm-3A-270oz-in1-8Nm-Bipolar-RL8/192184965880?hash=item2cbf1ddaf8%3Am%3Amo5OOqKrWPb61coLLmDuWuw&var=492103011572&_sacat=0&_nkw=stepper+motor+Schrittmotor&_from=R40&rt=nc&_trksid=p2047675.m570.l1313.TR11.TRC2.A0.H0.Xstepper+motor+Schrittmotor.TRS1)
- Arduino: I used (a clone of) the nano version for it is convenient due to its dimension, but everyone is really the same. You can buy it for no more than $3 online (https://www.ebay.com/itm/MINI-USB-Nano-V3-0-ATmega328P-CH340G-5V-16M-Micro-controller-board-for-Arduino/381374550571?hash=item58cbb1d22b%3Ag%3Aci0AAOSwNSxVAB3c&_sacat=0&_nkw=arduino+nano&_from=R40&rt=nc&_trksid=p2047675.m570.l1313.TR12.TRC2.A0.H0.Xarduino+nano.TRS0)
- The motor controller chip L293D: buy it online for less than $1 (https://www.ebay.com/itm/2Pcs-L293D-L293-Push-Pull-Four-Channel-Motor-Driver-IC-NEW-IC/171907289499?hash=item280679119b%3Ag%3AbKQAAMXQVERSsEdI&_sacat=0&_nkw=l293d&_from=R40&rt=nc&_trksid=p2380057.m570.l1313.TR12.TRC2.A0.H0.Xl293d.TRS0)
- You will also need a DC-DC step down voltage regulator to adjust the voltage from the 12V telescope supply (alternatively you can use some batteries) to the one you need to run the motor and Arduino. Here you are: https://www.ebay.com/itm/5PC-Mini-DC-DC-Converter...)
- Of course, the Nunchuck (a fake one is good too) (https://www.ebay.com/itm/Nunchuck-Nunchuk-Video-Game-Controller-Remote-For-Nintendo-Wii-Console-5-Colors/302411879669?hash=item46692714f5%3Am%3AmW4vDc-cLmn_jE6E3xkIBTw&var=601244670237&_sacat=0&_nkw=nunchuck&_from=R40&rt=nc&LH_TitleDesc=0)
- Gears of various dimensions to transfer the motion from the motor to the knob (for example: https://www.ebay.com/itm/58-style-Plastic-Gears-C... if you have access to a 3D printer you are done)
- 1 (red) Led
- 1 Resistor (220 Ohm)
- 1 perfboard (https://www.ebay.com/itm/NEW-10PCs-5cm-x-7cm-Paper-PCB-Prototyping-Perf-Boards-Breadboard-DIY/202321128432?hash=item2f1b476bf0%3Ag%3AI5YAAOSwuyNbBluU&_sacat=0&_nkw=perfboard&_from=R40&rt=nc&_trksid=p2047675.m570.l1313.TR11.TRC2.A0.H0.Xperfboard.TRS1)
- A metallic plate or a little bit of ingenious to attach the device to your telescope
- Wires, soldier, (eventually) a breadboard, connectors, tools
Of course, especially points 6 and 7 depends on your telescope, so I can't really say you how to do that part of the projects, but here you can unfasten your ingenious!
Step 2: Mechanical Engineer
The first thing I did was finding a way to attach the motor to the telescope tube.
I was pretty lucky since the motor I recovered from the printer had a plate (I will call it the motor plate) with two gears already built in it, so I only had to block that plate on the telescope. However, you do not really need it and you can directly attach the motor to the L shaped plate I am going to talk in a while.
I managed to cut a 1mm metal plate I had in my garage in order to obtain an L shaped plate.
Taking advantage of the two screws holding the focuser knob, I attached the L plate to the telescope, and then I attached the motor plate to the L one, as in the pictures. In that way I can also eventually space the motor from the focuser (for manual adjustment) by just rotating the motor plate on the L one.
Done that, the issue was: how do I transfer the rotating motion from the gears I had on the motor plate to the focuser knob?
I though of drive belts, but I had no one and it would have been struggling to find one of the right length and to find two gears to drive it. In addition, it would have be possible for the belt to lose its elasticity in the future; so I discarded the option.
What I believe is the best solution is to directly connect the motor to the knob by mean of gears.
The problem now is: what gears do I have to use and where can I find them?
If you are lucky enough that your knob is already grooved (as a gear) you can just insert a compatible gear on the motor pivot and make it touch the grooved knob.
However, my knob was almost smooth, so I needed a gear to be installed on the knob and communicate with the one installed on the motor (or as in my case with the gear train I had). I chose to 3D print that gear, so that I could get precisely what I needed. The result was great and I was finally able to transfer motion from the motor to the knob.
I also installed a reinforcing plate (as you can see in pictures) to prevent the main plate to bend under the effort of the rotating motor.
Ok, the mechanics is ready, let's now jump to the "sophisticated" section!
Step 3: Electrical Engineer
Now we need to control the motor.
Note #1: In the file attached you will find the electric scheme, the arduino pin scheme, the step-down data sheet and the l293 scheme. In addition to that, you will find a labelled picture of the circuit setup on a breadboard. Please note that at the right of the breadboard there are two buttons. Just ignore them, we are not gonna use them, they should have not been there :)
Note #2: If you are going to use my setup (Arduino Nano) you are ok, otherwise you just need to eventually change some pin connections.
The first thing to do in order to do that is to build the electronic circuit.
I have uploaded the scheme, so it will be quite easy for you to setup it.
You can firstly try the circuit on a breadboard and then (after having programmed arduino (the next step is about it)) solder everything on a perfboard, as I did.
Now, I would like to explain the scheme to you, so that you can deeply be aware of what you are doing.
So:
Firstly, you need power. I attached the whole circuit to the power supplier I use for the Telescope mount, but you can do how you prefer. Based on the stepper motor you have bought, you will need a specific voltage to let it run. In my case it was about 8 Volts, so I needed a DCDC step down (device capable of reducing continuous current voltage) from 12V to 8V. I chose the MP1584 (refer to the documentation attached) which allowed me to regulate the output voltage too.
I then connected everything that needed power (motors, l293d, arduino) to the +output of the step down.
In particular, you can power arduino by pin on pin 30 (refer to arduino website for further infos). To power the motor and the l293d you have to power pins 1,8,9,16 on l293d chip.
Now, connect pin 4,5,12,13 on l293d and pin4 on arduino to the circuit common ground (it basically is the -output on the voltage step down).
Done that, you have to connect the motor to the l293d chip in order to control it from arduino.
An usual stepper motor is made up of two coils, a vertical one and a horizontal one. inside them there is a rotor, which is constituted by a magnet. Alternating the currents on the coils, you can generate a rotating magnetic field inside the coils (View Biot-Savart law). The magnet (or the rotor) is affected by this rotating magnetic field, and starts to rotate itself in order to get aligned with the field lines. This will cause the rotor to rotate.
That is basically how a stepper motor works (I will reexplain it in details in the next step)
What now we have to do is to identify which wires are from a coil and which from the other one. You can do it by using a digital multimeter to check which wires are connected each other: try all the combinations and you will identify the two couples of wires correspondent to the two coils.
Done that, connect one wire from one coil to pin 3 on the l293d and the other one (from the same coil) to pin 6 on l293d. Also, connect the other two wires from the other coil to pins 11 and 14 on l293d.
Now you have to connect l293d to arduino:
Follow the scheme and you are done.
the next thing to do is to connect the nunchuck to arduino, which will receive data from it and control the motor.
Firstly, unless you have a slot for the nunchuck peculiar pin, cut the nunchuck wire. You will have now 5 little wires coming from the nunchuck. We are gonna use just 4 of them (the white, yellow, green and the red ones).
To communicate, the nunchuck uses the I2C protocol, which uses a bus constituted by a clock wire and a data one. The yellow wire is the one for the clock. Connect it to the analog A5 pin on arduino. The nunchuck green wire is for the data. Connect it to the A4 pin on arduino. The nunchuck red wire is for the 3.3V alimentation. Arduino has a 3.3V output pin ( is pin 17) so connect the red wire to it. Connect the nunchuck white wire to the circuit common ground.
Ok, you are almost finished.
Just add a led (red is the best for night observation) to the circuit so that we can have a sort of feedback of what is happening in the circuit.
The effect we want is to get the led brighter as we push the nunchuck joystick forward or backwards. To do that, we need a special arduino pin, one with a function called PWM that allow you to modulate the output pulse in order to regulate led brightness. Use pin 16 on arduino for that. Connect it to a 220 Ohm resistor and then to the anode of the led. Connect then the led cathode to the ground.
Finally, you have to regulate the screw on the dcdc step down in order to let it output the right voltage (see the picture). (you can do it by connecting the dcdc step down to the power and using a digital multimeter to measure the output voltage while regulating it according to the motor data sheet (be careful not to overcome the maximum voltage for powering arduino by pin (it is 20V as stated here: https://store.arduino.cc/arduino-nano).
Ok, well done!
Now, before solder everything, let's tell arduino what it has to do!
Step 4: Software Engineer
Note: I have attached both the .ino version and the .txt version of the code I have used in this project
Here, we are gonna program arduino and tell it what it has to do with the data it will receive from the nunchuck.
Before doing anything, disconnect the arduino pin 30 and 4 from the previous circuit, since now we are going to connect arduino to our pc by usb, and it will receive the power needed from the usb connection.
Done that, connect arduino to your pc using a micro usb cable. Than launch the arduino app (you can download it from here: https://www.arduino.cc/en/Main/Software? ) and select from [Tools->port] the usb serial port you have connected arduino to. Now create a new project. We are ready to start.
We can divide our goal in two sub-goals:
- Acquire data from the nunchuck
- Use these data to control the motor (and the led)
Let's proceed with order:
the easiest way you have to collect data from the nunchuck is by using a dedicated library (it is called ArduinoNunchuck and you can download it from here: http://www.marcopucci.it/wp-content/uploads/2013/... )
download it and import it in the arduino software.
Thanks to this library, arduino will store data from the nunchuck in some specific numeric variables. We will just need the one corresponding to the joystick vertical movement, and it is called nunchuk.analogX. What we need to know is what is the value for nunchuk.analogX when the joystick is at rest. In order to do that, from the arduino app go to [files->examples->arduino nunchuck-> arduino nunchuck demo] and run it. Open the serial monitor and you will see a list of numbers. (Similar to the one in the attached picture) In the first column are showed the numbers corresponding to nunchuk.analogX for different moments in time. Try to move the joystick vertically and you will see them change. What you have to do is to remember the number you get when the joystick is at rest and when it is at the two extremes (mine were: 124 for the rest, 255 for the extreme upward, 0 for the extreme downward).
You will need these numbers later.
Now let's move to the task number 2: how do we control the stepper motor?
Actually, there are several libraries, such as Stepper or AccelStepper, to do that, but I preferred to write my own code to control the motors. The idea is that, as explained in the previous step, for a stepper motor to rotate, it needs a rotating magnetic field in which the rotor (that is the magnet) which is connected to the pivot can rotate. In your motor there are two coils, perpendiculars to each other and both perpendiculars to the motor pivot (see the picture attached). From this setup you can get the rotating magnetic field this way:
- If current in coil A is upward and current in coil B is zero, thanks to Physics we know that inside the coil A there will be a magnetic field directed downward, so the rotor north pole will be downside.
- We than change current in A to zero and let current in B flow rightward, so the magnetic field will be leftward, and rotor north pole will be left side
- Then we let current in A flow downward and we set current in B to zero, so the magnetic field is upward and rotor north pole is upside
- Finally we set Current in A to zero and let current in B flow leftward. Magnetic field is now rightward and rotor north pole is right side
Et Voilà, the magnetic field has done one revolution clockwise and so has the rotor and so the motor's pivot.
Interchanging steps 2 and 4 we get a counterclockwise revolution.
We can change the motor speed by changing the time delay between each step: the less the delay, the faster the motor.
As you will see in the code attached there is nothing difficult in implementing the previous 4 steps needed to achieve one complete revolution in code for arduino.
We then let arduino do these 4 steps in a loop, obtaining a continuous rotating motion.
Now, we both know how to get data from the nunchuck and how to control the motor.
What we have to do is to use the data from the nunchuck to control the motor.
We can do it by using the number arduino stores in the nunchuk.analogX as we move the joystick vertically.
We will create some ranges of values for the nunchuk.analogX variable and assign each range a value for the delay time between the motor revolution steps.
Doing that, while moving the joystick vertically, depending on which range we "fall" in, we will get a different rotating speed for the motor.
Also, we will tell arduino that if nunchuk.analogX is greater than the value we got for the joystick rest position, the motor will have to move clockwise. If nunchuk.analogX is less than the rest value, the motor will have to move counterclockwise.
In this way, depending on how forward we push the joystick, the motor will move clockwise at different speeds, and the opposite will do if we push the joystick backwards.
Anyway, the code is commented enough so that it will be difficult for you to get lost in it.
Last thing to do is to control the led.
We can dimmer the led brightness depending on the joystick position by using the function analogWrite(led, brightness) where "led" stands for the pin (16 in our case) where the led is attached to, and "brightness" is a number quantifying the led brightness. This number has to be proportional to the value given by nunchuk.analogX . After some trials, I found that the best expression for "brightness" is: brightness=6^abs(nunchuk.analogX - 124)
In that way, the led will bright a little when the joystick is at rest position (meaning that the circuit is on) and it will increase its brightness both if we move the joystick upward or downward.
Ok, everything should be fine enough now to be soldered!
Step 5: Designer
Note: in the pictures attached you can find some photos of the soldering iron in action and of various phases of the welding. In addition to that, I reattach the electric scheme so that it will be useful to you to double check the connections before solder.
Now that everything works fine, we have to rearrange everything in a nicer way.
First, we have to solder all the components we had already (in step 2) placed on the breadboard.
I used (obviously) a soldering iron and a support base for the PerfBoard. I made all the connections using wires cut on purpose from a hank. I also decided not to directly solder arduino and the l293d chip. Instead, I soldered two slots where I inserted the two components.
I chose to use a USB connector to connect the Nunchuck to the board (since it has just 4 wires). So I connected a USB pin to the nunchuck wire (as in the picture) and a USB slot to the PerfBoard (Make sure to respect the electric scheme while doing all these connectors' connections).
Then, I opted for the white 6 pin connector (though as I said in the intro I (and you of course) only needed 4) to connect the motor to the board. (I chose this connector just because it was already installed on my motor wires). For the power connection, I chose an ordinary cylindrical jack which I then connected to (as I said and as you can see in the picture) the 12V power supply I use for the telescope mount. In any case, you can use every connector you prefer (just make sure that it has enough pins as the wires you have to connect).
After having soldered everything, I connected all the wires, I gave power and...
The result was amazing. I was able to make even the smallest correction on the focus without having the minimum movement in my field of view even at 300x with an orthoscopic eyepiece.
It is just night and day if compared with the manual focuser adjustment.
Last thing I did was 3D print a case designed on purpose for my board and then I hung it on my telescope with a string and a hook as you can see in the following pictures.
Step 6: Happy Astronomer!
I leave you with a short video of the diabolic device in action and some pictures of the ultimate Nunchuck & Arduino Controlled Focuser.
Thanks for having followed my project and please comment if you have any question or suggestion: everything will be appreciated!
Marco