Jump to content

SkySurveyBanner.jpg.21855908fce40597655603b6c9af720d.jpg

Stepper motor focus control version 2


ncjunk

Recommended Posts

OK guys, I have the Arduino and driver board on the way... I have pulled 2 stepper out of an old printer etc... I found the stepper driver library so the only missing piece of the puzzle is the ASCOM driver.

How far are you guy's with the ASCOM driver? I have checked there website and its rather unhelpful... At least I couldn't find the files that I needed. Any advise / pointing in the right directions would be appreciated.

Link to comment
Share on other sites

  • Replies 141
  • Created
  • Last Reply

I've done an ASCOM Focuser driver in C# and put the sources in a zip file under Files/Iffley

I don't use the Stepper Arduino library, I preferrred to code it myself.

The Arduino receives a single character ("f" or "b") from the serial connection and steps the motor one step forward or backward. It also maintains an integer position which it sends down the serial line after every move. This is the minimal useful implementation I could think of.

Have you got the ASCOM Profile Explorer installed on your PC?

Link to comment
Share on other sites

We have an arduino version working with an ascom driver done in vb in the following yahoo group sgl observatory automation ....i think.

It needs tidying but is working, i aim to add in any suggestions as they come in and with Reggies help and in a dew heater he is doing and a few other things.

Still not had a chance to look at Thermos code though, sorry!

Neil C

Link to comment
Share on other sites

George your mounting looks less heath robinson than mine!

I will tidy the code up and make all the limits etc configurable in the setup page this weekend, should only take an hour.

Be carefull with the autofocus and the limit setting as if autofocus cant find focus it puts larger off sets in and i set the limit default to 16000 odd steps which is way outside the range of my focus unit...so it moves the focuser outside the mecanical range. Hence the need for me to make all those settings configurable.

If you get it in the right focus area theres no problem though.

Neil c

Link to comment
Share on other sites

Great stuff Neil ;)

BTW there's a dozen or so pictures in my folder on the yahoo group, the Freeduino is now boxed as well.

Ive been thinking about the focus range, if you do a visual focus first wouldn't it be safer to limit the steps either side of this focus point? Once you reach focus manually you could just zero the step point and work from there, after all unless you change your imaging device this wouldn't change.......just a thought :)

Link to comment
Share on other sites

Carefull with resetting to zero as the autofocus software takes measurments either side of the focus points and setting to zero too close to focus may stop it getting enough measurements either side to calculate the point of best focus.

Link to comment
Share on other sites

I've used my ASCOM home-made focuser with the Bahtinov Autofocus App with mixed results (mainly due to image shift when I reverse direction but that's down to crappy focuser mechanics).

Link to comment
Share on other sites

Looking good guys :)

Whats a rough cost of that lot George and do you use it with the Bahtinov Grabber App?

Peter...

Around £30 Peter ;)

Freeduino V1.16 Board AT328 Mega £13.99

Freeduino V1.16 Board, 100% Arduino compatiable [] - £13.99 : nuelectronics.com, Arduino Freeduino projects

EasyDriver Stepper Motor Driver £10.59

https://www.technobots.co.uk/acatalog/Shop_Front_EasyDriver_Stepper_Motor_Driver_1077.html

Miscellaneous, project boxes,breadboard, header pins etc £5.00

Bitsbox - UK Electronic Components Distributor

Stepper motor was salvaged from a HP5L laser printer that was hanging about in my loft, motor specs below:

Motor-bipolar stepper:EM-257_17PM-K212-PIT Minebea

This is the equivalent to Astrosyn SST-024 with a 10 Ohm coil. The high holding torque and small package size makes it ideal for small CNC or robotics project.

Manufacturer page:Minebea - Astrosyn

Specifications

Nominal Voltage 7

Current 0.7

Resistance (Ohms) 10

Torque (in-oz) 44.4

Torque (kg*cm) 3.2

Wires 4

Steps / Revolution 200

Step Size (degrees) 1.8

NEMA frame size 17

Link to comment
Share on other sites

  • 1 year later...
  • 4 weeks later...
  • 7 months later...

Hi all,

Would love to use this build but I have the adafruit motor shield not the easy driver and the instructions in the sketch seem to be very different. has anyone used the af shield and changed the sketch over??.

Mike

Link to comment
Share on other sites

Mike,

The code does contain the control for the adafruit motor driver. You need to download the following version of the sketch:-

http://f1.grp.yahoofs.com/v1/EBc-Ty-cLbA4IGiTqYiZmBuq6uNOjQwVf2bpaIYXbm8kl5MmMLRPGTuSBfaivZYQtSo_DsoIXlbPdB3A0-Lj4A/SGL%20Software/Focuser/Current%20Version/SGL_Focuser_Driver_nolcd_2_0_0I.pde

and install the library into the library directory of the Arduino folder, the pde then has a library reference to the adafruit library at the top of the code:-

#include <AFMotor.h>

and then in the main code there are two sections that control the in and out of the motor. Both the In and Out code are effectively the same except that one adds the steps and the other subtracts the steps. This is the code example below and the adafruit bit is the "Case 2:" bit of code in each case.

void FocusINFun (void) {//Move the Stepper IN.

long Steps = 0;

if (Absolute == false) { //If not Absolute move the number of steps

if ((Position-NoOfSteps)>=0) {

switch (BoardType) {

case 0:

EasyDriverStep(Direction,NoOfSteps);

break;

case 1:

digitalWrite(13,HIGH); myHalfStepper.step (NoOfSteps); digitalWrite(13,LOW);

break;

case 2:

motor.step(NoOfSteps, FORWARD, MICROSTEP); motor.release();

break;

default:

// if nothing else matches, do the default

// default is optional

break;

}

Position=Position-NoOfSteps;

}

}

else if (NoOfSteps < MaxStep) //Absolute :- work out the number of steps to take based on current position

{

if (NoOfSteps<Position){

Steps=(Position-NoOfSteps);

switch (BoardType) {

case 0:

EasyDriverStep(Direction,Steps);

break;

case 1:

digitalWrite(13,HIGH); myHalfStepper.step (Steps); digitalWrite(13,LOW);

break;

case 2:

motor.step(Steps, FORWARD, MICROSTEP); motor.release();

break;

default:

// if nothing else matches, do the default

// default is optional

break;

}

Position=NoOfSteps;

}

else

{

Steps=(NoOfSteps-Position);

switch (BoardType) {

case 0:

EasyDriverStep(!Direction,Steps);

break;

case 1:

digitalWrite(13,HIGH); myHalfStepper.step (-Steps); digitalWrite(13,LOW);

break;

case 2:

motor.step(Steps, BACKWARD, MICROSTEP); motor.release();

break;

default:

break;

}

Position=NoOfSteps;

}

}

// set the update flag so that the new position is displayed

IsMoving=true;

UPDATE=true;

}

On the Ascom driver you need to select adafruit from the settings, this then sets the mode of control to 2 which tells the PDE to use the CASE 2 code when driving the motor, mentioned above.

The pde only compiles on version 23 of the Arduino software. I keep meaning to update it as the problem is only that one of the library references we have at the top is incorporated in version 1.0 of the arduino software so the library reference is not needed....but I haven't tested that yet and not had time.

Let me know if you have any problems or find any errors.

thanks

Neil C

Link to comment
Share on other sites

Mike,

I need to change the pde name as it is not just for the easydriver but for the L293 and adafruit as well.

I just had a look at the stand alone version and it is just for the easydriver at the moment BUT it has comms on it so you could manualy send a mode change command to set it to control the adafruit, I think this should work.

There is a settings button that opens a communications section. In the box at the top you can type #MDE:02; and then hit send and it should change the mode to the adafruit mode of control.

The Ascom version has a settings page where you can set the type of board you are using but it looks like I forgot it in the standalone version.

regards

Neil C

Link to comment
Share on other sites

Hi Neil

Thanks for the reply.

didnt see the case with the af commands in, fairly new to the arduino language so thats not surprising ;-).

I have already sorted the library changes out so dont get errors from that any more however everything has uploaded fine, the standalone runs, shows com7 and no errors when clicking connect or entering #MDE:02; should i see this appear in the box below?

But nothing moves. I know the steppers are working as the examples for af and accelstepper have all been ok. I have tried setting the communications set speed to 19200 and 9600 but nothing.

I dislike it when these things dont give errors, gives you no where to start looking lol.

now i may have this done wrong but Serial.println(BoardType); shows as 0 in the serial monitor. is this the expected result.

clear skies here last night, all set up and the focus slipped as i settled inside to start imaging, I cant wait to have this working :)

Mike

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.