Rock'em Sock'em Robots - Part 4
2024-06-21 | By Zach Hipps
License: See Original Project Arduino
Over the last several months, I've been building my own version of the classic toy Rock ‘Em Sock ‘Em Robots. Because I like to overcomplicate and overengineer everything I do, I decided to make mine life-size and controlled by pneumatic cylinders connected to an air compressor. I invited my friend Will over because this game requires two people to play. Before we can have our fighting robot face-off, there are a few things that I need to finish first.
In part two of this series, I built a simple control board for Red Robot. This board allows me to connect two buttons and three solenoids. I went ahead and used a prototype board because it's quick and easy, but now I need to build another for Blue Robot. There are six solenoids in total, and each solenoid is going to need a MOSFET, a diode, and several other passive components. That's going to get very overwhelming for a prototype board like this. Not to mention, each robot is getting an inertial measurement unit (the accelerometer and gyroscope). Finally, each robot is also going to have LED bar eyes. That will be a lot of work to build on a prototype board. I think it's in my best interest to design a custom PCB. If I tried to cram all of this on a prototype board, it would introduce the possibility of so many problems. Whereas a PCB will be a lot more reliable, and should any issues arise, it'll be easier to diagnose and troubleshoot those problems.
This circuit board is straightforward because it has a lot of repeating components. I design one solenoid driver circuit, and then I can just copy it six times. The same goes for the button inputs. I can design the low pass filter and then just make a copy of it four times. Once the boards arrive, I use the stencil to apply solder paste, then hand-place each component, and reflow them on my little hotplate. The finished circuit board is divided in half. All the connectors on one side of the board will control Red Robot, while all the connectors on the other side will control Blue Robot. In the middle, there’s an Arduino Nano microcontroller, which reads all of the button inputs and controls the solenoid outputs. I'm using a barrel jack to supply 12 volts to the solenoid valves. I also have a dedicated set of connectors for the LED bar eyes and the IMU sensor. This control board will sit between the two robots in the same place as the pneumatic control valves. Connecting all six solenoid valves will be simple because they're close.
I don't want the arcade-style buttons that the players need to press to be in the center. I'm trying to imagine myself playing this fighting robot game, and for me, it makes sense for each player to stand behind their robot as they're operating their robot. I designed and printed this little button grip, and I’ll wire in the arcade buttons and then attach the grip to the skeleton frame. To do that I need to remove the skins, install the button grips and mounts, and then replace the skins.
The next thing I do is install the small IMU. That's the inertial measurement unit, and it sits inside the chest and will detect when the robot is being punched. Each of the robots will have one of these IMUs. The sensor data will be fed into the central microcontroller, and that microcontroller will also be reading the button pushes, as well as sending out the LED information for the eyes in each of the robots.
Here are the bar LEDs for the eyes. It is just ten regular LEDs all in one package, with all the anodes on one side and all the cathodes on the other. To drive this, I'm using a couple of shift registers. I need two of them because the shift registers that I have are only eight bits, and I have ten LEDs, which is a bit silly to use an entire shift register just for the last two LEDs, but that's what I end up doing.
To make this a really clean install, I designed a little circuit board with the two shift registers and a little connector that I will use for data and power. Unfortunately, the solder pads for the shift registers are barely too wide to fit under the bar LED. So, I have to get a little creative, and I place it on the other side of the PCB and make them surface-mount solder pads. The problem is that this is a through-hole component! I'm going to have to bend these leads over and make it a DIY surface mount part. I'll admit that this is a janky solution, but I think it's going to work. To assemble this board, I first solder on the current limiting resistors for the LEDs, and then I solder on the shift register and the connector. Finally, I solder on the bar LED.
At this point, I connect the bar LED to the Arduino Nano and write some test code to see if I can cycle through all the LEDs, but this is where I run into a problem. While most of the LEDs are lighting up just fine, the 7th and the 10th LEDs are not illuminating. I've got to troubleshoot that. I worry that I made a mistake on the circuit board design and that when I plugged it in, it may have burned out those LEDs. Let’s hope that's not the problem! I test each individual LED by applying 1.7V across each individually. When I do that, it looks like both the problem LEDs light up just fine, and I am relieved that I didn't burn those out. But I still have the problem that they're not lighting up. I start looking at my schematic a little bit closer as well as my code, but neither appear to contain the problem. I did some more digging, and it turns out that I didn't make a mistake on the circuit board per se, but some of the LEDs used a thin 5V trace around the edge of the board. It turns out that on the first board I built, I damaged that 5V trace, so it wasn't intact. Therefore, those LEDs weren't getting the five volts that they needed. Fortunately, I ordered enough parts to build more boards, so the solution meant I just needed to build another board. I also took the time to build two blue bar LEDs for the other robot. When I ran the test code on all these bar LEDs everything was working great so now it's time to install them onto the robots.
I want to move the robots to the front yard for the fight, and I don't have a great way to move them. I put them on a sheet of OSB and try to tug it along with the lawnmower, like on a little raft, but it's pretty top-heavy, so I asked my wife to help stabilize it.
Round 1 (Zach 0 | Will 0)
It’s time to fight. Will has arrived, and we are both at the controls…Will is on Red Bot, and I am on Blue Bot. Okay, Ready? Let's go! It is a quick fight with some fast punches that ultimately knock out Blue Bot. Will is ahead 1-0.
Round 2 (Zach 0 | Will 1)
We have Will with one win, and me with zero. The Red Bot must have an advantage, so let’s switch sides and do best two out of three. All right, Ready? Uh oh… something is not right. Red Bot’s right arm is not working. We discover that the arm wasn't even attached during the first fight! As we were setting up, I found a little bolt on the table and thought, “That's probably not a good sign”, but I didn't think any more about it and I threw it in my pocket. It turns out this little bolt was holding the right arm on Red Robot! Somehow Will beat me with only one working robot arm! Maybe in the next round, we need to tie one of Will's arms behind his back. After a quick repair, it is time for my redemption. Will tells me he’s feeling a quick, clean sweep right here. All right. Three, two, one… Go!
Right hook right there. Right hook! Jab! I don't know any boxing terms, but it seems like this round is going much better for me. The LEDs are getting knocked down, and I have Will down to only one LED remaining! One more hit, and he’s gone. Out of nowhere, my robot’s head pops up!!! Will sneaks in another win! Will is ahead 2-0. I guess Will won two out of three already. That's really embarrassing. I have got to redeem myself. Let’s play one more round because we are both having way too much fun.
Round 3 (Zach 0 | Will 2)
Three, two, one. Go! I don’t stand a chance, and Will swiftly and expertly puts me out of my misery, and my bot’s head pops up yet again! It is over. Will wins a clean sweep. Will 3, Zach 0.
This project has been super fun to dream up and build. As I complete this project for now, I have some thoughts. I was tempted to put in a microcontroller that could connect to the Internet and play with somebody where they could be pushing the buttons on their keyboard remotely and play as Red Robot, and I could be playing Blue Robot. The problem, though, is latency. Between pushing a button on their keyboard, it has to be transmitted over the internet before it would result in any movement of the robot arm. It would be probably a half-second delay at best. Whereas my buttons are being read in real time, and it wouldn't be a fair fight. So that's one of the reasons I decided against doing that. Another fun option, which is more possible, would be to write a program and have them be synchronized and do a synchronized robot dance. What do you think? What should I do next with this ridiculous project?
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum