Environmental Monitor

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:

Environmental Monitor

Post by JohnCrow »

Environmental Monitor

Introduction:
This project is a 2 channel environmental monitor. It was spawned when I obtained the humidity sensor.
I have already used the LM35 type temperature sensors in previous projects
It can measure temperature and humidity.
Dew Point is also shown as a calculated value.
It also incorporates a real time clock and touch screen display.

Requirements:
01 x EB006 Programmer with 16F1939 PIC
01 x EB076 Touch Screen Display
01 x EB016 Proto-Board
01 x EB002 Screw Terminal Board
01 x Generic Twin Potential Divider Board
02 x Generic D-Plug Adaptor
12 x LED’s (3 Red, 3 Green, & 3 Orange)
12 x 560 R Resistors (For the above LEDs)
01 x LM35 Temperature Sensor (Or Similar)
01 x LinPicco A05 Humidity Sensor

Plus a selection of M-M & M-F jumper wires to connect the LED’s etc.

The EB076 is connected to Port D and uses the patch system. (Set to software)
D5 = Reset
D6 = TX
D7 = RX

Sensors:

Channel 1 (Local) - Connected to Port E

ADC5 = Humidity .
This is measured using a LinPicco A05 Basic sensor.
This has a DC output of 0 V to 5 V for 0%RH to 100%RH.
The output is measured from an ADC input as a voltage (Float) and then multiplied by 20 to give a direct reading in %RH


ADC6 = Temperature.

This is measured using a LM35CZ (3-pin) device.
This also has a DC output of 10mV/°C.
This can also be easily read directly by the ADC input.

It will be noticed the local sensors are inside a plastic tube.
While it will be appreciated this will have an effect on the accuracy of the readings, it is to protect the delicate humidity sensor during development of the system.

Channel 2 (Remote) - Connected to Port A
ADC0 = Humidity
ADC1 = Temperature

Currently Channel 2 is simulated.
A pair of trimmer potentiometers wired as potential dividers are used to generate the signal voltages, as I only have 1 humidity sensor (used on the local channel.)
This also using this makes testing easier as I can set any humidity or temperature over the full working range.
I can also swap Local and remote by swapping the 2 D-plugs round

The values displayed on the main screen are rounded to 2dp by means of a C-Box in the flowchart.
Note: C- Box’s do not simulate.

Dew Point:

Dewpoint is the temperature at which condensation will form.
Its accurate calculation is quite complex and not necessary for this project.
A simplified version of the calculation is as follows.

Temp_DP = Temp –( (100 – Relative Humidity)/5)

DS1307 RTC:
This project uses the Adafruit DS1307 Break Out Board.
I already had this fitted to one of my Protoboards
This uses the I2C Bus
C3 – Clock
C4 – Data

This uses the component developed by Jordy on the Matrix Forums.
The component allows the device to be read directly, rather than having to program the I2C interface within Flowcode.
The flowchart assumes the date and time has already been setup in the DS1307, and held by means of the backup battery.

Alarm Connections:
Local Sensor

B0-Orange Humidity Low
B1-Red Humidity High
B2-Orange Temp Low
B3-Red Temp High
C0-Green Humidity Normal
C1-Green Temp Normal

Remote Sensor

B4-Orange Humidity Low
B5-Red Humidity High
B6-Orange Temp Low
B7-Red Temp High
C6-Green Humidity Normal
C7-Green Temp Normal

To save on memory, the values are converted to integers before being tested.
It was not considered necessary to have the precision of a FP variable for this.

This also allows a simple Yes/No decision box to be used rather that the more complex test needed with a floating point number.
While these are displayed using LED’s they can also been seen on the display by means of the first soft key on the touch screen display.

Max - Min Display:

The same integer variables used in the high / low alarm are used for Max Min testing.
Again, it was not considered necessary to have the precision of a FP variable for this.

The current value is compared with the last maximum variable and if greater it is stored as the new value, if not it is discarded.
The same idea is used for the minimum values.

These can be seen by use of the second soft key on the touch screen display.

Max – Min values are currently lost when power is removed.

The Max values are initialised to 0 and Min values initialised to 100 when the program is first started or reset is pressed.
This allows them to be set to the current ambient the first time the sensor is read, and then they will change as the readings increase or decrease.
Monitor.JPG
Monitor.JPG (63.7 KiB) Viewed 11681 times
Sensors.jpg
Sensors.jpg (36.85 KiB) Viewed 11683 times
Display.jpg
Display.jpg (53.01 KiB) Viewed 11683 times
1 in 10 people understand binary, the other one doesn't !

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:

Re: Environmental Monitor

Post by JohnCrow »

The Flowcode program can be found below
Simple Environmental Monitor V1.fcfx
(74.88 KiB) Downloaded 631 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: Environmental Monitor

Post by Steve001 »

as always a well documented fascinating project Thanks for sharing :D


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

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:

Re: Environmental Monitor

Post by JohnCrow »

Visi Display Version

I have made a simpler version of my monitor using the 4D Systems Display and Visi Components.
This is a single channel version and uses the same sensors

ADC 5 = Temperature
ADC 6 = Humidity.

The displays have been scaled to 0 to 50 for the temperature and 0 to 100 for the humidity.
Visi Display.zip
(216.65 KiB) Downloaded 605 times
The above zip archive contains the FC6 program and the 4D Display Source Code.
Visi_System.JPG
Visi_System.JPG (70.96 KiB) Viewed 11611 times
Visi_Display.JPG
Visi_Display.JPG (63.9 KiB) Viewed 11611 times
1 in 10 people understand binary, the other one doesn't !

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:

Re: Environmental Monitor

Post by JohnCrow »

For those who prefer a digital display.
Digital.JPG
Digital.JPG (63.92 KiB) Viewed 11604 times
DualADCV3.zip
(88.57 KiB) Downloaded 651 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: Environmental Monitor

Post by Steve001 »

Hi John.

The display looks nice what is it ?

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

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:

Re: Environmental Monitor

Post by JohnCrow »

Hi Steve

Its the 4D Systems 32PTU (An Aussie Company)
http://www.4dsystems.com.au

You can get them in the UK from http://www.milinst.co.uk/

I have it plugged into a separate development board.(It will work without the dev board)
You will find some posts by acestu using the same display if you search the forums.
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: Environmental Monitor

Post by Steve001 »

Cheers John i know where they are i used to pass them every day on the way home from gr, wondered what they did :lol:

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

Post Reply