I noticed that behavior before when trying to use a Servo. As you pointed, it's an issue with the Edison PWM generator. I'm afraid that there isn't a workaround for it, it's simply how it works. If you have a Logic Analyzer or Oscilloscope, check the PWM signal with the following code: Edison/setPWM_Edison.ino at master · MakersTeam/Edison · GitHub. It's an Arduino sketch that sets the frequency and duty cycle of the PWM signal. You will notice that there aren't changes in the signal at some frequency intervals.
My suggestion would be to use an external PWM controller to achieve the accuracy you need.
Diego, you never disappoint!
Thank you very much for your response.
I want to add that after reading around, it actually makes sense.
Apparently a part of it is due to the resolution of the PWM signal on the Edison.
This theory made a lot of sense to me, correct me if i am wrong but it appears that the Edison's resolution is 8-bit, allowing for 2^8 = 256 adjustments. Since the ESCs readings are in the range of 5-10% duty cycle this allows for 5% usable settings, which is about 13 adjustments (also 100%/256~=0.39%, so the Edison has steps of 0.39% and there is about 13 of those in a 5%), now with a little calibration i managed to increase those settings (by calibrating the ESC to read a minimum of 700 microseconds - it does not read anything under that- and a maximum of 2000 microseconds) up to a few more settings, but still, 15-16 settings is not enough to have a precise control over the motors. So i ordered an independent 12 bit resolution PWM generation shield allowing for 4096 steps (200+ are usable in the ESC range).
I will report back on how it goes in case anyone is interested!
Your analysis is correct. The only option would be using an external PWM controller.
I invite you to post your results after testing the external PWM generator.
This is a little update in-case anyone is looking for this kind of information.
I have acquired the PCA9685 and tested it with the Edison Arduino.
Turns out that it is true, the reason for the lack of control was the resolution of the PWM generators in the Arduino (8-bit)
The 12-bit PWM driver offered a lot finer control over the speed of the motors.
This is the setup i am using:
With the following library:
GitHub - adafruit/Adafruit-PWM-Servo-Driver-Library: Adafruit PWM Servo Driver Library
100% compatible with the Edison, no issues so far!
Yup, for those who may be interested I used the Sparkfun PWM block which is 12 bit with a frequency range from 24Hz to 1526Hz, so you should be able to use an ESC with fast PWM protocol like Oneshot125 using half of the period for the throttle signal. That's half of 12 bits, so half of 4096. The Sparkfun PWM board also uses the PCA9685 PWM controller over i2c. Had to learn how to use i2c, but its working now. I used the examples on sparkfun in c++ to write a program in python 2.7 to control a brushless motor with fine control at a high rate over i2c using this board. IF anyone reading this needs code let me know and I will post it somewhere.
Hi V1NO I was wondering how I would go about using this library in an arbitrary c++ script run from the command line of the intel Edison. I am using the miniBreakout board, and have a level shifter to interface with the hardware.