Fun, Learning, Friendship and Mutual Respect START  HERE


Unregistered
Go Back   HeliFreak > R/C Electronics Support > R/C Related Electronics DIY


R/C Related Electronics DIY DIY R/C Electronics for tinkerers and the budget minded


Reply
 
LinkBack Thread Tools Display Modes
Old 03-13-2017, 10:38 AM   #1 (permalink)
Registered Users
 

Join Date: Feb 2017
Default Can Someone Help Me Understand The Output of My ESC?

I am trying to get an RPM reading from a 160A scorpion commander ESC and was wondering if anybody could help me out?

Pic:
https://images.amain.com/images/larg...60a-hv-esc.jpg

The ESC has a red, 3 pin connector that has pulse output, but as I understand, that doesn't give rpm. I know I could plug it in to something like the eagletree elogger, but i was wondering if I could, instead use an arduino or other microcontroller to calculate RPM?

Any thoughts/explanation would be greatly appreciated! I don't fully understand what's being outputted.

Thanks!
r3nrut is offline        Reply With Quote Quick reply to this message
Sponsored Links
Advertisement
 
Old 03-13-2017, 01:30 PM   #2 (permalink)
Registered Users
 
Posts: 1,780
 
My HF Map location
Join Date: Dec 2011
Default

The pulses the ESC would give out correspond to the rpm in a 2 pole configuration. So depending on the number of poles you actually have on the motor you would divide the number of poles by 2 and then divide the pulses per minute by the number. For example on 10 pole motor you would need to decide by 5.

Not sure about the eagle tree but it should be possible to configure it with the number of poles if it is designed to read brushless motor rpm from a phase sensor.

Definitely doable on an arduino too. Same principle applies.

Hope that helps.
__________________
A\ziz - Citizen 672
Minicopter Diabolo 700 Black, SAB Kraken 700, Kraken 580, Minicopter Diabolo 600, Minicopter Diabolo 550, Henseleit TDR Mark II, Henseleit TDR

Jeti DS24 / VControl Touch
aziz76 is online now        Reply With Quote Quick reply to this message
Old 03-13-2017, 01:32 PM   #3 (permalink)
Registered Users
 
Posts: 1,780
 
My HF Map location
Join Date: Dec 2011
Default

Oh and with regard to the three pin wire you refer to. The signal wire (yellow) would be the one that carries the RPM signal.
__________________
A\ziz - Citizen 672
Minicopter Diabolo 700 Black, SAB Kraken 700, Kraken 580, Minicopter Diabolo 600, Minicopter Diabolo 550, Henseleit TDR Mark II, Henseleit TDR

Jeti DS24 / VControl Touch
aziz76 is online now        Reply With Quote Quick reply to this message
Old 03-13-2017, 03:10 PM   #4 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Feb 2017
Default

Okay thanks! That's what I was thinking.

It is a 10 pole motor. I had the signal wire attached to an arduino, but could it be going to quickly for the arduino clock to handle?

I know my motor is spinning at ~1000RPM for the test and it seems to be capping out.
r3nrut is offline        Reply With Quote Quick reply to this message
Old 03-13-2017, 04:34 PM   #5 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Feb 2017
Default

Okay, thanks! That's what I was thinking.

I tried reading the pwm from the signal cable with an arduino and it kept capping out at a certain value. It's a 10 pole motor and was going about 1000RPM (reading from optical tach).

I can't remember what the value I was calculating was, but is it possible the arduino clock is too slow for something like this?
r3nrut is offline        Reply With Quote Quick reply to this message
Old 03-13-2017, 10:31 PM   #6 (permalink)
Registered Users
 
Posts: 1,780
 
My HF Map location
Join Date: Dec 2011
Default

I doubt that. At 1000 RPM you are getting 5000 pulses per minute or 83.3 Hz. Even at 20000 RPM you would still be at 1.66 KHz. You maye not be getting a clear signal. Maybe investigate using something like a pull-up resister. I'm no Arduino expert though.
__________________
A\ziz - Citizen 672
Minicopter Diabolo 700 Black, SAB Kraken 700, Kraken 580, Minicopter Diabolo 600, Minicopter Diabolo 550, Henseleit TDR Mark II, Henseleit TDR

Jeti DS24 / VControl Touch
aziz76 is online now        Reply With Quote Quick reply to this message
Old 03-14-2017, 04:50 PM   #7 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Feb 2017
Default

Okay. Thanks for the help! I'll post here if I get it working . Sorry for the double reply! Still getting used to the forum.
r3nrut is offline        Reply With Quote Quick reply to this message
Old 03-15-2017, 02:13 PM   #8 (permalink)
Registered Users
Thread Starter Thread Starter
 

Join Date: Feb 2017
Default

So I finally got it working and figured I'd put my code for it up for others' reference.

It's kind of a mess with the casting in the equation, but I tested it against the optical tach and it was spot on!

Attach the signal wire from the esc to the interrupt and the ground to arduino ground.

Code:
//this should be interrupt
volatile byte pulse;
float rpm;
unsigned long timeStamp;
unsigned long newTime;
//cycle count
unsigned int count;
//if there's a new timestamp
bool newTimeStamp;
//sample threshold. arbitrary
const unsigned int THRESH = 20;
//arbitrary. how many cycles before serial printing the rpm value
const float CYCLESTOPRINT = 10;
//poles in motor
const float POLES = 10.0;
//milliseconds in a minute
const float MILTOMIN = 60000.0;

//must be an interrupt pin
const unsigned int PININ = 3;

void setup(){
 pulse = 0;
 rpm = 0;
 timeStamp = 0;
 newTimeStamp = true;
 count = 0;
 Serial.begin(9600);
 attachInterrupt(digitalPinToInterrupt(PININ), revCount, FALLING);        //pin 2 is our interrupt
}

void loop(){
  //have THRESH samples been taken?
 if (newTimeStamp){    
    noInterrupts();//disable interrupt
    newTimeStamp = false;//toggle newTimeStamp back
    count++;//increment count so cycles can compare so we aren't printing every cycle
    //(pulse/5) / millis/60,000
    rpm = (((float)pulse) * 2.0/(((float)(newTime-timeStamp)/MILTOMIN) * POLES));//calc rpm
    //check and print
    if(count >= CYCLESTOPRINT){
      count = 0;
      Serial.println(rpm);
    }
    //reset pulse and timestamp
    pulse = 0;
    timeStamp = millis();
    interrupts();//reattach interrupt
  }
}

void revCount() {
  //update pulse
   pulse++;
   if (pulse >= THRESH) {
       newTime = millis();
       newTimeStamp = true; // flag to tell main code to read the value of timeStamp
  }
}
r3nrut is offline        Reply With Quote Quick reply to this message
Old 03-16-2017, 03:20 AM   #9 (permalink)
Registered Users
 
Posts: 1,780
 
My HF Map location
Join Date: Dec 2011
Default

Great job
__________________
A\ziz - Citizen 672
Minicopter Diabolo 700 Black, SAB Kraken 700, Kraken 580, Minicopter Diabolo 600, Minicopter Diabolo 550, Henseleit TDR Mark II, Henseleit TDR

Jeti DS24 / VControl Touch
aziz76 is online now        Reply With Quote Quick reply to this message
Old 03-16-2017, 08:06 PM   #10 (permalink)
Registered Users
 

Join Date: Sep 2004
Default

Good job! Thanks for sharing!
Ace Dude is online now        Reply With Quote Quick reply to this message
Reply




Quick Reply
Message:
Options

Register Now

In order to be able to post messages on the HeliFreak forums, you must first register.
Please enter your desired user name, your REAL and WORKING email address and other required details in the form below.
User Name:
Password
Please enter a password for your user account. Note that passwords are case-sensitive.
Password:
Confirm Password:
Email Address
Please enter a valid email address for yourself. Use a real email address or you will not be granted access to the site. Thank you.
Email Address:
Location
Where do you live? ie: Country, State, City or General Geographic Location please.
Name and Lastname
Enter name and last name here. (This information is not shown to the general public. Optional)
Helicopter #1
Enter Helicopter #1 type and equipment.
Helicopter #2
Enter Helicopter #2 type and equipment.
Helicopter #3
Enter Helicopter #3 type and equipment.
Helicopter #4
Enter Helicopter #4 type and equipment.

Log-in


Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




Copyright © Website Acquisitions Inc. All rights reserved.
vBulletin Security provided by vBSecurity v2.2.2 (Pro) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.

SEO by vBSEO 3.6.1