In the meantime, I have installed the fan monitor in its real environment, and - big surprise - it works .
The attached schematic shows the main components of the fan monitor that I have built using the SX comparator.
Here is how it works in principle:
At startup, relay K1 will be activated via RA.2 and the driver transistor, and apply power to the fan. To avoid that the fan motor's starting current immediately causes an over-current situation, monitoring begins after a delay of approximately three seconds.
The fan motor is in series with the low voltage coil of a small transformer. The other coil feeds into a voltage divider (R1/R2), followed by a rectifier, and potentiometer R3. The voltage divider dimensioning depends on the type of transformer used. It should be adjusted for a voltage of approx. 5 V across R3 at normal fan operation. C1 filters the ripple on the signal at R3's wiper, and D1 protects the SX inputs against voltages above 5.1 V.
The voltage between R3's wiper and Vss should be adjusted to about 2.5 V at normal operation of the fan. This voltage will increase, when the fan's power consumption increases, and vice versa. As I'll explain later, you will not need a voltmeter to make this adjustment. This signal is fed into the SX pins RB.1 (one comparator input), and RB.3 as well (why? I'll explain this later too).
As this monitoring device shall react on over-current situations (fan is blocked by some reason), and under-current situations (fan coil is broken, or air outlet is blocked), the device must compare the voltage at RB.1 against two different reference voltages - a higher one for over-current, and a lower one for under-current situations.
The two potentiometers R7 and R8 are used to adjust the two reference voltages. While the monitor operates, it periodically toggles between R7 (RC.1 high, RC.0 high-Z = input) for the low reference voltage, and R8 (RC.1 high-Z = input, RC.0 high) for the high reference every half second. The voltages at the two potentiometer wipers are fed through D3 and D4 into RB.2, the other comparator input. The diodes are necessary to block reverse current into the non-active potentiometer. R6 is necessary to discharge the higher voltage from RB.2 when the lower reference voltage is turned on because RB.2 has such a high input impedance that it would take too long until the reference voltage settles down to the lower value.
LD1 and LD2 are used to indicate the current status of the monitor. When the fan operates normally, LD1 (green) blinks at about 1 Hz, and LD2 (red) is off. In case of a failure, LD1 turns off, and LD2 either blinks (under-current), or remains on (over-current). When an over-current situation is detected, also relay K1 is de-activated in order to turn off the fan, as it might over-heat in this case. In both error situations, the beeper is periodically turned on and off via RA.3.
In order to let the user adjust the monitor to the characteristics of the fan to be monitored, four steps are required:
First, R7 is adjusted to the lowest (0 V), and R8 is adjusted to the highest voltage (5 V). This means, the monitor practically does no longer detect over/under current situations.
Next, R3 should be adjusted so that the voltage at RB.1 (and RB.3) is about 2.5 V when the fan operates normally. Here comes the trick: RB.3's LVL bit is set to CMOS, i.e. its threshold is at about Vcc/2 which is about 2.5 V. Now, when the user turns R3 in a direction where the voltage at RB.3 goes below 2.5V, the logical level at RB.3 goes low, and the software will stop blinking LD1, and turn it on steadily. This indicates the user that the "middle value" has been reached. The user should then turn R3 slightly in the opposite direction until LD1 starts blinking again.
In step three, the user turns R7 in the direction of higher voltages, until an under-current situation is detected, i.e. when the reference voltage becomes higher than the voltage at RB.1, and then slightly back to the opposite direction.
Similarly, R8 is turned in the direction of lower voltage, until an over-current situation is detected, i.e. when the reference voltage becomes lower than the voltage at RB.1, and then again slightly back to the opposote direction.
This completes the adjustement of the monitor without the need for any measuring equipment.
BTW, the three potentiometers are spindle trimmers to allow for fine adjustments.
The software does not automatically restart monitoring after a fault has been detected, and generates the error signal until the reset button is pressed.
As the device is not timing-critical at all, I run the SX with its internal RC clock at 4 MHz. The "real" monitor has a built-in power supply, another relay to turn on/off an external alarm light.
I think the SX comparator is a helpful, but often under-estimated internal peripheral, and I must admit that this was my first real application too where I have used it.
Comments
In the meantime, I have installed the fan monitor in its real environment, and - big surprise - it works .
The attached schematic shows the main components of the fan monitor that I have built using the SX comparator.
Here is how it works in principle:
At startup, relay K1 will be activated via RA.2 and the driver transistor, and apply power to the fan. To avoid that the fan motor's starting current immediately causes an over-current situation, monitoring begins after a delay of approximately three seconds.
The fan motor is in series with the low voltage coil of a small transformer. The other coil feeds into a voltage divider (R1/R2), followed by a rectifier, and potentiometer R3. The voltage divider dimensioning depends on the type of transformer used. It should be adjusted for a voltage of approx. 5 V across R3 at normal fan operation. C1 filters the ripple on the signal at R3's wiper, and D1 protects the SX inputs against voltages above 5.1 V.
The voltage between R3's wiper and Vss should be adjusted to about 2.5 V at normal operation of the fan. This voltage will increase, when the fan's power consumption increases, and vice versa. As I'll explain later, you will not need a voltmeter to make this adjustment. This signal is fed into the SX pins RB.1 (one comparator input), and RB.3 as well (why? I'll explain this later too).
As this monitoring device shall react on over-current situations (fan is blocked by some reason), and under-current situations (fan coil is broken, or air outlet is blocked), the device must compare the voltage at RB.1 against two different reference voltages - a higher one for over-current, and a lower one for under-current situations.
The two potentiometers R7 and R8 are used to adjust the two reference voltages. While the monitor operates, it periodically toggles between R7 (RC.1 high, RC.0 high-Z = input) for the low reference voltage, and R8 (RC.1 high-Z = input, RC.0 high) for the high reference every half second. The voltages at the two potentiometer wipers are fed through D3 and D4 into RB.2, the other comparator input. The diodes are necessary to block reverse current into the non-active potentiometer. R6 is necessary to discharge the higher voltage from RB.2 when the lower reference voltage is turned on because RB.2 has such a high input impedance that it would take too long until the reference voltage settles down to the lower value.
LD1 and LD2 are used to indicate the current status of the monitor. When the fan operates normally, LD1 (green) blinks at about 1 Hz, and LD2 (red) is off. In case of a failure, LD1 turns off, and LD2 either blinks (under-current), or remains on (over-current). When an over-current situation is detected, also relay K1 is de-activated in order to turn off the fan, as it might over-heat in this case. In both error situations, the beeper is periodically turned on and off via RA.3.
In order to let the user adjust the monitor to the characteristics of the fan to be monitored, four steps are required:
First, R7 is adjusted to the lowest (0 V), and R8 is adjusted to the highest voltage (5 V). This means, the monitor practically does no longer detect over/under current situations.
Next, R3 should be adjusted so that the voltage at RB.1 (and RB.3) is about 2.5 V when the fan operates normally. Here comes the trick: RB.3's LVL bit is set to CMOS, i.e. its threshold is at about Vcc/2 which is about 2.5 V. Now, when the user turns R3 in a direction where the voltage at RB.3 goes below 2.5V, the logical level at RB.3 goes low, and the software will stop blinking LD1, and turn it on steadily. This indicates the user that the "middle value" has been reached. The user should then turn R3 slightly in the opposite direction until LD1 starts blinking again.
In step three, the user turns R7 in the direction of higher voltages, until an under-current situation is detected, i.e. when the reference voltage becomes higher than the voltage at RB.1, and then slightly back to the opposite direction.
Similarly, R8 is turned in the direction of lower voltage, until an over-current situation is detected, i.e. when the reference voltage becomes lower than the voltage at RB.1, and then again slightly back to the opposote direction.
This completes the adjustement of the monitor without the need for any measuring equipment.
BTW, the three potentiometers are spindle trimmers to allow for fine adjustments.
The software does not automatically restart monitoring after a fault has been detected, and generates the error signal until the reset button is pressed.
As the device is not timing-critical at all, I run the SX with its internal RC clock at 4 MHz. The "real" monitor has a built-in power supply, another relay to turn on/off an external alarm light.
I think the SX comparator is a helpful, but often under-estimated internal peripheral, and I must admit that this was my first real application too where I have used it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G