loading

This is a game where you aim a laser pointer at a robot's belly to "disable" it. When you hit the bot's weak spot its eyes go dark and you hear a laser sound. After all five bots are disabled the game resets and the bots turn back on one at a time.

I made this because it creates a simple example of input/output for explaining what microcontrollers are capable of and it is way more exiting than a button press on a breadboard. A nice next step might be to add servos or vibration motors for an extra level of feedback.

Step 1: Gather Supplies

  • 5mm LED (or if you're not using the 3d printed model you can use any size)
  • LDR (light dependent resistor)
  • 3 wires
  • 2 resistors (I used 200 ohm, but you can use any that will protect your LED. Educational Link!)
  • Microcontroller, I used an Arduino Micro
  • Breadboard and jumper cables
  • Momentary Switch(es)
  • Piezo "speaker"P

Optional

  • Heatshrink
  • Connectors
  • Glue

I set each bot up to be modular so I can unplug them easily for storage or modification. I used heat shrink for a little protection on exposed connections.

Tools:

  • Soldering equipment
  • 3D printer (Optional)

Step 2: 3d Printing

http://www.thingiverse.com/thing:2069579

If you want to use my model follow the link. A 5mm LED will press fit right into the back.

An LDR (or any sensor with two wires) can be threaded in through the front. You may have to open the holes a bit with a hot nail or a tiny drill bit.

If you don't want to 3d print the model you can make something yourself. The prototype started with a simple cardboard target with the leads poked through.

Step 3: Wiring

I designed these so that there are no extra components to plug into the breadboard. Just wires and switches.

Each set of {LED, LDR, 2 resistors} represents one bot. I used servo extension wires that plugged directly into header pins I soldered on each robot. Notice there will be three wires coming from each robot.

So be careful to connect the right resistors to the right leads. You might find my schematic a bit convoluted, but it saved me from needing four wires. Hope it makes sense.

The orange wires start HIGH. That provides 5V to each LDR. Since we are only reading the light sensor(LDR) when the LED is lit (orange wire HIGH) that works fine. If you change the code to read the LDR when the LED is not lit, you'll have to come up with a different way to wire it.

Step 4: Programming

Here's the code

https://gist.github.com/justbennett/f05c3e7a4e67ef0afaf56c5881a0168e

There are 5 analog inputs, that the 5 LDR's. There are 3 digital inputs. Reset, threshold up, and threshold down. The threshold adjustment is so that the device can adapt to different lighting situations. If you are using a bright laser it shouldn't matter.

There are 5 LED outputs and the speaker output.

You could adapt this code to other sensors or for many other purposes.

<p>I like it! I wish they could walk :D</p>

About This Instructable

1,301views

25favorites

License:

More by justbennett:Bot Laser Gallery Game Modular Star Tree Topper Multi-tool Tips 
Add instructable to: