Beruflich Dokumente
Kultur Dokumente
Abstract— The need to control the climate has become one of future) is, mainly dependent on the experience (knowing the
the most important issues in the man daily life. At home, office, past) and the current input applied (knowing the present). The
and car …etc. It is required that the temperature stays within the history is saved in the memory units of the ASM (flip flops or
comfortable ranges. In this paper we introduce the design of a registers). The present is represented by the current inputs
thermostat, completely based on FPGA usage. Algorithmic state
applied. The future is next state to be decided by the ASM itself.
machines, ASM, are used to control the system constituents.
Temperature setting is done via the infra-red remote control unit. ASMs consist of state variables, inputs, and outputs. A state
The system is further protected by a password, entered via the said machine accepts a sequence of inputs. Each input generates a
remote control unite, to prevent unauthorized people from new internal state that is a function of the input and the previous
changing the temperature setting. The overall system consists of a state. Each input also generates an output. Finite state machines
number of submodules. Digital submodules are converted into are state machines whose state variables, inputs, and outputs
FPGA based units and implemented using VHDL code. can be enumerated. For example, an oil refinery can be modeled
by a state machine. A traffic signal can be modeled by a finite
state machine.
Index Terms— temperature control, thermostat, remote Finite state machines are of theoretic importance to
control signals, data recognition, algorithmic state machines,
ASM, finite state machine, FSM, FPGA, VHDL.
computer science because they can model many of the concepts
of interest in the discipline. Finite state machines are also called
I. INTRODUCTION finite automata.
Our main goal in this paper is to use VHDL and the FPGA
III. SYSTEM ARCHITECTURE
technology to manipulate a climate control system in such a
way to make the ambient temperature follow the user’s set Fig.1 shows the overall system functional units. In the center,
point. The system consists of a number of sub modules. Each there is the ASM module and its supportive units. They are all
one is designed in the block diagram level, and then converted implemented using VHDL code. The code is compiled and
to a VHDL file [1]. The overall system or better known as the converted into a binary file. The file is sent to XC3S1000 chip
top level design will be a collection of all of the above- which is already mounted on a Digilent Spartan 3-1000
mentioned modules. development board. The seven segment display and the LED
The password is a 4-digit pin number applied via a keypad array are all mounted on the development board. They provide
that will communicate through infrared radiation with an FPGA us with the compulsory information about the ASM state
development board. The development board used in this paper variables and input/output signal status for diagnosis purposes.
is the Digilent Spartan-3 prototyping board. It is equipped with It is possible throughout the design and testing processes that
a Xilinx XC3S200 FGA. the ASM gets stuck in one of its sequential states. To identify
Besides using the keypad to insert the PIN number, it is also the said problem, we should have a good state tracking method
used to insert the temperature set point. The temperature is to get a clue about the condition(s) that are forcing the state
measured using the AD595 thermocouple amplifier [2]. It is then machine to get locked at a certain state. The development board
converted to a digital value using an 8-bit analog to digital is also equipped with a number of toggle switches that supports
converter. The digitized temperature is then sent to the FPGA us to apply test signals to imitate certain input(s) or feedback
chip to compare it with the user’s set point. The air variable(s) [9]. The external infrared signal is created by any
condition/furnace control command is then generated by the infrared data transmitter. In this paper, the information source
FPGA chip. The board is also equipped with 4-digit 7- segment selected is the SONY 15-2113 remote control unit. It is the
display which is used to display both the set point and the board information supply and the tool through which a user
ambient temperature. sends information to the system (PIN code and temperature
II. ALGORITHMIC STATE MACHINES setting).
Toggle
Switches
Temperatu 7-
re Sensor segment
Display
by 10 then adding it to the ones digit. This state also resets the
timer counter DELAY1to 0.
State S10: This state is continuation to state S9. Here, the user
will be given few minutes to change the temperature setting
before being asked to insert the password again. This is possible
as long as ASM_MAIN is in state S10. As DELAY1 reaches its
count end, ASM_MAIN transfers back to state S1. The whole
system, then, would function as a pure temperature controller.
Any attempt to change the temperature setting, would be
preceded by password insertion and checking.
b) ADC_CONT module: This module controls and
synchronizes the operations of the analog to digital converter
unite AD7013 [6] [10]. Fig. 3 shows the state diagram of
ADC_CONT module. The state machine here is not a slave
machine. This means that is does not follow the commands of
another one. It is designed in such a way to make the ADC work
continuously without any break or halt.
State S5: It is the default state. Here ADC_CONT waits for
predefined period of time before giving the conversion order.
State S6: ADC_CONT reaches this state after the waiting
period of S5 is over (TMR counter reaches its full count). In this
state, the timer TMR is initialized to 0.
State S1: In this state, the “start conversion” command is
issued (activated by assorting signal CONV for certain period
of time equal to the count PRD2). Also the counter TMR is
incremented every clock cycle. Once the count exceeds PRD2
value, the ADC_CONT transfers to state S7.
State S7: CONV Signal is set to 0 (inactive). The CONV
signal level transfer from 0 in S6 to 1 in S1 and back to 0 in S7
initiates the conversion of the analog signal currently applied to
the ADC. The chip select (CS) and Read (RD) signals are Fig. 3: Main controller ASM chart.
deactivated in states S5, S6, S1, S7, S3 and S4 to prevent reading
any immature or invalid data from the ADC unit. This is very important to make the conversion on line and in a
State S2: In this state the ADC unit gets engaged with the real time manner.
conversion process. ADC_CONT keeps checking the BUSY c) ASM _TMP_CNTRL module: This is the third state
signal of the ADC unit. No reading is allowed in this state. Once machine module in the system. It is responsible for controlling
the ADC unit finishes the conversion, it deactivates the BUSY the furnace and the air condition units (govern these units by
signal. This causes ADC_CONT to transfer to state D1 (delay issuing appropriate ON and OFF commands). The control
state and stays there for 5 clock cycles). Then it transfers to state process is completely automatic. No man interaction is needed
S3. to change the system stetting between summer and winter
State S3: In this state ADC_CONT reads the converted data seasons. Traditional temperature controllers usually require
and saves it in its internal register DATA. This is the only that such an interaction. It is a button or switch to select the current
allows activation for the RD and CS signals. appliance to be controlled (A/C or furnace).
State S4: it is the last state in the sequence of this state Figure 4 shows the state distribution and their corresponding
machine. Here the contents of the internal register DATA are actions for ASM_TEMP_CNTRL module.
transferred to the ADC_CONT port and made available for the State S1: It is the initial state in this module. This machine is
other system constituents. ADC_CONT returns back to its initialized by the main reset button. One can notice that both of
initial state S5 to start another conversion process. It is well the furnace HT and the Air condition (A/C) are turned off. The
noticed that ADC_CONT is a free running unit. This means that machine stays in this state as long as the current temperature
it does not need a command from a higher hierarchy to start or and the temperature set point are the same. If the temperature
finalize job. All this is done automatically through the state drops below the set point, the machine jumps to state S3.
flow of the machine itself.