Notifications
Clear all

Control Brushed 540 motor

10 Posts
4 Users
4 Likes
205 Views
(@robert1952)
Active Member
Joined: 4 months ago
Posts: 5
Topic starter  

Hi

I'm currently trying to control a 540 brushed motor via an ESP32.

I initially thought that a TB6612FNG or L298N driver would work.  But neither would turn the 540 motor (a small 9v motor works fine).  

So I purchased a 60A brushed ESC that is controlled via a servo plug.  From what I can find on the internet the ESC has to be armed before it will spin the motor.  I have tried various arming sketches using both Servo and ESC libraries but nothing seems to work.  When I power up the ESC a small led flashes slowly, but there are no sounds.  I've tried using a Arduino Uno as well as the ESP32.

The 540 works well when connected directly to the battery so I know it is not faulty.

Can the forum offer any suggestions?

 

Thanks

Robert


   
Quote
(@hzulu)
Eminent Member
Joined: 4 months ago
Posts: 16
 

@robert1952 Hi Robert, there are about a million and one possibilities why your project may not work. Can you supply a wiring diagram and the sketch you proofed not working. It would be much simpler to identify the culprit

Rule of Thumb in hardware/software engineering:
From the estimated time to complete a project you need:
5% for the engineering itself
95% securing everything against any strange idea users can have
and the remaining
150% for finding and fixing bugs that you thought never could happen


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 1 year ago
Posts: 1617
 

@robert1952,

Have to agree with @hzulu.  Can't tell you what is wrong with your setup, without seeing the setup... hardware and software.  

The brushed ESCs I've used didn't need arming.  I've used L298N and they work also.  Their efficiency is for crap, but they do work on two motors. 

I also note from your entro message that you want to use 2S LiPo.  Could it simply be that you're trying to drive a 9V motor with 7.4V?  Typically the idea with PWM type throttling is the supply voltage must be significantly larger than the voltage needed.  The PWM then takes 12 Volts and using time averaging supplies voltages between 0 and 12.  With 2S, you're only able to supply between 0 and 7.4V.  I'm not familiar with your motor either, so don't know what minimum voltage it requires to start up.

 

 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
Inst-Tech reacted
ReplyQuote
Inst-Tech
(@inst-tech)
Honorable Member
Joined: 2 years ago
Posts: 448
 

"The brushed ESCs I've used didn't need arming. I've used L298N and they work also. Their efficiency is for crap, but they do work on two motors.

I also note from your entro message that you want to use 2S LiPo. Could it simply be that you're trying to drive a 9V motor with 7.4V? Typically the idea with PWM type throttling is the supply voltage must be significantly larger than the voltage needed. The PWM then takes 12 Volts and using time averaging supplies voltages between 0 and 12. With 2S, you're only able to supply between 0 and 7.4V. I'm not familiar with your motor either, so don't know what minimum voltage it requires to start up."

@Inq, @robert1952,

Indeed, this is a valid question of what power source is required..Also, the current capability of the motor driver may be in question as the L298N has only 2A max current, and the 540 series brushed motors can have DCR ( locked rotor) amps of over 7.5 amps @ 7.4 V , with a unloaded running amps of 4 Amps for a 2t model. 

As @Robert1952 hasn't specified what specific motor model he has, it is just speculation of my part, why the L298N didn't work..I might suggest that he ( Robert) hook up the motor to the 2s battery pack and use a current meter to measure the current of the motor at no load to confirm what his motor spec. are.

I concur with what some previously have  already suggested that a schematic and code be made available. This will make trouble shooting much easier for those who wish to help..

Regards,

LouisR

 

LouisR


   
Inq reacted
ReplyQuote
(@robert1952)
Active Member
Joined: 4 months ago
Posts: 5
Topic starter  

Sorry for my omission.  Code is attached.  The motor is a standard brushed 540 for RC cars etc.  The ESC is a standard  60A

The wiring is simple.  Common earth for ESC, motor and Uno/ESP32.  Pin 9 to white connector on ESC.

The battery pack runs the 540 motor fine without the ESC or L298N attached, so I doubt its a voltage thing.

 

Thanks for your continued help

#include <Servo.h>

Servo motor;

void setup ()
{
motor.attach(9);
Serial.begin(9600);
int i = 0;

//Give some time before you start anything like switching on your ESC / Motor

Serial.print("Arming Test Starts in ");
for(i =10; i > 0; i--)
{
Serial.print(i);
Serial.print(".. ");
}

Serial.println();

// Watch for the tone when the ESC gets armed

for(i = 50; i < 130; i++)
{
motor.write(i);
Serial.println(i);
delay(500);
}
}

void loop()
{
}


   
ReplyQuote
Inst-Tech
(@inst-tech)
Honorable Member
Joined: 2 years ago
Posts: 448
 

@Robert1952,

After tying to find motor specs for the "standard 540", it appears that most recommend a 2S (7.4V - 8.4V) battery pack, and looking at the LiPo battery specs ..see chart: https://blog.ampow.com/lipo-battery-size-chart/ it appears that most of the 540 series motors have current requirements that exceed 10A.. This is why the Tn6612FNG with a max current of 1.2A, and the L298N with a max of 4A . max 2A per motor, will not work with that high current the motor requires..What you will most likely need is a motor driver like a Cytron ..

see link: https://www.cytron.io/c-motor-driver .. the clue was the ESR 60A.. Lets us know what no load current is when you just directly connect the motor to the battery pack. You must measure the current in series with one of the leads from the battery to the motor.. this will tell us how much current draw the motor consumes at no load.

Of course whis the motor loaded, the current will be much higher..so you'll have to know what the loaded Amps will be so you can pick the appropriate motor driver. Hope this helps you figure out what the problem is.

regards,

LouisR

LouisR


   
Inq reacted
ReplyQuote
(@robert1952)
Active Member
Joined: 4 months ago
Posts: 5
Topic starter  

Just a further note to my original post.  The 540 motor is designed for 7.4v not 12v.  As I stated initially I have abandoned the L298N in favour of the 60A ESC.  The L298N would get the motor to hum but not turn.  As far as I'm aware all RC ESCs require arming for safety reasons.  On an Arduino an ESC acts the same as a servo, though with different values.  My issue is finding the values to arm the ESC.  When it is armed the ESC will sound a tone.  The ESC will not respond to input until it is armed.  Someone out there must have developed a project to control a 540 60A ESC with an Arduino, or at least know how it is done.

For reference the above code is from helitus on the Arduino Forum

 

Thanks 

Robert


   
ReplyQuote
(@hzulu)
Eminent Member
Joined: 4 months ago
Posts: 16
 

@Robert1952 Provided you did not wire GND loops, which would kick the Arduino into an undefined state, as soon the motor draws some significant current...
Your sketch looks right, except the "count down" at start - there is a "delay(1000);" missing in the for loop. But this has nothing to do with your motor not working.
I did some investigation on other arduino sketches, using 60A brushed ESC's
This one: https://github.com/tungstenexe/Arduino-Control-Brushed-ESC/blob/master/ControlESC_Hobbywing.ino uses
motor.writeMicroseconds(throttle) library function, with "throttle" in the range of 1000 to 2000.
Maybe this is the clue why your motor does not do anything.

Rule of Thumb in hardware/software engineering:
From the estimated time to complete a project you need:
5% for the engineering itself
95% securing everything against any strange idea users can have
and the remaining
150% for finding and fixing bugs that you thought never could happen


   
ReplyQuote
Inq
 Inq
(@inq)
Noble Member
Joined: 1 year ago
Posts: 1617
 

@robert1952, I did the searches like @inst-tech and found that "540 motor" is a pretty broad description for both brushed and brushless motors of a wide range of sizes and current draws.  Most of the brushed... were way above the capacity of L298N.  Your 60A brushed ESC sounds like it would have plenty of capacity above almost any 540 I ran across, but an actual link to your motor and ESC would be helpful.  Neither are standard.  While at it... a wiring diagram or picture of your wiring rig would be helpful in case we can see a wiring issue.

Then I looked into the arming you described.  I see that procedures for different vendors/models of ESC are different.  I've dink'd around with a FlySky RC receiver integration with an ESP8266.  When the transmitter throttle is at zero (neutral) the servo is at 0°.  At full throttle the servo is at 180°.  I know for starting up the transmitter/receiver on my brushless motor ESC, I must have the throttle at zero.  This is for safety reasons so the motor doesn't just start the propeller without user input.  I'd assume a brushed ESC would have the same safety requirements.

Point being... your sketch does not do that.  The servo library defaults to having the servo at the middle position (aka 90°).  It then just moves it from 50° to 130°.  At no time do you have it set at 0°.  IOW you never get to zero throttle so it can arm.  You might simply need to do something like....  Note my additions to your code (Inq).

#include <Servo.h>

Servo motor;

void setup ()
{
motor.attach(9);
Serial.begin(9600);
int i = 0;

//Give some time before you start anything like switching on your ESC / Motor

Serial.print("Arming Test Starts in ");
for(i =10; i > 0; i--)
{
Serial.print(i);
Serial.print(".. ");
}

Serial.println();

// Watch for the tone when the ESC gets armed

// Inq - Set throttle to zero to arm
motor.write(0);      
delay(1000);

// Inq - If I'm write, it's armed and the following will run the motor.  Be aware!
for(i = 50; i < 130; i++)
{
motor.write(i);
Serial.println(i);
delay(500);
}

// Inq - In case I'm right, stop the motor (Don't leave at 130).
motor.write(0);

}

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
Inst-Tech reacted
ReplyQuote
(@hzulu)
Eminent Member
Joined: 4 months ago
Posts: 16
 

@Robert1952

For reference the above code is from helitus on the Arduino Forum

when I understand helitus' blog right - this code sample is used to find the spot where the controller arms (at around 90). This means it takes about 20 seconds ( (90-50)*500msec ) until the 60A ESC beeps or the led stops blinking - depending on the model or manufacturer.

Did you wait that time?

Rule of Thumb in hardware/software engineering:
From the estimated time to complete a project you need:
5% for the engineering itself
95% securing everything against any strange idea users can have
and the remaining
150% for finding and fixing bugs that you thought never could happen


   
ReplyQuote