Download implemetation of an automatic protection for a

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Buck converter wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Solar car racing wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Control system wikipedia , lookup

Lumped element model wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Thermal runaway wikipedia , lookup

Rectiverter wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
IMPLEMETATION OF AN
AUTOMATIC
PROTECTION FOR A
SOLAR WALL
CONTROL OF AN ELECTRICAL SHUTTER
Xavier de Sanz Cosialls
2010-2011
Project at:
BETHUNE IUT
Dpt GEII
1230 rue de l’université
62400 BETHUNE
FRANCE
Tutor: Dr Patrick FAVIER
Implementation of an automatic
protection for a solar wall
Contents
I. Acknowledgements ............................................................................................... 3
II. Presentation of the project and objectives ............................................................ 4
II.1 Solar wall...................................................................................................................4
II.2 Protections needs for solar wall .................................................................................5
III. Elements of the project ........................................................................................ 7
III.1 Structure of the electronic controller .........................................................................7
III.2 Light sensor ..............................................................................................................8
III.3 Temperature sensors ................................................................................................9
III.3.1 Thermistor ................................................................................................................................ 9
III.3.2 Tiny Serial Digital Thermal Sensor TC74.................................................................................. 10
III.4 Model of card with micro-chip PIC16F877 with relay ................................................ 11
III.4.1 Micro-chip PIC16F877 ............................................................................................................. 11
III.4.2 relation of inputs and outputs of the PCB .............................................................................. 14
III.5 solar heater ............................................................................................................ 16
IV. Implementation of the system ........................................................................... 17
VI.1 Study and realization of sensors .............................................................................. 17
VI.1.1 Light sensor ............................................................................................................................. 17
VI.1.2 Temperature sensor ............................................................................................................... 19
VI.2 Study of relay and thermal safety system ................................................................ 23
VI.2.1 Relay ....................................................................................................................................... 23
VI.2.2 Safety temperature system with thermal contact.................................................................. 24
IV.3 Realization of the prototype ................................................................................... 26
IV.4 Model of power supply ........................................................................................... 28
IV.5 Program of the simulator ........................................................................................ 29
IV.5.1 Structure of the program ........................................................................................................ 29
IV.5.2 Program trancription .............................................................................................................. 32
IV.6 Tests ...................................................................................................................... 36
IV.7 Execution of source boxes ....................................................................................... 38
V. Areas of improvement ........................................................................................ 39
VI. Conclusion ......................................................................................................... 40
2
Implementation of an automatic
protection for a solar wall
I. Acknowledgements
We want to thank all the pedagogic and administrative team of the technological
university college of Béthune (IUT) and of the university of Artois.
We want to thank specially the team of the Electric Engineering Department of the IUT:
Mr Favier Patrick
Maxime Guyot
Mr Cresson Pierre-Yves
Mr Leroy
Borrega Xavier
N'diougas m'baye
3
Implementation of an automatic
protection for a solar wall
II. Presentation of the project and objectives
II.1 Solar wall
The department of research of Civil Engineering from the University of Artois
has installed, in two houses in the department of Pas-de-Calais, two prototypes of a wall
able to transfer the energy from the sun into special brick able to store the thermal
energy.
electrical shutter
HOT AIR FOR
HEATING
Int.
Ext.
electrical gate
bricks
COLD AIR
Fig 1 : Graphic of the wall
The bricks of wall get warmer when they receive the energy of sun. The system
get warmer, so the hot air, with the premise of convection, flows up and it will go to
warm the house. To prevent a circulation of air in the opposite sense, there's an
electrical gate in the intake of cold air that only less get inside in one way. This solution
avoids losing energy during periods of no sun conditions.
However the bricks are made with a plastic envelopment, which melts if the
temperature of the wall it's too high. To prevent this problem, the engineers installed to
the wall an electric shutter. The aim of this project is to set up an automatic control of
the shutter
Objectives of the project:
Design and realization of an automatic system to control the shutter.
Improve the performances of the system, taking more variables than the
temperature of the system to control it and make it more efficient.
4
Implementation of an automatic
protection for a solar wall
II.2 Protections needs for solar wall
To protect the solar wall and make it efficiently, we have to take to variables:
•
1)Temperature
How explained before, the bricks have a temperature limit of working. Taking
this variable we are able to protect the bricks against over warming situations and keep
the system working at the appropriated temperature.
•
2)Light
Not only is the temperature the only element that we have to think, also the light
received for the solar wall is very important to make more efficient our system. We will
use this variable in two cases:
First of all during the night period when there’s no sun and the solar wall only
give energy to the receptor and it doesn’t stores new ones. Is in this moment when we
have to keep down the shutter to save the stored energy.
The other case where we have to work in function of the light is during the day.
When we have a cloudy weather, without in off sun to warm efficiently the solar wall
also we have to put down the shutter to keep the stored energy.
Fig 2: Graphic of hystereis of the variables
5
Implementation of an automatic
protection for a solar wall
The graphic of the fig 2 show us our needs of light and temperature. How we can
see, the shutter only will be open if the conditions are ok. This means: there’s in off
light to work and the brick’s temperature not too hot.
Another really important think that we can see in the graphic is the hysteresis
zone that we put to operate the shutter. The output depends in part on the internal state
of system and not only on its input. Using this system we avoid the problem of constant
mouvement up and down of the shutter if temperature or light range during a periond in
the same working zone.
For exemple when temperature arrives to a too hot temperature, we put down the
shutter. But instead of put it high when it arrives again to the too hot threshold
(too_hot), we put up the shutter in a lower threshold (hot) .
In the light case we use the hysteresis to avoid the constant up and down
mouvement in the case of variable or not so strong clouds.
In the histeresis zone the system doesn’t do anything and it’s like that how we
give memory to our system and we make it capable of work in a imperfect contitions of
work.
To control the LEDS, that show us the light or temperature level, we don’t need
hysteresis because they only tell us the variable state. To see the light state we use two
LEDS: one for high level and the other for the low level. In the temperature case we use
three LEDS: one for too hot temperature, another for hot temperature and finally one for
no hot temperature.
In the following graphic we can see the light and temperature LED range of
working:
Fig 3: Graphic LEDS range working
6
Implementation of an automatic
protection for a solar wall
III. Elements of the project
III.1 Structure of the electronic controller
Our system is composed by different elements. In the following block diagram
we can see the different parts of our system:
Fig 4: Block diagran of the system
How we can see the PIC16F877’s supply comes from the electrical network
(230V AC) and finally the microcontroller receive a voltage of 5V DC.
The PIC receives and processes the data from the sensors (light and
temperature). In function of our needs the microcontroller will control the relay. This
one commands the electrical shutter that will go up or down depending of the situation.
To protect the solar wall against over temperatures we installed a safety thermal
contact system that will close the shutter if the temperature is too high.
7
Implementation of an automatic
protection for a solar wall
III.2 Light sensor
The light sensor is composed of a photo-pile and one resistance of 22Ώ. The
photo-pile give us an image of current from the sunshine, that means that value of
output current in the photo-pile is proportional to the sunshine received.
The circuits of micro-chips are controlled with voltage. To have an image of
voltage from the sunshine received we added a resistance in the terminals of the photopile.
Fig 5: Photopile
8
Implementation of an automatic
protection for a solar wall
III.3 Temperature sensors
III.3.1 Thermistor
The temperature sensor that we utilise is a thermistor whose resistance varies
significantly with temperature. Its operating system is based on the variation of the
resistance who presents a semiconductor with the temperature. The word is a ensemble
of thermal and resistor. Thermistors can be classified into two types, depending on the
sign of the coefficient of temperature:
•
•
NTC (Negative Temperature Coefficient) – negative temperature coefficient
PTC (Positive Temperature Coefficient) – positive temperature coefficient
The sensor works because of the raising of temperature, a semiconductor
increases the number of electrons able to move about and carry charge. It promotes
them into the conduction band. More charge carriers that are available, more current a
material can conduct. If the resistance decreases with increasing temperature, the device
is called a negative temperature coefficient (NTC) thermistor. And if the resistance
increases with increasing temperature, the device is called a positive (PTC) thermistor.
The difference between a thermistor and a resistive thermal devices (RTD) is
that the variation of the resistance in function of temperature is not linear. With that
characteristic we are able to have a huge variation of resistance with a little variation of
temperature.
In the followings graphics we show the relation R(T) of both types of
thermistors.
Fig 6: Different graphics of thermistor characteristic
For our application we've chosen a thermistor type NTC. Utilising that type, for
low temperatures we will have a high value of resistance. And for high temperatures we
will have a low value of resistance. If we look the graphic, we can see that the
temperature which we are working (50ºC) is inside of the zone of big variation of
temperature. This characteristic is perfect for our needs.
9
Implementation of an automatic
protection for a solar wall
III.3.2 Tiny Serial Digital Thermal Sensor TC74
The TC74 is a serially accessible, digital temperature sensor particularly suited
for low cost and small form factor applications. Temperature data is converted from the
onboard thermal sensing element and made available as an 8-bit digital word.
Communication with the TC74 is accomplished via a 2- wire SMBus/I2C
compatible serial port. This bus also can be used to implement multi-drop/multi-zone
monitoring. The SHDN bit in the CONFIG register can be used to activate the low
power Standby mode.
Temperature resolution is 1°C. Conversion rate is a nominal 8 samples/sec.
During normal operation, the quiescent current is 200 µA (typ). During standby
operation, the quiescent current is 5 µA (typ). Small size, low installed cost and ease of
use make the TC74 an ideal choice for implementing thermal management in a variety
of systems.
Features
• Digital Temperature Sensing in SOT-23-5 or TO-220 Packages
• Outputs Temperature as an 8-Bit Digital Word
• Simple SMBus/I2C™ Serial Port Interface
• Solid-State Temperature Sensing: - ±2°C (max.) Accuracy from +25°C to
+85°C ±3°C (max.) Accuracy from 0°C to +125°C
• Supply Voltage of 2.7V to 5.5V
• Low Power: - 200 µA (typ.) Operating Current - 5 µA (typ.) Standby Mode
Current
Applications
• Thermal Protection for Hard Disk Drives and other PC Peripherals
• PC Card Devices for Notebook Computers
• Low Cost Thermostat Controls
• Power Supplies
• Thermistor Replacement
Fig 7: Fonctional block diagram
10
Implementation of an automatic
protection for a solar wall
III.4 Model of card with micro-chip PIC16F877 with relay
To control the relay we utilise a card already designed. That relay is controlled
by a micro-chip PIC16F877.
III.4.1 Micro-chip PIC16F877
The microcontroller PIC16F877 from Microchip® belongs to a big family of
microcontrollers PIC (Peripheral Interface Controller) of 8 bits.
They have an improved memory of program type EEPROM flash, this makes
easier to program it using computer software of PIC. This characteristic makes much
easier to design the projects and reduce the time used in the programming of
microcontrollers.
Main features:
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
High performance RISC CPU
Only 35 single word instructions to learn
All single cycle instructions except for program branches which are two
cycle
Operating speed: DC - 20 MHz clock input DC - 200 ns instruction cycle
Up to 8K x 14 words of FLASH Program Memory,
Up to 368 x 8 bytes of Data Memory (RAM)
Up to 256 x 8 bytes of EEPROM Data Memory
Pinout compatible to the PIC16C73B/74B/76/77
Interrupt capability (up to 14 sources)
Eight level deep hardware stack
Direct, indirect and relative addressing modes
Power-on Reset (POR)
Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)
Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable
operation
Programmable code protection
Power saving SLEEP mode
Selectable oscillator options
Low power, high speed CMOS FLASH/EEPROM technology
Fully static design
In-Circuit Serial Programming (ICSP) via two pins
Single 5V In-Circuit Serial Programming capability
In-Circuit Debugging via two pins
Processor read/write access to program memory
Wide operating voltage range: 2.0V to 5.5V
High Sink/Source Current: 25 mA
Commercial, Industrial and Extended temperatura ranges
Low-power consumption:
- < 0.6 mA typical @ 3V, 4 MHz
- 20 µA typical @ 3V, 32 kHz
- < 1 µA typical standby current
11
Implementation of an automatic
protection for a solar wall
The combination of these features gives to the microcontroller a high efficiency
in the use of data memory and program.
program. So also we will have an efficiency speed of
execution.
Microchip® divides the microcontrollers in three big subfamilies according with
the number of bits of the instruction bus:
subfamilies
instructions
name
Base - Line 33
instructions of 12 bits
PIC12XXX and PIC14XXX
Mid – Range 35
instructions of 14 bits
PIC16XXX
High - End 58
instructions of 16 bits
PIC17XXX and PIC18XXX
Fig 8:: Subfamilies microcontroller PIC
We can find different types of packages: PDIP (Plastic Dual In Line Package),
PLCC (Plastic Leaded Chip Carrier), QFP (Quad Flat Package) y SOIC (Small Outline
I.C.). In thee following figure we can see the different type of packages:
Fig 9: Packages PIC
12
Implementation of an automatic
protection for a solar wall
The package that we use is a PDIP. In the following ping diagram we can see
with more detail the microcontroller used:
Fig 10: Ping diagram PIC16F877
13
Implementation of an automatic
protection for a solar wall
III.4.2 relation of inputs and outputs of the PCB
In the following table we can see de relation of inputs and outputs that we used:
OUTPUT/INPUT
USE
A1 Analog. Input
Light
C3 Input
I2C Serial clock
C4 Input
I2C Serial data
B2 Input
Switch 1
B3 Input
Switch 2
D3 Output
Relay
D4 Output
Green led 02
D5 Output
Orange led 02
E0 Output
Green led 01
E1 Output
Orange led 01
E2 Output
Red led 01
Fig 11: Table relation outputs/inputs
14
Implementation of an automatic
protection for a solar wall
Power
contacts for
the shutter
control
E0,E1,E2
B2,B3
POWER
SUPPLY
12V DC
RELAY
DEBBUGING
CONNECTOR
Safety
system
contacts
PIC16F877
ANALOGIC
INPUT
A0
I2C
CONNECTOR
E0,E1,E2
Fig 12: PCB with outputs/inputs
15
Implementation of an automatic
protection for a solar wall
III.5 solar heater
The solar heater has been made by french students during the year 2009/2010.
It's an autonomous system of solar heating that captures the thermal energy from the
sun. This converted energy is sent in form of hot air to the place where it is needed.
When the glass of the heater is exposed in front of the sun light, the black
aluminium surface absorbs the energy and in the same time gets warmer the air
contained inside the box. With an automatic system, controlled by a PIC micro
controller, our system drives a variable speed fan and an electrical gate. With the fan
and a little door opened by the engine, we can manage the thermal energy flowing in the
hot air.
The internal program of this application is not utilized in our project. To get
more information of this project consult the inform (web).
Fig 13: Solar heater
16
Implementation of an automatic
protection for a solar wall
IV. Implementation of the system
VI.1 Study and realization of sensors
The first part of the project, from September to October, we looked for the datasheets of the different sensors used. The aim was to understand the way of working of
the sensors. That part of my work is connected to the projects of Mr Borrega Xavier and
Mr M'baye N'diougas.
VI.1.1 Light sensor
How we explained before, the light sensor is a photo-pile that gives us an image
of current, so we have to add a resistance to the terminals. The current value that we
checked for the standard value of irradiance (1000W/m²) is 54mA.
We dimensioned the resistance (22Ω) to get a voltage of 1,2V in the output of
the sensor.
In the following schema we can see the light sensor equivalent circuit:
Fig 15: Light sensor equivalent circuit
Fig 14: Light sensor schema
17
Implementation of an automatic
protection for a solar wall
The last step of the light sensor study was to realize the characteristic curve of
the photo-pile. The two variables that we needed for our application were output voltage
in function of the irradiance received from the sun.
In the following graphic we can see the photo-pile characteristic`s curve:
1,6
y = 0,0011x + 0,0386
R² = 0,9962
1,4
1,2
V(V)
1
0,8
0,6
0,4
0,2
0
0
200
400
600
800
1000
1200
1400
E(W/m²)
Fig 16: Graphic output voltage in function irradiance received
In the graphic we see that the curve that we found is a linear equation, so with
the equation that excel give us we can calculate all the voltage value for each value of
irradiance. With the information that the graphic gives us, we are able to calculate the
different thresholds that after we will us in the program to control our shutter.
18
Implementation of an automatic
protection for a solar wall
VI.1.2 Temperature sensor
VI.1.2.1 Thermal sensor MOXIE
After the research of the reference and datasheet of thermal sensor, offered to us
by the IUT, we found that our thermistor was a Thermal sensor MOXIE TS3 B3 (NTC).
Fig 17: Reponse characteristic thermal sensor TS 3-57
For our application we've chosen this thermistor type NTC. Utilising that type,
for low temperatures we will have a high value of resistance. And for high temperatures
we will have a low value of resistance. If we look the graphic, we can see that the
temperature which we are working (50ºC) is inside of the zone of big variation of
temperature. This characteristic is perfect for our needs.
19
Implementation of an automatic
protection for a solar wall
VI.1.2.1 Thermal Sensor TC74
The TC74 acquires and converts temperature information from its onboard solidstate sensor with a resolution of ±1°C. It stores the data in an internal register which is
then read through the serial port. The system interface is a slave SMBus/I2C port,
through which temperature data can be read at any time. Eight SMBus/I2C addresses
are programmable for the TC74, which allows for a multi-sensor configuration. Also,
there is low power Standby mode when temperature acquisition is suspended.
To use our sensor we must create a subroutine to write, to read and to receive the
data of the sensor. In the following table we can see the SMBus/I2C Protocols that we
followed to create the routines:
Fig 18: SMBus/I2C Protocols
The TC74 is internally programmed to have a default SMBus/I2C address value
of 1001 101b. Seven other addresses are available. In our case, after searching in the
datasheet we found the table with the address of our sensor.
SOT-23(V)
Address
Code
SOT-23 (V)
Address
TC74A0-3.3VCT
1001 000
V0
TC74A0-5.0VCT
1001 000
TC74A1-3.3VCT
1001 001
V1
TC74A1-5.0VCT
1001 001
TC74A2-3.3VCT
1001 010
V2
TC74A2-5.0VCT
1001 010
TC74A3-3.3VCT
1001 011
V3
TC74A3-5.0VCT
1001 011
TC74A4-3.3VCT
1001 100
V4
TC74A4-5.0VCT
1001 100
TC74A5-3.3VCT
1001 101*
V5
TC74A5-5.0VCT
1001 101*
TC74A6-3.3VCT
1001 110
V6
TC74A6-5.0VCT
TC74A7-3.3VCT
1001 111
V7
TC74A7-5.0VCT
Code
U0
U1
U2
U3
U4
U5
1001 110
U6
1001 111
U7
Fig 19: TC74 adress table
20
Implementation of an automatic
protection for a solar wall
Our sensor is the model TC74A3-5.0VCT, so our address will be 1001 011 in
binary.
In the following image we will see the connections schema of the Tiny Serial
Digital Thermal Sensor TC74 with the components of the PCB and the PIC ports:
Fig 20: TC74 connections schema
21
Implementation of an automatic
protection for a solar wall
VI.1.2.3 Choose of the temperature sensor
After study both sensors. We chose the Tiny Serial Digital Thermal Sensor
TC74. We chose the digital sensor because with the other we hadn’t the precision that
this one give us.
With the thermistor the threshold changes all the time and never we can know
certainly at which temperature the system will work. We have to think that the digital
sensor always give us the exactly temperature with a precision of one degree.
The other advantage of the digital sensor is that we can introduce directly the
temperature’s value in Celsius. In the thermistor’s case first we have to predict the
voltage value in certain temperature. After to introduce the value to the program we
have convert it to a decimal number.
Fig 21: MOXIE TS3 B3 (NTC)
and
Tiny Serial Digital Thermal Sensor TC74
22
Implementation of an automatic
protection for a solar wall
VI.2 Study of relay and thermal safety system
VI.2.1 Relay
To operate the shutter we use a relay as a switch. The realy used is a FINDER 40.52.8.24.
Fig 22: Relay Finder 40.52
Our relay works in 230V AC because the shutter uses that voltage to work. Also
we have to remember that we need to ways of movement to put up or down the shutter.
For that reason our relay it’s a type DPDT (Double Pole Double Throw). These have
two rows of change-over terminals. Equivalent to two SPDT (Single Pole Double
Throw) switches or relays actuated by a single coil. Our relay has eight terminals,
including the coil.
In the following symbol circuit we can see the relay’s structure:
Fig 23: Relay symbol circuit
How we can see in the graphic, using that type of relay with double throw we are
able to have a double way of movement.
Another important aspect of the relay connection is the security. How we have
said the relay circuit works in a higher level of voltage (230V AC) than the other part of
the PCB (5V DC). This forces us to separate both voltages to protect the 5V DC circuit
and also the microcontroller.
23
Implementation of an automatic
protection for a solar wall
VI.2.2 Safety temperature system with thermal contact
If inside the solar wall, temperature’s the too high and the program fails during
the protection action. We installed a thermal switch to protect our system against over
temperatures.
The thermal switch that we chose is a MICROTHERM 05N1034(55/M). With a
configuration SPST (single pole single throw) is a simple on-off switch NC with reset
pin. When it arrives to 55ºC, it opens himself automatically. When the thermal contact
is opened the shutter goes down.
When we want to close the switch we have to press the reset pin. But the
problem is that the shutter is down and the only way to open it’s doing a short circuit
around it. We installed a push- button, which will produce a short circuit at the thermal
switch. Using this PB we can open the shutter and reset the thermal contact.
In the followings images we can see the thermal contact and its pin
configuration SPST:
Fig 24: MICROTHERM 05N1034(55/M)
Fig 25: thermo contact SPST
pin diagran
24
Implementation of an automatic
protection for a solar wall
In the following schema we can see the relay’s connections with both voltages
that we use and the thermal contact safety system:
Fig 26: Relay and safety thermal contact schema
25
Implementation of an automatic
protection for a solar wall
IV.3 Realization of the prototype
In the beginning of the project, our prototype only was the old project made by
others student. One very important part of our project was to modify the old frame and
put it ready for ours needs.
The prototype is composed of a solar heater mounted on a frame with an electric
shutter and the electronic board that commands the shuttle and the different sensors.
Mr Leroy realized for us the frame for the solar heater. We placed the solar
heater into the frame and we assembled it using a transversal axe enabling the rotation
of the solar heater into the frame, to incline it in respect the solar inclination angle for
maximum energy capture. This capacity of movement it’s made for the application of
autonomous solar air heater, but also we used that rotation to warm faster the
temperature inside the prototype. We have to remember that our system it’s made to
work in a vertical position.
Then we placed the sensors of temperature and light into the system. After we
designed and realized the 12V DC supply.
Fig 27: Solar heater before modification
26
Implementation of an automatic
protection for a solar wall
Fig 28: Sensors in the prototype
Fig 29: Ensemble PCB power supply
27
Implementation of an automatic
protection for a solar wall
IV.4 Model of power supply
The card of control utilise the types of tensions:
•
•
230V AC voltage to drive the shutter
12V DC voltage to supply the PIC electronic board.
To protect the AC circuit against short circuits or over current, we put a magneto
thermical breaker type C6 ref. Legrand 6392.
The power supply is composed of a P2 diodes rectifier placed at the output of a
transformer with a ratio of 230V-15V. Two capacitors of high value filter the signal. A
special 7812 regulator give us at the output a constant 12V DC voltage. The green led
display us the presence of voltage at the output.
Fig 31: Equivalent circuit power supply
Fig 30: Power supply
The following schema show us the equivalent circuit of our power supply:
Fig 32: Equivalent circuit power supply
28
Implementation of an automatic
protection for a solar wall
IV.5 Program of the simulator
When we finished our PCB, we started the design of the PIC's program to
control the system.
IV.5.1 Structure of the program
The program’s structured in different structures called subroutines. These
routines are small programs that we execute during the sequence of our main program.
This use gives to our program a clearly structure.
Main subroutines of the program:
•
1) Normal function
If the switch is in position 1,0 the system will work normally.
The magnitudes that we control, are analogical (light) and digital
(temperature).
With two subroutines of the program (cadlum and actemp) we
receive and process the data of our sensors. Finally this information is
used to control the shutter in function of our needs.
•
2) Test function
If the switch is in the position 0,0 or 0,1 the shutter
will go up or down depending of the position of the switch .
With this mode we can test if the shutter works or not
and also opened it if we need to make some reparation.
How we can see in the normal function flowchart, which we find in the next
page, we used a variable in form of bit to store the light and temperature. This means
that when the temperature is too hot or there’s enough light ours bits MEMLI and
MEMTE are 1 and the bits will be zero in the opposite case.
Using this system we are sure that, when we arrive to a threshold, the program
will work according to ours needs without the dangerous of doing a wrong action if the
light or the temperature range weirdly.
In the next pages we can see the different flowcharts, which explain the way of
working of our program. The three flowcharts are the main subroutines of the program.
29
Implementation of an automatic
protection for a solar wall
•
Main flowchart
•
Test function flowchart
30
Implementation of an automatic
protection for a solar wall
•
Normal function flowchart
Legend:
•
•
•
•
THLH: Thresholds Light High
THTH:Thresholds Temperature High
MEMLI: Light bit
MEMTE: Temperature bit
31
Implementation of an automatic
protection for a solar wall
IV.5.2 Program trancription
#include "C:\Borrega\Xavi D\TEST\I2C\testi2C03.h"
#include <stdio.h>
#ZERO_RAM
//---------- application variables -------------#define LEDV1 PIN_E0
//define LED'S
#define LEDO1 PIN_E1
#define LEDR1 PIN_E2
#define LEDV2 PIN_D5
#define LEDO2 PIN_D4
#define LEDR2 PIN_C7
#define SHUT PIN_D3
//define shutter
#define switch_01 PIN_B3 //define switch
#define switch_02 PIN_B2
//---------- variables declaration -----------------signed int temp;
int1 ack;
//bit to store the acknowledge
int8 light=0;
//to store the light value after
conversion
int1 MEMTE=0;
//bit to store temperature condition
int1 MEMLI=0;
//bit to store light condition
const
const
const
const
const
int
int
int
int
int
too_hot=50; //constant threshold of temperature
hot=45;
//
no_hot=30; //
THLH=25;
//constant threshold of light
THLD=13;
50°C
45°C
30°C
//---------- funtions declaration -----------------void cadlum(void);
//subroutine for AD conversion of the
light
void actemp(void);
//subroutine of temperature data
capture to bus I2C
void norm (void);
//subroutine of normal function
void test (void);
//subroutine of test function
//---------- main program -----------------------void main()
{
setup_adc_ports(AN0);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
set_tris_E(0x00);//port E as output
set_tris_D(0x00);//port D as output
i2c_start();
ack=0;
ack=i2c_write(0x9A);
while(ack);
ack=0;
ack=i2c_write(0x01);
32
Implementation of an automatic
protection for a solar wall
while(ack)
ack=0;
ack=i2c_write(0x00);
while(ack);
ack=0;
i2c_stop();
//----------------------------- MAIN boucle --------while(1)
{
if (input(switch_01)==1)
{test();}
else
{cadlum();
light
actemp();
to bus I2C
norm();}
//switch_01 in position 1
//=> function test
//subroutine for AD conversion of the
//subroutine of temperature data capture
//subroutine function normal
}
}
//------- end of MAIN bucle -------//----------------------subroutines-----------------------//-----------------subroutine normal function
void norm(void)
{
if (light>THLH)
{(MEMLI=1);}
//light ok
if (light<THLD)
{(MEMLI=0);}
//light low
if (temp>too_hot)
{(MEMTE=1);}
//indoor temperature too hot
if (temp<hot)
{(MEMTE=0);}
//indoor temperature ok
if (MEMLI==1)
//light ok
{
if (MEMTE==1)
{
output_low(SHUT);
}
if (MEMTE==0)
{output_high(SHUT);
}
if (MEMTE==1)
//indoor temperature too hot
//=> shutter down
//indoor temperature ok
//=> shutter up
//indoor temperature too hot
33
Implementation of an automatic
protection for a solar wall
{
output_high(LEDR1);
//=>switch on red LED01
output_low(LEDO1);
output_low(LEDV1);
output_low(LEDO2);
}
if ((temp>=no_hot)&&(temp<too_hot))//temperature between
too hot and ok
{
output_high(LEDO1);
output_low(LEDV1);
output_low(LEDR1);
output_low(LEDO2);
}
if (temp<=no_hot)
{
output_high(LEDV1);
output_low(LEDR1);
output_low(LEDO1);
output_low(LEDO2);
}
//=> switch on orange LED01
//indoor temperature low
//=> switch on green LED01
}
if (MEMLI==0)
{
output_low(SHUT);
}
//light low
//=>shutter down
if (light<THLH)
{
output_high(LEDO2);
output_low(LEDV2);
output_low(LEDR2);
}
//light lower than THLH
if (light>=THLH)
//light ok
{
output_high(LEDV2);
delay_ms(40);
output_low(LEDV2);
output_low(LEDR2);
output_low(LEDO2);
}
//=> switch on orange LED02
//=>switch on green LED02
}
//--------------subroutine test function
void test(void)
{
{output_high(LEDR1)&output_high(LEDV1)&output_high(LEDO1);
output_high(LEDV2)&output_high(LEDO2)&output_high(LEDR2);
delay_ms(100);
output_low(LEDR1)&output_low(LEDV1)&output_low(LEDO1);
output_low(LEDV2)&output_low(LEDO2)&output_low(LEDO2);
delay_ms(100);}
34
Implementation of an automatic
protection for a solar wall
if(input(switch_02)==1)
{output_low(SHUT);}
//switch_02 in position 1
//=> shutter down
else
{output_high(SHUT);}
}
//switch_02 in position 0
//=> shutter up
//--------------routine function light conversion
void cadlum(void)
{
set_adc_channel(0);//Selection of port to conversion AN0
light = read_ADC(ADC_START_AND_READ);
}
//-------------//subroutine of temperature data capture to
bus I2C
void actemp(void)
{
i2c_start();
ack=0;
ack=i2c_write(0x9A);
while(ack);
ack=0;
ack=i2c_write(0x00);
while(ack)
ack=0;
delay_ms(100);
i2c_start();
ack=0;
ack=i2c_write(0x9B);
while(ack);
ack=0;
temp=i2c_read(0);
i2c_stop();
}
//------------ subroutines end ---------------------------------
35
Implementation of an automatic
protection for a solar wall
IV.6 Tests
•
Light test:
To test the light system we used a potentiometer o simulate the sun variation. In
the graphic we can see a normal function example.
We start the test without light and we go up until a standard irradiation level
(1,2V -> 1000W/m²). Then we test the hysteresis mode where we can see that the output
high temperature level of the shutter is higher than the down threshold.
To see the shutters state we use the relay voltage. When there’s high level means
that the shutter’s high. And the opposite with low voltage level.
V relay
V photo-pile
Fig 33: Light test
36
Implementation of an automatic
protection for a solar wall
•
Temperature test:
We used the same system to test the temperature. In the following graphic we
can see temperature (ºC) and relay voltage (V).
Here also we can see the hysteresis zone and the thermal inertia that the
temperature takes when the shutter goes down.
V relay
Temperature
Fig 34: Temperature test
37
Implementation of an automatic
protection for a solar wall
IV.7 Execution of source boxes
One of the objectives of the project is to install the control system in some
houses. To do the installation in a house, in comparative of the laboratory, we need a
isolated box, which has to resist the hard conditions of working outside the work-room.
We have utilised one plastic box from the factory MERLYN GERIN. The
material that we have chosen is plastic. The industrial junction boxes in ABS have a
waterproof resistance and they are designed to protect electronics cards, which are
placed in a environments where there're risks of dusk and/or liquid entry.
To put our ensemble of electronic-card, converter-card and the guide for the
protections, we utilise the same support utilised in the experimental version. The
support is fixed in the box by four screws. The difference in that case, is that we have
rounded the corners because the box corners are not perfects squares. To solve that
problem we have rounded the corners with the help of a power-drill and a crown
On the following photos, we can see the ensemble of the box and the cards that
we have built:
Fig 35: Source box
Fig 36: Source box
To have an isolated box, also we have to protect the hold that we have done to pass all the
source and sensor cables. We have utilised a pass-cable to protect the box from liquid projections.
38
Implementation of an automatic
protection for a solar wall
V. Areas of improvement
After our study, there are some areas of improvement for our project. Now we
will see some of these areas that will be for our successors.
Our study is limited because only it considers the heater working in a vertical
position. Would be so interesting, for a following project, to automatise the movement
of the heating. That means that while the blind is in open position, we can incline the
heater. When we should close the blind the heater will go to the vertical position. Use
the command PWM would be possible doing this.
When we where studding during the year all the possible options, we have
thought to put an hour module. That gadget is an element isolated that we can program
in function of the solar hour. It has to give us the complementary information of sensors
(day, night, summer, winter). With this module we give extra information to the
program, so we can make it more efficient.
39
Implementation of an automatic
protection for a solar wall
VI. Conclusion
Personally, I have learnt a lot about different methods of working. After the
realization of this project, my knowledge of manual work, mechanisation of pieces and
programming with C. Always it's good to work in a project of renewals energies, this is
the future.
40