A deliberately over-engineered timepiece provided a satisfying distraction for a busy software engineer. In today’s new issue of the MagPi magazine, Rosie Hattersley learns how this broken clock keeps going.
Like many of us, 33-year-old software engineer Hendrik Ohrens likes to combine the technical skills he uses for work with those he’s picked up through his hobbies, to come up with something creative. “I love working on projects that involve electronics, mechanics, and software,” he says of his enthusiasm for making things. With a background in scientific research and mechanical engineering at the University of Hannover, plus a few Raspberry Pi builds under his belt, he decided it was time to challenge himself to design his first robot. He decided on a robot arm, since it seemed relatively simple to design but “still has some degree of flexibility”. When Hendrik’s existing clock stopped working, the idea of using a robot arm to move the dials to the correct position immediately sprang to mind. View the robot arm clock in action on Instagram.
Monitoring every movement
Hendrik began by using inverse kinematics to work out how to control his robot arm’s motion – a scenario that involves using formulae to determine where the end of the arm will swing round to – but soon realised this wasn’t the best approach. Instead, he switched to Raspberry Pi 3B+, with the intention of continuing to explore inverse kinematics and the ikpy library alongside AI and computer vision. In the end, he found training the robot to adopt specific poses was the most useful approach for his needs. “The position teaching feature allows me to move the arm to a position (with my hands) and then save that position for further use. This feature turned out to be very useful for the tasks the robotic arm performed after that,” Hendrik explains.
“Raspberry Pi is the perfect development tool for me. It is powerful, versatile, and offers all I need to prototype my projects,” he says. Hendrik has not only worked on other Raspberry Pi projects, but has accrued enough of them over the years to possess a dedicated Pi Box to keep them all in. “The fact that I can run modern full stack applications, as well as talk directly to connected hardware, makes it my first choice when I prototype a project.”
He decided on an Arduino to talk to the servos using the manufacturer’s library, and Raspberry Pi to handle all the logic, as well as controlling the Arduino attached via a serial interface and a USB cable. For this he wrote custom code, refined over time (and still ongoing) to control the arm.
Sketching it out
Hendrik prefers to sketch out plans and adapt them as needed, rather than starting with a rigid design. For his robot arm, he started with some servos and a basic CAD model that would be easy to 3D-print and add small parts to. Once he was happy with the basic design, he simply duplicated it to make additional movable parts and chained the servos using a cable.
The robot’s arm needed to be mounted to prevent it toppling over, so Hendrik 3D-printed clamps he’d found on Thingiverse, and clamped the arm to the table. He then glued the broken clock (whose dials the robot arm would move) to a wooden box, which he also then glued to the table so it wouldn’t budge. After some adjustments to the arm’s movement, which squeaked because it slightly overlapped in places, Hendrik began the far lengthier process of training the robot which position to adopt when. Having created the somewhat expanded motion-control code, he says the robot arm could be used for any sort of Raspberry Pi project he likes.