The goal of this project was to create a simple light sensor that would detect whenever a certain amount of light was present. This output could be used to drive an LED or an input pin on the PIC32. To design the circuit I used the Eagle schematic editor. Eagle is made by CadSoft and is a powerful PCB CAD tool for designing PCB schematics and layouts. The Eagle light edition is provided free of charge to hobbyists and is powerful enough for most projects. In my case I only used the schematic portion of the software as I implemented the circuit on a breadboard instead of a PCB.
The circuit works by creating a voltage divider using the Photoresistor (R1) and a base resistance (R2). The output voltage of that circuit will be:
Vout = (R2/(R1+R2))*Vin
The inverter's switch-point (when it transitions from a logical 1 to a 0) is roughly half of VCC. Given this we know that the inverter will switch when R1 equals R2. We can select how much light will trigger the sensor by select the value of R2. The more light the Photoresistor receives, the lower its resistance, so a lower value of R2 means we need more light to trigger the sensor. In this schematic the output of the sensor is used to drive an NPN transistor so that a logical 0 will cause the LED to light up. The output of the inverter could just have easily been connected to one of the PIC32's input pins where software could react based on the input (with a logical 0 meaning that the sensor has triggered since we are using an inverter).
No comments:
Post a Comment