Go Down

Topic: Arduino presets for stepper (Read 613 times) previous topic - next topic

SOLARMAN61

Hello All,

I m a newbie and love the site and hope I can get some help.

Does anyone know if this is possible?
I will try and be brief, I hope I can explain this as simple possible.

I'm trying to come up with a way to control my focuser on my telescope using a simple stepper that would have adjustments for small increments fwd/rev yet, not sure of fraction of steps needed, type NEMA 17 etc yet. but slow as possible.
Will need to have a way to press one of 4 buttons (presets) for steppers positions.

left field example: press and hold button 1 of the 4 preset button and then press 2 other buttons for forward or reverse to set the stepper position (focus) and  somehow save/lock that into button 1 of the 4. doing the same for 2, 3 4 so when any of the buttons are pressed the stepper will go to that position and stay programmed until repeated over/reset or power down.

Are there any Arduino solutions available for my application?



Clear Skies,

Solarman61

Robin2

#1
Feb 07, 2018, 10:53 am Last Edit: Feb 07, 2018, 10:54 am by Robin2
I would not expect that you will find a ready made solution but what you want to achieve should not be too difficult.

When the Arduino starts it will need to establish the zero position of the stepper motor - usually done by moving the motor until a limit switch is triggered. After that it should be able to move very precisely any number of steps that you may have stored.

You could have 2 modes in the program - one of which allows you to move the motor back and forward at the press of two buttons with a 3rd button to save the position when you get it correct. In the other mode it would move directly to a stored position when you press a button. You can save positions long-term in the Arduino's EEPROM.

...R
Stepper Motor Basics
Simple Stepper Code
Two or three hours spent thinking and reading documentation solves most programming problems.

SOLARMAN61

Thanks Robin for you input. I reading and will check out your valuable links below!

There is quite a bit of DIY projects out there after posting here, most if not all I found involve rotating a control knob/encoder knob and the motor moves the same motion as the encoder knob does.
That works for me but if I can save a particular position for me and another viewer for there position. eventually that we just press a button and not touch the scope and our independent focus is achieved.

Thanks again

Robin2

You need to think clearly about the logic of your system. Maybe write down a step-by-step guide (not stepper motor steps :) ) in as much detail as possible.

When you are very clear about how the system will work turning it into program code should be straightforward. Without a clear understanding of precisely what is needed the programming will be a lot more difficult. It is very easy to get confused between design problems and program code problems.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

johnwasser

That works for me but if I can save a particular position for me and another viewer for there position. eventually that we just press a button and not touch the scope and our independent focus is achieved.
So my understanding is that you have several people with different uncorrected vision using your telescope without their glasses.  You want a way to shift focus for the several users without touching the scope and causing vibrations.

Depending on how hard it is to turn the focus knob it may be possible to use the small, cheap, and light 28byj-48 geared stepper.  It is used in MANY commercial products so they are low in cost.

I would have your code store the presets in EEPROM and have YOUR setting be the default position.  That way you may find that when you manually focus for your vision the other buttons don't have to be re-programmed.

One problem that might cause frustration is backlash... Approaching focus from one direction may produce different results than approaching from the other direction.  Having the positioning code always approach from the same direction should fix that.  When you step in the desired direction a single step will do.  In the other direction you should go back a number of steps ('n') and then forward n-1. N to be determined experimentally.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

SOLARMAN61

Thanks John for chiming in.
my apologies if so lengthily!

Below is a more detail description that Robin suggested. Now I mainly wrote up a step by step conception, using multiple eyepieces and users, when one changes out an eyepiece for more or less power on a telescope, refocus is necessary.
You are correct about backlash, however with my (SCT) Schmidt Cassigrain Telescope the primary mirror will be set and a fixed postion to eliminate backlash or mirror shift. and  allowing my secondary crayford focuser by JMI NGF-S and has a DC motor on it to do the work. I would be replacing with a stepper, the overall torque is minimal and can figure out its torque and overall travel, just need to be very slow.
There may be 10 other ways to accomplish this in a more simplified fashion, but this is the best way I know how to describe it right now. I hope this helps.

Kendall

This example demonstrates using 2 users and 2 telescope eyepieces without touching the telescope focuser

Step 1
User places the #1 eyepiece in the telescope.

Step 2
Power on the focuser/project, and focuser moves to limit switch and stops.

Step 3
User #1 presses and holds the eyepiece #1 button, button or an LED flashes. (program mode)
User #1 also presses and holds the user #1 button and the button or an LED flashes. (program mode)

Step 4
User #1 moves a set of up/dn buttons to move the focuser for object to be in focus.

Step 5
User #1 presses one of the 2 flashing buttons to get out of program. (the 1st user and 1st eyepiece are now programed.

Step 6
User #1 removes the #1 eyepiece from the scope and replaces with eyepiece #2 and repeats steps 3 - 5.
Now eyepiece #1 and #2 are set up  for user #1.

*For the 2nd user: they would complete steps 3-5 using the #2 user button.

When initial set up is complete:

Example: We start using the 1st eyepiece (#1 eyepiece) user #1 presses the #1 eyepiece button and his user #1 button and looks into the eyepiece and should have a focused object, and the next user #2 wants to look at the object, he or she would just press the #2 user button and looking into the eyepiece and it should be in focus for them. Next,  if we are to change out the #1 eyepiece to the #2 eyepiece, the user will press the #2 eyepiece button and his or her user # button and the object should be in focus.
This system would have 4 channels instead of the two mentioned herein. Representing up to 4 users and 4 eyepieces.
There may be work around with this configuration like a central program button. It would be nice that the user and eyepiece buttons would light up in there perspective mode to show where the focus is.
The programs can stay in the system until power off or over write, restset or what ever would work the best.



johnwasser

using multiple eyepieces and users, when one changes out an eyepiece for more or less power on a telescope, refocus is necessary.
Unless you have invested in a set of 'parfocal' eyepieces.

OK... So 4 'eyepiece' button, 4 'user' buttons, 1 'focus in' button, 1 'focus out' button:  10 inputs

4 'eyepiece' LEDs, 4 'user' LEDs, 2 or 4 stepper outputs: 10 or 12 outputs.

20 or 22 digital I/O pins.  That's is very close to the limit for an Arduino UNO.

It might be good to look into a parallel in, serial out shift register to handle 8 of the inputs (buttons) with 3 pins.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Robin2

#7
Feb 08, 2018, 10:01 am Last Edit: Feb 08, 2018, 10:14 am by Robin2
I suspect you could do it with fewer buttons if you have LEDs to identify the selected user and selected lens but the overall number of pins will be similar to what @johnwasser has suggested. My preference would be to spend a little extra and get a Mega rather than invest time figuring out a shift register.

However this really sounds like an application that is crying out for an LCD display and menus. The programming may be a little more complicated but the user experience will be so much better. And try to get an LCD display with a Serial or I2C interface rather than the slightly cheaper ones that need 10 or 12 Arduino I/O pins - it will make connection very much easier.

Another option (and my personal preference) would be to do all the control stuff and data saving on a PC connected to the Arduino and just use the Arduino to operate the stepper motors.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

SOLARMAN61

Thanks guys,

I hadn't thought about an LCD display because of my current experience level with the the major components with all this, much less the programming! However I understand the basic concept of each of the major components and how they play a role but clearly not an expert with this but willing to learn, I looked around and for such a display and found something like the ST7586 link below, (sorry, wanted to insert pic here) this maybe a little overboard to what I wanting to a accomplish herein but a start.

https://www.ebay.com/itm/3-4-Red-Serial-SPI-Graphic-240x160-LCD-Display-Module-ST7586-Controller-Tutorial/302033120661?hash=item465293ad95:g:h4wAAOSwyLlXpDOG

- Robin, you mention the Mega. are you referring to the 2560?

At times I control the scope with my laptop via serial interface but it would be nice to have some sort of hand controller by the scope. Are you talking about the having at the program in the laptop and coming off the MEAGA with a cable to a controller?

Kendall

Robin2

#9
Feb 08, 2018, 02:35 pm Last Edit: Feb 08, 2018, 02:36 pm by Robin2
- Robin, you mention the Mega. are you referring to the 2560?
Yes

Quote
At times I control the scope with my laptop via serial interface but it would be nice to have some sort of hand controller by the scope. Are you talking about the having at the program in the laptop and coming off the MEAGA with a cable to a controller?
I had been thinking of the laptop being close to the 'scope.

If you were using a laptop then you probably would not need a Mega as there would not be the requirement for so many Arduino I/O pins.

I have built a model train controller on my laptop using the Python Bottle web framework and HTML and CSS for the display. I can also operate the system from the browser in my phone with no extra programming. Indeed it will work with 2 or 3 phones at the same time - one locomotive each. The laptop connects via USB to an Uno that sends data wirelessly to each of the locos.

I also use Python and Bottle for a control interface for a small CNC lathe - but I have no need to use my phone for controlling that.

I much prefer the ease of building user interfaces on my PC. But these are just ideas. Feel free to ignore them.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

SOLARMAN61

Wow.. sounds pretty cool with the trains!
I wish I knew 1/2 of what you guys know about all the ins and outs of the Arduino world. only thing I have done with the Arduino products is incorporate two 365 day times into a solar tracking system I built a while back and I put a B17 aircraft bomber fuel gauge project in MY CJ7 Jeep to convert my fuel tank readings to work with the gauge or something of that nature, but I ended up selling it before completion.

I have a knack for problem solving and creating solutions to make things better to a degree, I hold a patent for a mechanical connector system for this type of telescope that I own. but I wish I had more in dept knowledge with the Arduino products.

Using the laptop is ok for tracking off star charts, kids love to interact with this instead to using the telescope keypad sometimes. I don't always set it up with a laptop, but what ever would work with less hassle and programing issues down the road will work for me.
I have a 10 year old son and of course our eyesight is somewhat a skew between us, as I also wear glasses! so having something that myself, co viewers and kids can have fun with would be a great addition.


Kendall 

SOLARMAN61

Robin or John,

Whould it be better or more simple to have a 4 pos swicth for the eyepieces? that selection want be used as much as the user buttons.


Thanks
Kendall

Robin2

Whould it be better or more simple to have a 4 pos swicth for the eyepieces?
You need to tell the role of each switch AND give details of the alternative arrangement that you are comparing it to.

At the moment the question is equivalent to "which is the better piece of string"

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

SOLARMAN61

#13
Feb 10, 2018, 08:16 pm Last Edit: Feb 10, 2018, 08:24 pm by SOLARMAN61
Yes, I've been reading and learning about some if the programing code,
check this link out, this would be nice and seems similar that whatt I'm trying to do but maybe have a POT to slow the motor down what do you think?


https://www.bing.com/videos/search?q=28BYJ-48+stepper&&view=detail&mid=CFF42904CBD9C0DC4820CFF42904CBD9C0DC4820&&FORM=VRDGAR

Tell me, is it possible to have 4 encoder /knobs with push buttons to set the user focuser position?

also this is the motor I was thinking of using-

http://robocraft.ru/files/datasheet/28BYJ-48.pdf


Thanks,

Kendall


Robin2

Tell me, is it possible to have 4 encoder /knobs with push buttons to set the user focuser position?
Probably.

How come I am answering your questions but you don't bother to answer mine?

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up