Arduino+Brushless Motor Problem

iwonder
Admin Emeritus
Admin Emeritus
Posts: 1115
Joined: May 10th, 2011, 8:25 pm
Division: Grad
State: TX
Has thanked: 0
Been thanked: 1 time

Re: Arduino+Brushless Motor Problem

Post by iwonder »

If it only happens with a load on the motor then it really sounds like an ESC issue.

It's a long shot, you could also try a few things. First, make sure all your motor wires are well away from the arduino/control wires, second, try putting a large (3.3kOhm or something) resistor between the servo pin on the arduino and ground, lastly if you can try a 0.1uF-1uF capacitor in it's place as well... Maybe one of those will help.

Oh and go back to the servo.h code :P the noInterupts() and delays seem like they're going to cause more headaches than they solve.

(now that I think about it, the capacitor is much more important than the resistor)
'If you're the smartest person in the room, you're in the wrong room' - Unknown
User avatar
Bazinga+
Exalted Member
Exalted Member
Posts: 383
Joined: March 8th, 2014, 7:10 am
Division: C
State: NY
Has thanked: 0
Been thanked: 0

Re: Arduino+Brushless Motor Problem

Post by Bazinga+ »

windu34 wrote:
Bazinga+ wrote:
windu34 wrote: How did you implement your code to gradually change your speed?
Something like this
for(Pulse=1500;Pulse<1800;Pulse+=){
noInterrupts();
digitalWrite(HIGH);
delayMicroseconds(Pulse);
digitalWrite(LOW);
interrupts();
delay(20-(Pulse/1000));
}
(basically the same as servo.write)
When I tested this the encoder was missing a ton of counts because it wasn't counting from noInterrupts to interrupts, so ideally I wouldn't want to go through this loop 300 times. Would it still work well (as in not glitch out) if I went up in increments of 10 or even 50?
That's gonn abe something you will have to experiment with. Why don't you just use the servo.h commands? worked fine for me. I don't quite understand what you are sending to the servo in this scenario because there is no writeMicroseconds() present
The reason for not using servo.h is because servo.h does not include no interrupts in the code. This means that when it send the speed the delay between high and low is longer. It's pretty interesting actually since as you spin the encoder the motor turns faster even when I set it to a constant speed. I'm pretty sure servo.h doesn't have no interrupts in it and I don't want the interrupts to screw with the signal. Also in case you don't know, writemMicroseconds() is practically exactly the same thing except without noInterrupts(I am sending signals through dogitalWrite() ).
Innovation =/= success
Bob_117
Member
Member
Posts: 16
Joined: December 3rd, 2015, 4:24 am
Division: C
State: TN
Has thanked: 0
Been thanked: 0

Re: Arduino+Brushless Motor Problem

Post by Bob_117 »

Did you calibrate the esc and have you tried using interrupts for the encoder and just using servo.write() with a while loop in the main loop, like this:
while(count < targetDist)
{
servo.write(what ever speed you want)
}
There is nothing like the last minute rush to get your cheatsheets organized the night before the big day :D

"I don't believe in luck, I believe in skill or the lack thereof." - Me
User avatar
Bazinga+
Exalted Member
Exalted Member
Posts: 383
Joined: March 8th, 2014, 7:10 am
Division: C
State: NY
Has thanked: 0
Been thanked: 0

Re: Arduino+Brushless Motor Problem

Post by Bazinga+ »

Bob_117 wrote:Did you calibrate the esc and have you tried using interrupts for the encoder and just using servo.write() with a while loop in the main loop, like this:
while(count < targetDist)
{
servo.write(what ever speed you want)
}
Yes I calibrated it. I've already figured out the problem and it should be fixed.
Innovation =/= success
turb0lag
Member
Member
Posts: 7
Joined: January 22nd, 2016, 11:00 am
Has thanked: 0
Been thanked: 0

Re: Arduino+Brushless Motor Problem

Post by turb0lag »

Bazinga+ wrote:
Bob_117 wrote:Did you calibrate the esc and have you tried using interrupts for the encoder and just using servo.write() with a while loop in the main loop, like this:
while(count < targetDist)
{
servo.write(what ever speed you want)
}
Yes I calibrated it. I've already figured out the problem and it should be fixed.
Sorry to bring up an old topic, but I also seem to be having a similar issue with my brushed motor and ESC. It seems as if when the vehicle is placed under load the motor pulses in a loop. But when I lift the vehicle in the air to simulate no load, the vehicle functions properly. I have tried to eliminate excess load by eliminating the four wheel drive function, but the issue still exists. Would you mind explaining how you were able to solve this issue? I am using the Servo.h library along with delays in my code. Thanks in advance!
unwoundmouse
Member
Member
Posts: 8
Joined: May 27th, 2016, 6:23 am
Has thanked: 0
Been thanked: 0

Re: Arduino+Brushless Motor Problem

Post by unwoundmouse »

seem to be having a similar issue with my brushed motor and ESC
Brushed motor or brushless?
turb0lag
Member
Member
Posts: 7
Joined: January 22nd, 2016, 11:00 am
Has thanked: 0
Been thanked: 0

Re: Arduino+Brushless Motor Problem

Post by turb0lag »

It is brushed. Is it possible that I am triggering my ESC's low voltage mode as my battery may have a low discharge capacity and is not up to the task of running the motor at full throttle?
unwoundmouse
Member
Member
Posts: 8
Joined: May 27th, 2016, 6:23 am
Has thanked: 0
Been thanked: 0

Re: Arduino+Brushless Motor Problem

Post by unwoundmouse »

Do you have more information? eg what motor esc battery are you using, what is the weight of the vehicle, etc
turb0lag
Member
Member
Posts: 7
Joined: January 22nd, 2016, 11:00 am
Has thanked: 0
Been thanked: 0

Re: Arduino+Brushless Motor Problem

Post by turb0lag »

unwoundmouse wrote:Do you have more information? eg what motor esc battery are you using, what is the weight of the vehicle, etc
Yes, I should have posted that to begin with. The motor is a Traxxas Titan 12T 550 size and the ESC is a Hobbywing Quicrun 1060. The battery is a Tenergy 7.2 Volt NiMH 6 Cell. I think I may be having brownouts with the Arduino as more load is placed on the vehicle. This would cause the Arduino to reset and re-run the program. I am going to try and power the Arduino seperately and see if that can solve my issue. Do you have any other suggestions?

Thanks for the help and replies during the Summer!
unwoundmouse
Member
Member
Posts: 8
Joined: May 27th, 2016, 6:23 am
Has thanked: 0
Been thanked: 0

Re: Arduino+Brushless Motor Problem

Post by unwoundmouse »

Based on the symptoms you're currently having, I would place my bets on a voltage drop as well. I assume currently you're powering the Arduino with the ESC's built in BEC?
Locked

Return to “Electric Vehicle C”

Who is online

Users browsing this forum: No registered users and 2 guests