-
Notifications
You must be signed in to change notification settings - Fork 6
2‐3‐2024 ‐ DC Motor Testing
DC Motor was tested today and it proved to work.
We are using the following equipment:
- ESC
- DC Motor Brushless
- Arduino UNO
- DC Voltage Supply
The circuit was the following:
flowchart LR
uno[Arduino UNO]
dc[DC Power Supply]
m[Brushless DC Motor]
esc[ESC]
uno --> |A0 to ESC signal|esc
uno --> |5V to 5V|esc
uno --> |GND to GND|esc
dc --> |18v to ESC Vin|esc
dc--> |GND to esc GND|esc
esc --> m
In order to control the DC motor speed with an Arduino we had to implement our own basic PWM
. Even though an Arduino has PWM functionality already, the delay between pulses is apparently not enough for the motor to detect it as something between 0 and 5V, however with our own implementation we define what's the delay between a HIGH and the delay between a LOW and from there create an artificial PWM:
// Pin for PWM output
const int pwmPin = 9;
const int highDelay = 50;
const int lowDelay = 50;
void setup() {
// Set the PWM pin as an output
Serial.begin(9600);
pinMode(A0, OUTPUT);
}
bool iter = false;
void loop() {
// Output the PWM signal
int val = 255;
int del = highDelay;
if(iter) val = 0;
if(iter) del = lowDelay;
analogWrite(A0, val);
iter = !iter;
// Delay for demonstration purposes
delay(del); // Adjust as needed
}
VID_20240203_185131.1.mp4
From testing we realized the slowest the motor could run without significant vibrations due to our custom PWM
is a delay of 50ms for the HIGH and 50ms for the low. If you were to dramatically increase that ratio of DelayHigh:DelayLow
, like 500ms for delay HIGH and 1ms for delay Low then we could achieve back again max speed.