You Spin My Head Right Round

Sox now has a turning neck. As seen in the movie, Sox needs to be able to turn his head 2x in one direction to scan and hack into various systems, while either beeping or meowing. This is a major problem for all of the wires going to the head, but that is a future problem. The current problem is just getting something to have a known position and turn that far. A standard servo motor only has 180 degrees of motion, and is too weak to move the head. While larger servos exist, the angle issue is still present unless switching over to continuous servo motors. Switching to continuous, the rotation limit is removed, but all position info is lost, now only being able to control velocity. 

Instead, a stepper motor was used. This results in continuous motion, and by counting the steps from a known position, very precise control can be achieved. Most, if not all 3d printers use stepper motors to control the axes and even the filament extrusion. 

This still left the problem of the known position. The absolute known position of a stepper is not given with just a stepper alone. They can be paired with limit switches, special drivers that detect over current from running into something, all the way up to encoders on the back of them that pretty much turn them into high powered servos. 

The encoders are expensive, and the stepper driver I bought does not support overcurrent impact detection, so I used a limit switch to define the home position. Rather than a true limit switch though, I used a photo interrupter. A photo interrupter is a device that pairs an LED with a phototransistor to control the output voltage at the positive side of the phototransistor. When light from the LED strikes the phototransistor, it conducts, resulting in a 0V potential difference across the unit. When the light turns off though, the transistor stops conducting, and whatever voltage is applied to the positive side is read, which in my case is 3.3V, which is read by the Raspberry Pi as a digital "On" or 1.

Thus, to home the neck and set the reference point to zero, I turn the stepper until the phototransistor shows a 1 on the output, then I stop. The neck is now homed.

That is the programming logic dealt with, but there is still an issue with the hardware. As the neck has to turn a minimum of 2 times, directly reading the rotation of the shaft would result in counting multiple rotations and multiple home positions. Due to the finite nature of wire, I cannot allow this as eventually Sox's neck would end up in a position where it would pull on the cables and unplug or snap them. To resolve this, I used a planetary gear set to reduce the rotation by a factor of 3, allowing me to measure the ring gear position directly without needing to count, as the 2 and a bit rotations I need are less than 3.

From this, Sox's next is now able to turn and not unplug itself. The last thing I did was add a blocker to prevent Sox's neck from being over turned in either direction using the same pin that the photointerrupter uses as a mechanical stop.

Comments

Log in to add a comment.