Remote Freezer Alarm

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

Post Reply
User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Remote Freezer Alarm

Post by JohnCrow »

1.0 Introduction.

The purpose of this project is to develop a simple method of monitoring both the temperature and mains supply status of a freezer located for example in an outhouse.
It utilises the nRF24L01 RF transceiver to send the data between the remote sensor and main display located inside.
The power to the remote sensor board is fed from a Matrix PSU via a custom battery backup board; this allows the system to carry on working in the event of a mains failure.
It also allows the system to transmit to the receiver that the mains have failed.
Because the unit is remote, it may always be noted that the power has failed in the outhouse.
If a total power failure occurs, the display on the monitor system will go off.

2.0 Equipment Required.

Most of the hardware required is supplied by Matrix TSL
2 x EB006 Programmers (16F1937).
2 x Matrix PSUs.
1 xEB005 LCD Displays (Transmitter)
1 x 4x20 custom LCD Display (Receiver)
2 x EB016 Prototype Boards.
2 x nRF24L01 RF Boards.
2 x 9-PIN Ribbon Cables.
Various Male-Male Jumpers.
1 x PSU Change-Over Board - Described later
1 x PP3 Battery.

2.1 Temperature Sensor Assembly

This is build on the EB016 Proto-Board

1 x LM335Z Sensor.
1 x 1k8 Resistor.
1 x 10k0 Trimmer (Finger Type).
1 x 330R0 Resistor
1 x Red LED

3.0 Change Over Board.

3.1 Equipment Required

1 x SPCO Relay
1 x 1N4001 Diode
1 x RED LED
1 x Green LED
2 x 330R0 Resistors
2 x 1k0 Resistors
1 x 3 way Terminal Block
1 x 2 way Terminal Block
1 x Coax Power Terminal
1 x PP3 Battery Connector
1 x PP3 Battery

3.2 Description
The change over board consists of a single pole change over relay.
The NC contact is connected to the +ve terminal on the PP3 battery, and the NO contact is connected to the +ve from the Matrix PSU.

The power supply is also connected to one side of the relay coil.
The common output of the relay feeds the EB006.

All the commons are tied together.

When the power supply is working, the relay is energised and the 9V is fed to the EB006, switching off the battery.

If the power supply fails, the relay is de-energised, switching in the battery.

A pair of 1k0 resistors are connected in series between the PSU 9V line and ground.

This acts as a simple voltage divider. The centre tap (approximately 4.5V)is connected to the microcontroller. (Port E0)

This can be used to detect if the power fails.
By having the Matrix PSU plugged into the same socket as the unit being monitored, it can give warning that the power has failed.

Two LEDS are also present on the board.

Green : Lit when the PSU supply is present.

RED: Lit when a battery is connected to the board.

This system allows for the remote monitoring of the mains supply, without making a direct connection , which is unadvisable for the average user.

A suitably qualified user could build the change-over board inside an insulated enclosure with a suitable mains transformer, rather than using a Matrix PSU.

ChangeOver Board5.JPG
ChangeOver Board5.JPG (23.29 KiB) Viewed 5672 times
Power Change-Over Board Circuit Diagram.
ChangeOver Board.jpg
ChangeOver Board.jpg (68.65 KiB) Viewed 5672 times
Power Change-Over Board


4.0 Temperature Sensor.

This section is an explanation of the theory behind and the reason for selecting the LM335 device.

My earlier temperature projects have mostly used the LM35 type devices.

This is a 3 pin device in either a TO-92 or TO-202 style package.
The LM35 device comes in a few different versions and accuracies, but all operate with the same basic 10 mV/°C output.
The main problem with the LM35 is that without external signal conditioning circuitry it only reads positive temperatures.
This project uses the LM335 type device.
It comes in the same TO-92 package, but it has an output of 10mV/K
This allows it to read negative temperatures without any external signal conditioning, and it also means the temperature value transmitted to the main display board can be a positive integer, even when measuring a negative temperature.
The device selected here reads from -40°C to 100°C (233.15K to 373.15K)
The project itself only needs a basic accuracy. ± 2°C will be more than adequate.


K = Kelvin
This is the absolute thermodynamic temperature scale, where 0K = absolute zero = -273.15°C
It is not referred to as degrees Kelvin, as in degrees Celsius, but just Kelvin.
Under current understanding, absolute zero cannot be achieved, as at this temperature all molecular movement stops.
The National Physical Laboratory have realised a temperature of a few mili-kelvin above absolute zero with highly specialised equipment.
Therefore
0°C = 273.15 K
100°C = 373.15 K
The output from the device is converted to temperature as follows
Remember to use the floating point calculations in Flowcode and not the standard mathematical operators.
First Convert The ADC voltage to Kelvin (Read ADC as float)
Temp = fmul ( ADC_Voltage, 100)
Now convert to °C from Kelvin
Temp2 = fsub( Temp , 273.15)
Example ADC Voltage = 2.9818 V
Temp = 2.9818 * 100
Temp = 298.18K
Temp2 = Temp - 273.15
Temp2 = 298.18 - 273.15
Temp2 = 25.03°C
Temp2 is then converted to a string to be displayed on the LCD

An over temp LED is connected to Port E1
This will turn on once the temperature rises above -10°C.

The alarm decision is done by converting the measured Kelvin value to an integer (-10° = 263 K)this means there is no need to use negative values in the decision.
The loss of accuracy in the conversion is not critical.

Sensor Circuit.jpg
Sensor Circuit.jpg (39.95 KiB) Viewed 5672 times
LM335Z Connection Diagram

The variable resistor is used to calibrate the output.

Sensor Board.jpg
Sensor Board.jpg (97.52 KiB) Viewed 5670 times
Sensor Board

5.0 RF Board (nRF24L01) Connections.

The nRF24L01 is connected as below on both transmitter and receiver boards

Hardware Setting Channel 1
Port C2 CE
Port C3 SCK
Port C4 MIOS
Port C5 MOSI
Port C7 CSN

6.0 Remote Monitor.

This again has an nRF 24L01 RF Transceiver connected to Port C to receive the data from the remote sensor board.
The received data is displayed on a 4 x 20 LCD display.

Along with the remote temperature , the mains status and an over temperature alarm are displayed.

There is no feedback required to the remote sensor.

The temperature data is received as a 8-bit byte.
Because the temperature sent is in the order of -10°C (263 Kelvin) this is above the value that can be held in 8 bits, so prior to transmission, it has 100 subtracted from it.

Convert Received Temp To Float
Temp_Rx_F = int2float (Temp_Rx)

Add 100 (Removed prior to transmit from remote sensor)
Temp_Kelvin_F = fadd (Temp_Rx_F,100)

Convert back to Celsius
Temp_Celsius_F = fsub (Temp_Kelvin_F,273)

This is then converted to a string to display on the LCD.
Temp_Celsius_S = FloatToString$ (Temp_Celsius_F)

The display doesn’t show decimals as these are lost when converting to the integer to send remote sensor.

The Kelvin value is used in a decision to test if the value is above the alarm point.
Alarm = float2int (Temp_Kelvin_F)

Using a value of 263K (-10°C) a simple decision can be made

After receiving the temperature, the mains / battery status is sent as a 1 or 0 (1 = Mains Ok, 0 = Mains Failed).

Again a simple decision is used to indicated this.
Display Board.jpg
Display Board.jpg (122.44 KiB) Viewed 5670 times
Display Board
Alarm-Transmitter V7.fcfx
(14.77 KiB) Downloaded 496 times
Alarm-Receiver V7a.fcfx
(13.38 KiB) Downloaded 490 times
1 in 10 people understand binary, the other one doesn't !

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: Remote Freezer Alarm

Post by Steve001 »

Another good project john I always look forward to seeing and reading them

thanks for sharing

Steve
Success always occurs in private and failure in full view.

Post Reply