Introduction: LEGO Arduino Sentry Turret

This instructable will show you step by step how to create your very own (non-lethal) sentry turret out of LEGO pieces, an Arduino UNO Board, a Bricktronics Shield, a few wires and a bit of lead. It is capable of automatic and remote control function through the use of an IR sensor and remote.

Step 1: Required Materials

Tools:

- 1x 220-240V soldering iron

- 1x soldering iron stand

- 1x container of solder flux

- 1x coil of solder wire

- 1x coil of jumper wire

- 1x electrical cutter

- 1x protective goggles

Materials:

- 1x Arduino UNO board

- 1x Bricktronics shield (Wayne & Layne)

- 1x 9-volt battery

- 1x 9-volt battery holder

- 1x V5 Bricktronics shield mounting plate (available from Wayne & Layne)

- 1x short length 25cm NXT/EV3 cable

- 1x Sparkfun IR remote

- 1x P/N IR Receiver Sensor TSOP38238

- 1x solderless mini breadboard (47 x 35 x 10mm)

- 2x 35 cm NXT/EV3 flexi cable

- 3x NXT connector cable

- 3x M3 nut

- 4x 7mm bolt

- 4x 1 inch metal standoff

LEGO parts:

A folder containing PDF files and JPG images of the LEGO part lists for both the base and ball shooter can be downloaded below. None of the listed LEGO parts have to be a required colour, with the exception of the 2 Technic Axle Pin in brick yellow if you want the ball shooter to operate more smoothly.

The ammunition used for the ball launcher is the Bionicle Zamor Sphere, Bricklink ID 54821. A total of 7 spheres are required to fill the launcher with the magazine attached.

Step 2: Constructing the Base

A Lego Digital Designer file of the build can be downloaded below. To open it, you will need the latest version of Lego Digital Designer which can be downloaded at http://ldd.lego.com/en-sg/download.

Step 3: Constructing the Ball Shooter

A Lego Digital Designer file of the build can be downloaded below. To open it, you will need the latest version of Lego Digital Designer which can be downloaded at http://ldd.lego.com/en-sg/download.

WHEN USING THE REMOTE CONTROL FEATURE, REMOVE BOTH THE "Technic Beam 4 x 0.5 Liftarm" FROM THE BALL SHOOTER SO IT CAN FULLY TURN!

Step 4: Soldering

1. Cut off 3 individual strings of jumper wire with the wire cutter. Each string should be less than 20 centimetres.

2. Cut half a centimetre of rubber on both ends of the strings to expose the connectors. An example of how an end should look is shown above.

3. Insert one of the ends of each string into the three holes indicated by the red arrows in the first photo above. Solder these ends to the soldered bits next to them indicated by the blue arrows in the second photo above.

Step 5: Putting the Robot Together

Each image has a number at the top left corner that corresponds to the steps below:

1. Slide in the 9-volt battery inside it's holder into the back compartment area of the robot. You can do this by taking off the left-hand side panel. Make sure the wire is placed as shown in the image so it can be pulled out and connected to the board's external power supply plug without issue.

2. Attach the ball shooter by lining up and inserting the dark stone grey "Technic Axle 4 with Stop" and 4 bright blue "Technic Axle Pin", all connected to the "Technic Gear 40 Tooth", into the base's NXT motor.

3. Attach the Arduino UNO board to the Bricktronics Shield Mounting plate with the 1-inch metal standoffs, 7mm bolts and M3 nuts.

4. Attach the mounting plate to the 5 blue pins connected to the base as such. Afterwards, place the "Technic Beam 3 x 5 Bent 90" and colour sensor on top of the pins to keep the plate in place.

5. Slide in the breadboard through the gap between the Bricktronics Shield and colour sensor at the back of the robot.

Step 6: Wiring

Bricktronics Shield and NXT Wires:

Motor 1 = Ball shooter motor

Motor 2 = Base motor

Sensor 1 = Right-hand touch sensor

Sensor 2 = Left-hand touch sensor

Sensor 3 = Colour sensor

Sensor 4 = Ball shooter IR sensor

A diagram for the placement of the soldered wires and 3 pin IR sensor is shown above. The arrows indicate where each wire is inserted onto the breadboard.

Step 7: Programming

A folder containing Arduino files for both the automatic and remote control functions can be downloaded below.

If you are using the Sparkfun IR remote, the button HEX codes are:

Off = 0x10EFD827

A = 0x10EFF807

B = 0x10EF7887

C = 0x10EF58A7

Up = 0x10EFA05F

Left = 0x10EF10EF

Right = 0x10EF807F

Down = 0x10EF00FF

Center (circle) = 0x10EF20DF

Step 8: Things to Note

- The ball shooter is only able to turn 90 degrees left and right from the center autonomously.

- If the ball shooter is not hitting the touch sensors, you may want to boost the base motor power or change the ball shooter's cable.

- The ball shooter has to be adjusted manually by moving it up or down.

- The robot is unable to function in dimly lit or otherwise dark areas because of the color sensor. This can be circumvented by shining a concentrated bright light directly at the color sensor.

- If you have integrated the remote control feature, you will have to temporarily remove the jumper wire soldered at digital 0 from the mini breadboard to upload any programs.

- The ball shooter may sometimes get stuck, but will eventually fire after a few tries. This may happen because a ball gets stuck in the attached magazine or the motor does not the sufficient power.

Step 9: Completion!

Congratulations! You have successfully constructed your very own sentry turret!

If you have any questions or suggestions, feel free to leave them in the comments!