Sensors
Sensors are very interesting components to integrate
with
a BS2. Most sensors come with a datasheet that explains how to interface
them to µcontrollers. It is essential that you carefully go through
their datasheet.
Sensors output information in many different ways.
They often simply act as a switch, other times they will give you a
range of data (variable resistivity or a variable voltage). Other interesting
sensors send a form of digital signal that they 'pulse' over time. The
width of the pulse on a timeline will correspond to a specefic sensed
value. This type of I/O is called 'pulse width modulation', or PWM.
SWITCH SENSORS
Mercury switch
A mercury switch is a simple switch that opens or closes a circuit depending
on its orientation in space.

Touch sensor
This is a more complicated sensor. It consists of an IC that sends a
signal when someone touches a lightly charged surface. It can be used
to monitor the contact of two conductive objects or the close presence
of someone. It can also serve as a 'hard' switch to turn lights on and
off for example. Quantum
Research Group has a nice selection of cheap touch sensors.

PIR infrared motion sensor
This type of sensor will sense infrared motion and open or close a circuit
accordingly. HVWTech
sells a PIR mounted on a Fresnel lens that is very sensitive to human
presence.
Digital compass
A digital compass is capable of detecting the earth's weak magnetic
field. It can distinguish between the cardinal points and will close
a part of the circuit formed by its 12 pins depending of the cardinal
point it senses.
Imagesco has one that can distinguish between the four cardinal
points and also the intermediate directions (NE, NW, SE, SW).
Piezoelectric switch
A piezo film is a stripe that generates voltage when you bend it back
and forth. It can be seen as a vibration sensor. The problem with those
sensors is that it is hard to interface them to a BS2 due to the nature
of the output. Someone came up with this addon to a piezo film that
simply opens or closes a circuit when it senses vibration. Imagesco
sells 2 types of piezo switches: the PZ-05 and the PZ-05-R. By tapping
on the end cantilever of the PZ-05, a digital pulse is generated. The
PZ-05-R has the reverse effect; a pulse is generated by a pulling force

VARIABLE RESISTANCE SENSORS
The sensors that generate a variable resistance are
very easy to interface to a BS2. You can digitize the signal in a simple
circuit consisting of a resistor and a capacitor. See 'Flashing LEDs
with a Potentiometer' in the 'Examples' section of the workshop for
a detailled diagram.
Flex sensor
A flex sensor is a kind of rehostat. It is a long stripe that you can
bend. When you bend it, its resistivity changes lineraly. This is what
Nintendo used in the Power Glove back in the days. Brand new, they are
around 10$ a piece. You can get a Power Glove on eBay for the same price
and it contains 5 flex sensors...
Photoresistor
A photoresistor is also a variable resistor. Its resistivity varies
with the intensity of light it is exposed to.
Thermsistor
A thermistor changes resistivity depending on the ambient temperature.
Force sensor
A force sensor outputs a varying resistance that is proportional to
the force applied to the button on the top of the device. The resistance
can then used to estimate force (or weight). HVWTech
sells the IESP-12 that can take up to 4 Kg of force.
Toxic gas sensor
A toxic gas sensor responds to a large number of airborne toxic compounds.
Its most suitable application is for a gas leak alarm or automatic ventilator
control. Its resistivity decreases with the amount of gas in its environment.
Imagesco
sells one that has a very low sensitivity to "noise gasses"
which considerably reduces the problem of false alarming.

PULSE WIDTH MODULATION SENSORS
PWM sensors send a stream of information to the BS2
by pulsing the voltage over time. The BS2 reads it using the 'PULSIN'
command.
Accelerometer
An accelerometer is an integrated chip that measures the acceleration
in space. It can also serve as a level (to know the orientation of something
in space). Many accelerometers do not use PWM so be careful when you
buy them. HVWTech
sells one that comes with a very complete datasheet and examples on
how to easily interface it to the BS2. You can also order free samples
from Analog
Devices, but you will have to do some dirty soldering before you
can use them.

Ultrasonic range finder
This sensor measures its distance form any object in front of it.

|