Author Topic: Confused how to set up and control ESC motor on Arduino  (Read 3077 times)

0 Members and 4 Guests are viewing this topic.

Offline SeaofdepTopic starter

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
  • leaning as i go
Confused how to set up and control ESC motor on Arduino
« on: August 13, 2017, 08:08:14 pm »
(Arduino Duemilanove/v5 sensor board)

Hi, can you please help me with some Advice/Tips on Esc Brushless motor. A while back I found a pretty damaged Phantom v2 that I would like to rebuild when I acquire more experiemce. Meanwhile I would like to check(play)for functionality of the Esc motors(p1:1khz, p2:gnd, p3:motor control from flight controller 400hz p4:motor control from flight controller 400hz/..37%duty cycle=off, 47%=idle, 71%=full throttle ). Researching has left  me confused and not sure where to begin and would appreciate any advice sent my way.
Thank you
 

Offline SeaofdepTopic starter

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
  • leaning as i go
Re: Confused how to set up and control ESC motor on Arduino
« Reply #1 on: August 13, 2017, 08:49:15 pm »



Sent from my iPhone using Tapatalk
 

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 4531
  • Country: nz
Re: Confused how to set up and control ESC motor on Arduino
« Reply #2 on: August 13, 2017, 10:19:03 pm »
I never drove an ESC from An Arduino but I've done a few servos. It should be just the same.

On the ones I've tried they don't actually care about the duty cycle or exact frequency of the pulses, but about the length of the hi pulse: 1000 us = 50% or centralized. And based on your figures 37% -> 740 us equals off, 71% -> 1420 us -> full throttle.

Or, maybe as it says 400 Hz not 500 Hz then it's 592 us for off and 1136 us for full throttle. Would not take much experimentation to find out. It won't break.
 

Offline SeaofdepTopic starter

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
  • leaning as i go
Re: Confused how to set up and control ESC motor on Arduino
« Reply #3 on: August 13, 2017, 10:31:24 pm »
I never drove an ESC from An Arduino but I've done a few servos. It should be just the same.

On the ones I've tried they don't actually care about the duty cycle or exact frequency of the pulses, but about the length of the hi pulse: 1000 us = 50% or centralized. And based on your figures 37% -> 740 us equals off, 71% -> 1420 us -> full throttle.

Or, maybe as it says 400 Hz not 500 Hz then it's 592 us for off and 1136 us for full throttle. Would not take much experimentation to find out. It won't break.
There is 100s of different ways  and what pins to connect too on arduino. Tried a few but most I got out of it was a hiccup affect on the motor . Im not quite sure why the esc has the 4th pin when 3&4 seem to connect to each other on the main board ,Any chance you have a link of a guide I can follow. Thank you for helping out


Sent from my iPhone using Tapatalk
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Confused how to set up and control ESC motor on Arduino
« Reply #4 on: August 13, 2017, 10:45:02 pm »
Most ESCs emulate a standard R/C servo and there are several arduino servo libraries available that will drive ESCs.

Note that for safety reasons most ESCs require an initial signal sequence provided before they will turn on their output, one example might be to apply 100% servo signal (2 msec) for > 2 seconds, wait for ESC tone signal and then apply 0% signal (1 msec) and then ESC will follow any servo signal value from 0% to 100%. Without first performing this 'arming' procedure the ESC will appear to be dead.

 
 

Offline SeaofdepTopic starter

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
  • leaning as i go
Re: Confused how to set up and control ESC motor on Arduino
« Reply #5 on: August 13, 2017, 11:09:02 pm »
Most ESCs emulate a standard R/C servo and there are several arduino servo libraries available that will drive ESCs.

Note that for safety reasons most ESCs require an initial signal sequence provided before they will turn on their output, one example might be to apply 100% servo signal (2 msec) for > 2 seconds, wait for ESC tone signal and then apply 0% signal (1 msec) and then ESC will follow any servo signal value from 0% to 100%. Without first performing this 'arming' procedure the ESC will appear to be dead.

I got them to the on directly threw the motor but more of a twitch than anything else. 3/4 seem to be in good condition the 4th Esc was cracked off at the v gnd and control pins. Would it help and if possible connecting the 3 motors to the main board and connecting Arduino to the main? My knowledge on said subject is limited if none. But would be a nice project to rebuild/repurpose this sidewalk salvage..
  I will post pictures of the rest of the phamtom


Sent from my iPhone using Tapatalk
 

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 4531
  • Country: nz
Re: Confused how to set up and control ESC motor on Arduino
« Reply #6 on: August 13, 2017, 11:13:56 pm »
I never drove an ESC from An Arduino but I've done a few servos. It should be just the same.

On the ones I've tried they don't actually care about the duty cycle or exact frequency of the pulses, but about the length of the hi pulse: 1000 us = 50% or centralized. And based on your figures 37% -> 740 us equals off, 71% -> 1420 us -> full throttle.

Or, maybe as it says 400 Hz not 500 Hz then it's 592 us for off and 1136 us for full throttle. Would not take much experimentation to find out. It won't break.
There is 100s of different ways  and what pins to connect too on arduino. Tried a few but most I got out of it was a hiccup affect on the motor . Im not quite sure why the esc has the 4th pin when 3&4 seem to connect to each other on the main board ,Any chance you have a link of a guide I can follow. Thank you for helping out


Sent from my iPhone using Tapatalk

Ahhh .. are you not actually writing the program for the Arduino? You found the Arduino along with the rest of the thing?

In that case, there is no way at all to know what pins are correct. Whoever programmed it could have done anything at all.
 

Offline SeaofdepTopic starter

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
  • leaning as i go
Re: Confused how to set up and control ESC motor on Arduino
« Reply #7 on: August 13, 2017, 11:14:33 pm »



Sent from my iPhone using Tapatalk
 

Offline SeaofdepTopic starter

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
  • leaning as i go
Re: Confused how to set up and control ESC motor on Arduino
« Reply #8 on: August 13, 2017, 11:27:09 pm »
I never drove an ESC from An Arduino but I've done a few servos. It should be just the same.

On the ones I've tried they don't actually care about the duty cycle or exact frequency of the pulses, but about the length of the hi pulse: 1000 us = 50% or centralized. And based on your figures 37% -> 740 us equals off, 71% -> 1420 us -> full throttle.

Or, maybe as it says 400 Hz not 500 Hz then it's 592 us for off and 1136 us for full throttle. Would not take much experimentation to find out. It won't break.
There is 100s of different ways  and what pins to connect too on arduino. Tried a few but most I got out of it was a hiccup affect on the motor . Im not quite sure why the esc has the 4th pin when 3&4 seem to connect to each other on the main board ,Any chance you have a link of a guide I can follow. Thank you for helping out


Sent from my iPhone using Tapatalk

Ahhh .. are you not actually writing the program for the Arduino? You found the Arduino along with the rest of the thing?

In that case, there is no way at all to know what pins are correct. Whoever programmed it could have done anything at all.
Yea a side walk find . I have no experience at all with motors or drones at all. You really think there is no way at all, I'd like to think that any enthusiast that does their own programming wouldn't trash something of this quality allbbecause one damaged esc thusly I am thinking that the functionality is that of factory settings . But on the other hand I don't no much at all about this subject lol


Sent from my iPhone using Tapatalk
 

Offline tpowell1830

  • Frequent Contributor
  • **
  • Posts: 863
  • Country: us
  • Peacefully retired from industry, active in life
Re: Confused how to set up and control ESC motor on Arduino
« Reply #9 on: August 14, 2017, 12:13:20 am »
Great Scot! just did a 2 part video.



PEACE===>T
 

Offline SeaofdepTopic starter

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
  • leaning as i go
Re: Confused how to set up and control ESC motor on Arduino
« Reply #10 on: August 14, 2017, 12:41:38 am »
Great Scot! just did a 2 part video.




Now I understand why the motor appeared stuck and only had lla hiccup like movement, this project might be a bit advanced for where I'm at, but you only fail if you don't try .. I can't wait till I get a full on oscilloscope , have a dso138 that I won here which I have fun with. Thanks a lot. The amount of information and the way you explain is [emoji108][emoji106][emoji122] I'll def be subscribing

One question , every video and article I read uses three pin esc. And the Esc I have has 4 ( although research has led me to pin 3&4 connecting with one another at the main boare)


Sent from my iPhone using Tapatalk
 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 5454
  • Country: us
Re: Confused how to set up and control ESC motor on Arduino
« Reply #11 on: August 14, 2017, 03:10:07 am »
Looking at your pictures I would bet that your ESCs are actually a fairly standard configuration.  Three control wires.  There just isn't any real justification for Phantom or any of the other drone makers to not buy a standard design.  In your case one of the three standard wires is doubled for some reason.  The connector back to the main board is a four pin connector with only 3 pins populated.  My guess would be that the darker brown wire is ground, the adjacent wire is the PWM signal and the next one is + 5V.   You could do a little verification of this if you have retained the original battery leads for the Phantom.  Just measure continuity between the dark brown wire (when everything is plugged together) and the battery negative.

With this information and reading the Arduino documentation for the SERVO you should be able to get electrically hooked up.  Note that the motors might turn if powered just by the Arduino 5V, but they really need their own high current supply.  This is supplied by the wire on the corner opposite the signal connection.  Since they didn't use a standard color code you will have to find continuity to the ground to see which one is positive and which is negative.

As others have said before, most ESCs have a safety feature.  They won't turn on until a sequence of throttle commands is sent.  This helps prevent an unexpected spinning propeller when the battery is plugged in.  This feature has reduced but not eliminated the parade of gory pictures of people with hands, arms, stomachs or faces chewed up by a poor quality circular saw.

A typical sequence is to require a zero throttle position, followed by full throttle, followed by a return to zero throttle before arming and making the motor operate.  Usually once armed a few cycles of a sine wave is sent to the motor to make it beep warning you that it is armed and dangerous. 

Different makers use different interpretations of full throttle.  Some use max pulse width, others use minimum.  This combined with variations in the arming sequence mean that trial and error to find the right sequence will take a while.  Again, google for ESCs and read the manuals for a few to get some ideas for sequences to try.  You might try googling phrases like "Phantom motor arming" and the like to find specific directions, although on drones this is likely done in the control software and considered proprietary.
 

Offline SeaofdepTopic starter

  • Regular Contributor
  • *
  • Posts: 96
  • Country: us
  • leaning as i go
Re: Confused how to set up and control ESC motor on Arduino
« Reply #12 on: August 14, 2017, 11:36:20 am »
Looking at your pictures I would bet that your ESCs are actually a fairly standard configuration.  Three control wires.  There just isn't any real justification for Phantom or any of the other drone makers to not buy a standard design.  In your case one of the three standard wires is doubled for some reason.  The connector back to the main board is a four pin connector with only 3 pins populated.  My guess would be that the darker brown wire is ground, the adjacent wire is the PWM signal and the next one is + 5V.   You could do a little verification of this if you have retained the original battery leads for the Phantom.  Just measure continuity between the dark brown wire (when everything is plugged together) and the battery negative.

With this information and reading the Arduino documentation for the SERVO you should be able to get electrically hooked up.  Note that the motors might turn if powered just by the Arduino 5V, but they really need their own high current supply.  This is supplied by the wire on the corner opposite the signal connection.  Since they didn't use a standard color code you will have to find continuity to the ground to see which one is positive and which is negative.

As others have said before, most ESCs have a safety feature.  They won't turn on until a sequence of throttle commands is sent.  This helps prevent an unexpected spinning propeller when the battery is plugged in.  This feature has reduced but not eliminated the parade of gory pictures of people with hands, arms, stomachs or faces chewed up by a poor quality circular saw.

A typical sequence is to require a zero throttle position, followed by full throttle, followed by a return to zero throttle before arming and making the motor operate.  Usually once armed a few cycles of a sine wave is sent to the motor to make it beep warning you that it is armed and dangerous. 

Different makers use different interpretations of full throttle.  Some use max pulse width, others use minimum.  This combined with variations in the arming sequence mean that trial and error to find the right sequence will take a while.  Again, google for ESCs and read the manuals for a few to get some ideas for sequences to try.  You might try googling phrases like "Phantom motor arming" and the like to find specific directions, although on drones this is likely done in the control software and considered proprietary.
@Catalina....WOW thank you I appreciate you taking the time and writing out such a detailed and informative reply..

 Update : After utilizing everyone's advice and after many trials and errors, i started to make some progress. First after fooling with pin sequences and sketches, managed getting the binding red leds to start followed by the start up tone and green white leds. Lastly each nanometer after nano... of a turn on a potentiometer the motor began to throttle. I'd say max was just above idle and minimum speed was half below idle .

I'll post pics later today



Sent from my iPhone using Tapatalk
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf