Qwerk Customization and Tekkotsu
Index
Adding a switch
Adding a bump sensor
Adding an LED
Adding raygun special effects
Adding a range sensor
Adding A Bump Sensor
Bump sensors are a cheap and effective way to provide collision
detection for your Qwerkbot. In this example we used Lynx Motion bump
sensors available here,
but feel free to experiment with other types.
Assembly
This particular package needed some assembly and soldering, but really
it's all very simple. In the end we didn't even make use of
the nuts and bolts provided, but rather opted to super glue the
switches to the
sides of the Qwerkbot.


Circuitry
The wiring does involve some soldering, but it is quite minimal. Just
follow the simple diagram below.

Wiring
In our case the bump sensor was a simple single-throw switch. This
means that the top of the resistor needs to be plugged into +5V on the
Qwerkbot. The common can then be wired directly to ground. Finally the
bottom of the resistor, also connected to ground is put into a digital
output. The way this circuit works is when we close the switch(hit
something), current flows through the resistor pulling the digital
input pin to ground, whereas when it's open no current is flowing so it
will show 5 volts. Of course you don't have to understand this to use
it, but it is because it can only be 5V or 0V that we can use the
Digital inputs.
Code!
Yes it's just that simple! Now you can use the code linked to below to monitor the
bump sensors. One or usually both will drop to 0 when you've crashed.
However, this code below only monitors the outputs, for a more useful way of
using this sensors be sure to check out my final project here.
BumpSensorDemo.h
Scott McCaffrey and Dave Touretzky
Last
modified: Thu May 13th 2008