I am currently communicating with the blue ESC at 10-100 khz. The I2C data registers I read updates its values very slow. I think we are looking at a 1 sec refresh/sampling rate internally at the blue ESC. Is this correct or have I done something horribly wrong here…?
(also the pulse_count parameter is sort of useless when polling fast?)
The values measured with the onboard microcontroller’s ADC are read pretty slowly at 1 sample/sec. Those values are current, voltage, and temperature. The pulse_count is updated every cycle. It is less valuable when polling very quickly so we recommend polling at slower rate like 10 hz.
I should also note that right now the current sensor does not have a low-pass filter but the hall-effect measurement chip has very high bandwidth. Because of this, it measures transient changes in current and must be low passed in software to arrive at an accurate value. We’ll be adding a hardware low-pass filter to future versions of the ESC.
I hope that helps. Let me know if you have any other questions!
You list the refresh rate to be 50hz for the Servo Library and suggest 4hz in the i2c example. I would like to understand the limitations of the 4Hz. Is that low refresh due to reading data FROM the BlueESC, or is that also a limitation is writing to the BlueESC? Can I write to faster and read from slower to increase responsiveness of the ESC? Don’t think it is a major drawback either way, but I wanted to ask the questions just in case.
Side question: (I am sure i can test this myself… but just to ask… could I Write to the BlueESC using SERVO library, and read status using i2c at the same time?)
This is definitely an appropriate thread to ask on. Let me explain all of the rates.
50 Hz servo rate: This is the standard update rate for a servo signal. Both of our ESCs can handle much faster update rates up to around 400 Hz.
4 Hz I2C rate: This is the suggested rate for reading only. I would definitely suggest writing faster at 10-100 Hz. The reason for the slow rate is because the onboard sensors for voltage, current, and temperature don’t update very fast (around 1 Hz right now). Additionally, the RPM is sent as “pulses since the last request”, so that if you request very often, you’ll only get a couple pulses and the RPM measurement will be noisy. If you request a 4 Hz, there will be many pulses between requests and you’ll get an accurate RPM.
Just to be clear, you can read much faster if you want.
And yes! You can command via PWM but still read data from I2C. The PWM interface is prioritized over the I2C one so that if it is getting valid PWM signals it will listen to those.
I just got a T100 thruster with an integrated BlueESC to play with and I’m still trying to figure out the I2C communications. I’m wondering if you can confirm the behavior I’m seeing and any suggestions if I’m doing it wrong.
I’m using an Arduino UNO right now and combined your I2C and PWM (servo) examples from http://docs.bluerobotics.com/bluesc/. The I2C is hooked up on A4/A5 (green on A5) and the PWM on pin 9. I have a logic analyzer connected to all the signals. A variable power supply is powering the motor and I’m using the voltage sensing to determine if the ESC data is valid (changing the voltage 11-14V)). I re-flashed the ESC with the hex file as described on your documentation page. I have a couple different cases I’m testing:
I2C speed control and I2C data at 4Hz (default demo)
On reset (holding UNO reset, power cycling motor, releasing UNO reset) the voltage readings are updating at about 1 Hz as you mention above
After giving a speed command other than 0, it takes a few seconds before voltage readings will start updating again. The ESC is responding, but the data isn't being refreshed
PWM speed control at 50Hz with I2C data at 1Hz
I can control the motor, but no I2C data is returned. The logic analyzer is showing that the ESC doesn't ACK the write or read requests
I2C speed control at 50Hz with I2C data at 1Hz
I can control the motor, I2C data only updates while the motor is running. Again, ESC is responding but data isn't being refreshed
Thoughts, suggestions? I've attached my Arduino project where someone could run the test cases by changing the 'test_case' variable near the top. I'm shooting for the 20-50Hz mark for speed updates so the attitude controller can run more quickly. Ideally I'd like to go all I2C to save data lines and I'd really like the I2C data for diagnostics.
I’m going to test out your code and see if I can replicate this. This definitely doesn’t sounds normal. Everything you’re looking to do (50 Hz speed update + regular data updates) should be very doable.
I would recommend putting a oscilloscope on your communication wires and check from there with the timing, clock, bits and length etc. to see what is really going on there.
This should give a good pointer to where and what the issue is.
I don’t have an O-scope handy at home, only a Saleae logic8 analyzer. It doesn’t show the analog values, but the digital seems fine. I2C clock is nice and steady around 100kHz.
Two screenshots attached for case2 and case3. In case 2, the ESC is being controlled by PWM and isn’t returning any I2C data when probed. In case3, the ESC seems to be responding perfectly, except that the values it sends back for voltage don’t change when I adjust the power supply… Unless the motor is spinning, in which case the values update as expected.
data_output is the Arduino serial monitor for case3. I’m constantly adjusting the power supply voltage up and down. When the motor is running (after line with “1”), the voltage changes, but when the motor stops (after line with “0”) the voltage doesn’t update.