——
#DonLucElectronics #DonLuc #Robotics #MultiMotorControl #AdafruitMETROM0Express #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Multi-Motor Control
In order to synchronize the multi-motor system, a novel method for this system based on embedded control terminal. A controller of the strategy with the function of synchronous control is also completed. According to the requirements of this system, a distributed control structure which based on Hierarchical Approach is chosen. The hardware platform of this structure is composed of embedded control terminal motor could be driven independently. The experiment results verified that the multi-motor system is reliable, the control strategy is rational applied this multi-motor system has better dynamic response and higher reliability.
DL2305Mk01
1 x Adafruit METRO M0 Express
1 x ProtoScrewShield
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
2 x Pololu DRV8834 Low-Voltage Stepper Motor Driver Carrier
2 x Electrolytic Decoupling Capacitors – 100uF/25V
2 x Pololu Stepper Motor Bipolar, 2.8V, 1.7 A/Phase
2 x Pololu Universal Aluminum Mounting Hub for 5mm Shaft, M3 Holes
1 x SparkFun Solderable Breadboard – Large
1 x SparkFun Cerberus USB Cable
Adafruit METRO M0 Express
JH – Analog A0
JV – Analog A1
JS – Digital 2
DIR – Digital 7
SPR – Digital 8
DIL – Digital 9
SPL – Digital 10
LED – Digital 13
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2305Mk01p.ino
/* ***** Don Luc Electronics © *****
Software Version Information
Project #12: Robotics - Multi-Motor Control - Mk25
12-25
DL2305Mk01p.ino
1 x Adafruit METRO M0 Express
1 x ProtoScrewShield
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
2 x Pololu DRV8834 Low-Voltage Stepper Motor Driver Carrier
2 x Electrolytic Decoupling Capacitors - 100uF/25V
2 x Pololu Stepper Motor Bipolar, 2.8V, 1.7 A/Phase
2 x Pololu Universal Aluminum Mounting Hub for 5mm Shaft, M3 Holes
1 x SparkFun Solderable Breadboard - Large
1 x SparkFun Cerberus USB Cable
*/
// Include the Library Code
// Arduino
#include <Arduino.h>
// DRV8834 Stepper Motor Driver
#include <BasicStepperDriver.h>
#include <MultiDriver.h>
// DRV8834 Stepper Motor Driver
// Stepper motor steps per revolution.
// Most steppers are 200 steps or 1.8 degrees/step
#define MOTOR_STEPS 200
// Target RPM for X axis stepper motor
#define MOTOR_X_RPM 800
// Target RPM for Y axis stepper motor
#define MOTOR_Y_RPM 800
// Since microstepping is set externally,
// make sure this matches the selected mode
// If it doesn't, the motor will move at a
// different RPM than chosen
// 1=full step, 2=half step etc.
#define MICROSTEPS 1
// X Stepper motor
#define DIR_X 7
#define STEP_X 8
// Y Stepper motor
#define DIR_Y 9
#define STEP_Y 10
// BasicStepperDriver
BasicStepperDriver stepperX(MOTOR_STEPS, DIR_X, STEP_X);
BasicStepperDriver stepperY(MOTOR_STEPS, DIR_Y, STEP_Y);
// Pick one of the two controllers below
// each motor moves independently
MultiDriver controller(stepperX, stepperY);
// Joystick
#define JH A0
#define JV A1
#define JS 2
// Variable for reading the button
int JSState = 0;
// Adjusted Value
int adjustedValue = 0;
int adjustedValue2 = 0;
// LED Yellow
int iLED = 13;
// Software Version Information
String sver = "12-25";
void loop() {
// Button
isButton();
// Joystick
isThumbJoystick();
// Stepper
isStepper();
}
getButton.ino
// Button
// Button Setup
void isButtonSetup() {
// Make the button line an input
pinMode(JS, INPUT_PULLUP);
// Initialize digital pin iLED as an output
pinMode(iLED, OUTPUT);
}
// Button
void isButton(){
// Read the state of the button
JSState = digitalRead(JS);
// Check if the button is pressed.
// If it is, the JSState is HIGH:
if (JSState == HIGH) {
// Button
// Turn the LED on HIGH
digitalWrite(iLED, HIGH);
} else {
// Button
// Turn the LED on LOW
digitalWrite(iLED, LOW);
}
}
getStepper.ino
// Stepper
// isStepperSetup
void isStepperSetup() {
// Set stepper target motors RPM.
stepperX.begin(MOTOR_X_RPM, MICROSTEPS);
stepperY.begin(MOTOR_Y_RPM, MICROSTEPS);
}
// Stepper
void isStepper() {
// Stepper => Controller rotate
controller.rotate(adjustedValue, adjustedValue2);
}
getThumbJoystick.ino
// Thumb Joystick
void isThumbJoystick() {
// Joystick JH
// Horizontal
// Joystick Pot Values JH
int potValue = analogRead(JH);
int potValues = 0;
// Adjusted Value
potValues = map(potValue, 0, 1023, 1000, -1000);
if (potValues > 300) {
adjustedValue = potValues;
} else if (potValues < -300) {
adjustedValue = potValues;
} else {
adjustedValue = 0;
}
// Joystick JV
// Vertical
// Joystick Pot Values JV
int potValue2 = analogRead(JV);
int potValues2 = 0;
// Adjusted Value2
potValues2 = map(potValue2, 0, 1023, 1000, -1000);
if (potValues2 > 300) {
adjustedValue2 = potValues2;
} else if (potValues2 < -300) {
adjustedValue2 = potValues2;
} else {
adjustedValue2 = 0;
}
}
setup.ino
// Setup
void setup()
{
// Button Setup
isButtonSetup();
// DRV8834 Stepper Motor Driver
isStepperSetup();
}
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc


