You are on page 1of 29

EMBEDDED CONTROL SYSTEM DESIGN

TEMPERATURE CONTROLLER

Group 12

Instructors: M.Sc.Chu Duc Viet


Class ID:128336

Name Student ID
Vu Minh Hieu 20181885
Nguyen Ngoc Huy 20181893
Nguyen Duc Duy 20181880
Pham Trung Kien 20181897

Hanoi,2021
I. REQUIREMWNTS AND SPECIFICATIONS:
1.1Overview of the Design:
In this project, we want to design a Temperature controller control any
device according to its requirement for some industrial application which
including the following criteria:
✓ Fundamental knowledge and the structure performed by block diagram.
✓ Electrical components and microprocessor selection.
✓ Designing power supply, user interface and communication.
1.2Spercification:
Specification Table:

Criteria Value

Size 84*72*30(mm)

Power Supply 220VAC – 50Hz

Input Voltage Range 3.3VDC – 12VDC


RTD(pt100, PT1000)
Temperature(Input type)
TC(type: S, T, J, K)
Temperature(output type) Relay SSR

Temperature Range -30 to 2000C

Sampling Time 100ms

User Interface LCD, Button


On/Off
Control Method
PI, PID controller

❖ Reference the configuration of the TC4SP Temperature Controller.


II. Architeture and Components selection:
2.1 General block diagram:
In the domain of the project, our group focus on controller design based on the
specifications as mentined above, we have main blocks consist of Input block,
Output block, Power supply.
Fig2.1.1: Block Diagram

2.2Components selection:
2.1.1 Input devices:
a. Temperature sensor:
- Requirements:
▪ the divice requires to detect temperature with small deviation.
▪ The range of the temperature is -30 to 2000C
▪ The error is small.
▪ The temperrature controller can operate with many types of
temperature sensor.
➢ Choose the sensor:
✓ RTD: Pt100, Pt1000
✓ Thermocouple: K, J, R, S
2.1.2 Output devices:
a. Relay:
- Requirements: Relay has high switching speed, energy saving, no noise
during operation, no ignition.
 Solid state relay is suitable for this project because:
• Fast switching speed.
• Require low power consumption to energy.
• No noise and no ignition during operation, can create soft
switching.
- To control the temperature, the heating capacity of the heating rod is
controlled by using the SSR (Solid State Relay) connected to the
Microcontroller.
- Choose: FUTEK SSR – 40DA suitable for the voltage range and
required, easy to use and cheap.

Technical parameters:
o Input voltage: 3-32 VDC
o Input current: 75mA (12V)
o Output voltage: 24 – 380VAC
o Max output current: 40A

Fig 2.2.1: Solid State Relay.

2.1.3 Power supply:


- Requirements:
• Need convert the source 220VAC to 12 VDC to supply some
components such as: SSR, relay, …
• Need the Isolated source 5VDC, 3.3VDC from the source 12VDC to
supply some components using this source.
• The source has low drop voltage, the efficiency is not too low.
- Choose components:
• Using AC-DC rectifier include transformer and full bridge diode to
conver AC to DC source.
• Using LM7812 to transfer DC voltage to 12VDC
• Using TMH_1205S to transfer 12VDC to 5VDC Isolate with source
12VDC
• Using LM1117DT33 to transfer 5VDC to 3.3VDC Isolate with
source 12VDC

2.1.4 Microcontroller:
As following the schematic , our group choose a microcontroller which should be
compatible with criteria as mentioned below:

• Must have at least 20 pins to connect to sources and peripherals.


• Must have 1 SPI and 2 I2C interface types built-in microcontroller.

• Signal processing speed must be high and accurate.


Following this requirements, the appropriate microcontroller used for the system
is STM32F103C8T6.

In addition to the satisfaction of the system, microcontroller STM32F103C8T6


is also contained particular advantages as:

✓ Small size and low price( $1.99)


✓ RAM 20kBytes and Flash 128kBytes
✓ Maximum frequency: 72MHz
✓ Comfortable to buy and uncomplicated programming.

2.1.5 Other componets:


a. Display:
• the information that are required for the user are the temperature in the
heat generator in the real time. So, we choose LCD1602 to present the
insformation with line 1 for setup value and line 2 for temperature.
• To save the number of the pins for MCU, using PCF8574 which using
I2C communication standard to transfer data connects with 16 pins of
LCD.
b. Alarm:
• need an alert method to be able to sound the error message when an
error occurs
• have a suitable working voltage range for the power supply
• Low power consumption, making sound loud enough, easy to use
 choose Buzzer 12850 has the parameter:
o Source: 3.5-5.5VDC
o Current consumption: < 25mA
o Resonance frequency: 2300Hz
o Sound amplitude: > 80dB
o Operating temperature: -20 to +700 oC
c. Isolated component:
• On input part, need to isolate the signal 3.3V from ADC to MCU; on
output part, need to isolate the signal 3.3V from MCU to 12V from
DAC
 The input part, choose is ISO7341; on the output part, choose is
ISO7641
d. Terminal block:
- Terminal block is a connector that allows multiple circuits to be
interconnected use in industry.
- Requirements: use in industry, rate power 220VAC - 300W, cheap and
suitable for circuit, high stability.
- Choose TGP-050-02A1 because:
• Quick connect 2-poles, 4 way quick connector per pole (Input:
1way; output: 4 way).
• Range voltage 600V, range current 50A
• Size: 50.0*37.0*32.5mm (L*W*H)

e. Button:

In order to serve the most convenient experiences for users, which easier
to do set functions we decided to select the push button instead of hold
button. We use R13-507 which has multiple choice of color to distinguish.

Fig 2.2.2: Push button R13-507.

III. Detail Design:


3.1 Hardware Design:
3.1.1 Power supply:
a. AC-DC rectifier 220VAC-12VDC:
- Need 12VDC voltage supply to relay input SSR-40DA:
▪ Input voltage: 3-32VDC ➔ choose 12VDC
▪ Input current: 75mA (at 12VDC)
- using transformer 220VDC – 12VAC/5A
- Diode bridge RS507 to rectify:
▪ Maximum reverse voltage: 1000V
▪ Maximum forward current:5A
▪ Forward voltage drops:1V
▪ Reverse current: 500uA
▪ Operating temperature range: -550C to 1500C
- using voltage stepdown IC 12VDC supply to SSR-40DA ➔ choose
LM7812 because:

Input voltage 𝑉𝑖𝑛 = 12√2 -1 =15.79

Output voltage 𝑉𝑜𝑢𝑡 = 11.5 → 12.5𝑉

Output current 𝐼0 = 5𝑚𝐴 → 1.5𝐴


 suitable for SSR
▪ Capacitor 1000uF/50V to electric flattening.
▪ Capacitor 0.1uF/50V to decrease ripple input voltage.
▪ Capacitor 10uF/35V to low frequency noise filter.
▪ Capacitor 0.01uF/36V to high frequency noise filter.

Fig 3.1.1: AC-DC Rectifier 220VAC-12VDC.

b. DC-DC converter 12VDC-5VDC:


- Need power 5V to supply for: LCD, PCF8574, Piezoelectric buzzer,
- LCD:
▪ Operating voltage: 4.7 to 5.3V
▪ Current consumption is 1mA without backlight.
- PCF 8574:
▪ Supply current: 40uA
▪ Maximum supply current:100mA
▪ Supply voltage: 2.5 to 6VDC
- Piezoelectric buzzer:
▪ Supply voltage: 3.5 to 5.5V
▪ Current consumption <25mA
- Other compents:
 So, the muximum supply current in circuit using 5VDC:
𝐼𝑚𝑎𝑥 = 1𝑚𝐴 + 25𝑚𝐴 + 100𝑚𝐴 + 134𝑚𝐴 (supply current to
MCU) = 260mA.
- Choose TMH_11205 is source IC to the design:
• Ultra miniature isolated DC/DC converters
• Versions with single and dual output voltages
• 1000V input/output isolation
• Up to 83% efficiency
• Range of input 12VDC±10%
• Output voltage 5VDC, maximum current: 400mA

Fig 3.1.2: DC-DC Converter 12VDC-5VDC.

c. DC-DC converter 5VDC-3.3VDC:


- 5VDC from DC-DC 12VDC-5VDC provided for this power supply.
➢ STM32F103C8T6 has:
Operating voltage 2V – 3.6V choose 3.3VDC
Maximum current consumption: 150mA

So, the maximum supply current in circuit using 3.3VDC:

𝐼𝑚𝑎𝑥 = 150𝑚𝐴 = 0.150(𝐴)


3.3×0.15
- Maximum supply current input = × 134% = 0.134(𝐴)
5
- Choose LM1117-3.3v voltage regulator IC is used to stabilize the 3.3v
output voltage, with the maximum input of 9v and the minimum 5v.
LM1117DT-3.3V has:
Input voltage: 4.5VDC to 9VDC
Output voltage: 3.235V-3.365VDC
Output current: 10mA-800mA.
- Choose input Bypass Capacitor.
An input capacitor is recommended in datasheet. A 10µF tantalum on the
input is a suitable input bypassing for almost all applications.
So, choose 10µF/15V.
- The output capacitor is critical in maintaining regulator stability and must
meet the required conditions for both minimum amount of capacitance
and ESR (Equivalent Series Resistance). The minimum output
capacitance required by the LM1117 is 10µF if a tantalum capacitor is
used.

So, choose 10µF/15V.

Fig 3.1.3: DC-DC converter 5VDC-3.3VDC.

d. DC-DC converter 12VDC-3.3VDC:


• When using the iso7341 on the input part, we need the voltage 3.3V and
isolation 3.3VDC. So, using the LM1117T-3.3 to transfer 12VDC to
3.3VDC.
Fig 3.1.4: DC-DC converter 12VDC-3.3VDC (not isolation source).

➢ Overview of the Power Supply Circuit:

Fig 3.1.5: Power supply of the circuit.


3.1.2 Input:
• Thermocouple input
o Thermocouple amplifier

Requirements:
- Temperature ranges from 0 to 400° 𝐶
- Measuring K-type thermocouple based on using AD8495 thermocouple
amplifier
- Output 5mV/ᵒC to the ADC from 40uV/ᵒC

o ESD protection
D1 and D2 are reverse biased under normal operating conditions.
However, if a pulse occurs that raises the input voltage above the rail
voltage the top diode, D1, will conduct. Similarly, if the voltage falls
below the ground voltage, the other diode, D2, will conduct.
=> Using Low-leakage double diode BAV199
o Input filter
1 1
𝑓𝑐𝑚 = = = 15.9𝑘𝐻𝑧
2. 𝜋. 𝑅4. 𝐶𝐶𝑀𝐴 2. 𝜋. (10𝐾Ω). (1𝑛𝐹)
1 1
𝑓𝑑𝑖𝑓𝑓 = =
2. 𝜋. 𝑅4. (𝐶𝑑𝑖𝑓𝑓 + 0.5𝐶𝐶𝑀𝐴 ) 2. 𝜋. (10𝐾Ω). (10𝑛𝐹 + 0.5𝑛𝐹)
= 1.52𝑘𝐻𝑧
o AD8495 with gain of 122
Amplifiers A1, A2, and A3—and the resistors shown—form an
instrumentation amplifier that amplifies the K-type thermocouple's output with
a gain appropriate to produce an output voltage of 5 mV/°C. Inside the box
labeled "Ref junction compensation" is an ambient temperature sensor.

• RTD input
Requirements:
- Supply voltage 5VDC
- RTD temperature range: -50ᵒC to 130ᵒC
- RTD resistance range 80.3Ω to 150Ω
- Output: 0V to 2.048V
Calculation
At -50℃ the RTD resistance is 80.3Ω and the voltage across it is: 100uA *
80.3 Ω = 8.03 mV
At 125ᵒC the RTD resistance is 148Ω and the voltage across it is: 100uA *
150 Ω = 15 mV

2.048𝑉−0𝑉
According to datasheet => gain = = 294
15𝑚𝑉−8.03𝑚𝑉

=> Choose gain = 290


2𝑅2
Choose R1 = 2k Ω; G = => R2 = 300K Ω(easy to buy on market)
𝑅1
=> Choose C2 = 0.5nF according to

o Input filter
1 1
𝑓𝑐𝑚 = = = 15.9𝑘𝐻𝑧
2. 𝜋. 𝑅3. 𝐶𝐶𝑀𝐴 2. 𝜋. (10𝐾Ω). (1𝑛𝐹)
1 1
𝑓𝑑𝑖𝑓𝑓 = = = 1.52𝑘𝐻𝑧
2. 𝜋. 𝑅3. (𝐶𝑑𝑖𝑓𝑓 + 0.5𝐶𝐶𝑀𝐴 ) 2. 𝜋. (10𝐾Ω). (10𝑛𝐹 + 0.5𝑛𝐹)
• ADC
Using ADS1248:
- Delta-sigma 24-bit ADC
- Analog and Digital supplies: 2.7 V to 5.25 V
- PGA gain up to 128
- Analog input voltage: -1.6 to 0.3 V
o Pin schematic

ADC output calculation:


𝑣𝑟𝑒𝑓
𝑣0𝑢𝑡 = 𝐴𝐷𝐶𝑣𝑎𝑙𝑢𝑒
2𝑛 − 1
Since it’s 24 bits ADC and we are using internal 𝑣𝑟𝑒𝑓 = 2.048𝑉, so
2.048
𝑣0𝑢𝑡 = 𝐴𝐷𝐶𝑣𝑎𝑙𝑢𝑒
224 − 1

• Input Isolator
o ISO7341 Automotive, low-power, quad-channel
The entire circuit constitutes a single-ended,
low-voltage system in which a digital isolator connects the SPI
interface of a controller with the SPI interface
of a data converter

o Schematic
• Cold-junction-compensation
o LMT70 Precision Analog Temperature Sensor

According to this datasheet table

3.Output block
3.1.Analog output
a.The design requirements:

• Analog Output Channels: 2

• Voltage Outputs: 0-10 V

• Current Outputs: 4-20 mA

• Digital isolation for the SPI and GPIO control signals

•ESD protection
TVS:protect the application against transient overvoltage
b.Solutions:
-DAC8760
+User-selectable: Voltage or Current Output
+12V supply voltage
+Vout:0-10V
+Iout:0-20mA
+16 bit resolution
-ISO7641: in order to maintain isolation from the host controller, the digital signals
used to control the DAC must be isolated through a digital isolator.
+ Operates From 2.7-V, 3.3-V, and 5-V Supply and Logic Levels
+ The ISO7641 is a 25 MBPS digital isolator that features >4 kV galvanic isolation.

c.Calculation:

-The output voltage (VOUT) can be expressed:


𝐶𝑂𝐷𝐸
VOUT=VREF x GAIN x
2𝑁

CODE is the decimal equivalent of the code loaded to DAC


N is the bits of resolution (16 for DAC8760)
VREF is the reference voltage,for internal reference VREF=5V
GAIN is selected for a desired voltage output range(GAIN = 2 for voltage output 0V
to 10V)
-The output current (IOUT) can be expressed:
𝐶𝑂𝐷𝐸
IOUT=16mA x +4mA
2𝑁

CODE is the decimal of equivalent of the code loaded to the DAC


N is the bits of resolution
- Ferrite bead L1 – It has a DC resistance of 0.2 Ω and an impedance of 470 Ω at 100
Mhz. The ferrite bead does not interfere in the normal analog output operating
frequency region, which is typically <1 kHz, but provides a high impedance to high-
frequency transients.

3.2.SSR Voltage output and Relay


a.Requirement:
-Isolation with MCU
-Voltage output:12VDC
-ESD Protection
b.Solution:
-Using opto-coupler PC817 for isolation between MCU and the SSR output
-Using IC ULN2803
- Choose HF46F/12-HS1:relay 12VDC input voltage
c.Calculation
𝑉𝑐𝑐 :Voltage source from MCU:3.3V
VF drop of the input light emitting diode is from 1.2 to 1.4 volts
𝐼𝐹𝑇 ∶ 𝐿𝐸𝐷 𝑇𝑟𝑖𝑔𝑔𝑒𝑟 𝑐𝑢𝑟𝑟𝑒𝑛𝑡:5mA to 50mA
Max output current of MCU:25mA

From the datasheet Vce at saturation mode is 0.2V when 𝐼𝐹𝑇 =20mA and collector
current 𝐼𝐶 = 1𝑚𝐴.
Choose R1:
3.3−1.4−0.4 3.3−1.2−0.4
-> R1=R3= < R6<
0.02 0.02

-> 75 < R6 < 85


->Choose R1=80 ohm.
Choose R2:
5−0.2
-> R2=R4= =480 ohm.
0.01

-ULN2803:
+The relationship between Vce(sat) and collector current:
. +From the figure 8, with 500-mA-Rated Collector Current,the maximum Vce(saturation) is
1.5V,then the input voltage of the coil is Vcoil=12-1.5=10.5V > 9V (Pick-up voltage VDC max).

3.1.3 User interface and communication:


1. LCD 16x2 with I2C:

-Recommend on connect I2C with LCD:

-Calculate ballast resistor for LED:


Led A works at 1.8 to 3V current 10 to 20mA, power suppy: 5V
So R1 = (5-1.8)/(10x10-3 ) = 320 (Ω) .
Then choose R1=330 (Ω)

2.Communication:
-To isolated for circuit, we use RS485 communication as MAX3485ESA
3.2 Software Design:

I. User interface
Press button Mode and hold 2 seconds to move to Unit Control.
1. IDLE Mode:
Starting at IDLE, press SET for 2 seconds to move to Config Mode (including
Control Mode, OF/OFF Mode, Alarm Mode, PID Parameter, Change Value).
2. Config Mode:
There are 5 smaller function blocks in Config mode: Setpoint, Control Mode,
ON/OFF Mode, Alarm Mode, PID Parameter, Change Value.
We press SET button and can change between each block in sequence: Setpoint-
>Control Mode->ON/OFF Mode->Alarm Mode->PID Parameter-> Change
Value.
(When from IDLE to Config mode, we will be at the setpoint mode first)

To change between each parameter in each block we press MODE button.


After selecting the parameters we want to adjust, press UP button to move to
Change value block, at here, the value of parameters(Kp, Ki, Kd, Set point,
Alarm value, hysteresis value) will be adjusted by pressing UP or DOWN button.
+If press and release UP button, the value will increase 0.1
+ If press and hold DOWN button, the value will decrease 0.1
+ If press and hold UP button, the value will increase 1 each 0.3 seconds
+ If press and hold DOWN button, the value will decrease 0.1 each 0.3 seconds
After finishing selecting the value, press SET button to save that value and
continue selecting parameter needed to adjusted.
II. Unit Control:
Press button Mode and hold 2 seconds to move to User interface and stop
immediately.
State description table
Index State Sub- Sub-sub-state Description
state
1 USER Operating the user interface
INTERFACE
2 IDLE All variables of user interface (see in variable
table) are default at initial or keep old value of
the previous setup
3 CONFIG Choosing config mode to modify the
MODE parameters
4 Setpoint config Setting value for setpoint temperature
5 Input type config mode Choosing type of sensor
6 Sampling time Setting time for interval of sampling data
config mode from sensor
7 Output mode config Choosing type of Digital or Analog output (0 or
1)
8 Alarm value config Setting temperature value for alarming
9 Change Taking the value needed to change and refine
Value value by UP, DOWN buttons
10 UNIT Operating temperature control
CONTROL
11 RUN Normal operation
MODE
12 ON/OFF Control ON mode: current temp < down limit
OFF mode: current temp > up limit
13 PID Control Running in ANALOG output mode
14 ALARM When the sensor value reaches the alarm
MODE config value
15 Error Detection Determine type of error

16 Disconneting from Heater stop working


source
17 Self-calibration Controller fix the error itself
❖ Program Model:
IV. Test and Verifications:

You might also like