Building a robot sparring partner

Prototyping the frame

The Body (v1)

  • Nuts, bolts and washers. For this I went with some M4 (4mm diameter) screws of two lengths. Short ones for when there is one bar and long ones for when I need to connect the bars together
  • A bunch of bars to build the frame. But for this not just any bars I found some nice bars with holes in all the way down called Tetrix the smallest holes are 3mm but I knew I could get a 4mm one in there if need be.
  • Brackets to hold the frame together
  • Plastic ends for the noodles to connect to the servo mounts
  • The servo mounts, so when the motor moves they swipe the arm up / down or left / right for hooks.
  • Servos (the motors). This was really hard as there was a bunch of math for working out the strength you would need. But given my arms were going to wobble like crazy I wanted fairly strong ones. And looking at the servos it seemed like the stronger they got the slower they were. So I opted for the middle ground of 25kg servos.
  • Two big ass bolts to come out of the punchbag so I can take the robot part of him on and off if I like by removing the bolts.
v1 frame

The Muscles (v1)

  • Voltage converters to turn one voltage into another. I needed 7.4 for the servos and 5 for the pi. So at this point my thinking was, I will go from he plug power (9v) down to 7.4, then power all the motors. then come of this line of power and convert again down to 5 for the pi. And as there are 3 voltage converters in the pack if I blow one I should still be good.
  • Barrel jack connectors for the power in from a plug.
  • A bunch of wires so I could make some nice long wires to the box. I did not want to connect the box to the back of the punchbag as she wobbled like crazy and was worried of damaging the box. It also just makes things much simpler to not worry too much about shock damage.
  • Raspberry pi4
  • Breadboard
  • Box to put it all in
  • 9v power supply plug with a male barrel jack connector
  • Soldering iron. So I could solder the wires (live and ground) to the barrel jack that would go to our first converter
  • Multimeter to work out the voltage (as the servos need more than what goes to the raspberry pi)

The Brains

Little app to move the arms

The problems …

  • The pi would cut out as there was not enough power and the servos would drain the current.
  • The arms moved too slow.
  • The whole thing wobbled too much when I really used it and the momentum of the bag moving made it even harder for these little motors to move the arms.
v1, not working quite as I expected
  • Get bigger motors
  • Fix the arms to the body somehow and not have this frame bolted on.
  • Fix the power issues.

The Body (v2)

After printing the parts
Notice the voltage for the servos is now 8.4 as the new servos need more juice.

Wrapping up

Speaking of the app

The main architecture

  • React Native app for the front which sends and receives events to the robot
  • Node js app for the robot (code on the pi) using Jhonny-five to send and receive events, manage the workout and combat and send signals to the servos
  • Infrastructure application using Pulumi to manage the AWS infrastructure in code

How the robot talks to the react native app

Structure of the events

  • difficulty
  • duration
  • arms enabled
  • pause duration

Logic of the robot

  • Pick a combination from an array of combinations I created at random (based on the arms enabled).
  • Extend and pull back the arms. managing the speed of the arms and timeouts for knowing when things are done. All this is based on the difficulty.
  • Pick the next combo and start it. Only after the pause duration from the config so the user gets a nice pause if they want one.
  • Stop the workout when the workout duration is over.

The React app

screens from the app

Whats in the future?

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How To Use Linux Date Command?

10 takeaways from AWS re:Invent 2019

Building Planet 4: from tech team to software.

Learn the Abstract Factory Design Pattern

Change Notifications and Named Options using Options pattern in .NET Core

Our journey to Micro Frontend

Elliott Wave View: Nifty Found Support for Next Leg Higher

Rusty Shorts — Instantiating a Struct in rust way

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gareth Fuller

Gareth Fuller

More from Medium

The beginning of the end of Crypto Assets

Steam Demo Festival Aftermath — Was it worth it?

Blog on “IoT Based Smart Home Automation”

XchangeOn 2022 — A Revised User Experience for Crypto Traders !