Wednesday 5 September 2012

Circuit Diagram Of Swimming Pool Alarm~(WEEK 4)

In this circuit diagram,there are the pressure sensor, an instrumentation amplifier and a PIC microcontroller, plus associated switches, LEDs and other components.Sensor 1 has differential outputs at pins 2 and 4. With the same pressure at both ports, pins 2 and 4 are nominally at the same voltage; ie, 2.5V. If the pressure at port 1 increases compared to port 2, pin 2 rises and pin 4 falls. The change in voltage is quite small – around 1mV for a 1kPa pressure difference. However, the actual voltage change with typical wave movement is only around 200mV,so we need to amplify this signal using instrumentation amplifier IC1.Since we are concerned with wave movements (pressure variations) rather than the absolute pressure levels, the output from the sensor is AC-coupled via 1mF non-polarised capacitors to op amps IC1a and IC1b. The non-inverting inputs of IC1a and IC1b (pins 3 and 5 respectively) are biased via 470kW resistors to a +2.5V reference, derived using two 2.2kW resistors and a 100mF capacitor.IC1a and IC1b are set up as non inverting amplifiers with 39kW feedback resistors and a single 10W resistor between their inverting inputs. A 470pF capacitor across the 39kW resistors rolls off signals above about 8.7kHz, and this prevents possible oscillation. The gains of IC1a and IC1b are each 1 + 39kW/10W, or close enough to 3900.The outputs of IC1a and IC1b are summed in differential amplifier IC1c, which effectively adds the two outputs together. IC1c’s gain is 2 × 27kW/22kW, or 2.45 (for the two outputs), so the overall gain is 3900 × 2.45 or 9555.


Rain Filtering:

IC1c’s output is filtered using a 2.2kW resistor and a 10mF capacitor to remove high-frequency signals above 7.2Hz. This prevents alarm triggering due to the detection of rain falling on the pool. IC1c also shifts the DC level of the output signal. This is done by feeding it with an offset voltage from IC1d, viathe 27kW resistor from pin 14. IC1d obtains its reference voltage from a pulse width modulated (PWM) signal from PIC micro IC2. This signal swings from 0V to 5V at a frequency of 490Hz, and has a duty cycle of about
50%. The PWM signal is filtered using a 220kW resistor and a 10mF capacitor, and is fed to pin 12 of IC1d. The PWM signal is adjusted automatically during calibration so that IC1c’s output is at 2.5V when there is no signal from Sensor 1.

Microcontroller:

The PIC16F88-I/P microcontroller (IC2) processes the signal from IC1c and drives the alarm and the Hold, Status and Alarm LEDs. IC2 also monitors inputs at RB1, RB2 and RB3 for the switches, the linking options at RA2, the RB4 to RB7 inputs for BCD1 and the voltage at the wiper of trimpot VR1. Output RA7 drives the flashing Alarm LED, while output RA6 drives transistors Q1 and Q2, which are the siren drivers. Trimpot VR1 is monitored by the AN4 input and its wiper voltage is converted to a digital value from 0 to 255 for its 0V to 5V range, to give a timeout period in minutes. This value is placed in a counter that is decremented every 1.18s until it reaches zero and the alarm goes off. Hold switch S1 connects to the RB3 input, which is normally held high (+5V) via an internal pull-up resistor. When S1 closes, IC2 responds by altering the mode from Hold to Monitor, or from Monitor to Hold. Output RA1 drives the Hold LED via a 1kW resistor. Output RA0 drives Status LED 2 via a 1kW resistor. LED2 lights during the quiescent set and Alarm set procedures. If LED2 is flashing, it indicates levels that are over the quiescent setting. Switches S2 (Quiescent Set) and S3 (Alarm Set) are monitored by the RB1and RB2 inputs. Pressing S2 or S3 starts
the program in IC2. This monitors the AN3 input and calculates the voltage range encountered for a period of 10s. It does this by monitoring the AN3 input every 100ms and storing the level in memory. After sampling for 10s,it finds the minimum and maximum values and subtracts the minimum from the maximum to derive the span range. This value is then multiplied by 95% for the Alarm level, and 105% for the Quiescent level. The lower alarm level provides for a small amount of leeway in pool movement to sound the alarm. The higher quiescent setting of 105% is so that the quiescent level for the pool will normally be less than this. The resulting values are then used to check for quiescent or alarm levels at the AN3 input. Whether or not to return to Hold from monitoring is selected with the linking at input RA2. RA2 is pulled high with the link in LK2 position and low with the link in LK1. Rotary switch BCD1 selects the monitor return period. When BCD1 is in position 0, all the switches are open and the RB4 to RB7 inputs are pulled high via internal pull-up resistors. This setting is for a ‘no-return to monitoring’ from hold. Other settings of the BCD switch will pull at least one of the RB4-RB7 lines to ground via its common pin, and select a time period.


PWM Signal:

As already noted, the CCP1 output at IC2 pin 6 produces the PWM signal. It is initially preset so that the output of IC1c is nominally at +2.5V. However, because of manufacturing tolerances in IC1, the output could vary and so there is a setup (to set the output to 2.5V). Pressing switch S2 before power is applied to the circuit runs this procedure. The program within IC2 then adjusts the PWM percentage so that the reading at port AN3 is at +2.5V. This process takes about 60s. The new PWM value is then stored and used every time the pool alarm is powered up. IC2 operates at 500kHz using an internal oscillator, and is run from a 5V supply derived from regulator REG1.




2 comments:

  1. Is it possible that we can display that pressure on the LCD?I interfaced the MPX2100GP to a PIC16F877A for reading the pressure but I am not getting the good result because I have been unable to calculate the real pressure to display to the LCD,can you please help?Between the PIC and sensor I put the Differential amplifier with TL084.
    Differents output I am getting are,5.215V;5.215V and 5.826 at the last output which is connected to the analog input of PIC16F877A so how can I read the real pressure and display it on the screen.

    Thanks

    ReplyDelete
  2. Is it possible that we can display that pressure on the LCD?I interfaced the MPX2100GP to a PIC16F877A for reading the pressure but I am not getting the good result because I have been unable to calculate the real pressure to display to the LCD,can you please help?Between the PIC and sensor I put the Differential amplifier with TL084.
    Differents output I am getting are,5.215V;5.215V and 5.826 at the last output which is connected to the analog input of PIC16F877A so how can I read the real pressure and display it on the screen.

    Thanks

    ReplyDelete