====== ROBOTIZED MAG LOOP ======
===== GOAL =====
Using a stepper motor to remotely control the variable capacitor from the shack while watching the SWR-meter and avoid tuning mess because of skin effect.
===== HARDWARE =====
==== STEPPER MOTOR ====
The famous 28BYJ-48.
{{:projets:antennes:robotized_mag_loop:28byj-48.jpg?direct&200|}}
=== DATASHEET ===
{{ :projets:antennes:robotized_mag_loop:28byj48-stepper-motor-datasheet.pdf |}}
=== CHARACTERISTICS ===
* Rated voltage → 5 V
* Coil Resistance → 50 Ohms
* Coil Type → Unipolar
* Diameter – shaft → 0.197″ (5.00 mm)
* Length – shaft and bearing → 0.394″ (10 mm)
* Features → Flatted shaft
* Size/dimension → Round – 1.100″ dia (28.00 mm)
* Mounting hole spacing → Flatted Shaft
* Gear reduction → 1/64
* Step angle → Half step mode (recommended): 0.0879°
* Full step mode → 0.176°
* Steps per revolution :
* Half step mode → 4096
* Full step mode → 2048
* Termination style → Wire leads with connector
* Motor type → Permanent Magnet Gear Motor
* Number of phases → 4
=== NOTES ===
Manufacturers usually specify that the motors have a 64:1 gear reduction. Some members of the Arduino Forums noticed that this wasn’t correct and so they took some motors apart to check the actual gear ratio. They determined that the exact gear ratio is in fact 63.68395:1, which results in approximately 4076 steps per full revolution (in half step mode).
I am not sure if all manufacturers use the exact same gearbox, but you can just adjust the steps per revolution in the code, to match your model.
The Adafruit Industries Small Reduction Stepper Motor uses the same form factor as the 28BYJ-48, but does have a different gear ratio. It has a roughly 1/16 reduction gear set, which results in 513 steps per revolution (in full-step mode). You can download the datasheet for it here.
==== DRIVER BOARD ====
The famous ULN2003 driver board.
{{:projets:antennes:robotized_mag_loop:uln2003_driver_board.jpg?direct&200|}}
{{:projets:antennes:robotized_mag_loop:uln2003-stepper-motor-driver-pinout.png?direct|}}
=== ULN2003 DATASHEET ===
{{ :projets:antennes:robotized_mag_loop:uln2003-datasheet.pdf |}}
{{:projets:antennes:robotized_mag_loop:uln2003-datasheet-pinout-circuit-diagram-proteus-simulation.png?direct&400|}}
=== ULN2003 DRIVER BOARD DATASHEET ===
{{ :projets:antennes:robotized_mag_loop:uln2003-stepper-motor-driver-pcb.pdf |}}
===== STEPPER CONTROL SCHEMATICS =====
{{:projets:antennes:robotized_mag_loop:28byj-48-stepper-motor-uln2003-driver-wiring-diagram-schematic-pinout-1024x482.jpg?direct&600|}}
==== POSITION READING ====
We are using a 250k potentiometer to read the position of the stepper-motor / variable capacitor. We must avoid to go below the 0 position of the variable capacitor (fully open, minimum capacitance) and avoid to go over the 100% position of the variable capacitor (fully closed, maximum capacitance).
{{:projets:antennes:robotized_mag_loop:arduino_potentiometer_reading_01.png?direct&600|}}
{{:projets:antennes:robotized_mag_loop:arduino_potentiometer_reading_02.png?direct&600|}}
/* Analog Read to LED
* ------------------
*
* turns on and off a light emitting diode(LED) connected to digital
* pin 13. The amount of time the LED will be on and off depends on
* the value obtained by analogRead(). In the easiest case we connect
* a potentiometer to analog pin 2.
*
* Created 1 December 2005
* copyleft 2005 DojoDave
* http://arduino.berlios.de
*
*/
int potPin = 2; // select the input pin for the potentiometer
int ledPin = 13; // select the pin for the LED
int val = 0; // variable to store the value coming from the sensor
void setup() {
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT
}
void loop() {
val = analogRead(potPin); // read the value from the sensor
digitalWrite(ledPin, HIGH); // turn the ledPin on
delay(val); // stop the program for some time
digitalWrite(ledPin, LOW); // turn the ledPin off
delay(val); // stop the program for some time
}
===== CODE =====
==== LIBS ====
* https://github.com/Mohamad1994HD/28BYJ48
==== ARDUINO STEPPER EXAMPLES ====
/* Example sketch to control a 28BYJ-48 stepper motor with ULN2003 driver board and Arduino UNO. More info: https://www.makerguides.com */
// Include the Arduino Stepper.h library:
#include
// Define number of steps per rotation:
const int stepsPerRevolution = 2048;
// Wiring:
// Pin 8 to IN1 on the ULN2003 driver
// Pin 9 to IN2 on the ULN2003 driver
// Pin 10 to IN3 on the ULN2003 driver
// Pin 11 to IN4 on the ULN2003 driver
// Create stepper object called 'myStepper', note the pin order:
Stepper myStepper = Stepper(stepsPerRevolution, 8, 10, 9, 11);
void setup() {
// Set the speed to 5 rpm:
myStepper.setSpeed(5);
// Begin Serial communication at a baud rate of 9600:
Serial.begin(9600);
}
void loop() {
// Step one revolution in one direction:
Serial.println("clockwise");
myStepper.step(stepsPerRevolution);
delay(500);
// Step one revolution in the other direction:
Serial.println("counterclockwise");
myStepper.step(-stepsPerRevolution);
delay(500);
}
----
//Includes the Arduino Stepper Library
#include
// Defines the number of steps per rotation
const int stepsPerRevolution = 2038;
// Creates an instance of stepper class
// Pins entered in sequence IN1-IN3-IN2-IN4 for proper step sequence
Stepper myStepper = Stepper(stepsPerRevolution, 8, 10, 9, 11);
void setup() {
// Nothing to do (Stepper Library sets pins as outputs)
}
void loop() {
// Rotate CW slowly
myStepper.setSpeed(100);
myStepper.step(stepsPerRevolution);
delay(1000);
// Rotate CCW quickly
myStepper.setSpeed(700);
myStepper.step(-stepsPerRevolution);
delay(1000);
}