Hardware: Building a light bridge

Posted on December 10, 2011

0


[First draft, updated]

Basis

A light bridge in its simplest form is a light source and a light receptor. When the light source can no longer be “seen” by the receptor, the bridge is “broken”.

Light bridges are most common in shops where, when you enter, some kind of “ding dong” chime is activated.

Light bridge

What you can use it for

  1. Sensing movement in your house – Is there movement? How much? Can you correlate the data between multiple Light Bridges?
  2. Simple alarm system – Is there movement while you are away? Should there be? Who coult it be?
  3. Checking if the cat is still alive – This is what triggered this project in my case. Is the cat still alive? Is she still moving through the house on day 3, 4, 5 and 6 after we left?

Types of Light Bridges and which will be covered in this article

  1. Visible light- Covered in this article. The simplest form is using a bright visible light source, in our case bright LEDs, and an LDR. The LDR is a resistor sensitive for visible light. The more light falls on the surface of the light sensitive resistor, the less resistance it has. The problem with normal LEDS is that the light disperses. Meaning two things:
      1. Visible – At night it will light the envorinment
      2. Loss – A lot of light is “lost” as it does not reach the LDR but is shone upon the surroundings
  2. Laser light – Not covered in this article (yet). Laser light is a focused bundle of light, with a minimal dispersion. This means that most of the light from the LED will reach the LDR and that it will be less visible at night.
  3. Infrared light – Covered in this article. To cut all visible light, you can move to using infrared LEDs and an infrared receiver

Reliability

  1. Derived information – What you sense is derived information. In most cases, when the Light Bridge is broken, this is due to someone moving through it / blocking the light source.
  2. Assumption – When the light sensor “senses” something, we assume it is someone or something moving through the light beam, blocking the light. In reality, anything might have happened.
  3. Broken Light Source – When the Light Source breaks, no light, or not enough light reaches the sensor and the Light Sensor will register “Activity”. What really happens is that the Light Source is broken
  4. Too much light: does not measure “activity” – This is specific for the solution using an LDR. When the environment is saturated with light, the light sensor might never register “activity” as – even without the Light Source, the LDR registers enough environmental light to conduct
  5. Your components – Your components might be of bad quality, leading to an early death under normal circumstances
  6. My schematics – I might have made a mistake in my calculations, leading to too much current running through components that can only stand a fraction of that and thus die before their real time is due (which is in most cases after more than 30 years of constant operation)

Related articles

  1. Building a Wireless State Bridge – [To be written] As we might want multiple Light Bridges around the location, wires become tedious at a certain point and Wireless is one way to go. Where you can use sophisticated solutions like XBee and Pololu Wixels (described in the article) you can also save a lot of mony by a Do It yourself solution
  2. Programming your Arduinoto to act as an IO board – [To be written] If your real processing is done on a computer, you might want to use your Arduino device simply as a IO board, passing all readouts from all Input-pins directly to your computer

Basic workings of the Light Bridge

Light Bridge block diagram

The light bridge consists of two parts:

  1. The light source (a) – Which is either a bright LED, a Laser LED or an Infrared LED
  2. The light sensor (b) – Which receives the light and will change state based on:
    1. Recieving light – Meaning that everything is OK and nothing is happening
    2. Not receiving light – Which means that something is blocking the light source and something is happening

The output of the Light Sensor reflects the “state” of our Light Bridge, which is “low” when all is well and “high” when something blocks the light source.

Passing data to your processor: using a Wired and wireless State Bridge

Using a wired and wireless State Bridge
  1. Wired State Bridge – Means that we will run wires from the Light bridge to the device that will take that state and act upon it (either a electronic chime or something else)
  2. Wireless State Bridge – Means that we will use a radio transmitter to broadcast the state – in this case – “broken” – over the air
  3. State Processor – Your PC, laptop, netbook or Android device, linked to an Arduino, Android IOIO or similar IO board

Wireless State Bridge

As our base-station responding on anything passing the Light Bridge will be on another location, we will use a wireless State bridge, which can be an existing solution based on – for instance – a wirless doorbell, or something you build yourself. Both solutions for a Wireless State Bridge will be explained in a separate article here [to be written].

States – and what it means

In any process-technology, including electronics and informatics, we talk about a “state” when something can be two things or more.

For instance, the base-states of a fridge can be: “empty”, “full”, “clean”, “dirty”, “open”, “closed”, “cooling” and “not cooling” and any shade in between.

As discussed the Light bridge has two states: “no activity” and “activity sensed” which is derived from “light is hitting our sensor, so we assume all is well” and “no light is hitting our sesor, so we assume something is blocking the path and activity is sensed”.

We respond and want to respond on activity, which is the “up” part of the little icon we use for state.

In the schematic below, you will find a solution that connects module MOD1 to GND, using T2 as a “power switch”, allowing current to flow through that module when the Light Bridge is broken.

1: The LDR Light Bridge

The LDR Light bridge is the most simple Light Bridge to start with.

In this example we use a 12 Volt schematics, but with some minor adjustmens (different values for the resistors) you can make it into a 5 Volt Light Bridge. The main reasons why you might want to do that are:

  1. Lower costs for power supply – 5 Volt phone chargers are in principle sufficient to power this Light Bridge.
  2. Arduino – Arduino has a 12Volt Power in, but actually runs on 5 Volt. When connecte to a USB, 5 Volt is all you get
It uses 2 Transistors, 3 Resistors, a LDR, a Potentiometer (variable Resistor) and 3 LEDs of which 2 are bright white LEDs you find in LED flashlights and the likes.

I focused on simplicity before anything and building this schematic for the first time should be possible in one hour.

When you are done building and testing the Light Bridge, please take care

1.1: Schematics of a simple 12 Volt LDR Light Bridge

Schematics of a simple Light Bridge (click to enlarge)

This light bridge uses only two transistors, 4 resistors and a potentiometer / variable resistor to do all the work.

It will switch any connected module “on” by pulling M3 down / closing the circuit to the GND when the Light Source is no longer registered by the Light Sensor.

Choice of parts

I choose parts which are most common, and will not be in your way when you buy them due to obscurity.

In my case I am using the parts in standard “200 Resistor/Capacitor/Transistor/Diode” packages provided by Velleman, but similar packages are sold by DIY electronics parties in the likes of Velleman and Radio Shack.

Labelling

  1. Ω, k and  – Represents the resistance measured in Ohm and kilo-Ohms. For example: 1k or 1kΩ is 1000 Ohm

Parts list and role of each part

  1. R1: 1kΩ – This resistor reduces the current to below 10 milli Ampere. As the maximum current for each diode is 20 milli Ampere, it will assure a long livity for your diodes
  2. LDR1 – A run of the mill LDR. This is a Light Sensitive Resistor and the centerpiece of this design
  3. R2: 50 kΩ potentiometer – You use this potentiometer to set the sensitivity of the Sensor. Together with the LDR this potentiometer basically forms a voltage divider. As the resistance increases on the LDR when light reduces, the potentiometer will “pull down” the voltage level on the Basis of the trnasistor to the point where it will stop conducting current between Emitter and Collector, thus switching “open”
  4. T1: BC457B – An NPN transistor, used to amplify or multiply the voltage differences created between the LDR and the potentiometer. A slight change in Voltage on the Basis is multiplied/amplified between Collector and Emitter of T1
  5. R3: 400kΩ – This resistor “pulls up” the voltage on the Collector of T1 and reduces the current-flow through the Basis of T2
  6. T2: BC337B – An NPN transistor like the BC547 but with a larger allowed current throughput. Where the BC547 only allows to a maximum of 0.2 Ampere, the BC337 allows for 0.8 Ampere. We connected the Basis to the Collector of T1, using the “pull up” to switch T2 “on” and “off”. This way we reverse the state of the first part of our Sensor, which is “on” when it registers light and “off” when it registers no light
  7. LED3: red or green indicator LED – This is your indicator of the registered State. It will help you to fine-tune the Light Sensor. It should be on when no light is registered and off when light is registered by the Sensor
  8. R4: 2k2Ω – This resistor limits the current running through the LED to below 10 milli Ampere
  9. D1: 1N4007 – This Diode pulls up the voltage level of the Emitter of T2 to 0,6 Volts. As the Collector of T1 never really is pulled to 0 Volts we use this Diode to raise the Basis of T2 above that level so that for T2 it is. The 1N4007 is a general purpose and  allows for 1A of current flowing through, so it will be

1.2: Building the 12 Volt LDR Light Bridge

Layout of the Light Bridge (click to enlarge)

Board

Use a experimentation board with 3 holes per copper strip. As you will be working with Transistors, you will have several junctions with 3 components.

Color coding

I color-coded the copper strips for easy reference and “paper debugging” of the schematics/layout. The color-coded strips mark the  copper strips you will use to solder the components. The view is top-down (top side of the board). Additionally I inserted a Bottom view.

The coding is as follows:

  1. Red – Is the 12V power line. All red copper strips should be connected to each other
  2. Blue – are all other connections or junctions “in between”. These are not necessaraly connected to other strips (and in most cases not)
  3. Dark grey – Is the GND. All dark grey copper strips should be connected to each other

Connected strips

In the drawing you will find red, green and dark grey strips connected. You can do this simply by using one of the wires of your components to bridge the gap between the copper strips.

1: The light source

The light source is a very simple schematic and can be done on 4 strips of copper.

Connect the 12V and GND to the circuit board of the Light Sensor to power it from the same source: to save you another Power adapter. Make sure the connecting wire is at least 40 centimeters longer than your opening is wide.

Some points of attention:

  1. LED1 and LED2 – Make sure the “flat side” of the LEDs point in the right direction. What helps to double-check is to associate the flat side with the GND / Volt Minus pole

2: The Light Sensor

The Light Sensor board will have three wires going out:

  1. To your Power Source – In most cases this is to a plug you can use to plug in any 12 V power plug
  2. To the Light Source – To power your two LEDs
  3. To the Module – Which you will power when the Light Bridge is broken

Some points of attention:

  1. LED3 – Make sure LED3 has the “flat side” of the ring pointing down, as that is the flow of power through it. If you connect it the other way around, it will simply block and not light up.
  2. R2 – R2 is only connected with two points. The third connector of R2 is not used
  3. T1 and T2 – Make sure you mount them in the right position, flat face pointing towards the LDR. If you switch the transistor (and connect it the wrong way around) it will be dead the moment you power your circuit
  4. Wire1 – Wired 1 runs on the under-side of the board, to connect the copper strips that provide 12V (red) to your different components
  5. LDR1, pin 2 – Connect the copper strip of LDR1, pin 2 to the copper strip that holds the Basis of T1

1.3: Shielding the sensor and building a casing

As the LDR is very senstive to any light source, you want to take extra care of shielding out any other source but your own Light Source.The simplest way to do this is by building a “tunnel” in which the LDR is deep in shadows and the only light that can reach it is the one from your Light Source.

I found that the tunnel between the LDR and the outside world ideally is 10 centimeters deep.

Depending on where your light is coming from, you need to do some experiments on what is the most ideal setup.

1.4: Understanding the LDR Light Bridge

Understanding the Light Bridge (click to enlarge)

  1. State 1: Light on sensor – When the LDR in our Light Sensor receives light from any source, its resistance value will drop, “pulling” the Voltage “up” at the junction point where the Basis of T1 is connected
    1. T1 “closes” the “connection” between Collector/Emitter – Due to the raise of voltage on the Basis of T1, the Collector/Emitter will start to conduct, “closing” the circuit it is part of
    2. T2 “opens” – As T1 has pulled down the Voltage on its Collector (see Measure point M2), the Basis of T2 is pulled down was well, preventing T2 to “close” between Collector and Emitter
    3. MOD1 is not connected to the GND – As T2 is “open”, MOD1 is not connected to the GND and for MOD1 it is as if the power switch is set to “off”
  2. State 2: No light on sensor (“dark”) – When the light source is blocked, the LDR no longer receives light and its resistance value will go up to “infinity”, leading to a drop of voltage on the Basis of T1 as it is “pulled down” by Potentiometer R1
    1. T1 “opens” the connection between Collector/Emitter – Due to the drop of voltage on the Basis of T1, the Collector/Emitter will stop to conduct, “opening” the circuit it is part of
    2. T2 “closes” – As T1 opens, the resistor R3 will “pull up” the Basis of T2, allowing it to “close” the connection between Collector/Emitter and pulling Collector down to GND
    3. MOD1 is connected to the GND – Via the now “closed” connection between GND and the “GND” provided to the Module, MOD1 now receives 12 Volt power and will start doing whatever it is designed for

Recalculating the resistors for different voltages

This circuit is designed for 12Volts, but 12Volts might not be the smartest choice.

5 Volt

5 Volt might be your most conveniant choice as 5 Volt power supplies (the ones to charge your mobile phones) are almost half the price of 12 Volts power supplies (6 euro for a 5V phone charger compared to 12 Euro for a 12 Volt transformer).

For 5 Volt, we roughly reduce the resistance by 2 or 3. This might not be the most scientific approach, but for this kind of circuits precision is not really required, so as long as you do not blow up your components, you are fine.

  1. R1: 220 Ω – Each LDR takes about 1.4 Volts. Added up (as they are in serial) this is 2.8 Volts. The remaining Voltage is 5 Volt – 2.8 Volt = 2.2 Volt. As we allow roughly 10 mA to pass, we divide the remaining Voltage by 0.01 (10 milli) which gives us: 2.2V / 0.01A = 220 Ω
  2. LDR1 – Unchanged
  3. R2: 50 kΩ potentiometer – Unchanged
  4. T1: BC457B – Unchanged
  5. R3: 100kΩ – We roughly divide it by two, keeping the maximum current through Basis Emitter around 50 micro-Ampere and well below the threshold where you will kill T2
  6. T2: BC337B – Unchanged
  7. LED3: red or green indicator LED – Unchanged
  8. R4: 1kΩ – This resistor limits the current running through the LED well below 10 milli Ampere
  9. D1: 1N4007 – Unchanged

2: Schematics for the Infrared Light Bridge

[To be added]

About these ads