Robots! Who doesn’t like robots… I’ve never to day done any projects in robots now while I find them cool, the reasoning for which is they’re generally pretty expensive. Therefore, I’ve decided to try and design the smallest most functional micro robot that I can. One of my main aims was to be able to build the entire robot for <£10 which of course means efficient choice on motors, packaging and all associated parts.
The main platform for the robot is going to be the hardest design. This platform is what will support all of the peripherals – the RF transceiver, front facing proximity sensor, SwarmSense (what I’m calling my protocol of spatial locating of each fellow swarm bot), along with the battery and motors.
For ease of PCB design and control, I’ve decided to use continuous servos for the drive mechanism. This abstracts all of the gearing along with motor controller and motor control protocol as the servo control protocol is well established and seems to work well, not forgetting I’ve driven servos with an STM32 microcontroller before!
…Which leads to the next part: My robot “brain” is going to be an STM32F030K6 microcontroller. As any reader of this blog knows, I will try and throw an STM32 microcontroller in anything, even including guitar pedals! I’ve chosen this microcontroller because of its cheap price (£0.842 each in packs of 10 – RS 8/4/16), along with having ample power to do some simple robotics and signal processing featuring a 48MHz ARM Cortex M0 core with 32kB of flash and 4kB of SRAM. The job of this microcontroller will be to calculation the spatial locations of each fellow swarmbot using my SwarmSense algorithm, producing the required signals to control the continuous servos and doing all required RF communication.
My RF transceiver of choice is the standard ol’ NRF24L01+. You can get pre made boards for this RF transceiver with all RF components already designed and assembled for £0.45/board (Aliexpress -8/4/16). I’ve used these boards before and they’re relatively simple along with being interfaced through SPI. They also feature multiple slave/master configurations with up to 6 communication channels (though 5 if the auto ack feature is used).
Finally, I’ll be using a standard TC1185 regulator for the 3V that the system runs off. The servos will get their power directly from the battery – a 10440 lithium battery that will be removable to negate the requirement for charging facilities on board.
I’ve sent off for the PCBs with PCBWay. I’ve used these guys quite a lot recently and they do a good job with a fast turnaround time and cheap prices! I decided to go for two different PCBs, one for the base and one for the Sense circuitry. This choice was mainly so I could elevate the SwarmSense PCB above the wheels and top layer circuitry.
As of yet, I’ve written a small library to control the servos (speed as a percentage between -100% to 100%, -100% is fully reverse, 100% is fully forward), along with one that executes the DSP required for the SwarmSense spatial location. I’ve not yet implemented the NRF24L01 RF library so that’s yet to come.
The SwarmSense implementation samples all 4 LEDs at a sample rate of 10kHz and has a software band pass filter for each one centered at 1kHz. The middle transmitter LED has a pulse frequency of 1kHz which matches the band pass filters. This band pass filtered signal then goes through a resettable software peak detector. During acquisition, the peak detector is set to 0, then the software waits for X acquisition cycles (X currently set to 50). Higher cycle acquisition times will increase the precision of the measurement as it will put less emphasis on the transient response of the software filters at the disadvantage of course of… higher acquisition times. With a acquisition time of 50, the latency from sampling to Angle is ~5ms. The SwarmSense protocol will have every robot sequentially enable its transmitter LED as the others acquire this data, therefore a full wave of acquisitions will take NumberOfRobots*AcquisitionCycles/10000 seconds. With 4 robots, this would be equivalent to 20ms. The SwarmSense implementation also includes the intensity received which is inversely proportional to the distance from the light source.