A translational drift robot also known as a melty brain spins its entire mass. To control this spinning mass the robot must pulse the drive motors in phase with the robot’s rotation. This requires the robot to know its heading throughout each revolution. Almost all melty brains use an accelerometer to measure centrifugal force and infer rotational velocity. With good filtering and slight adjustments from the driver, the integral of this velocity can be used to maintain a steady heading. However, some melty brains implement IR beacons or more recently magnetometers to get an absolute heading. To keep Danger Donut simple, I decided to implement an accelerometer and IR beacon.
From research of other melty brains, I found 2500 RPM to be a decent target for the 150 gram weight class. For a bit of safety factor, I wanted the motors to theoretically be able to spin the bot at 5000 RPM. The accelerometer had to be placed at a radius of 3 cm to be properly supported. By mounting the accelerometer at 45 degrees, I can use two of the channels and increase the max acceleration by ~ 41%. Therefore, the accelerometer needs to measure up to:
\(a= r \omega^2 = \frac{1}{\sqrt{2}} \cdot 0.03 m \cdot (2500\frac{2\pi}{60})^2 = 1454 \frac{m} {s^2} = 148 g\)
I chose to use the ESP32S3 chip due to its high performance for short loop times and built-in Bluetooth capabilities for connecting with my controller. Additionally, the chip is inexpensive which reduces the cost of damaged parts.
These tiny brushless motors are plenty powerful for the small robot despite the high Kv value. I also was able to find them for insanely cheap at only $1.50 a piece.
I used these small 7A ESCs to drive the brushless motors. They are smaller and lighter than most other 7A ESCs and run BLHeli_s which I control using dshot300.
GNB batteries were recommended to me and they seem to perform well, although I do not trust the 80C discharge rating they advertise. For better packaging, I used two single cell batteries in series.
This is the primary sensor used to detect the rotational velocity of the melty brain. By measuring the centrifugal force, I can calculate the current rotational velocity. The 200G max acceleration is needed to reach the design required max rotational velocity.
For the IR beacon to work effectively, the sensor must be able to distinguish the beacon from surrounding sources of IR light. This sensor is only sensitive to IR light modulated at 38kHz and provides a simple output unlike most IR sensors used in TVs that have automatic gain adjustment or decoders.
These are the fastest individually addressable LEDs I could find. They support SPI up to 40MHz and have a PWM frequency of 26kHz, which prevents gaps when used in a persistence of vision display.
To do early testing of components and begin programming before I ordered custom PCBs, I created a prototype robot. It used a solderless breadboard glued to a 3D printed chassis. I used a ESP32S3 development board and wired up the motors, ESCs, IR sensor, and a LED heading light.
Although the prototype does not look the greatest, it allowed me to quickly make adjustments and quickly develop a proof of principle for the melty brain.
The main control PCB contains the microprocessor, accelerometer, IR sensor, LEDs, and power management. Following is the schematic for the main board.
From the 2S HV-LiPo, the robot gets approximately 6 to 8.7 volts. I used two LDOs to regulate and step down this voltage to a 3.3 and 5 volt rail. The 5V rail powers the LEDs while the 3.3V rail powers the microcontroller and sensors. Additionally, I added a voltage divider to monitor the battery voltage. To protect the microcontroller’s input, I added a zener diode.
I used a ESP32S3-WROOM-1-N16 daughter board with a built-in antenna for Bluetooth. I added reset and boot switches and decoupling capacitors to the 3.3 volt rail. I also added a USB-C port for programming including the 5.1k Ohm resistors to properly pull power and a diode to the LDO’s input.
I connected both sensors to the 3.3 volt rail with decoupling capacitors. Due to the higher data rate, I used the SPI interface of the ADXL375. I used a second SPI channel for the persistence of vision LEDs. The IR sensor simply used a digital GPIO.