The Drawer Alarm

1 Setting up sensors.

Learn It

  • Like many of the projects you have completed in the past, this one will use a GENIE C08 micro-controller.
  • GENIE chips can receive both analogue and digital signals.

Learn It

  • Digital signals are binary in nature.
  • There are many ways to describe the signal - On/Off, High/Low, 1/0.
  • Analogue signals vary over a range of values.

Try It

  • Let's build a simple circuit to try and get a GENIE chip to detect an analogue signal.
  • Use CircuitWizard to build the circuit shown below

analogueCirc1.png

  • This circuit has an LDR connected to the analogue input of the GENIE chip.
  • A light dependent resistor is a resistor that responds to light.
    • When light levels are high, the resistance is low.
    • When light levels are low, the resistance is high.
  • In theory we should be able to use the GENIE chip to detect light levels.
  • So that we can simulate the circuit, we need to give the GENIE chip a program.
  • Use this loop.

analogueCirc2.png

  • Micro-controllers can't detect resistances, they only read voltages. Let's have a look at the voltage drop between the input pin and ground for out circuit.
  • Recreate this circuit in CircuitWizard and have a look at the voltage differences that are generated when the light levels reaching the LDR are altered.

analogueCirc4.gif

  • As you can see, altering the light levels at the LDR has a minimal effect on the voltage at the pin. While we could use a setup like this, we'd have a very insensitive detector.

Learn It

  • There's a way to provide a larger voltage differential at the pin, by adding a single resistor to the circuit.
  • We're going to create something called a potential divider.
  • The visualisation below shows a standard set up for a potential divider. You can use the slider to alter the resistance of the LDR, and type in values for the resistor beneath it. Look at what happens to the voltage readings for Vout_.

Test It

  • Play around with the value of the resistor. We want a resistor value that is high enough to provide a reasonable voltage range, but not too high.

Badge It - Silver

  • Now you know how to set up an analogue sensor on the GENIE chip, use CircuitWizard to create a light sensor circuit.
  • We'll also need a switch connected to a digital input. You've done this before when you made the digital die. Have a look at this resource if you need reminding about digital inputs.
  • Once you've completed the inputs for the circuit, take a screenshot.

2 Setting up visual outputs

Try It

  • We're going to need a couple of LEDs (one red and one green) attached to the digital outputs of the GENIE chip.
  • Don't forget that LEDs are sensitive to large currents can can 'pop' if the current is too high. A couple of 330Ω resistors should be sufficient to protect them

Badge It - Gold

  • Create a flowchart program that causes the LEDs to alternately flash on and off when the light levels reaching the LDR are high.

Badge It - Platinum

  • Create a flowchart program that saves the current light level reaching the LDR in a variable, when the button is pushed.
  • The program should wait for a few seconds and then the LEDs should flash on and off if the light level goes above the recorded level.