One ESP32 to rule them all

Today, Marc and I started to work on the common time reference shared between Phyllos. 

As you may recall, we need this common time reference to be able to play synchronized animations with several Phyllos. Here is a gif to visualize an example of synchronized animation :

Master election

As explained in this post, we know since a long time that it is possible to transmit precisely enough a time reference with UDP. But we still have to choose one ESP32 to be the master ESP32 and to enforce its time reference to all other ESP32, and by extension all other Phyllos.… Read more

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

From ChibiOS to FreeRTOS

While Marc and Xavier are stuck in a tedious FH class, Vlaya and I have decided to work on the SD card. Our goal is to upload animations to the SD card (the same animations on each Phyllo). The Phyllos agree thanks to a discussion over Wifi on an animation identifiant and to start the animation at a chosen time (as you may remember, the Phyllos have a common time reference). Then each Phyllo will search the SD card for the desired animation and send it to the LEDs.

We started to read ChibiOS and STM32H7 documentation about SD card and SDC Driver, but soon, we discovered that on the last ChibiOS stable version (19.1.3)… 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

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

Live wire

Yesterday evening, the whole groupe work together to test the power transmission through the ball bearings. Those tests are significant to determine if we need to add a 5V-regulator on the main board, and which regulator we choose for the bottom PCB  to account for the tension drop.

Electrical setup

We had ordered the resistors (two 0.5Ohms/25W resistors and one 0.1Ohm, 30W)  described in this article and used them to build the following electrical setup:

The generator supplies 5V because we plan to use a 5V regulator on the bottom PCB and send 5V to the main board through the ball bearings. … 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

Flower power

Blooming Phyllo 

This morning, Vlaya, Xavier and I carefully made a paper template for where to bore holes in the PCV disc to attach the Phyllo shell. Vlaya had previously finished placing threaded inserts on a 3D-printed sculpture. We then went to the school mechanic, Mr Croullebois, to bore the holes and attach the sculpture. 

The threaded inserts we used have a screw thread diameter of 3.5, which it turns out is not standard in France. Thankfully, the school go-to guy for electronics, Karim Ben-Kalaia, who by luck was visiting Mr Croullebois at that time, offered to take a look in his own workshop and promptly returned with a handful of suitable screws 🙂 

Without further ado, here’s what it look like : 

Just a quick note : the motor currently in the fixed base has been damaged during our tests and makes a pretty annoying creaking noise while turning.… 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

RTFM !

Yesterday, Xavier and I went through the STM32F207 documentation to finish preparing the code for the LED-driving processors. As we explained on Thursday, we would like to go bare-metal on this one.

Reminder of the SPI protocol

As Vlaya already explained, the LED configurations are 16-bits frames (8 address bits and 8 data bits)  send by the main board on a SPI bus. By looking at the firsts bits of the frame, the processor determines whether the following 8 bits configuration concerns it (configuration for one of its LEDs or “TOP” to turn on the LEDs) or not. 

  • If so, it retrieves the following 8 bits on the SPI bus and uses it to configure one of its LEDs or start the flash. 
Read more