Hello everyone, recently I have started to make a project for Digilent Design Contest 2014. My project is called FPGA Climatic , and the main idea of it is to replace the typical thermostate and the Air Conditioning remote control with only one control device.
I have to mention that we are not focusing on the heating and cooling systems , so they will be represented in our project as a light bulb ( heating system ) and a PC fan ( cooling system ).
My project idea has been implemented for about 95% percent so far.
The components I have used:
- Nexys 3 FPGA board;
- PmodTMP temperature sensor;
- A light bulb , representing the heating system;
- A pc fan , representing the cooling system;
- 2 Relays ( one for the light bulb , and one for the fan ,also one of them you won't see it because it is glued to the wooden board);
- TSOP 4838 IR receiver and a 38KHz remote control;
The project is being split in two main parts : the HDL Design ( in Verilog ) and software design ( in ANSI C and ARM Assembly language ).
In HDL design I have implemented the following:
- I have integrated the ARM Cortex M0 processor in a SoC system with AHB-Lite Peripherals;
- The top level of our SoC System was modified to suite our needs ( added interrupts for IR signal , deleted unneeded peripherals);
- Custom modules for my input and output peripherals ( ahbinputs and ahb2ctrl );
- The VGA module ( vga_console module ) was modified to allow cursor repositioning and screen clearing.
- A module for my temperature sensor ( PModTmp ). It is useful to convert and read the temperature from the sensor. This temperature is being read on 12 bits , but we only use 8 of them ( we ommited bit 11 which is the sign bit, and bits 0 , 1 and 2 which are 3 of 4 of the decimal part bits. We will show a positive temperature , with only one decimal : for example 30.0 , 21.5); This temperature is being sent to the SoC system through an 8-bit Bus;
- The temperature reading is being refreshed at each second ( I have implemented an autoreset module for this ), so it could be read in real-time;
- The IR receiver module; it decodes a received signal from the remote control; we can assign a 3 bit key-code for each key-pressed ( which will be further sent to the AHB System); also for a few pressed buttons ( such as On/OFF , A,B or C ) we will send an interrupt signal to the SoC on another wire;
- A PWM fan control module; it receives 6 bit data from the SoC ( values between 111111 and 000000 ), and it generates a correspondent clock signal (111111- 100% Duty Cycle , 100000 - 50% Duty Cycle and so on);
- On 2 wires we control the relays for the light bulb and fan;
On the software design part I have implemented the thermostat and A/C control parts:
- I handled the IR receiver interrupt with Assembly code , I have linked to a INPUT_ISR function; there we will check the key we pressed;
- If the on/off key was pressed , then we will see a menu on the screen , and we will have the oportunity to choose heating or cooling mode ;
- Otherwise ( if we didn't press the on/off key ) then our system acts as if would be shut down , so we could not choose to control the heating/cooling system;
- In cooling/or heating mode, we can choose a desired temperature with left ( decrease temperature ) and right (increase) buttons; to validate our temperature we press the O button, or if we changed our mind , and we don't want to set the thermostate/AC , we can always press the on/off button to exit to the main menu;
- If we pressed O button , then it will enter the heating/cooling process; we have 3 states for each mode. I will describe them only for the heating control:
* the active state : we will show the current temperature and the setpoint on the screen. It will compare these , and if the current temperature is lower than the setpoint , our heating system will be turned on; otherwise it will go in the pasive state;
* the pasive state: it compares ,in the background ,the current temperature with the setpoint and switches to the active mode when the current temperature is lower than the setpoint with about 2 degrees;
* the aborted state : even if we are in the active or pasive state, if we press the on/off button , the heating/cooling process will stop and it will return to the main menu;
- For the cooling process I have implemented a simple PID controller. It is used to slow down gradually our fan as we approach the current temperature to the setpoint.
A youtube link to a small demonstration :
If you have any ideas or suggestions, just write back!Thanks!