build bright on invisible instrument

Upload: chrisholden2495

Post on 08-Apr-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 Build Bright On Invisible Instrument

    1/6

    Instructions and Assembly Guide

    The invisible instrument is a relatively simply device, used to trigger up to four sounds ata time on a PC. It uses a PIC microcontroller to create a USB/generic HID device tocontrol 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 ofthe analogue pins on the microcontroller.

    A voltage divider works by splitting thevoltage in the same ratio as the resistors. Theactual values of the resistors is not important,it is the ratio between them that changes theoutput voltage.

    For example, R1=1K, R2=1KVoltage 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 ratiobetween the resistors changes depending on light conditions, we can generate a varyingvoltage which is related to the amount of light being received.

    In this example, as more light hits the LDR, theresistance goes down. As the resistance of the topresistor 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

  • 8/6/2019 Build Bright On Invisible Instrument

    2/6

    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 ortwo 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 todetermine whether a change has occurred. Only when the light level changes (causingthe voltage on the input pin to change) by a certain amount (lets say 0.1V) do we takethe reading as an accurate value.

    In bright light, the LDR resistance is lowand so the output voltage is high

    When a shadow is introduced, theresistance in the LDR increases so theoutput 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 thetwo resistances that varies the voltage. So an LDR that is rated at 200K in darkness and100ohms in bright light may sound ideal, because it has a wide range of values, but it

    wont necessarily work if the resistor at the bottom isnt matched to it.

  • 8/6/2019 Build Bright On Invisible Instrument

    3/6

    Instructions and Assembly Guide

    Also remember that although different LDRs (light dependent resistors) can havedifferent minimum and maximum values, it is the range somewhere in the middle thatwell be working with in ambient light, sometimes with and sometimes without ashadow. You will need to change the value of the bottom resistor depending on thesensitivity of your LDR andthe light conditions youre working in.

    So now we need to have one resistance for bright working conditions, and one for darker since its effectively the difference in ambient light that well 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 cantune the device to work in whatever light conditions we find ourselves in!

    This circuit will form the basis of ourlight detection inputs.

    We can read the VOUT value and alterthe bottom (variable) resistance to

    match the light conditions that wereworking in.

    In moderately lit room with overheadlighting this device works well with a100K resistor. In bright sunlight, becausethe top resistance still remains relativelyhigh, even when a shadow is present, a1M resistor is required to get workablereadings.

    A potentiometer allows us to change the value of the bottom resistor to match thelighting conditions were working in

    Now we have a way of generating a variable voltage depending on light conditions, wejust need a way of collecting this data and sending back to our PC (which will host andplay the sounds to give the instrument effect).

    For this project were using a PIC 18F2455 because were already familiar with itsfunctionality and it has built-in USB support so no extra hardware will be required tocommunicate with the PC.

  • 8/6/2019 Build Bright On Invisible Instrument

    4/6

    Instructions and Assembly Guide

    The schematic below shows how the LDRs and potentiometers can be arranged, using aPIC18F2455 as the microcontroller. This particular controller has analogue-to-digital pinson 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 lightsource, representing the presence of a shadow)

    These LEDs are not included in the BuildBrighton kit as they are optional (the deviceworks without them) but can be added easily at a later date. As you can see, there aremany free pins on the microcontroller these can be used for additional functions in

    future developments.

  • 8/6/2019 Build Bright On Invisible Instrument

    5/6

    Instructions and Assembly Guide

    Below is a diagram showing the PCB (as shown from the bottom, left) and the componentlayout (from above, right). You should be able to use these as a guide for assembling yourInvisible Instrument Kit. The microcontroller should be supplied ready-programmed andalthough 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 futuredevelopment.

    Note that most microchips have a small circle in the top left-hand corner, indicatingpin1. Most DIP style chips (long thin ones with spider-legs) also have a small semi-circlemoulded into the casing. This indicates the top of the chip.

  • 8/6/2019 Build Bright On Invisible Instrument

    6/6

    Instructions and Assembly Guide

    After assembling the PCB and testing that the device shows up as a USB device on yourPC, 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 thedirection of the light, we need to introduce a way of funnelling the light onto thesensor. 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 openingof each of these tubes. A video of this working simple prototype can be seen on YouTubehttp://www.youtube.com/watch?v=HMBmudFf_H0