Go Back   IceInSpace > Equipment > ATM and DIY Projects

Reply
 
Thread Tools Rate Thread
  #1  
Old 23-04-2018, 11:53 AM
redbeard's Avatar
redbeard (Damien)
Registered User

redbeard is offline
 
Join Date: Nov 2010
Location: Adelaide
Posts: 558
DIY DC Motor Controller for a Meade focuser and others

I was keen to put an electric focuser onto my Meade ETX 125 and I had a spare Meade focuser that fitted the bill.

I wanted the electronics to be as simple as possible by using off the shelf modules. And also to share with others who may want to build one.

I used a 'L298N DC Stepper Motor Driver Module Dual H Bridge Control Board' from Ebay under $5 and a Nano Arduino micro $7. 6 buttons, 4 LED's and 3 connections.
4 buttons are for speed, 2 other buttons for focuser travel in and out, 4 LED's to indicate the speed setting and a power, USB and focuser connection. I've set this up to how I wan't to use it but any types of buttons and switches can used to suit users needs.

I also wanted PC control as I was already driving the ETX from the laptop.
It also works with Ascom, (Meade classic focuser).

By manipulating the I/O pins on the motor control module, you control how it works eg: dynamic braking, standby mode, speed (pwm), and motor direction.
It's quite easy. Simply make one pin a 0, and the other pin a 1 and the motor turns in one direction. Reverse the logic and the motor turns the other way. Speed is set by connecting another I/O pin in PWM mode and sending a value 0 - 255 to set the speed. Dynamic braking is set with two 1's and standby mode is set with two 0's.

So really just another home brew DC controller. Happy to share info if anyone is interested.

Cheers,
Damien
Attached Thumbnails
Click for full-size image (Focuser_hardware1.jpg)
129.6 KB86 views
Click for full-size image (Focuser_top1.jpg)
166.3 KB93 views
Click for full-size image (software.png)
37.6 KB102 views
Reply With Quote
  #2  
Old 23-04-2018, 03:44 PM
AndrewJ
Watch me post!

AndrewJ is offline
 
Join Date: Mar 2006
Location: Melbourne
Posts: 1,905
Gday Damien
Looks really pretty :-)
Have attached 2 units i have made for my Meade microfocusser on my LX200.
Both units are designed to go into the fork arms and hence remove a lot of cabling.
The MkI uses only passive components ( OpAmps, comparators and a Mosfet driver )
The MkII uses a PIC ( 12F675 ) and a motor driver chip ( L293D )
No control via PC, but only requires one hand and one potentiometer when at the EP.
Andrew
Attached Thumbnails
Click for full-size image (Passive Focusser MkI.jpg)
179.7 KB80 views
Click for full-size image (12F675 and 293D unit.jpg)
104.1 KB63 views
Reply With Quote
  #3  
Old 25-04-2018, 12:45 PM
ZeroID's Avatar
ZeroID (Brent)
Lost in Space ....

ZeroID is offline
 
Join Date: May 2010
Location: Auckland, NZ
Posts: 4,949
Hey Damien, I'd be interested in seeing the circuit and sketch for the focuser control. I have a Duinotech board and a stepper motor module sitting on my desk to try and make work.
Reply With Quote
  #4  
Old 25-04-2018, 03:48 PM
redbeard's Avatar
redbeard (Damien)
Registered User

redbeard is offline
 
Join Date: Nov 2010
Location: Adelaide
Posts: 558
Quote:
Originally Posted by AndrewJ View Post
Gday Damien
Looks really pretty :-)
Have attached 2 units i have made for my Meade microfocusser on my LX200.
Both units are designed to go into the fork arms and hence remove a lot of cabling.
The MkI uses only passive components ( OpAmps, comparators and a Mosfet driver )
The MkII uses a PIC ( 12F675 ) and a motor driver chip ( L293D )
No control via PC, but only requires one hand and one potentiometer when at the EP.
Andrew
Hi Andrew,

Cool, good location in the fork arm. Once I pictured in my head how the potentiometer functions, as in use, I like it, actually might add that feature to mine as I can velcro the controller on the ETX fork, and have a pot as the extension.

Cheers,
Damien
Reply With Quote
  #5  
Old 25-04-2018, 06:58 PM
AndrewJ
Watch me post!

AndrewJ is offline
 
Join Date: Mar 2006
Location: Melbourne
Posts: 1,905
Gday Damien
Quote:
Once I pictured in my head how the potentiometer functions
With a PICand an ADC converter, its easy peasy.
With a passive analog system its a bit more complicated
but still quite simple, as long as you have a centre click pot.
ie centre is off, move either way fron centre and the speed increases and direction is based on what way from centre you are.
I used a 2 section Pot as one controlled speed and the other direction, ref attached schematic.
A Pic or arduino etc can do it much simpler these days,
but its not as much fun :-)
Andrew
Attached Thumbnails
Click for full-size image (FocusserCrct.jpg)
173.9 KB82 views
Reply With Quote
  #6  
Old 26-04-2018, 10:49 AM
redbeard's Avatar
redbeard (Damien)
Registered User

redbeard is offline
 
Join Date: Nov 2010
Location: Adelaide
Posts: 558
Quote:
Originally Posted by ZeroID View Post
Hey Damien, I'd be interested in seeing the circuit and sketch for the focuser control. I have a Duinotech board and a stepper motor module sitting on my desk to try and make work.
Hi Brent,

See code below:
It's very basic and easy to read.
This one is DC motor control not stepper, and they need to be controlled different ways. I have yet to do any stepper code for this module, but I have used one of those Stepper Jaycar units. (https://www.jaycar.com.au/arduino-co...oller/p/XC4458).

I have no actual circuit drawing as it's so easy I have this in my head, the code lets you know what pin goes to where. I've attached pics of the pinouts and input table.

Here is a good tutorial:
https://tronixlabs.com.au/news/tutor...a-and-arduino/

This is a link to the stepper library I used with the Jaycar module:
http://www.airspayce.com/mikem/arduino/AccelStepper/


When I get a chance, I will create a stepper version based on a Moonlite focuser.

Let me know if you have any questions.

Cheers,
Damien

Arduino Code:
=========

//DC MOTOR CONTROL - Damien Poirier 2018
//ARDUINO NANO

#define PWM_LEVEL 9 //USE ANY PWM PINS
#define DC_MOTOR_A 6
#define DC_MOTOR_B 7

#define SPEED_1 A0 //BUTTONS - USING THE ANALOG PINS IN DIGITAL MODE
#define SPEED_2 A1
#define SPEED_3 A2
#define SPEED_4 A3

#define TRAVEL_IN A7 //3 //USING THE ANALOG PINS FOR FOCUS BUTTONS - I ACTUALLY DON'T RECCOMEND USING ANALOG PINS UNLESS YOU HAVE NO DIGITAL PINS LEFT, MIGHT NEED EXTERNAL PULLUS
#define TRAVEL_OUT A6 //4

#define LED_1 A4 //LED'S - USING THE ANALOG PINS IN DIGITAL MODE, HOWEVER ANALOG PINS A6 AND A7 CANNOT BE USED AS DIGITAL IN THE NANO
#define LED_2 A5
#define LED_3 3
#define LED_4 4

const byte PWM_LEVEL_L1 = 80;
const byte PWM_LEVEL_L2 = 130;
const byte PWM_LEVEL_L3 = 190;
const byte PWM_LEVEL_L4 = 255;

const byte PWM_MAX = 255;

boolean trap_button_out;
boolean trap_button_in;

String GET_COMMAND;

void setup()
{
pinMode(PWM_LEVEL, OUTPUT);
pinMode(DC_MOTOR_A, OUTPUT);
pinMode(DC_MOTOR_B, OUTPUT);

//SPEED BUTTONS
pinMode(SPEED_1, INPUT_PULLUP);
pinMode(SPEED_2, INPUT_PULLUP);
pinMode(SPEED_3, INPUT_PULLUP);
pinMode(SPEED_4, INPUT_PULLUP);

//TRAVEL BUTTONS
pinMode(TRAVEL_IN, INPUT); //NOTE, NO INPUT PULLUPS ON ANALOG 6 % 7. SHOULD USE DIGITAL PINS WITH PULLUPS IF POSSIBLE
pinMode(TRAVEL_OUT, INPUT);

//LED'S
pinMode(LED_1, OUTPUT);
pinMode(LED_2, OUTPUT);
pinMode(LED_3, OUTPUT);
pinMode(LED_4, OUTPUT);

Serial.begin(9600);

digitalWrite(DC_MOTOR_A, LOW); //SET MOTOR DRIVER TO STANDBY MODE
digitalWrite(DC_MOTOR_B, LOW);
analogWrite(PWM_LEVEL, PWM_MAX); //SET MAXIMUM DEFAULT SPEED

analogWrite(TRAVEL_IN, 255); //SET BUTTONS INPUT HIGHISH - NORMALLY USE DIGITAL PINS FOR THIS
analogWrite(TRAVEL_OUT, 255);

digitalWrite(LED_1, LOW);
digitalWrite(LED_2, LOW);
digitalWrite(LED_3, LOW);
digitalWrite(LED_4, HIGH); //TURN ON LED 4, OTHERS OFF

trap_button_out = 0;
trap_button_in = 0;
}



void loop()
{
boolean get_speed_button_1;
boolean get_speed_button_2;
boolean get_speed_button_3;
boolean get_speed_button_4;

boolean get_travel_in_button;
boolean get_travel_out_button;

get_travel_out_button = analogRead(TRAVEL_OUT);
get_travel_in_button = analogRead(TRAVEL_IN);

get_speed_button_1 = digitalRead(SPEED_1);
get_speed_button_2 = digitalRead(SPEED_2);
get_speed_button_3 = digitalRead(SPEED_3);
get_speed_button_4 = digitalRead(SPEED_4);



//FOCUS
//=====
if(get_travel_out_button == 0)
{
if(trap_button_out == 0)
{
trap_button_out = 1;
digitalWrite(DC_MOTOR_A, HIGH);
digitalWrite(DC_MOTOR_B, HIGH);
digitalWrite(DC_MOTOR_A, LOW);
}
}
else
{
if(trap_button_out == 1)
{
trap_button_out = 0;
digitalWrite(DC_MOTOR_A, HIGH);
digitalWrite(DC_MOTOR_B, HIGH);
digitalWrite(DC_MOTOR_A, LOW);
digitalWrite(DC_MOTOR_B, LOW);
}
}

if(get_travel_in_button == 0)
{
if(trap_button_in == 0)
{
trap_button_in = 1;
digitalWrite(DC_MOTOR_A, HIGH);
digitalWrite(DC_MOTOR_B, HIGH);
digitalWrite(DC_MOTOR_B, LOW);
}
}
else
{
if(trap_button_in == 1)
{
trap_button_in = 0;
digitalWrite(DC_MOTOR_A, HIGH);
digitalWrite(DC_MOTOR_B, HIGH);
digitalWrite(DC_MOTOR_A, LOW);
digitalWrite(DC_MOTOR_B, LOW);
}
}






//SPEED
//=====

if(get_speed_button_1 == false)
{
analogWrite(PWM_LEVEL, PWM_LEVEL_L1);
digitalWrite(LED_1, HIGH);
digitalWrite(LED_2, LOW);
digitalWrite(LED_3, LOW);
digitalWrite(LED_4, LOW);
delay(50);
}

if(get_speed_button_2 == false)
{
analogWrite(PWM_LEVEL, PWM_LEVEL_L2);
digitalWrite(LED_1, LOW);
digitalWrite(LED_2, HIGH);
digitalWrite(LED_3, LOW);
digitalWrite(LED_4, LOW);
delay(50);
}

if(get_speed_button_3 == false)
{
analogWrite(PWM_LEVEL, PWM_LEVEL_L3);
digitalWrite(LED_1, LOW);
digitalWrite(LED_2, LOW);
digitalWrite(LED_3, HIGH);
digitalWrite(LED_4, LOW);
delay(50);
}

if(get_speed_button_4 == false)
{
analogWrite(PWM_LEVEL, PWM_LEVEL_L4);
digitalWrite(LED_1, LOW);
digitalWrite(LED_2, LOW);
digitalWrite(LED_3, LOW);
digitalWrite(LED_4, HIGH);
delay(50);
}

serialEvent();
delay(100);
}

void serialEvent()
{
while (Serial.available() > 0)
{
char GET_SERIAL_DATA = Serial.read();
GET_COMMAND += GET_SERIAL_DATA;

if (GET_SERIAL_DATA == '#')
{


//FOCUS COMMANDS
//==============

if(GET_COMMAND.endsWith(":F+#")) //out
{
Serial.print(GET_COMMAND);
digitalWrite(DC_MOTOR_A, HIGH);
digitalWrite(DC_MOTOR_B, HIGH);
digitalWrite(DC_MOTOR_A, LOW);
}

if(GET_COMMAND.endsWith(":F-#")) //in
{
Serial.print(GET_COMMAND);
digitalWrite(DC_MOTOR_A, HIGH);
digitalWrite(DC_MOTOR_B, HIGH);
digitalWrite(DC_MOTOR_B, LOW);
}

if(GET_COMMAND.endsWith(":FQ#")) //stop
{
Serial.print(GET_COMMAND);
digitalWrite(DC_MOTOR_A, HIGH);
digitalWrite(DC_MOTOR_B, HIGH);
digitalWrite(DC_MOTOR_A, LOW);
digitalWrite(DC_MOTOR_B, LOW);
}



//SPEED COMMANDS
//==============

if(GET_COMMAND.endsWith(":F1#"))
{
Serial.print(GET_COMMAND);
analogWrite(PWM_LEVEL, PWM_LEVEL_L1);
digitalWrite(LED_1, HIGH);
digitalWrite(LED_2, LOW);
digitalWrite(LED_3, LOW);
digitalWrite(LED_4, LOW);
}

if(GET_COMMAND.endsWith(":F2#"))
{
Serial.print(GET_COMMAND);
analogWrite(PWM_LEVEL, PWM_LEVEL_L2);
digitalWrite(LED_1, LOW);
digitalWrite(LED_2, HIGH);
digitalWrite(LED_3, LOW);
digitalWrite(LED_4, LOW);
}

if(GET_COMMAND.endsWith(":F3#"))
{
Serial.print(GET_COMMAND);
analogWrite(PWM_LEVEL, PWM_LEVEL_L3);
digitalWrite(LED_1, LOW);
digitalWrite(LED_2, LOW);
digitalWrite(LED_3, HIGH);
digitalWrite(LED_4, LOW);
}

if(GET_COMMAND.endsWith(":F4#"))
{
Serial.print(GET_COMMAND);
analogWrite(PWM_LEVEL, PWM_LEVEL_L4);
digitalWrite(LED_1, LOW);
digitalWrite(LED_2, LOW);
digitalWrite(LED_3, LOW);
digitalWrite(LED_4, HIGH);
}
GET_COMMAND = "";
}
}
}
Attached Thumbnails
Click for full-size image (l298n-dual-2a-motor-driver-module-tronixlabs-australia-pinout.jpg)
104.0 KB66 views
Click for full-size image (s-l1600.jpg)
154.4 KB48 views
Reply With Quote
  #7  
Old 26-04-2018, 11:04 AM
redbeard's Avatar
redbeard (Damien)
Registered User

redbeard is offline
 
Join Date: Nov 2010
Location: Adelaide
Posts: 558
Quote:
as long as you have a centre click pot.
Hi Andrew,

That answers my second question of accidental drift or knocking from centre position.

Micros and modules sure make easy work of it all.

Cheers,
Damien
Reply With Quote
  #8  
Old 26-04-2018, 12:07 PM
AndrewJ
Watch me post!

AndrewJ is offline
 
Join Date: Mar 2006
Location: Melbourne
Posts: 1,905
Gday Damien

Quote:
That answers my second question of accidental drift or knocking from centre position.
If you look at my schematic, R14 effectively creates a "dead zone" that allows you to be slightly off centre and still stay OFF. You can make that as big as you want, then tweak the sawtooth oscillator to suit the startup PWM you want.
If using a microprocessor with ADC, its equivalent to setting a range where the unit doesnt work.

Andrew
Reply With Quote
  #9  
Old 26-04-2018, 03:53 PM
ChrisV's Avatar
ChrisV (Chris)
Registered User

ChrisV is offline
 
Join Date: Aug 2015
Location: Sydney
Posts: 1,737
Damien

Thanks for this. I've been mulling over building a DC motor or stepper controlled focuser. Looks like the time to do it. But the computer interface bit of arduino code - are they for a meade focuser ASCOM interface, or something else?

Chris
Reply With Quote
  #10  
Old 26-04-2018, 04:24 PM
redbeard's Avatar
redbeard (Damien)
Registered User

redbeard is offline
 
Join Date: Nov 2010
Location: Adelaide
Posts: 558
Quote:
Originally Posted by AndrewJ View Post
Gday Damien

If you look at my schematic, R14 effectively creates a "dead zone" that allows you to be slightly off centre and still stay OFF. You can make that as big as you want, then tweak the sawtooth oscillator to suit the startup PWM you want.
If using a microprocessor with ADC, its equivalent to setting a range where the unit doesnt work.

Andrew
Hi Andrew,

Yep, that's how I do it in micro land and good to know how to do it another way.

Cheers,
Damien
Reply With Quote
  #11  
Old 26-04-2018, 04:58 PM
redbeard's Avatar
redbeard (Damien)
Registered User

redbeard is offline
 
Join Date: Nov 2010
Location: Adelaide
Posts: 558
Quote:
Originally Posted by ChrisV View Post
Damien

Thanks for this. I've been mulling over building a DC motor or stepper controlled focuser. Looks like the time to do it. But the computer interface bit of arduino code - are they for a meade focuser ASCOM interface, or something else?

Chris
Hi Chris,

It works with the Meade Classic focuser Ascom and I've tested it on Nebulosity 4 and BYEOS 3.1.

In the Arduino code, I used the Meade protocol commands for the focuser and the Ascom driver uses these too for the Classic LX200. It's a very basic implementation of Ascom. So if you serially send the Arduino a ":F+#" from your computer, (9600,n,8,1), the focuser will start to travel outwards. Then send the Arduino a ":FQ#" to stop the travel and put a brake on the motor.

The commands the Arduino looks for are, (without quotes):
":F+#" travel out
":F-#" travel in
":FQ#" stop travel
":F1#" speed 1
":F2#" speed 2
":F3#" speed 3
":F4#" speed 4

Can be tested with a basic Serial program. (Hercules)

The speeds can be set to whatever value is best for your focuser.

I'm going to experiment in the Windows app, as I have a "centre the focus travel" button which is a timed function. Put the focuser in home position all the way in and then travel out and time it for a half way, put that time count in the code. I made it a little less than half as if the button gets pressed twice, it will almost be a full travel of the focuser.

Also to have a counter, not sure if it will be accurate enough. Realise it can't be precision with out some sort of encoding but with the braking implemented, it will be interesting to see if it could save a couple of values and then use later. For example on a night use eyepiece for a while, switch to camera and select a preset that gets you in the ball park for the camera.

But positioning is really for steppers and motors with encoders. We'll see what happens.

Cheers,
Damien
Reply With Quote
  #12  
Old 01-06-2018, 04:31 PM
OuterObsession's Avatar
OuterObsession (Jameson)
Registered User

OuterObsession is offline
 
Join Date: May 2018
Location: NORMAN PARK
Posts: 37
If anyone's interested in building a computer controllable focuser a nema 17 stepper motor works great!

There's plenty of good software options to interface with the focuser with an arduino. In my case I used Tekydaves's (over at stargazers lounge) ardunio sketch which he also wrote an ascom driver to go with.

I even 3D printed a bracket that'll fit on any skywatcher/vixon/orion crayford focuser.

To avoid repeating myself you can read my main post on stargazers lounge: https://stargazerslounge.com/topic/2...omment-3323222

Cheers,
Jameson
Reply With Quote
Reply

Bookmarks

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +10. The time is now 09:48 PM.

Powered by vBulletin Version 3.8.7 | Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Advertisement
Testar
Advertisement
Bintel
Advertisement