Motor control over Wifi

Yesterday, I used Marc’s UART server to connect the ESP32 to the Olimex E407 devboard which we use to test our bottom PCB code. 

After a few adjustments, it works and we are know able to turn on the motor and choose its speed by sending a speed target from a computer to the bottom ESP32, which transmit it to the dev board over UART, which translate it in DShot frames and transmit it to the ESC.

As the majority of the bottom PCB code is written and functional under ChibiOS, we will of course keep this OS for this PCB and use FreeRTOS only on the main board.… Read more

PID tuning

As explained in the last article on PID control, the aim of the PID regulator is to compute a correction according to the error (the difference between the target speed and the actual speed), its integral and derivative, and 3 chosen coefficients : KP (for proportional correction), KD (for derivative correction) and KI (for integral correction). This week, Xavier and I made some corrections on the software (presented in this article) and choose the coefficients.

Tuning KP

This coefficient was the easiest to choose by following the steps indicated in this article

We took the smallest KP for which the system oscillates (called critical KP) and multiplied it by ⅔.… Read more

Speed control from every angle

Since our previous post last Thursday, Sibille and I have kept working on speed control. It has taken us much longer than we originally thought, but we’re happy with the result. Now that we have a working product, we’ll go back over what all went into making it work:

As mentioned previously we use a Proportional, Integral, Derivative (PID) control scheme to regulate the throttle command given to our ESC so that the motor speed matches the desired speed.

Speed feedback and speed format

If you’ll recall, Vlaya had previously written code to capture the edges of a once-a-rotation interruption (the “period interruption”) from a Hall sensor or an optical sensor and deduce the elapsed time during the rotation, and from there the speed.… Read more

PID control

This past few days, Xavier and I worked on the PID for motor speed control. We haven’t quite finished debugging our code, but here is an update of what we are working on.

A few words about PID controller

Our PID (Proportional, Integral, Derivative) controller is a control loop algorithm using the speed feedback from the optical sensor or the hall sensor to control the motor speed.

The code continuously calculates the error, i.e. the difference between the target speed (the speed at which we want the motor to turn) and the measured speed, its integral, and its derivative. It applies a correction to the command send by the ESC to the motor.… Read more

Time and material

LED-driving software

Today, Xavier and I continued to work on the software for the LED-driving processors. We have obtained fairly satisfying results 🙂 

First, we managed to fix the bug explained here for TIM1. 

We had just forgot to set one bit (MOE bit) in the configuration : TIM1 is an “advanced timer” and this bit is mandatory to enable the outputs. As for TIM9, it is actually not available on the dev board we use. But it is a “general purpose timer”, so we won’t hopefully have any trouble with it.

Then, with the help of Vlaya, we use her SPI generation code to test our SPI reception.… Read more

Tuning up

Motor update

Since yesterday, Sibille and I have worked on reducing the voltage threshold for motor acceleration we’ve mentioned here

After a meeting with Alexis yesterday and with the school mechanic this morning, we have two main leads.

Reflashing BLHeli ESC

The first lead is to take a look and the programmable  parameters of the ESC. We previously hadn’t given this much thought, but ESCs usually allow for the tweaking of several parameters in how they control the motor. Usually there’s a way to access these settings by playing with the PWM throttle input and using the feedback bips to identify various menus.… Read more

Speedometer

As explained in this post, Xavier and I worked on a setup to measure the motor speed. We had to laser-print a drilled plastic plate and some fixation for the dev-board with the optical sensor we’ve borrowed from LitSpin (TCUT1600X01). 

Setup

The plastic disk is thin enough to slide between the emitter and the receptors of the optical sensor, and has a small aperture on the edge so that once per rotation the receptors see the emitter and their output goes high.

The optical sensor, which we thought we damaged on Friday, actually works very well. We had some bugs when integrating the dshot code to control the motor’s speed, but very quickly we were able to measure the speed, and to determine the correspondence between a dshot command and an actual speed at a given voltage.… Read more

Mechanical issues and motor troubles

The root of the problem

Yesterday Sibille and I brought the Phyllo structure with the faulty motor (see this post) to the school mechanic, Mr Croullebois. We disassembled the structure, and it turns out the motor shaft goes slightly lower than the motor base, so when we screwed it tight it would scrape against the aluminum plate underneath. 

Mr Croullebois bored a depression in the middle of the plate so we wouldn’t have this problem anymore, and then we reassembled everything with the other motor that we used for tests and knew to be working. The motor that was in the structure spins more freely now, and we managed to make it run, but there is a weird creaking sound from time to time.… Read more

False start

Today Xavier and I soldered an ESC to the motor in the Phyllo structure (in truth, after struggling for a long time, we asked Karim Ben Kalaia to show us the way). We just wanted to see the power consumption of the motor while bearing a load, and set up a better configuration for the speed feedback.

Sadly, when we tried to turn on the motor, it didn’t work, creaking and hiccuping for a few moments and then stopping. We noticed that it was really difficult to turn with the hand comparing to the other motors we have. We removed all the load (the PVC plate and the axis) so that the motor can turn freely, but we got the same result.… Read more

Good vibrations

Today Xavier and I prepared the setup for the integration of the speed feedback module and the Dshot sender, and the test of the hall sensor :

There is a circular magnet lended to us by Touch at the end of the screw. It generate a magnetic fields in a radial direction, which will therefore point towards the breadboard. It is pretty powerful so we hope it won’t constantly trigger the hall sensor.

The hall sensor we will be using is the TLE4964-4M. It is a pretty basic hall sensor with three pins (VCC, ground and output), which outputs a low value when the magnetic field exceeds B_OP , and goes back to a high value when the field drops below B_RP .… Read more