Community
cancel
Showing results for 
Search instead for 
Did you mean: 
TKirv1
New Contributor II
2,092 Views

flight controller, Edison pwm

Jump to solution

Wondering if anyone has built a flight controller using the Edison and an IMU. Just a simple little flight controller with some # includes, that gets IMU data and drives the 4 pwm lines. I am trying and this is the part that isn't working:

mraa::Pwm* pwm1

pwm1 = new mraa::Pwm(20);

pwm1->enable(true);

int freq = 50; // Hz

int per = 1000000/freq; // microseconds

int pulse = 1400 // microseconds

pwm1->period_us(per);

pwm1->pulsewidth(pulse);

produces the correct signal, only it isn't recognized by the ESC (the 1.8v pwm output is level shifted to 5v). Meanwhile the same signal from an Arduino Uno IS recognized by the ESC. I am wondering if the low or high voltage level of the PWM signal from the Edison is slightly different from that of the Arduino, (maybe as a result of the level shift?) enough so that it isn't recognized.

Are there any sort of pulldown or pull up resistors on the pwm lines, or any other gpio settings, that could effect the low or high voltage level of the pwm signal?

I greatly appreciate any advice or direction anyone has for me! Thanks,

Thomas

0 Kudos
1 Solution
TKirv1
New Contributor II
80 Views

I may have found the problem: It seems the Edison is only putting out 5-10 milliAmps on the pwm lines, while the signal generator and arduino are outputting 50+ milliAmps. As of now this is the only difference I have found between the signals and despite what I've learned about ESC's (that they only care about duty cycle and period) I think that the current must also matter since the Edison PWM is not detected, presumably because it outputs only about 1/10 the amount of current of the other sources, which were both successful in influencing the ESC.

CONCLUSION - ESC's need at certain amount of input current.

View solution in original post

10 Replies
idata
Community Manager
80 Views

I managed to control my escs with edison pwm using a higher frequency of 1khz instead of the standard 50hz ppm. I only checked it on BLheli but it might work on others.

TKirv1
New Contributor II
80 Views

Interesting.. I will try that, thanks!

TKirv1
New Contributor II
80 Views

Piotrek were you not able to get the motors spinning with ant other frequency?

idata
Community Manager
80 Views

At first I tried to control the motors using the 50 Hz PPM signal, however I quickly discovered that the 8 bit resolution of Edison PWM generator is way too low to keep the quadcopter stable (it gives you like 13 steps from 0% to 100%) so I found in the BLHeli esc documentation that it also supports 1khz, 2, 4, 8 and 12khz true PWM input. However I'm pretty sure that if you can't even get your motors to spin the problems is with something else, but I'm using arduino board so I don't have much experience with all those pullups and shifters.

TKirv1
New Contributor II
80 Views

Ok cool, I am using what eBay says are Emax 12A ESC's w/simonk. They seem to accept any frequency between 10-1000 hz, if it comes from an arduino. Also made the same pwm signal with a signal generator, and it accepts that too, even if the amplitude is less than 5v (went down to about 3v and the ESC still registered it). The Edison pwm signal however is not accepted, and I am baffled as to why not.

With the signal generator I even biased the entire signal so that the ground level was +- 1 volt and the ESC STILL accepted that. It seems to be very adamant about not accepting the Edison signal for god knows why.

TKirv1
New Contributor II
80 Views

To be clear the problem is not the PWM resolution at this point (though that may be a problem further down the road). The problem is that the Edison pwm signal is not Accepted by the ESC's at all, and it simply doesn't make any sense. Heres why:

- An oscilloscope shows that the Edison and Arduino pwm signals are pretty much identical.

- A signal generator has shown that the ESC's will accept pretty much any variation of the pwm signal, whether its biased (DC offset of 1v) above or below ground voltage level, also accepts signal lower than 5v which also may be biased above or below ground voltage. In short the ESC's are remarkably permissive regarding signal input.

- Somehow, for some ridiculously obscure reason, the ESC doesn't register the Edison signal, though it is much better than the worst signals that were accepted from the signal generator.

idata
Community Manager
80 Views

Is the code above all you do? You missing the arming sequence

TKirv1
New Contributor II
80 Views

I don't think these ESC's really require an arming sequence, they respond whenever I give them a pwm signal with any period between 10-1000hz and duty cycle between 1-2 ms, just not when it comes from the Edison. I have also tried giving them an arming sequence from the Edison: a high duty cycle (2ms) followed by a low (1ms) but no response.

TKirv1
New Contributor II
81 Views

I may have found the problem: It seems the Edison is only putting out 5-10 milliAmps on the pwm lines, while the signal generator and arduino are outputting 50+ milliAmps. As of now this is the only difference I have found between the signals and despite what I've learned about ESC's (that they only care about duty cycle and period) I think that the current must also matter since the Edison PWM is not detected, presumably because it outputs only about 1/10 the amount of current of the other sources, which were both successful in influencing the ESC.

CONCLUSION - ESC's need at certain amount of input current.

View solution in original post

idata
Community Manager
80 Views

Hi Thomas,

 

 

That's a great analysis, good job. Looks like you need an external circuit to increase the current, in your case I recommend you to use an external PWM controller to implement your flight controller.

 

 

Thank you for remaining so positive.

 

 

Regards,

 

-Leonardo

 

Reply