Continued,
start here.Determination of the initial requirements for the device. The choice of "iron"
In order not to solve the problem in a completely general form, I asked certain requirements based on general considerations (budget, simplicity or complexity of the purchase of components, difficulty in implementation, or expected problems in operation). At the same time, the presentation of these considerations will allow you to immediately translate a possible dialogue into a constructive direction, and for those who want to use my experience, it will tell you what details you should pay attention to. So let's get started.
General requirements
The solution should be:
- simple and not expensive;
- built on available components;
- the device must be sufficiently reliable, since I plan to use it on the road (that is, in a sturdy case, screw-on connectors, etc.);
- the device must be maintainable;
- the development should not require me really deep knowledge of electronics and circuit design and strongly go beyond the school course;
- development should not drag on not only for months, but even for weeks;
- I do not want to deal with wiring, etching boards, etc. - I want to make the most of ready-made components, preferably in the form of modules.
.
')
Functional
The main functions of the device:
- counterclockwise rotation with a given speed (clock button, while pressed - rotate)
- clockwise rotation at a given speed (clock button, while pressed - rotate)
- rotation speed adjustment (potentiometer)
- the command “release the engine” - remove the voltage from the engine (to save battery life and to cool the engine, if necessary)
- In addition, it is useful to insert the function of automatically removing the voltage from the engine if the focus is not used for a long time (say, more than 10 minutes) - options are possible here;
- It would be nice to have on the remote control a simple indication of the magnitude of the speed of rotation, for example, the brightness of the LED.
Based on the method of application, it is necessary to have at least two options for controlling the focusing device:
- from the control panel when working directly at the telescope (including during visual observations or with coarse focusing on the image on the display of a digital camera) - that is, I am completely satisfied with the button control on a short cable;
- using your own software from a laptop under OS Windows, then the focus control unit should be connected to a PC, for example via USB;
- Optionally, in the future - from a PC using the ASCOM driver.
When working remotely from a PC, I want to be able to also memorize the position of the focuser and go to the specified position. This is due to the fact that when the eyepiece is changed, the focal length changes and the focusing procedure must be carried out anew. I want to save the position of the focus for each eyepiece in the form of presets and quickly switch between them when changing the eyepiece. Of course, it will be necessary to focus the telescope, but this cannot be avoided in any case, since at different temperatures the focal length may differ slightly. Based on this, the microcontroller firmware should read the steps (taking into account the micro-step mode) and transmit the current position to the PC, as well as scroll the focus to the specified position.
Engine and driver
The motor is uniquely stepping, since most of the time the focus is stationary, rotation is required at low revs, precise focusing requires turning to the lowest possible angle, and most of the time a rigid fixation of position is required - the stepper motor is ideal for solving this problem.
Motor Connection - BipolarBipolar. This is explained by the fact that it is the bipolar connection that gives the maximum torque at low revs. In the event that an engine with 6 taps is used, it is necessary to use extreme, average insulate. It should be borne in mind that the resistance of the windings in this case increases by 2 times, respectively, the current drops twice, respectively, the torque drops.
An extremely important parameter by which you need to choose the engine - the
required torque of the engine . In my case, the maximum torque that I managed to fix was ~ 2 kg / cm at room temperature.
Wanting to have some stock, I wondered at a minimum torque of 3 kg / cm.
How to measure torque without measuring equipment at home.Make it simple enough. To do this, it is necessary to attach a lever to the shaft of the focusing device (the self-focusing wheel can be used by hooking on its edge) and using a dynamometer to measure the force at which the shaft position “breaks down”. To do this, gradually increasing the force we pull the dynamometer strictly perpendicular to the axis of the lever (naturally, in the plane of the lever, perpendicular to the axis of the focuser shaft) and catch the moment of the beginning of rotation.
Scheme 2

Do not forget to bring the dynamometer to the required units and multiply by the lever arm (usually the torque is indicated in N * m or in kg * cm). What if there is no dynamometer? Take the balance bar, kitchen scales or make yourself using a spring and a ruler, for example, like this:

In the latter case, calibration is necessary, which can be done using a bottle of water (1l = 1kg). Accuracy is certainly not high, but for our task it is quite sufficient.
It is important to note that the friction force on the bearings or the worm gear of the focuser can strongly depend on the orientation of the latter in space (on the telescope), as well as on the weight attached to the equipment focuser (adapters, slewing prism, eyepiece, digital camera, etc.) . Therefore, I recommend hanging the maximum of the equipment and taking measurements (2-3 times) in several positions (at least two, when the optical axis of the focuser is oriented vertically and horizontally).
In addition, it must be borne in mind that in the cold the force of friction may increase markedly, respectively, will require more torque.
UPD! Another very important point - usually manufacturers specify the nominal torque. That is, the moment at rated voltage, rated current and
full step ! Below it will become clear that in order to achieve the required accuracy it is necessary to use the micro-step mode, at which the torque drops significantly! Therefore, it is necessary to choose the engine according to the amount of torque with a margin.
The next important parameter is positioning accuracy. Since I have already decided that I will use a stepper motor, the question is: what step should the motor have and should I use a microstep driver? Most of the engines available have a step of 1.8 ° per revolution (or 200 steps), but models with a step of 0.9 ° (400 steps per revolution), 7.5 °, and others are also available. This parameter is also individual. In my case, the focus area turned out to be about 15 °.
Focus Angle MeasurementTo assess the accuracy of positioning, it is necessary to determine at what angle we turn the shaft of the focusing device during focusing. To do this, I put a zero point label on the handle of the focuser. Next, using the mask Bakhtinov focused on the star. I measured the angle a1 - the position of the mark relative to the plumb of the protractor. After that, the image was defocused (in any direction) so that the lack of focus was clearly visible (the middle beam shifted significantly away from the center of symmetry of the diffraction pattern). Measured the angle a2 - the second position of the mark relative to the plumb line. The difference of values ​​(a1-a2) modulo multiplied by 2 - and there is a focus area.
Scheme 3

At the same time, precise focusing (the minimum angle at which the average beam displaces from the center becomes noticeable) is less than 2 ° (the chosen method does not allow for more accurate measurements, but this is not necessary). Thus, when using the engine in 1.8 ° increments, the entire focus area will be covered in approximately 10 steps, and precise focusing will be virtually impossible. A pitch of 0.9 ° is also likely to be insufficient for good focusing.
Measuring the angle at which focusing is performed with different eyepieces, I obtained different values, but of the same order - 10–20 °. So the influence of the eyepiece in this case is probably not critical.
As a result, I came to the conclusion that you can use a stepper motor with a step of 1.8 ° or 0.9 °, but in any case, you need a stepper motor driver with micro-step support. For this reason, I had to abandon the use of popular drivers, distributed as Arduino Shield - they all do not support microstep. The choice fell on the easily accessible and cheap
Polulu A4988 , which the truth had to be placed on a separate board.
Later, in the next project, I used the same manufacturer's
DRV8825 and I liked it much more.

"
To control the A4988 you need at least 6 signals - ENABLE, STEP, DIR and three microstep selection signals MS1, MS2, MS3. Given the three such buttons on the remote control (left, right and "release") and the speed LED it turns out that you have to use 10 digital outputs of the microcontroller.
Skip step and low accuracy in microstepping mode - myth and realityYou can often hear that the SM in micro-step mode necessarily skips steps, is inaccurately positioned, the torque drops dramatically, etc., and that the pier does not need to be used at all. Having spent some time on this question, I got the impression that this is a common misconception. This is confirmed by both my own experiments and various sources on the web. I am not an expert in this field, I will try to summarize the collected information (theoretical and experimental), leaving the reader to draw the final conclusion himself. So, the most common claims are SD and mikroshagu:
- In microstep mode, the torque is very much reduced. Yes, indeed, the popular theoretical SD models give a significant drop in torque during the transition to the microstep. And the smaller the step, the greater the loss. At the same time, in a number of sources (for example, here and here ). I also did not notice that in my experiments the torque dropped even 3 times, although I work in the mode of 1/16 and 1/32 microstep.
- In the microstep mode, the SM will skip steps.
Let's see for what reasons a skip step may occur. The main reasons given by manufacturers:
- Inadequate nutrition SM. On the driver A4988 there is a regulator (limiter) of the current, roll it and immediately see how insufficient current (and in fact the loss of torque) affects the microstep. By reducing the current strength, instead of 16 micro steps, you can gradually get 8 first, and then 4 stable. This is because the torque is also different in different phases of the full step;
- Too much load torque . That is, the torque applied to the engine, which is obviously greater than that produced by this engine in certain phases - at this moment we have omissions;
- Speed ​​too high. SD does not have time to walk. For this task is not relevant;
- Too fast braking / acceleration. This task is not relevant;
- Bad engine. And this also happens.
Briefly and very capaciously about the SD is stated
here ,
here and very well
here.Most often, the problem of skipping steps is not a problem of the SD, but a problem of either insufficient nutrition or the problem of overloading. The first problem is solved quite easily by choosing the right power supply and setting the correct position on the A4988 limiter. The second requires careful consideration of all load options of the focus. It is also necessary to solve the problem of increasing the torque required for rotation due to the increase in friction force (on the shaft of the SM and on the focuser) at low temperatures. It can be solved in different ways. You can take a more powerful engine, and you can use a cold-resistant lubricant.
Therefore, I believe that for this task, the SD is almost ideal, and the problem of skipping steps is the problem of proper selection of the SD and operation mode. So that the power of the SD is enough to deliver enough torque in all situations.
Nutrition
The Arduino Uno is powered by a fairly wide voltage range (the recommended range is 7-12V) and a small current, so when choosing a power source you actually have to push away from the engine. Driver A4988 supports voltages from 8 to 35V. Stepper motors are presented in a wide range, with different nominal parameters (for different voltage and current). The power source I want to use one for the control unit and for the engine itself. Hence we get the restriction: the supply voltage should be in the range of 8-12V. The final choice can be made after the choice of engine is made based on the required power.
In addition, it is worth considering the place of use of the telescope. In my case it is a loggia (~ 220V), the roof of the house (battery), at the exit (car, 12V or ~ 220V through the inverter, but sometimes you have to leave the car and then again the battery). Maybe someone should immediately pick up the battery instead of BP.
Mechanics
I chose the coaxial arrangement of the engine: using a
coupling, the motor is fixed directly on the shaft of the focusing device. The second point of support is an arbitrary rigid attachment of the engine to the focuser housing. Simple and reliable, although it requires more torque. Such a scheme will allow to simplify the fastening (one point) as much as possible, facilitate the removal and installation of the engine if necessary, and, most importantly, avoid the “alignment” of the mechanical part - fastening and fitting gears, pulleys, etc.
Scheme 1

Weight and dimensions
Since the motor is located on a focusing device on a telescope, weight is important. Too much weight will complicate balancing, increase the load on the mount and tripod, dimensions will add sail. Therefore, the smaller the engine - the better. This criterion is quite individual, I asked the maximum mass of the engine in 300 g
Selection of key components (platform, SD, BP, case, etc.)
Engine selection
So, we have already determined that we need a stepper motor with certain
characteristics.- Step 1.8 ° or 0.9 °;
- Torque from 3 kg / cm;
- Rated voltage 12V;
- The winding current is the smaller the better, the reasonable limit is no more than 1A;
- Bipolar connection (respectively, 4 taps, if you choose a unipolar motor with 6 taps, do not forget to double the resistance of the windings and recalculate the current);
- Weight - not more than 0.3 kg;
- Dimensions. Keep in mind that a motor that is too large in some mounting positions may touch other equipment. This parameter also makes sense to minimize.
Next, run the browser and look for a suitable engine on the Internet. The average cost in China is 10-20USD, the average cost in the Russian Federation is 1000-1500 rub. We try to choose a motor, with possibly lower rated current. Theoretically, it is possible to use engines with a current up to 2A, but a large current will lead to a strong heating of the engine (it will have to be turned off every time after focusing) and a rapid consumption of the battery. In addition, driver A4988 has a built-in current limiter, which is good, since it is possible to connect to it an engine designed for substantially large currents. The bad thing is that such an engine will not gain the right torque.
Mechanics
To select the coupling we need to know the mounting diameters. To do this, we must measure the diameter of the focuser shaft and see the diameter of the motor shaft. In my case, it turned out 8 mm and 5 mm, respectively. You also need to know the torque.
Fastening the engine to the focuser is a purely individual task. I decided it as follows: I screwed an aluminum corner to the engine (specially cut out), and in the case of the focuser I cut a slot where this corner went. This is enough to rule out a twist, but not enough to eliminate play. To eliminate the backlash, I took a transformer ring, stuck a medical strip on the inside, waiting for it and fastened it on the focuser. In the aluminum corner I drilled another hole in place and pulled off the clamp with a bolt. The backlash is gone, although of course the whole structure is generally not rigid: I had one point of support on the focuser + mount on the shaft through a flexible coupling. Accordingly, there is little mobility on the clutch. In practice, this mobility does not interfere, but can "eat" some of the torque to the deformation of the coupling.
This question is creative and very individual.

Platform for control unit
In fact, there are certainly plenty of options, I chose the Arduino Uno.
Why I chose the Arduino Uno or the Ode to modern modular electronics- Available;
- Not expensive;
- Free development environment;
- C ++ programming;
- Popular platform, support lovers around the world;
- RS232 support - when the debug board of the microcontroller (USB) is connected to the PC, a COM port appears in the system. Support of work with RS232 from the program executed by the microcontroller is also available, and from the point of view of programming everything is VERY simple.
And most importantly, the Arduino Uno has a sufficient number of inputs and outputs and is fully ready for use - no additional wiring is required, take and program.
Moreover, there are a lot of implementation options, both Arduino-compatible and implemented on a different architecture, with their development environments and their communities. On the Arduino Uno, of course, the light did not converge. We live in an amazing time, when using school knowledge based on modular electronics, you can solve a variety of tasks, mechanizing and automating various processes - telescopes, aquariums, greenhouses, cradling a child in a cradle or managing high-precision processes. Incomprehensible and ridiculous concept of "smart home" limited by adjustments of climate, lighting, etc. finally it acquires some practical sense, gives some really new quality, which is very difficult or even impossible to achieve “manually”. And at the level available to very many. And this is just great!
Power supply selection
A very popular voltage is 12V and it was there that I stopped. It is suitable for Arduino; There are many stepper motors available for this voltage on the market; there is a mass of power supplies, batteries, you can connect directly from the vehicle's cigarette lighter.
For my device, I stopped at
the power supply 12V and 25 watts .
Slightly more details ..The choice of power supply is carried out in two main parameters - voltage and power. In my case, U = 12V. Power can be estimated by knowing the maximum current as I * U. Based on the 2A on the engine and the voltage of 12V, we get 24 watts.
With the battery is similar, but instead of power it makes sense to look at the capacity and operating current. The current is up to 2A, the capacity based on 2-3 hours of work - say 4-5 A * hours. In practice, the total focusing during the night hardly takes more than an hour, so a 2 A * hour capacity should also be enough.
Following the general power condition for the Arduino and the engine, I combined the GND and VIN buses of the Arduino microcontroller board with the GND and VMOT buses of the A4988 driver, respectively (
see diagram ). At the same time, the second power connector, similar to the Arduino power connector, is brought to the case. This is done so that in case of replacing the engine with a more powerful one with another power supply (for example, 24V), it was possible to separate the VIN and VMOT tires without any problems and apply the required voltage to the engine.
Constructive
Since initially when developing the device I set the condition for using standard components, all components from the specification below are available in stores, and the vast majority can be ordered online.
The joys of a beginner, or what they don’t write about in datasheets ...I just want to remind one proverb - “Measure 7 times, order one” :) After the assembly I had a bunch of spare parts, but some had to be ordered a second time :)
Separately, I want to say a few words about the placement of the connectors in the case and the buttons on the breadboard. When placing connectors take into account that the case will be closed and place the connectors so that when they do not interfere with the assembly. When placing buttons, keep in mind that a cap is put on the button after assembly, and this cap may be wider than the button itself. Therefore, if the buttons are put on the board too close to each other - the caps will have to be filed :) It’s also worth noting the height of the buttons - they should just go out of the case so that you can put a cap on them (the height of the buttons should be taken into account when ordering the console case Do).
The engine control unit
So, the brain of our device is the engine control unit. In order not to clutter up and not overload the focuser, the Arduino Uno microcontroller board and the A4988 driver were brought to me in a separate
standard industrial building from. Accordingly, the following connectors are brought to the case:
- Power supply (standard Arduino connector and a separate connector for independent power supply of the engine, if necessary)
- Motor Power Cable Connector
- USB connector of microcontroller board for PC connection and remote control
- Remote control connector


As experience has shown, I chose not the most successful, although very high-quality case. You can take a similar, but a couple of centimeters lower, and 1-2 centimeters wider.
I place the control unit under the telescope or on a shelf on a tripod. Accordingly, the cable length of the control unit - the engine should be about 1m. The cable is 4-core, with a section sufficient for current up to 2A. You can weave yourself.
Remote control
Again, you can choose any case, just to be able to place inside the PCB. I recommend to first prepare the PCB, and then choose the
case .
A single word about the PCB. I really didn’t want to do PCB layout, so I took a ready-made prototyping board for
DIP-1M soldering, cut a quarter from A4988 from it, and used the rest for the remote control.

That's all for today.
Full details on selected components are available here .The schematic diagram is shown
here and in the
first part .
In the next part we will get to the microcontroller code and the control panel code under Windows.