RoboDuckBuild

Day 18

On its neck and following a face

Three more servos named, the head built onto the neck and centred in software, a bearing that carried nothing and a beak that gripped. Then the head learned to find a face and follow it, with the neck held still: on 5 V, the neck servo can't lift the head.

The head on its neck on the bench stand, with its blue eye ring and camera ring on. The video has no sound.

Yesterday the new head came together on the bench. Today it went on its neck: three more servos got their names, the head was built onto them from Luwu's guide, and it learned to find a face and follow it.

Three more names

The head needs servos 32, 33 and 34: turn, lean and beak. Each was named on the FE-URT2 like 30 and 31 yesterday, then given a test swing of 90 degrees each way. Servo 32 answered as ID 10, left over from a first naming run where it "sounded funny", and one of its horns felt free. That's the idler disc on the back, which spins freely by design. All three moved the same: smoothly, at 300 to 400 mA, landing within a few steps of where they were sent. 34 stops 0.3 degrees short and keeps pushing gently, which is harmless.

The number labels took two test prints to line up on Simon's laser printer: 3 mm left, then 1 mm back.

The bearing that carried nothing

Servo 32 turns the whole head, and Luwu's guide puts a 16 × 22 mm bearing on its bracket. Simon couldn't see how it was taking "any weight at all".

A grey U-shaped bracket held under a servo, with a steel bearing sitting loose on its round boss
Servo 32 on its bracket. The bearing sits on the bracket and touches nothing above it.

He was right. The white U-bracket screws to the servo's output disc through a round boss, and the bearing just slides onto that boss and sits on the bracket. Its outer ring touches nothing, so the head's weight and every knock go straight down the servo's output shaft. Our first answer, that the outer ring sat in a recess in the bracket, was wrong: there's no recess.

Simon's fix: a plate screwed to the servo for the outer ring to rest on. It needs one more part. Both rings sit on the bracket now, and pressing the outer ring down from above would pin it between two parts that turn against each other, so it would rub instead of roll. A 0.4 mm shim on the boss lifts the bearing so only the inner ring touches the bracket. Then the inner ring turns with the bracket, the outer ring with the servo, and the balls do the work.

Two cross-section drawings of servo 32 on its bracket. Left: the bearing sits on the bracket with a gap of about 1.4 mm above its outer ring. Right: a shim under the inner ring and a spacer on the servo, with arrows showing the weight passing through the bearing
Before and after: the spacer takes the weight onto the outer ring, and the shim keeps the outer ring off the bracket.

The model says the gap is 1.9 mm, but in the photo it looked nearer 1 mm, so there are eight spacers from 0.6 to 2.0 mm, notched to tell them apart. The one to keep is the thickest that slides in with a light drag. They're C-shaped, so they slide in after the bracket is screwed on.

Finding the middle

With the head built and on the neck, centring every servo should have pointed it straight ahead. It pointed left and tilted back. The discs the brackets screw to have 8 holes, 45 degrees apart, and sit on a splined shaft at whatever angle the factory left them, so there's no way to screw a bracket on square at the servo's electronic centre. Luwu's guide says not to pull the shafts off to move them round.

Luwu's answer is in software: a "Reset Mid" command makes a servo store where it is as its centre. With the servos limp, Simon held the head straight and level, and each one saved its place: 20.4 degrees out on the turn, 18.5 on the tilt and 2.1 on the lean. The offsets live in the servos, so they survive a power cut. On the finished robot, Luwu's app does the same job for every joint.

The beak

The beak's first centre stalled its servo at 1.16 A. It had been saved with Simon squeezing the beak shut, so the servo kept squeezing. Then Simon asked whether the beak had a bearing, because "it looks like just PLA rubbing on PLA". It hasn't. One side screws to the beak servo; the other is a 16 mm tube turning in a 15.9 mm hole in the white servo support. Printed, it gripped, and there's no room for a bearing. Simon eased the hole until the beak swung freely. Now it falls open on its own when the servo lets go, so everything we run holds it shut.

Then a beak demo: a yawn, quacks, talking, chatter, nibbling, a snap and a laugh, with the head moving along.

Moving the head

Simon asked for a minute of head movements, then a quicker minute "more like what it will do when its running": random glances that ease in and out. Getting there taught us a few things.

  • Limp isn't safe. The first safety stop let every servo go limp, and the neck folded straight forward. Now a stop holds every servo where it is.
  • The lead order matters. Leaning one way, the head pushed against the beak servo's lead. Simon spotted it, and then the cause: he'd chained the beak servo's lead down the neck instead of up to it. Luwu's guide runs 31 to 32 to 33, then up out of 33's top socket to the beak servo.
  • Look before you move. After the re-chain, servo 31 read 86 degrees off centre: its disc had gone back on six teeth round. Our first move drove the head into its stop. Now, after any rebuild, Simon holds the head at centre and we read every servo before anything moves.
  • A corner that catches. With the head turned past about 20 degrees, leaning towards that side drives a corner of the U-bracket into the edge of the head plate's opening. That's in Luwu's parts. For now the software keeps the lean small on big turns; filing about 3 mm off the front edge of the opening would free it.

Not enough power

Servo 30, at the foot of the neck, carries the neck and the whole head. Holding the head still is easy, at about 0.2 A. But on the bench's 5 V USB supply, 30 can let the neck lean forward and can't lift it back. It stalls at 1 to 1.6 A with nothing in its way. These servos run on 5 to 8.4 V, and they're stronger at the top of that range.

Luwu's 8.4 V pack hasn't arrived, so the bench will run from one of Simon's 7.4 V airsoft batteries instead. Its mini Tamiya plug needs leads, which come tomorrow, and the battery plug will be the power switch. In Simon's words: "Frustrating to have to stop but there we go."

It follows a face

So, with the neck held still, a job for the servos that were behaving: following a face. The Mac pulls pictures from the head's camera over Wi-Fi, about eight a second, and Apple's own face detection finds the face in each one. The turn and tilt servos follow it, and the lean keeps the head level. It calibrates itself first, nudging each servo a few degrees to see how far the picture moves. On the first run it found a face in about 98% of the pictures for 75 seconds, and it has since followed all three people who've tried it.

Then Simon kept asking for more, and it got:

  • a search: when it can't see anyone, it looks round for a face, with the eye leading the way;
  • a head tilt "like a dog does" when a face is looking at it;
  • a beak that eases open as a face comes closer and eases shut as it backs off. The first version opened and shut quickly, until Simon asked for "some nice easing";
  • a still eye: while it follows a face, the eye stops wandering and looks straight out, so it looks focused. It looks surprised when the beak opens wide.

Simon also asked for the two white highlights on the eye to go. That was a firmware change, and the head now takes its updates over Wi-Fi, so no USB lead went near it.

Its view is narrow, about 35 degrees across at this picture size, so a quick move can leave the picture before the head catches up.

A ring for the camera

With the head together, the camera looked unfinished: its 8 mm slot was bare, with the grey holder showing round the lens. Simon wanted a blue ring. The new one is a low 17 mm bezel, 3 mm proud, with a cone inside it down to the lens, wide enough to stay out of the camera's view. Its first version left a wall 0.05 mm thick, which Simon caught in the slicer. In the video it's on, next to the blue eye ring.

The head from the front: the glowing blue eye in its round window, and to its left a bare slot with a tiny camera lens in a grey holder
Before the ring: the camera's bare slot, with the grey holder showing.

Next

The battery leads come tomorrow, and then the neck gets its tests again at 7.4 V. After that: find what now stops the head leaning one way since the leads were re-routed, print the bearing spacers, name the ten leg servos and start on the legs. Simon's also after longer servo leads, because the ones in the box made for a tight fit in the head. Where the new head has got to is on the Head V2 page.