Software apps and online services
Hand tools and fabrication machines
The idea of having a large number of robots doing tasks in unison is nothing new, as there have been quadcopters drawing designs with LEDs at events like the Sochi Olympics, and convoys of trucks all moving together. What I wanted to do with this project was explore how this could be accomplished using cheap hardware and at greater distances apart, since Bluetooth can only reach about 45m away before the signal becomes too weak.
The Adafruit Feather M0 used for this project contains an onboard RFM69 radio module, and it can operate in one of two modes. The first one is a continuous stream of data from one point to the other, much like how a pair of walkie-talkie radios would function. This can lead to a lot of data being missed or corrupted, and it's more difficult to build an application layer on top of it.
The other way to operate the radio module is packet mode, which collects a buffer of data and sends it in a packet, akin to how the UDP protocol works. This way, information can be encrypted and checked for errors, making information transfer more reliable. Once the packet is sent, the receiver sends an acknowledgement to the sender that indicates a successful transference.The Chassis
Designing a robot chassis from scratch and gathering the necessary components takes a long time and can become very costly. Rather, using a kit is a much faster and cheaper option. I went with one of Elegoo's Smart Car V3 Kits, which contain everything needed for a robotic car, including motors, a motor controller, rechargeable batteries, and a servo mount. The kit is solidly constructed from laser-cut acrylic panels and milled aluminum pieces. If you're curious about how to assemble it, you can view one of my other projects here.
As alluded to before, this project uses a pair of Adafruit Feather M0 with RFM69 Packet Radio boards. One is set up to send movement data, and the other receives it. In addition, each robot has four DC motors with gearboxes, a custom L298N motor driver, and a battery pack. One of my previous projects used several Particle Xenon boards to control the same robot, and those boards also have the same pinouts (both feathers), so I was able to quickly solder together a few more PCBs and plug in the packet radio feathers instead.
Because I had already assembled the two chassis, I was able to skip that part and move straight to soldering the boards together. First, I soldered the headers for the feather and L298N, along with two connectors for power. Next, I added a single WS2812B LED to each PCB for future use. Finally, I wired up the 5v regulator. All of this then got placed onto the chassis and attached with a single 3mm machine screw.
This portion of the project was probably the most difficult, since several things need to happen at the same time to get any communication and/or movement between the two cars. The program is essentially two separate programs which are defined by either defining "LEADER" or "FOLLOWER" as a preprocessor directive. Movements are stored as Movement struct objects, which each contain a left and right motor value, along with the duration of the movement. If a robot has been designated as a leader, it has an address, destination address, and a series of pre-planned movements. If it's a follower, it simply has an address (same as destination of leader) and a queue to store its movement history (to be used later). Both devices then initialize their radio modules and motor pins.
Inside of the main loop, the leader goes through each movement and sends it to the receiver in the form of a serialized data packet. If it gets a success message back, the leader proceeds with its move. Meanwhile, the follower waits for a new movement to come in, and once one arrives, it parses the packet into a Movement object and then runs the motors.
The video below shows the process of building the robot, programming it, and then taking the two cars out for a test run.
As you can see, they worked very well. The sender was able to transmit its movements to the receiver, which then got decoded and translated into the identical movement. In the future, I would like to make the sender robot move autonomously, and then have the receiver move just behind it in a sort of convoy.