Вы находитесь на странице: 1из 6

Instructions and Assembly Guide

The invisible instrument is a relatively simply device, used to trigger up to four sounds at
a time on a PC. It uses a PIC microcontroller to create a USB/generic HID device to
control some bespoke software that is used to play the sounds.

Each input on the microcontroller is a simple voltage divider.


Two resistors are connected in series and the voltage at the “join” is taken into one of
the analogue pins on the microcontroller.

A voltage divider works by splitting the


voltage in the same ratio as the resistors. The
actual values of the resistors is not important,
it is the ratio between them that changes the
output voltage.

For example, R1=1K, R2=1K


Voltage ratio = (1K/2K) = ½
This is also true for 400ohm and 800 ohm
resistors, 500K and 1M resistors and so on.

By replacing one of the resistors with a light dependent resistor (LDR) so that the ratio
between the resistors changes depending on light conditions, we can generate a varying
voltage which is related to the amount of light being received.

In this example, as more light hits the LDR, the


resistance goes down. As the resistance of the top
resistor falls, the voltage out rises.

Assume the bottom resistor has a value of 1K.


In darkness, the LDR has high resistance, say 2K.
The output voltage is (1K/3K) = 1/3 * 5V (1.7V)

In bright light the LDR has low resistance, say 100ohm.


The output voltage is (1000/1100) = 0. 9 * 5V = 4.54V
Instructions and Assembly Guide

This set-up works well, even in moderate light conditions, but there are some caveats:
The value being read onto the input pin can “drift” causing the value to change by one or
two over time, even when the light level is constant (this is a limitation of the analogue-
to-digital convertor on the microcontroller).

To make our device stable and to avoid “false triggers” we use a threshold value to
determine whether a change has occurred. Only when the light level changes (causing
the voltage on the input pin to change) by a certain amount (let’s say 0.1V) do we take
the reading as an accurate value.

In bright light, the LDR resistance is low When a shadow is introduced, the
and so the output voltage is high resistance in the LDR increases so the
output voltage drops

By how much the voltage drops depends on the type or rating of the LDR.
Remember that it is not the actual value that is important, but the ratio between the
two resistances that varies the voltage. So an LDR that is rated at 200K in darkness and
100ohms in bright light may sound ideal, because it has a wide range of values, but it
won’t necessarily work if the resistor at the bottom isn’t matched to it.
Instructions and Assembly Guide

Also remember that although different LDRs (light dependent resistors) can have
different minimum and maximum values, it is the range somewhere in the middle that
we’ll be working with – in ambient light, sometimes with and sometimes without a
shadow. You will need to change the value of the bottom resistor depending on the
sensitivity of your LDR and the light conditions you’re working in.

So now we need to have one resistance for bright working conditions, and one for darker
– since it’s effectively the difference in ambient light that we’ll be detecting.
The easiest way to introduce variable resistance is by using a potentiometer.

If we replace the bottom (fixed) resistor with a potentiometer (variable voltage) we can
“tune” the device to work in whatever light conditions we find ourselves in!

This circuit will form the basis of our


light detection inputs.

We can read the VOUT value and alter


the bottom (variable) resistance to
match the light conditions that we’re
working in.

In moderately lit room with overhead


lighting this device works well with a
100K resistor. In bright sunlight, because
the top resistance still remains relatively
high, even when a shadow is present, a
1M resistor is required to get workable
readings.

A potentiometer allows us to change the value of the bottom resistor to match the
lighting conditions we’re working in

Now we have a way of generating a variable voltage depending on light conditions, we


just need a way of collecting this data and sending back to our PC (which will host and
play the sounds to give the instrument effect).

For this project we’re using a PIC 18F2455 because we’re already familiar with it’s
functionality and it has built-in USB support so no extra hardware will be required to
communicate with the PC.
Instructions and Assembly Guide

The schematic below shows how the LDRs and potentiometers can be arranged, using a
PIC18F2455 as the microcontroller. This particular controller has analogue-to-digital pins
on PORTA (pins RA0, RA1, RA2, RA3)

Also included on this diagram are some LEDs which can be turned on and off to display
the current “state” of the device (i.e. which inputs have recognised a drop in light
source, representing the presence of a shadow)

These LEDs are not included in the BuildBrighton kit as they are optional (the device
works without them) but can be added easily at a later date. As you can see, there are
many free pins on the microcontroller – these can be used for additional functions in
future developments.
Instructions and Assembly Guide

Below is a diagram showing the PCB (as shown from the bottom, left) and the component
layout (from above, right). You should be able to use these as a guide for assembling your
Invisible Instrument Kit. The microcontroller should be supplied ready-programmed and
although it can be soldered directly to the board, it is common practice to use a DIP chip-
socket. Solder the chip socket to the PCB, then push the microcontroller into the socket.
This allows the microcontroller to be removed and re-programmed for future
development.

Note that most microchips have a small circle in the top left-hand corner, indicating
pin1. Most “DIP style” chips (long thin ones with spider-legs) also have a small semi-circle
moulded into the casing. This indicates the “top” of the chip.
Instructions and Assembly Guide

After assembling the PCB and testing that the device shows up as a USB device on your
PC, the last thing to do is to remove any “cross talk” between the sensors.

Because each LDR responds to the total amount of light it receives rather than the
direction of the light, we need to introduce a way of “funnelling” the light onto the
sensor. A simple way to do this is to use a darkened tube over each LDR.

When using a darkened tube, each LDR can only “see” a small section of the ambient
light around it. We can trigger “hits” on the device by casting a shadow over the opening
of each of these tubes. A video of this working simple prototype can be seen on YouTube
http://www.youtube.com/watch?v=HMBmudFf_H0

Вам также может понравиться