I don’t have a good track record with mechanical projects – anything that moves. I do much better with purely electrical devices. As soon as you have moving parts you have to deal with things like friction, backlash, wear, tolerances, inductive spikes… I don’t like any of those things. Every couple of years I forget this and think it’ll be different this time, so here is another mechanical project.
A couple of years ago while still at university I started a balancing robot project. I quickly gave up. The reason was that my robot was free standing and balanced on two wheels. There were a number of issues:
- The robot would run around and I didn’t have enough space of my desk to allow it to balance
- The programming cable would restrain the robot so I also had to unplug my programming cable each time I wanted to test it – not ideal for quick iteration
- It was hard to control the environment and get the motors aligned
- The robot could not have an external power source so had to rely on batteries
This time I am still going for a balancing robot but I am going for a rotational robot, rather than a free standing robot.
In this design the robot is attempting to balance the arm in a vertical position. It does so by rotating the lid around the central vertical axis and providing a tangential force to the arm which is rotating around a horizontal axis attached to the lid.
This time I don’t have to deal with the robot running away and I can provide external power via a plug on the base. The main processor (mounted on the arm) still needs to have the programming cable unplugged for testing, but I have made sure to put the connector in a convenient location.
There are four main mechanical parts of this design: the lid, base, motor-mount and arm, and two main electronic parts to this design: the main board and the power board.
The main board is mounted on the arm and contains the sensors and brains of the design. It features:
- STM32F070C6T6 32-bit ARM Cortex-M0 processor (U1)
- MPU-6050 accelerometer/gyroscope (U2)
- MP6513 H-bridge (bottom left) for motor control
- Connector (J1) to provide connection to the motor and 6V power
- AP2210N 3V3 by the voltage regulator
- Switches SW1 and SW2 to reset and boot into DFU mode for programming over USB
Technically the MPU-6050 is discontinued however it is still available to purchase and has lots of documentation online. Plus there is a drop-in replacement part that is still supported so I was happy to build it into my design.
One difficulty of this design is that power needs to be supplied to the main board from the base despite there being a rotational pivot in the centre. Therefore I designed a circular PCB that has tracks on one side and four spring-contacts on the other side.
One of these boards is mounted in the base and one on the lid. As the two parts rotate relative to each other the spring-contacts on the top-side of the base PCB make contact with the circular copper rings on the bottom-side of the lid PCB. Therefore the 6V power and ground can be supplied from the base to the lid. The power then passes via a cable from the lid to the main PCB via a cable.
The base has an input for a power jack, mounting holes for the motor and four standoffs which mount the power PCB with the spring-contacts facing upwards. The rotor of the motor is mounted to the bottom of the base via the four holes.
The lid sits flush with the top of the base. It has two holes to mount the motor-mount in the centre on the under-side and one more hole to pass the cable between the power PCB and the main PCB. There is also a vertical section with a 6mm hole for an M6 bolt to act as the pivot for the arm.
The motor mount is designed to clamp square body of the motor in place. The mount is mounted to the underside of the lid via two M3 bolts via the two flanges at the base. There are four more vertical flanges which are clamped together with a two M3 bolts and two nuts.
The arm pivots around the M6 hole at the base and features a recessed section in which the main PCB sits. There are two M2.2 holes to attach the PCB and a cutout on the right-hand side for the USB port.