BUILD YOUR OWN
Want a turret of your own? Start small and level up. Each level teaches something new and makes a good science fair project by itself.
Level 1: Hit Detector
about $25 (one micro:bit V2) 路 30 minutes
The micro:bit's LED screen can also sense light. Shine a flashlight on it and it counts a hit, just like the mosquito in the MS-2000.
- 1Open makecode.microbit.org and start a new project.It is free and runs in the web browser.
- 2Find your threshold first.Make a tiny program: forever, show number (light level). Write down the number in room light, then with the flashlight right on the micro:bit. Pick a number between them.
- 3Click the JavaScript tab and paste the code below.Change 150 to your threshold. Click Blocks to see it as blocks.
- 4Download it to the micro:bit.Plug in the USB cable and drag the file onto the MICROBIT drive.
- 5Shine the flashlight on the LED side.The micro:bit beeps and shows a target. That is a hit.
- 6Press B to see your score, A to reset.Now it is a game: can a friend hit it while you move it around?
let hits = 0
input.lightLevel()
basic.pause(1000)
input.onButtonPressed(Button.A, function () {
hits = 0
basic.showIcon(IconNames.Yes)
basic.pause(300)
basic.clearScreen()
})
input.onButtonPressed(Button.B, function () {
basic.showNumber(hits)
basic.pause(1000)
basic.clearScreen()
})
basic.forever(function () {
if (input.lightLevel() > 150) {
hits += 1
music.playTone(988, music.beat(BeatFraction.Sixteenth))
basic.showIcon(IconNames.Target)
basic.pause(300)
basic.clearScreen()
basic.pause(400)
}
})The first light reading after power-on is always 0, so the code reads it once and waits.
- Does standing farther away change the light number? Measure at 1, 2, and 3 steps.
- Does a red, blue, or white light give a bigger number?
- Can you score more hits in 30 seconds when the micro:bit is still or moving?
Level 2: Camera Tracker
about $125 路 A weekend
An AI camera learns a toy, and two servos turn it to keep the toy in the middle of the screen. This is the MS-2000 without the laser.
- 1Plug the micro:bit into the expansion board.We use the DFRobot Xia mi board. It has a HuskyLens port and 5 V servo pins.
- 2Connect the HuskyLens to the HuskyLens port, the pan servo to P1, and the tilt servo to P2.Tape or rubber band the camera onto the tilt servo, and the tilt servo onto the pan servo.
- 3On the HuskyLens, pick Object Tracking. Point it at a toy and hold the learn button.Move the toy closer and farther, and turn it, while it learns. A box appears around it when it knows it.
- 4In MakeCode, add the HuskyLens extension.Extensions, then search HuskyLens. It gives blocks for the X and Y of the box.
- 5Build the program on the right with blocks.Servos use the "servo write pin" block from Pins.
- 6Move the toy slowly. The camera follows.If it turns the wrong way, swap the + and the - for that servo.
startpan = 90, tilt = 90foreverask the camera for the learned objectif it sees itif x > 170: pan = pan - 2if x < 150: pan = pan + 2if y > 130: tilt = tilt + 2if y < 110: tilt = tilt - 2servo P1 to pan, servo P2 to tiltif 150 < x < 170 and 110 < y < 130: beep, locked on!
Level 3: The full MS-2000
about $225 plus batteries and craft supplies 路 About 6 weeks of weekends
Add a safe laser, a mosquito that feels every hit, a wand that saves the data, sound effects, and a 3D printed body. Everything Addie uses is here.
Science fair questions you can test
Any level can answer a real question. Change one thing, count what happens, five runs each.