Skip to content

Commit 308a0b3

Browse files
V1.8.02 - Updates
- Cleaned up some pin definitions (ESP32 was incorrect, amongst other things)
1 parent b8cf715 commit 308a0b3

File tree

4 files changed

+142
-230
lines changed

4 files changed

+142
-230
lines changed

Software/Arduino code/OpenAstroTracker/Configuration.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
=======================================================================================================================================
1919
*/
2020

21-
String version = "V1.8.01";
21+
String version = "V1.8.02";
2222

2323
///////////////////////////////////////////////////////////////////////////
2424
// Also use Configuration_adv for further adjustments!
Lines changed: 84 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,96 @@
11

2+
////////////////////////////////////////////////////////////////////
23
// Arduino MEGA
4+
////////////////////////////////////////////////////////////////////
35
#ifdef __AVR_ATmega2560__ // Arduino Mega
4-
//---------------------------------------
5-
// If using 28BYJ-48 and ULN2003 drivers:
6-
#define RA_IN1_PIN 22
7-
#define RA_IN2_PIN 24
8-
#define RA_IN3_PIN 26
9-
#define RA_IN4_PIN 28
10-
#define DEC_IN1_PIN 30
11-
#define DEC_IN2_PIN 32
12-
#define DEC_IN3_PIN 34
13-
#define DEC_IN4_PIN 36
14-
//-----------------------
15-
// If using NEMA steppers
16-
#define RA_STEP_PIN 22 // STEP
17-
#define RA_DIR_PIN 24 // DIR
18-
#define RA_EN_PIN 25 // Enable
19-
#define RA_MS0_PIN 30, HIGH //
20-
#define RA_MS1_PIN 32, HIGH
21-
#define RA_MS2_PIN 34, HIGH
22-
//RA TMC2209 UART specific pins
23-
#define RA_SERIAL_PORT Serial3 // HardwareSerial port, wire to TX3 for write-only
24-
#define RA_DRIVER_ADDRESS 0b00 // Set by MS1/MS2. LOW/LOW in this case
25-
#define RA_DIAG_PIN 40 // only needed for autohome function
26-
27-
#define DEC_STEP_PIN 26 // STEP
28-
#define DEC_DIR_PIN 28 // DIR
29-
#define DEC_EN_PIN 29 // Enable
30-
#define DEC_MS0_PIN 31 //
31-
#define DEC_MS1_PIN 33
32-
#define DEC_MS2_PIN 35
33-
//DEC TMC2209 UART specific pins
34-
#define DEC_SERIAL_PORT Serial3 // HardwareSerial port, wire to TX2 for write-only
35-
#define DEC_DRIVER_ADDRESS 0b01 // Set by MS1/MS2 (MS1 HIGH, MS2 LOW)
36-
#define DEC_DIAG_PIN 41 // only needed for autohome function
37-
//---------------
38-
// MISC PINS
39-
#define GPS_SERIAL_PORT Serial1
40-
#define GPS_BAUD_RATE 9600
6+
//---------------------------------------
7+
// If using 28BYJ-48 and ULN2003 drivers:
8+
#define RA_IN1_PIN 22
9+
#define RA_IN2_PIN 24
10+
#define RA_IN3_PIN 26
11+
#define RA_IN4_PIN 28
12+
#define DEC_IN1_PIN 30
13+
#define DEC_IN2_PIN 32
14+
#define DEC_IN3_PIN 34
15+
#define DEC_IN4_PIN 36
16+
//-----------------------
17+
// If using NEMA steppers
18+
#define RA_STEP_PIN 22 // STEP
19+
#define RA_DIR_PIN 24 // DIR
20+
#define RA_EN_PIN 25 // Enable
21+
#define RA_MS0_PIN 30, HIGH //
22+
#define RA_MS1_PIN 32, HIGH
23+
#define RA_MS2_PIN 34, HIGH
24+
//RA TMC2209 UART specific pins
25+
#define RA_SERIAL_PORT Serial3 // HardwareSerial port, wire to TX3 for write-only
26+
#define RA_DRIVER_ADDRESS 0b00 // Set by MS1/MS2. LOW/LOW in this case
27+
#define RA_DIAG_PIN 40 // only needed for autohome function
28+
29+
#define DEC_STEP_PIN 26 // STEP
30+
#define DEC_DIR_PIN 28 // DIR
31+
#define DEC_EN_PIN 29 // Enable
32+
#define DEC_MS0_PIN 31 //
33+
#define DEC_MS1_PIN 33
34+
#define DEC_MS2_PIN 35
35+
//DEC TMC2209 UART specific pins
36+
#define DEC_SERIAL_PORT Serial3 // HardwareSerial port, wire to TX2 for write-only
37+
#define DEC_DRIVER_ADDRESS 0b01 // Set by MS1/MS2 (MS1 HIGH, MS2 LOW)
38+
#define DEC_DIAG_PIN 41 // only needed for autohome function
39+
//---------------
40+
// MISC PINS
41+
#define GPS_SERIAL_PORT Serial1
42+
#define GPS_BAUD_RATE 9600
4143
#endif //mega
4244

45+
////////////////////////////////////////////////////////////////////
4346
// ESP32
47+
////////////////////////////////////////////////////////////////////
4448
#ifdef ESP32
45-
// todo
49+
#if (RA_STEPPER_TYPE != STEP_28BYJ48) || (DEC_STEPPER_TYPE != STEP_28BYJ48)
50+
#error Only 28BJY-48 stepper motors are supported on the ESP (for now)
51+
#endif
52+
53+
// RA Motor pins
54+
#define RA_IN1_PIN 19
55+
#define RA_IN2_PIN 21
56+
#define RA_IN3_PIN 22
57+
#define RA_IN4_PIN 23
58+
59+
// DEC Motor pins
60+
#define DEC_IN1_PIN 16
61+
#define DEC_IN2_PIN 17
62+
#define DEC_IN3_PIN 5
63+
#define DEC_IN4_PIN 18
64+
65+
// ST4 Input Pins - TODO.
66+
/*#define st4North SD0
67+
#define st4South SD1
68+
#define st4West SD2
69+
#define st4East SD3*/
70+
#if USE_GPS == 1
71+
#error GPS module not currently configured/supported in ESP32
72+
#endif
4673
#endif
4774

75+
////////////////////////////////////////////////////////////////////
4876
// Arduino UNO
77+
////////////////////////////////////////////////////////////////////
4978
#ifdef __AVR_ATmega328P__ // Arduino Uno
50-
#define RA_IN1_PIN 12
51-
#define RA_IN2_PIN 11
52-
#define RA_IN3_PIN 3
53-
#define RA_IN4_PIN 2
54-
55-
#define DEC_IN1_PIN 18
56-
#define DEC_IN2_PIN 17
57-
#define DEC_IN3_PIN 16
58-
#define DEC_IN4_PIN 15
79+
#if (RA_STEPPER_TYPE != STEP_28BYJ48) || (DEC_STEPPER_TYPE != STEP_28BYJ48)
80+
#error Only 28BJY-48 stepper motors are supported on the UNO (for now)
81+
#endif
82+
83+
#define RA_IN1_PIN 12
84+
#define RA_IN2_PIN 11
85+
#define RA_IN3_PIN 3
86+
#define RA_IN4_PIN 2
87+
88+
#define DEC_IN1_PIN 18
89+
#define DEC_IN2_PIN 17
90+
#define DEC_IN3_PIN 16
91+
#define DEC_IN4_PIN 15
92+
93+
#if USE_GPS == 1
94+
#error GPS module not currently configured/supported in ESP32
95+
#endif
5996
#endif

Software/Arduino code/OpenAstroTracker/a_inits.hpp

Lines changed: 17 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,155 +1,34 @@
11
#pragma once
22

3-
43
#include <AccelStepper.h>
54
#include <LiquidCrystal.h>
6-
7-
#if USE_GPS == 1
8-
//#include <SoftwareSerial.h>
9-
//SoftwareSerial SoftSerial(50, 52); // RX, TX
10-
#endif
5+
#include "configuration_pins.hpp"
116

127
#include "Utility.hpp"
138
#include "DayTime.hpp"
149
#include "Mount.hpp"
1510
#include "MeadeCommandProcessor.hpp"
11+
1612
#if RA_DRIVER_TYPE == TMC2009_UART
1713
#include <TMCStepper.h>
1814
#endif
15+
1916
#if USE_GPS == 1
17+
//#include <SoftwareSerial.h>
2018
#include <TinyGPS++.h>
19+
20+
//SoftwareSerial SoftSerial(GPS_SERIAL_RX_PIN, GPS_SERIAL_TX_PIN); // RX, TX
2121
TinyGPSPlus gps;
2222
#endif
2323

2424
#define HALFSTEP 8
2525
#define FULLSTEP 4
2626
#define DRIVER 1
2727

28-
///////////////////////////////////////////////////////////////////////////
29-
// ESP8266 Wifi Board (NodeMCU)
30-
///////////////////////////////////////////////////////////////////////////
31-
#ifdef ESP8266
32-
// RA Motor pins
33-
#if INVERT_RA_DIR == 1
34-
#define RAmotorPin1 D0 // IN1 auf ULN2003 driver 1
35-
#define RAmotorPin3 D1 // IN2 auf ULN2003 driver 1
36-
#define RAmotorPin2 D2 // IN3 auf ULN2003 driver 1
37-
#define RAmotorPin4 D3 // IN4 auf ULN2003 driver 1
38-
#else
39-
#define RAmotorPin1 D3 // IN1 auf ULN2003 driver 1
40-
#define RAmotorPin3 D2 // IN2 auf ULN2003 driver 1
41-
#define RAmotorPin2 D1 // IN3 auf ULN2003 driver 1
42-
#define RAmotorPin4 D0 // IN4 auf ULN2003 driver 1
43-
#endif
44-
45-
// DEC Motor pins
46-
#if INVERT_DEC_DIR == 1
47-
#define DECmotorPin1 D5 // IN1 auf ULN2003 driver 2
48-
#define DECmotorPin3 D6 // IN3 auf ULN2003 driver 2
49-
#define DECmotorPin2 D7 // IN2 auf ULN2003 driver 2
50-
#define DECmotorPin4 D8 // IN4 auf ULN2003 driver 2
51-
#else
52-
#define DECmotorPin1 D8 // IN1 auf ULN2003 driver 2
53-
#define DECmotorPin3 D7 // IN3 auf ULN2003 driver 2
54-
#define DECmotorPin2 D6 // IN2 auf ULN2003 driver 2
55-
#define DECmotorPin4 D5 // IN4 auf ULN2003 driver 2
56-
#endif
57-
58-
// ST4 Input Pins - TODO.
59-
#define st4North SD0
60-
#define st4South SD1
61-
#define st4West SD2
62-
#define st4East SD3
63-
#endif
64-
65-
66-
///////////////////////////////////////////////////////////////////////////
67-
// ESP32 Wifi Board
68-
///////////////////////////////////////////////////////////////////////////
69-
#ifdef ESP32
70-
// RA Motor pins
71-
#if INVERT_RA_DIR == 1
72-
#define RAmotorPin1 35 // IN1 auf ULN2003 driver 1
73-
#define RAmotorPin3 34 // IN2 auf ULN2003 driver 1
74-
#define RAmotorPin2 39 // IN3 auf ULN2003 driver 1
75-
#define RAmotorPin4 36 // IN4 auf ULN2003 driver 1
76-
#else
77-
#define RAmotorPin1 23 // IN1 auf ULN2003 driver 1
78-
#define RAmotorPin3 22 // IN2 auf ULN2003 driver 1
79-
#define RAmotorPin2 21 // IN3 auf ULN2003 driver 1
80-
#define RAmotorPin4 19 // IN4 auf ULN2003 driver 1
81-
#endif
82-
83-
// DEC Motor pins
84-
#if INVERT_DEC_DIR == 1
85-
#define DECmotorPin1 26 // IN1 auf ULN2003 driver 2
86-
#define DECmotorPin3 25 // IN3 auf ULN2003 driver 2
87-
#define DECmotorPin2 33 // IN2 auf ULN2003 driver 2
88-
#define DECmotorPin4 32 // IN4 auf ULN2003 driver 2
89-
#else
90-
#define DECmotorPin1 18 // IN1 auf ULN2003 driver 2
91-
#define DECmotorPin3 5 // IN3 auf ULN2003 driver 2
92-
#define DECmotorPin2 17 // IN2 auf ULN2003 driver 2
93-
#define DECmotorPin4 16 // IN4 auf ULN2003 driver 2
94-
#endif
95-
96-
// ST4 Input Pins - TODO.
97-
/*#define st4North SD0
98-
#define st4South SD1
99-
#define st4West SD2
100-
#define st4East SD3*/
101-
#endif
102-
103-
///////////////////////////////////////////////////////////////////////////
104-
// Arduino Uno
105-
///////////////////////////////////////////////////////////////////////////
106-
#ifdef __AVR_ATmega328P__ // normal Arduino Mapping
28+
////////////////////////////////////
29+
// Stepper definitions /////////////
10730
#if RA_STEPPER_TYPE == STEP_28BYJ48
108-
// RA Motor pins
109-
#if INVERT_RA_DIR == 1
110-
#define RAmotorPin1 RA_IN1_PIN // IN1 auf ULN2003 driver 1
111-
#define RAmotorPin3 RA_IN2_PIN // IN2 auf ULN2003 driver 1
112-
#define RAmotorPin2 RA_IN3_PIN // IN3 auf ULN2003 driver 1
113-
#define RAmotorPin4 RA_IN4_PIN // IN4 auf ULN2003 driver 1
114-
#else
115-
#define RAmotorPin1 RA_IN4_PIN // IN1 auf ULN2003 driver 1
116-
#define RAmotorPin3 RA_IN3_PIN // IN2 auf ULN2003 driver 1
117-
#define RAmotorPin2 RA_IN2_PIN // IN3 auf ULN2003 driver 1
118-
#define RAmotorPin4 RA_IN1_PIN // IN4 auf ULN2003 driver 1
119-
#endif
120-
#endif
121-
#if RA_STEPPER_TYPE == STEP_NEMA17
122-
#define RAmotorPin1 11
123-
#define RAmotorPin2 12
124-
#endif
125-
126-
// DEC Motor pins
127-
#if DEC_STEPPER_TYPE == STEP_28BYJ48
128-
#if INVERT_DEC_DIR == 1
129-
#define DECmotorPin1 DEC_IN1_PIN // IN1 auf ULN2003 driver 2
130-
#define DECmotorPin3 DEC_IN2_PIN // IN2 auf ULN2003 driver 2
131-
#define DECmotorPin2 DEC_IN3_PIN // IN3 auf ULN2003 driver 2
132-
#define DECmotorPin4 DEC_IN4_PIN // IN4 auf ULN2003 driver 2
133-
#else
134-
#define DECmotorPin1 DEC_IN4_PIN // IN1 auf ULN2003 driver 2
135-
#define DECmotorPin3 DEC_IN3_PIN // IN3 auf ULN2003 driver 2
136-
#define DECmotorPin2 DEC_IN2_PIN // IN2 auf ULN2003 driver 2
137-
#define DECmotorPin4 DEC_IN1_PIN // IN4 auf ULN2003 driver 2
138-
#endif
139-
#endif
140-
#if DEC_STEPPER_TYPE == STEP_NEMA17
141-
#define DECmotorPin1 16
142-
#define DECmotorPin2 17
143-
#endif
144-
145-
#endif
146-
147-
///////////////////////////////////////////////////////////////////////////
148-
// Arduino Mega
149-
///////////////////////////////////////////////////////////////////////////
150-
#ifdef __AVR_ATmega2560__ // Arduino Mega
151-
#if RA_STEPPER_TYPE == STEP_28BYJ48
152-
// RA Motor pins
31+
// RA Motor pins
15332
#if INVERT_RA_DIR == 1
15433
#define RAmotorPin1 RA_IN1_PIN // IN1 auf ULN2003 driver 1
15534
#define RAmotorPin3 RA_IN2_PIN // IN2 auf ULN2003 driver 1
@@ -161,8 +40,7 @@
16140
#define RAmotorPin2 RA_IN2_PIN // IN3 auf ULN2003 driver 1
16241
#define RAmotorPin4 RA_IN1_PIN // IN4 auf ULN2003 driver 1
16342
#endif
164-
#endif
165-
#if RA_STEPPER_TYPE == STEP_NEMA17
43+
#elif RA_STEPPER_TYPE == STEP_NEMA17
16644
#define RAmotorPin1 RA_STEP_PIN
16745
#define RAmotorPin2 RA_DIR_PIN
16846
#endif
@@ -180,22 +58,23 @@
18058
#define DECmotorPin2 DEC_IN3_PIN // IN3 auf ULN2003 driver 2
18159
#define DECmotorPin4 DEC_IN4_PIN // IN4 auf ULN2003 driver 2
18260
#endif
183-
#endif
184-
#if DEC_STEPPER_TYPE == STEP_NEMA17
61+
#elif DEC_STEPPER_TYPE == STEP_NEMA17
18562
#define DECmotorPin1 DEC_STEP_PIN
18663
#define DECmotorPin2 DEC_DIR_PIN
18764
#endif
188-
189-
#endif
65+
// End Stepper Definitions //////////////
66+
/////////////////////////////////////////
19067

191-
// Driver definitions /////////////
68+
/////////////////////////////////////////
69+
// Driver definitions ///////////////////
19270
#if RA_DRIVER_TYPE == TMC2009_STANDALONE
19371
//#define RA_EN_PIN 40 // Enable Pin
19472
#endif
19573
#if RA_DRIVER_TYPE == TMC2009_UART
19674
#define R_SENSE 0.11f // 0.11 for StepStick
19775
#endif
198-
// End Driver Definitions //////////////
76+
// End Driver Definitions ///////////////
77+
/////////////////////////////////////////
19978

20079

20180
// Menu IDs

0 commit comments

Comments
 (0)