Skip to content
Snippets Groups Projects
Commit 1794abb8 authored by Agis Zisimatos's avatar Agis Zisimatos
Browse files

Arduino code with AccelStepper library, add Gerber files for arduino shield,...

Arduino code with AccelStepper library, add Gerber files for arduino shield, add power supply board.
parent 5d27da97
Branches
No related tags found
No related merge requests found
Showing
with 16070 additions and 8479 deletions
Arduino Code
============
In order to use this code, you need to download and install the [AccelStepper library](http://www.airspayce.com/mikem/arduino/AccelStepper/).
\ No newline at end of file
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <AccelStepper.h>
#define DIR_AZ 18
#define STEP_AZ 10
#define DIR_EL 6
#define STEP_EL 7
......@@ -13,30 +13,32 @@
#define SPR 200 //Step Per Revolution
#define RATIO 60 //Gear ratio
#define T_DEALY 10000 //Time to disable the motors
#define T_STEPPER 1000 //2*T_STEPPER is the period of pulses
#define T_DEALY 20000 //Time to disable the motors
/*Global Variables*/
long t_DIS = 0; //time to disable the Motors
unsigned long t_DIS = 0; //time to disable the Motors
/*Define a stepper and the pins it will use*/
AccelStepper AZstepper(1, STEP_AZ, DIR_AZ);
AccelStepper ELstepper(1, STEP_EL, DIR_EL);
void setup()
{
/*Define the Stepper drivers PIN's*/
pinMode(DIR_AZ, OUTPUT);
pinMode(STEP_AZ, OUTPUT);
pinMode(DIR_EL, OUTPUT);
pinMode(STEP_EL, OUTPUT);
digitalWrite(STEP_AZ, LOW);
digitalWrite(DIR_AZ, LOW);
digitalWrite(STEP_EL, LOW);
digitalWrite(DIR_EL, LOW);
/*Change these to suit your stepper if you want*/
AZstepper.setMaxSpeed(400);
AZstepper.setAcceleration(100);
/*Change these to suit your stepper if you want*/
ELstepper.setMaxSpeed(400);
ELstepper.setAcceleration(100);
/*Enable Motors*/
pinMode(EN, OUTPUT);
digitalWrite(EN, LOW);
/*Step size*/
pinMode(MS1, OUTPUT);
digitalWrite(MS1, LOW); //Full step
/*Serial Communication*/
Serial.begin(19200);
}
......@@ -45,30 +47,26 @@ void loop()
/*Define the steps*/
static int AZstep = 0;
static int ELstep = 0;
/*Define the steps from the start of motion*/
static int AZstepPos = 0;
static int ELstepPos = 0;
/*Time Check*/
if (t_DIS == 0)
t_DIS = millis();
/*Disable Motors*/
if (AZstep == 0 && ELstep == 0 && millis()-t_DIS > T_DEALY)
if (AZstep == AZstepper.currentPosition() && ELstep == ELstepper.currentPosition() && millis()-t_DIS > T_DEALY)
digitalWrite(EN, HIGH);
/*Enable Motors*/
else
digitalWrite(EN, LOW);
/*Read the steps from serial*/
cmd_proc(AZstep, ELstep, AZstepPos, AZstepPos);
cmd_proc(AZstep, ELstep);
/*Move the Azimuth & Elevation Motor*/
stepper_move(AZstep, ELstep, AZstepPos, ELstepPos);
Serial.print(AZstepPos);Serial.print("\t");
Serial.println(AZstep);
stepper_move(AZstep, ELstep);
}
/*EasyComm 2 Protocol & Calculate the steps*/
void cmd_proc(int &stepAz, int &stepEl, int stepPosAz, int stepPosEl)
void cmd_proc(int &stepAz, int &stepEl)
{
/*Serial*/
static char buffer[256];
......@@ -90,7 +88,7 @@ void cmd_proc(int &stepAz, int &stepEl, int stepPosAz, int stepPosEl)
/*Get the absolute value of angle*/
double angleAz = atof(data);
/*Calculate the steps*/
stepAz = deg2step(angleAz) - stepPosAz;
stepAz = deg2step(angleAz);
}
else if (buffer[0] == 'E' && buffer[1] == 'L')
{
......@@ -98,15 +96,15 @@ void cmd_proc(int &stepAz, int &stepEl, int stepPosAz, int stepPosEl)
/*Get the absolute value of angle*/
double angleEl = atof(data);
/*Calculate the steps*/
stepEl = deg2step(angleEl) - stepPosEl;
stepEl = deg2step(angleEl);
}
else if (buffer[0] == 'S' && buffer[1] == 'A')
{
stepAz = 0;
stepAz = AZstepper.currentPosition();
}
else if (buffer[0] == 'S' && buffer[1] == 'E')
{
stepEl = 0;
stepEl = ELstepper.currentPosition();;
}
counter = 0;
/*Reset the disable motor time*/
......@@ -121,42 +119,13 @@ void cmd_proc(int &stepAz, int &stepEl, int stepPosAz, int stepPosEl)
}
/*Send pulses to stepper motor drivers*/
void stepper_move(int &stepAz, int &stepEl, int &stepPosAz, int &stepPosEl)
void stepper_move(int stepAz, int stepEl)
{
if(stepAz > 0)
{
digitalWrite(DIR_AZ, HIGH);
digitalWrite(STEP_AZ, HIGH);
stepPosAz++;
stepAz--;
}
else if(stepAz < 0)
{
digitalWrite(DIR_AZ, LOW);
digitalWrite(STEP_AZ, HIGH);
stepPosAz--;
stepAz++;
}
if(stepEl > 0)
{
digitalWrite(DIR_EL, LOW);
digitalWrite(STEP_EL, HIGH);
stepPosEl++;
stepEl--;
}
else if(stepEl < 0)
{
digitalWrite(DIR_EL, HIGH);
digitalWrite(STEP_EL, HIGH);
stepPosEl--;
stepEl++;
}
AZstepper.moveTo(stepAz);
ELstepper.moveTo(stepEl);
delayMicroseconds(T_STEPPER);
digitalWrite(STEP_AZ, LOW);
digitalWrite(STEP_EL, LOW);
delayMicroseconds(T_STEPPER);
AZstepper.run();
ELstepper.run();
}
/*Convert degrees to steps*/
......
G75*
G70*
%OFA0B0*%
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%AMOC8*
5,1,8,0,0,1.08239X$1,22.5*
%
%ADD10R,0.0700X0.0700*%
%ADD11C,0.0780*%
%ADD12C,0.0740*%
%ADD13OC8,0.0640*%
%ADD14C,0.0560*%
%ADD15OC8,0.0630*%
%ADD16C,0.0630*%
%ADD17C,0.0320*%
D10*
X003000Y005680D03*
X004000Y005680D03*
X005000Y005680D03*
X006000Y005680D03*
X007000Y005680D03*
X008000Y005680D03*
X009000Y005680D03*
X010000Y005680D03*
X012000Y005680D03*
X013500Y005680D03*
X014500Y005680D03*
X015500Y005680D03*
X016500Y005680D03*
X017500Y005680D03*
X018500Y005680D03*
X019500Y005680D03*
X020500Y005680D03*
X019500Y009680D03*
X019500Y010680D03*
X018500Y010680D03*
X017500Y010680D03*
X017500Y009680D03*
X016500Y010680D03*
X015500Y010680D03*
X014500Y010680D03*
X013500Y010680D03*
X012500Y012680D03*
X014000Y014180D03*
X014000Y015180D03*
X014000Y016180D03*
X014000Y017180D03*
X014000Y018180D03*
X014000Y019180D03*
X014000Y020180D03*
X014000Y021180D03*
X014000Y022180D03*
X014000Y023180D03*
X014000Y024180D03*
X014000Y025180D03*
X011000Y025680D03*
X011000Y022680D03*
X008000Y022180D03*
X008000Y021180D03*
X008000Y020180D03*
X008000Y019180D03*
X008000Y018180D03*
X008000Y017180D03*
X008000Y016180D03*
X008000Y015180D03*
X008000Y014180D03*
X010000Y012680D03*
X010000Y010680D03*
X009000Y010680D03*
X008000Y010680D03*
X007000Y010680D03*
X006000Y010680D03*
X005000Y010680D03*
X004000Y010680D03*
X003000Y010680D03*
X012000Y003680D03*
X020500Y010680D03*
X008000Y023180D03*
X008000Y024180D03*
X008000Y025180D03*
D11*
X003540Y003070D02*
X003540Y002290D01*
X005520Y002290D02*
X005520Y003070D01*
X007480Y003070D02*
X007480Y002290D01*
X009460Y002290D02*
X009460Y003070D01*
X014040Y003070D02*
X014040Y002290D01*
X016020Y002290D02*
X016020Y003070D01*
X017980Y003070D02*
X017980Y002290D01*
X019960Y002290D02*
X019960Y003070D01*
X019490Y024790D02*
X019490Y025570D01*
X017510Y025570D02*
X017510Y024790D01*
D12*
X012000Y024180D03*
X010000Y024180D03*
X010000Y020180D03*
X012000Y020180D03*
X009000Y008180D03*
X005000Y008180D03*
X015500Y008180D03*
X019500Y008180D03*
D13*
X005500Y018180D03*
X005500Y019180D03*
X005500Y020180D03*
X004500Y020180D03*
X004500Y019180D03*
X004500Y018180D03*
X004500Y022680D03*
X004500Y023680D03*
X005500Y023680D03*
X005500Y022680D03*
D14*
X015720Y022180D02*
X016280Y022180D01*
X016280Y021180D02*
X015720Y021180D01*
X015720Y020180D02*
X016280Y020180D01*
X016280Y019180D02*
X015720Y019180D01*
X015720Y018180D02*
X016280Y018180D01*
X016280Y017180D02*
X015720Y017180D01*
X015720Y016180D02*
X016280Y016180D01*
X016280Y015180D02*
X015720Y015180D01*
D15*
X020000Y013180D03*
D16*
X020000Y014180D03*
D17*
X019500Y009680D02*
X017500Y009680D01*
X012500Y012680D02*
X010000Y012680D01*
X012000Y005680D02*
X012000Y003680D01*
X011000Y022680D02*
X011000Y025680D01*
M02*
%
M48
M72
T01C0.0320
T02C0.0350
T03C0.0390
T04C0.0400
T05C0.0520
T06C0.1100
%
T01
X16000Y15180
X16000Y16180
X16000Y17180
X16000Y18180
X16000Y19180
X16000Y20180
X16000Y21180
X16000Y22180
X20000Y14180
X20000Y13180
T02
X19500Y8180
X15500Y8180
X9000Y8180
X5000Y8180
X10000Y20180
X12000Y20180
X12000Y24180
X10000Y24180
T03
X11000Y25680
X11000Y22680
X8000Y22180
X8000Y21180
X8000Y20180
X8000Y19180
X8000Y18180
X8000Y17180
X8000Y16180
X8000Y15180
X8000Y14180
X10000Y12680
X10000Y10680
X9000Y10680
X8000Y10680
X7000Y10680
X6000Y10680
X5000Y10680
X4000Y10680
X3000Y10680
X3000Y5680
X4000Y5680
X5000Y5680
X6000Y5680
X7000Y5680
X8000Y5680
X9000Y5680
X10000Y5680
X12000Y5680
X13500Y5680
X14500Y5680
X15500Y5680
X16500Y5680
X17500Y5680
X18500Y5680
X19500Y5680
X20500Y5680
X19500Y9680
X19500Y10680
X18500Y10680
X17500Y10680
X17500Y9680
X16500Y10680
X15500Y10680
X14500Y10680
X13500Y10680
X12500Y12680
X14000Y14180
X14000Y15180
X14000Y16180
X14000Y17180
X14000Y18180
X14000Y19180
X14000Y20180
X14000Y21180
X14000Y22180
X14000Y23180
X14000Y24180
X14000Y25180
X8000Y25180
X8000Y24180
X8000Y23180
X20500Y10680
X12000Y3680
T04
X5500Y18180
X5500Y19180
X5500Y20180
X4500Y20180
X4500Y19180
X4500Y18180
X4500Y22680
X4500Y23680
X5500Y23680
X5500Y22680
T05
X17510Y25180
X19490Y25180
X19960Y2680
X17980Y2680
X16020Y2680
X14040Y2680
X9460Y2680
X7480Y2680
X5520Y2680
X3540Y2680
T06
X1500Y1180
X1500Y26180
X22500Y26180
M30
Generated by EAGLE CAM Processor 6.4.0
Drill Station Info File: /home/azisi/Documents/github/satnogs-arduino/PCB/SatNOGSBoardV1_1/GerberFiles/SatNOGSBoardV1_1.dri
Date : 9/20/14 2:24 PM
Drills : /home/azisi/Documents/github/satnogs-arduino/PCB/SatNOGSBoardV1_1/GerberFiles/SatNOGSBoardV1_1.drl
Device : Excellon drill station
Parameter settings:
Tolerance Drill + : 2.50 %
Tolerance Drill - : 2.50 %
Rotate : no
Mirror : no
Optimize : yes
Auto fit : yes
OffsetX : 0inch
OffsetY : 0inch
Layers : Drills Holes
Drill File Info:
Data Mode : Absolute
Units : 1/10000 Inch
Drill Tolerances:
-- Requested -- -- Used Drill --
Size used Code Size
0.1102inch 3 T06 0.1100inch
0.0394inch 64 T03 0.0390inch
0.0354inch 8 T02 0.0350inch
Drills used:
Code Size used
T01 0.0320inch 10
T02 0.0350inch 8
T03 0.0390inch 64
T04 0.0400inch 10
T05 0.0520inch 10
T06 0.1100inch 3
Total number of drills: 105
Plotfiles:
/home/azisi/Documents/github/satnogs-arduino/PCB/SatNOGSBoardV1_1/GerberFiles/SatNOGSBoardV1_1.drd
T01 0.032in
T02 0.035in
T03 0.039in
T04 0.040in
T05 0.052in
T06 0.110in
Generated by EAGLE CAM Processor 6.4.0
Photoplotter Info File: /home/azisi/Documents/github/satnogs-arduino/PCB/SatNOGSBoardV1_1/SatNOGSBoardV1_1.gpi
Date : 9/20/14 2:25 PM
Plotfile : /home/azisi/Documents/github/satnogs-arduino/PCB/SatNOGSBoardV1_1/SatNOGSBoardV1_1.sts
Apertures : generated:
Device : Gerber RS-274-X photoplotter, coordinate format 2.4 inch
Parameter settings:
Emulate Apertures : no
Tolerance Draw + : 0.00 %
Tolerance Draw - : 0.00 %
Tolerance Flash + : 0.00 %
Tolerance Flash - : 0.00 %
Rotate : no
Mirror : no
Optimize : yes
Auto fit : yes
OffsetX : 0inch
OffsetY : 0inch
Plotfile Info:
Coordinate Format : 2.4
Coordinate Units : Inch
Data Mode : Absolute
Zero Suppression : None
End Of Block : *
Apertures used:
Code Shape Size used
D10 round 0.1182inch 3
D11 square 0.0780inch 64
D12 draw 0.0860inch 10
D13 round 0.0820inch 8
D14 rectangle 0.1080inch x 0.0580inch 2
D15 octagon 0.0720inch 10
D16 draw 0.0640inch 8
D17 octagon 0.0710inch 1
D18 round 0.0710inch 1
This diff is collapsed.
This diff is collapsed.
G75*
G70*
%OFA0B0*%
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%AMOC8*
5,1,8,0,0,1.08239X$1,22.5*
%
%ADD10C,0.1182*%
%ADD11R,0.0780X0.0780*%
%ADD12C,0.0860*%
%ADD13C,0.0820*%
%ADD14OC8,0.0720*%
%ADD15C,0.0640*%
%ADD16OC8,0.0710*%
%ADD17C,0.0710*%
D10*
X001500Y001180D03*
X001500Y026180D03*
X022500Y026180D03*
D11*
X014000Y025180D03*
X014000Y024180D03*
X014000Y023180D03*
X014000Y022180D03*
X014000Y021180D03*
X014000Y020180D03*
X014000Y019180D03*
X014000Y018180D03*
X014000Y017180D03*
X014000Y016180D03*
X014000Y015180D03*
X014000Y014180D03*
X012500Y012680D03*
X013500Y010680D03*
X014500Y010680D03*
X015500Y010680D03*
X016500Y010680D03*
X017500Y010680D03*
X017500Y009680D03*
X018500Y010680D03*
X019500Y010680D03*
X019500Y009680D03*
X020500Y010680D03*
X020500Y005680D03*
X019500Y005680D03*
X018500Y005680D03*
X017500Y005680D03*
X016500Y005680D03*
X015500Y005680D03*
X014500Y005680D03*
X013500Y005680D03*
X012000Y005680D03*
X012000Y003680D03*
X010000Y005680D03*
X009000Y005680D03*
X008000Y005680D03*
X007000Y005680D03*
X006000Y005680D03*
X005000Y005680D03*
X004000Y005680D03*
X003000Y005680D03*
X003000Y010680D03*
X004000Y010680D03*
X005000Y010680D03*
X006000Y010680D03*
X007000Y010680D03*
X008000Y010680D03*
X009000Y010680D03*
X010000Y010680D03*
X010000Y012680D03*
X008000Y014180D03*
X008000Y015180D03*
X008000Y016180D03*
X008000Y017180D03*
X008000Y018180D03*
X008000Y019180D03*
X008000Y020180D03*
X008000Y021180D03*
X008000Y022180D03*
X008000Y023180D03*
X008000Y024180D03*
X008000Y025180D03*
X011000Y025680D03*
X011000Y022680D03*
D12*
X017510Y024790D02*
X017510Y025570D01*
X019490Y025570D02*
X019490Y024790D01*
X019960Y003070D02*
X019960Y002290D01*
X017980Y002290D02*
X017980Y003070D01*
X016020Y003070D02*
X016020Y002290D01*
X014040Y002290D02*
X014040Y003070D01*
X009460Y003070D02*
X009460Y002290D01*
X007480Y002290D02*
X007480Y003070D01*
X005520Y003070D02*
X005520Y002290D01*
X003540Y002290D02*
X003540Y003070D01*
D13*
X005000Y008180D03*
X009000Y008180D03*
X015500Y008180D03*
X019500Y008180D03*
X012000Y020180D03*
X010000Y020180D03*
X010000Y024180D03*
X012000Y024180D03*
D14*
X005500Y023680D03*
X005500Y022680D03*
X004500Y022680D03*
X004500Y023680D03*
X004500Y020180D03*
X004500Y019180D03*
X004500Y018180D03*
X005500Y018180D03*
X005500Y019180D03*
X005500Y020180D03*
D15*
X015720Y020180D02*
X016280Y020180D01*
X016280Y019180D02*
X015720Y019180D01*
X015720Y018180D02*
X016280Y018180D01*
X016280Y017180D02*
X015720Y017180D01*
X015720Y016180D02*
X016280Y016180D01*
X016280Y015180D02*
X015720Y015180D01*
X015720Y021180D02*
X016280Y021180D01*
X016280Y022180D02*
X015720Y022180D01*
D16*
X020000Y013180D03*
D17*
X020000Y014180D03*
M02*
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
G75*
G70*
%OFA0B0*%
%FSLAX24Y24*%
%IPPOS*%
%LPD*%
%AMOC8*
5,1,8,0,0,1.08239X$1,22.5*
%
%ADD10R,0.1000X0.1000*%
%ADD11C,0.0780*%
%ADD12C,0.1306*%
%ADD13C,0.0562*%
D10*
X006583Y001760D03*
X006583Y008635D03*
X021208Y008635D03*
X021208Y001760D03*
D11*
X002973Y004270D02*
X002193Y004270D01*
X002193Y006250D02*
X002973Y006250D01*
X024193Y005750D02*
X024973Y005750D01*
X024973Y007770D02*
X024193Y007770D01*
X024193Y009750D02*
X024973Y009750D01*
X024973Y003770D02*
X024193Y003770D01*
D12*
X022083Y011673D03*
X019847Y011673D03*
X019847Y016847D03*
X022083Y016847D03*
D13*
X021016Y015638D03*
X019985Y015638D03*
X018953Y015638D03*
X018953Y014654D03*
X019985Y014654D03*
X021016Y014654D03*
X021016Y013866D03*
X019985Y013866D03*
X018953Y013866D03*
X018953Y012882D03*
X019985Y012882D03*
X021016Y012882D03*
M02*
%
M48
M72
T01C0.0360
T02C0.0390
T03C0.0520
T04C0.0910
T05C0.1260
%
T01
X18953Y12882
X19985Y12882
X21016Y12882
X21016Y13866
X19985Y13866
X18953Y13866
X18953Y14654
X19985Y14654
X21016Y14654
X21016Y15638
X19985Y15638
X18953Y15638
T02
X21208Y8635
X21208Y1760
X6583Y1760
X6583Y8635
T03
X2583Y6250
X2583Y4270
X24583Y3770
X24583Y5750
X24583Y7770
X24583Y9750
T04
X22083Y11673
X19847Y11673
X19847Y16847
X22083Y16847
T05
X2083Y1260
X25083Y1260
X2083Y17260
M30
This diff is collapsed.
T01 0.036in
T02 0.039in
T03 0.052in
T04 0.091in
T05 0.126in
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment