RoboDuckBuild

Day 21

Running on the duck's own power

The head now runs from the duck's battery through the servo bus, so its USB lead no longer comes down the neck. Its moves slow to a gentle stop, its eyelids look like eyelids, and the eye shows how it feels. The battery and the test board got better homes.

Eight round eyes in a grid: a blue eye with arched blue lids looking neutral, happy with a green iris, sad, angry with an orange iris, surprised, sleepy, half blinked and shut
The eye's looks with the new lids, from the preview script we check them in before flashing the head. "Surprised" is no longer used.

On Sunday the head still had a USB lead running down through the neck, and that lead stopped it turning as far as it should. On Monday it came out.

Power from the bus

Every servo has two sockets, and power runs through all of them, so the beak servo in the head has a spare socket with the battery on it. A spare servo lead from that socket now feeds one of the Pololu 5 V regulators in the head, which powers the XIAO, the screen and the camera. Simon worked out which wire was which by tracing the colours back to the plug and checking with a meter: power is the middle pin.

Close up of a red servo test board with two white three-pin sockets labelled G, V1 and S, and a lead with black jumper ends plugged into one of them
The servo sockets read G, V1, S: ground, power and signal, with power on the middle pin.

With wires soldered on, the regulator only just fitted under its printed cap, so a third cap with a deeper pocket is in the print file. The head came up on bus power and stayed up through the neck lifting, the camera waking and the sweeps. The beak cut out once at about 5 degrees; that was a screw done up too tight, and Simon loosened it.

Without the lead in the way the head can lean 14 degrees each way, and the catch at 7 degrees has gone. It can turn 60 degrees one way but still not the other, because the lead between the head and the neck is too short. Simon wondered about buying a second test board, which comes with a longer lead. The cheaper answer is to splice about 30 mm of wire into the one we have.

Shutting down is simpler now: the duck lies down, the battery comes out and the head goes off with it. Or it should. With the battery out but the test board's USB lead still in, the bus is fed backwards at about 3.3 V through the data line. The servos still answer, but the regulator can't make 5 V from that, so the head kept restarting and the screen flickered, which Simon spotted. So it's battery out and USB out.

Slowing to a stop

Simon liked the demo but wanted "nice gradual and smoother transitions" that slow to a stop. Two things came out of that. These servos ignore the speed you ask for: a 30 degree move takes about 67 ms whatever you set, and only the acceleration setting slows them. So smooth moves have to be sent as a stream of small steps, and at 40 steps a second the turn servo kicked, with peaks of 4.5 A and a visible judder. At 100 a second the peaks dropped to about 1.6 A. Each move now starts quickly and takes a long gentle stop, and the small drift while it holds still fades in and out instead of jumping.

Eyelids and moods

The straight black eyelids, Simon said, looked "like the screen isn't working". They're now arched, with a rim, a crease and a little shadow on the eye, and after a first go in grey, shaded blue to match the surround. They still draw at 22 frames a second.

In follow mode the eye now shows a mood: neutral while it follows you, sad while it looks round for someone, angry if you come too close (the beak opens a little before that), and happy while it's holding something in its beak.

Better homes for the battery and the test board

The battery's main lead, balance lead and plug all bunched up in the doorway of its tunnel, and the door wouldn't go on. The tunnel is now as deep as the base allows, 125 mm instead of 108, and wider towards the front, with a bigger notch in the door for the leads. The door moved onto the base's plate, in blue.

The end of the blue bench base, with red and black battery leads and a white balance plug bunched in the tunnel opening, and the blue door lying on the desk beside it
The battery's leads, with nowhere to go.

Simon also asked for the test board to sit square behind the duck under a little white cover with a grille, so it all looks neat. So the board turns 90 degrees in the new base, and the cover has a window for the USB-C at the back, one over both servo sockets at the front so a plug goes in with the cover on, and an open notch over the power terminal at the side.

Two renders of a white box with a slatted top on the blue base, one from each end, showing a small window at one end and a long slot at the other
The test board's cover, from the back and the front.

Next

Name the eight leg servos and build the legs, from Luwu's guide.