The Servo Brick is based on the SG90 servo. The axle of the servo has a 180-degree range of movement.
The servo comes with some accessories and screws.
We are going to use 2 of these screws (I will refer to them as "servo screws" from now on). These looks to be M2 screws with 7mm length and a rimmed pan head. If you are missing these screws, you can still use our default 5mm M2 screws with no issues.
Parts list
Type | Quantity |
---|---|
SG90 servo | 1 |
2-pin JST RCY connector (male) | 1 |
2-pin JST XH connector (male) | 1 |
M2 self-tapping screw | 5 |
Servo screw | 2 |
Circuit
Snip off the cable of the SG90, leaving about 2cm. Splice the JST RCY connector cable to the VCC and GND wires (red and brown respectively). Splice the JST XH connector cable to the PWM and GND wires (orange and brown respectively).
Print out the two halves of the wireholder on a 3D printer.
Lay out the wire joints on one half of the wireholder, add some hot glue, then mount the other half on top. This helps to protect and strengthen the joints.
Construction
Print out the enclosure parts on a 3D printer.
Line up two 3x1 brickbases on a faceplate, three rows apart. Add an additional brick on the side to assist in alignment.
Add two drops of superglue on each brickbase and mount the bottom piece. Use the markings along the side to align the brickbases. Press and hold for 60s.
Line up two 2x1 brickbases on a faceplate, one row apart.
Add two drops of superglue on each brickbase and mount the bottom piece vertically. Use the markings along the side to align the brickbases. Press and hold for 60s.
Screw one side of the servo to the backplate piece of the enclosure using a servo screw.
Insert the backplate with the servo attached into the slot in the bottom piece. Screw in with the other servo screw.
Now, secure the top piece onto what we have prepared so far with 4 x M2 screws.
Now connect the servo module to the Controller Brick, Battery Brick and Motor Power Brick, and run the following code to position the servo at 90°.
var< servo = new Servo(PORT_2A, 90);
while(true);
Now mount the axle adapter on the servo axle with the arrow pointing to the middle of the directional arrow. Then screw in with a M2 screw. This is best done with the servo still powered and supported by your fingers to ensure the arrow stays pointed at 90°.
Note: 90° is chosen as the mounting angle instead of 0° because quite a few SG90 servos are known to be unable to reach the full 0° or 180°. So the best angle to use is 90° because it is the midpoint of the servo's full range regardless of whether it is actually able to hit 0°/180°.
The Servo Brick can be positioned either vertically:
or horizontally:
The axle is positioned so that it will interface correctly with gears and other Technic pieces whichever way it is mounted.