1. Implementation of a Temperature Control System using ARDUINO
System structure Close control loop Fuzzy controller Fuzzy logic system: 9 rules Temperature Sensor One Wire Digital Temperature Sensor - DS18B20 Heating element Heating resistor 2Ω, supplied in ac (12V peak value) Heating power control Phase control of a SCR (thyristor) TCA 785
System implementation Arduino development board Brain of the entire system Read current temperature Compute error and change-of-error Run fuzzy logic system Determine digital value of control signal DAC - MCP4725, I 2 C interface Provide analog value of control signal Phase control board Analog amplifier for control voltage AD820 TCA 785 phase control IC
Block diagram
5 Computational Intelligence in Complex Decision Systems Functional diagram u(k) = u(k-1) - du c (k)
6 Computational Intelligence in Complex Decision Systems ARDUINO UNO development board
7 Programmable Resolution 1-Wire Digital Temperature Sensor 9-bit to 12-bit Celsius temperature measurements Unique 1-Wire Interface Requires Only One Port Pin for Communication Allows multiple DS18B20s to function on the same 1-Wire bus
8 Computational Intelligence in Complex Decision Systems DAC MCP4725 12-Bit Resolution On-Board Non-Volatile Memory (EEPROM) External Voltage Reference (VDD) Rail-to-Rail Output Single-Supply Operation: 2.7V to 5.5V I 2 C Interface Eight Available Addresses
9 Phase control TCA 785 Control thyristors, triacs, and transistors. The trigger pulses can be shifted within a phase angle between 0 and 180
1 0 TCA 785
1 1 Computational Intelligence in Complex Decision Systems Thermal enclosure Phase control board
1 2 16 x 2 LCD
1 3 Experimental setup
1 4 Experimental setup
1 5 Computational Intelligence in Complex Decision Systems Fuzzy logic system
1 6 1 0.8 Neg Zero Pos Input fuzzy sets 0.6 0.4 0.2 0-1 -0.5 0 0.5 1 err; cerr Output fuzzy sets 1 0.8 N Z P 0.6 0.4 0.2 0-1 -0.5 0 0.5 1 du
Rule base errfls cerrfls Neg Zero Pos Neg N N Z 1 Zero N Z P 2 Pos Z P P 3 4 5 6 7 8 9 Control surface
Waveforms for the phase control circuit CH3 - the analog control voltage applied at pin 11 of the TCA785 IC, 4.8V CH2 - the ramp voltage, generated by the TCA785 IC, at pin 10 CH1 - the positive voltage pulse generated by the TCA785 at pin 15, to be applied in the gate of the SCR to set it on (ch1, yellow); the voltage pulse is generated when the ramp voltage exceeds the analog control voltage CH4 - the almost sinusoidal supply voltage, in the secondary of the line transformer; the moment when the SCR switches on (when the positive pulse appears in its gate) is obvious on the waveform the voltage decreases due to the large current ensured through the 2Ω heating resistor Computational Intelligence in Complex Decision Systems
1 9 Waveforms for the power circuit Computational Intelligence in Complex Decision Systems CH1 - the supply voltage, in the secondary of the line transformer CH2 - the voltage drop across the SCR MATH - the voltage drop across the heating resistor
2 0 Experimental results, Tref = 45 o C 50 45 Tref T temperature [C] 40 35 30 process perturbation: opening the thermal enclosure 25 0 500 1000 1500 2000 2500 time [s]
2 1 Experimental results, Tref = 45 o C 60 temp 40 20 0 500 1000 1500 2000 2500 20 err 0-20 0 500 1000 1500 2000 2500 20 cerr 0-20 0 500 1000 1500 2000 2500 1000 du 0-1000 0 500 1000 1500 2000 2500 4000 u 2000 0 0 500 1000 1500 2000 2500
Experimental results, Tref = 45 o C 60 temp 40 20 0 500 1000 1500 2000 2500 1000 du 0-1000 0 500 1000 1500 2000 2500 4000 u 2000 contr. voltage 0 0 500 1000 1500 2000 2500 4 2 0 0 500 1000 1500 2000 2500
Experimental results, Tref = 37 o C Computational Intelligence in Complex Decision Systems 38 temperature [C] 36 34 32 30 Tref T 28 26 0 100 200 300 400 500 600 700 800 900 time [s]
Experimental results, Tref = 34 o C from 37 o C 37 36.5 Tref T 36 temperature [C] 35.5 35 34.5 34 33.5 0 200 400 600 800 1000 1200 time [s]
Experimental results, Tref = 34 o C from 37 o C 40 temp 35 30 0 200 400 600 800 1000 1200 1000 du 0-1000 0 200 400 600 800 1000 1200 6000 u 4000 2000 0 200 400 600 800 1000 1200 4 contr. voltage 3 2 0 200 400 600 800 1000 1200
2. IMPLEMENTAREA UNUI SISTEM DE CONTROL AL TEMPERATURII UTILIZÂND MATLAB
Fundamentare teoretică Controler fuzzy reguli definite de utilizator fiecărei reguli îi corespunde o mulţime parţială de ieşire e = e(k) - e(k-1) e y * y y * + y - e e Controler fuzzy u c Element de ieşire control Întârziere t senzor
Implementare practică Schema de principiu Flux achiziţie Senzor Execuţie Prelucrare analogică pentru achiziţie Prelucrare analogică pentru comandă CAN CNA Controler fuzzy Incinta termică Platforma EEboard Placa de sunet MATLAB/ Simulink Flux comandă Placă de sunet - limitare cuplaj capacitiv valori tensiune: [-1V; +1V] - amplificare achiziţie 3:1 comandă 1:1 Computational Intelligence in Complex Decision Systems
Senzor de temperatura Incinta termică LM35 factor de scală liniar +10 mv/ C (ex. 30 C 300mV) măsurarea temperaturii în intervalul -55 C,+125 C temperatura citită - diferită cu 0.01 C de temperatura suprafeţei precizie 0.5 C (la +25 C ) tensiune de alimentare - între 4V şi 30V Rezistenţă termică Implementare practică două rezistenţe ceramice conectate în paralel P max U 2 R ech iv
Implementare Platforma Electronic Explorer Flux de achiziţie Conversie cc ca Vcc Vcc 0 9 Vee 0-9 GND Vcc LM35 Vcc GND OUT GND Senzor de temperatură 0 3k Vcc V+ + LM741 OUT - Vee V- 11k 1k 0 VCC Vcc TRIGGER RESET OUTPUT CONTROL THRESHOLD Vcc DISCHARGE LM555 GND 1k GND 1k 2.2u + LM741 - V+ Vcc OUT Vee V- 1k 47n 0 1k Amplificator Av=12 Computational Intelligence in Complex Decision Systems Repetor (buffer) 0
Implementare cont. Flux de comandă Vcc Vee Vsursa + V+ Vcc D Vcc Vsursa Tranzistor Darlington 0 9 0-9 0 +12 LM741 OUT - Vee V- 10u 27k + V+ LM741 OUT - Vee V- Q1 2N2221 Q2 5.5k BD237 0 0 1k 0 Detector de vârf pozitiv Amplificator Av = 6.5 Rezistenţa de încălzire 6,8 6.8k 0 22 22k
Implementare Schemă Simulink
Controler fuzzy T-S Variabile de intrare: e, de 3 mulţimi de tip zmf, gauss, smf Variabila de ieşire: du 3 mulţimi singleton: Ne = -0.2 Ze = 0 Po = 0.2 Baza de reguli e de N Z P N Ne Ne Ze Z Ne Ze Po P Ze Po Po Computational Intelligence in Complex Decision Systems
Exemplu de activare a regulilor Reguli activate 5: Dacă (e este Z) şi (de este Z) atunci (du este Ze) 8: Dacă (e este P) şi (de este Z) atunci (du este Po) Defuzzificare - medie ponderată y * z 5 z 5 5 8 8 8
Rezultate experimentale Flux de achiziţie Semnalul preluat de la senzor Semnalul preluat de la 555 Semnalul transmis spre Simulink
Rezultate experimentale Flux de comandă Semnalul de la iesirea detectorului de vârf Semnalul provenit din Simulink
Rezultate experimentale Evoluţia temperaturii incintei:tref=45 C Computational Intelligence in Complex Decision Systems
Rezultate experimentale Evoluţia semnalelor: Tref = 45 C T e u c u cmax e 0 du c u c e, du, u c c const.
Rezultate experimentale Evoluţia temperaturii incintei:tref-variabilă 45 C 37 C
3. Implementation of a Fuzzy Logic-Based Embedded System for Engine RPM Control
Introduction implements an embedded system for the Engine RPM control based on a development board developed around an Arduino Mega board fuzzy logic system as controller offers an easy understanding of the main concepts regarding embedded systems Computational Intelligence in Complex Decision Systems
System implementation Block diagram
DC-Motor: Gear ratio: 30:1 Free run speed at 6V: 1000RPM Free run current at 6V: 120mA Stall current at 6V: 1600mA
Quadrature Encoder: Six pole magnetic disk +PCB Dual Channel 12 counts/revolution 2.8V -18V Output signal of the encoder
Motor Driver: L298 Middle class 2 Motors Sensors power supply
Arduino Mega Pinout LCD screen
The Arduino Mega board is the brain of the entire system. It is primarily responsible for the update of the digital control signal u, at every time instance. Therefore, the actual RPM, RPM k is read and the actual RPM error (err k ) and change of RPM error (cerr k ) are updated, as follows: (1) where is the RPM error in the previous time instance. The star of the entire system is the fuzzy logic controller, whose role is to infer the best modification in the control signal, in every time instance. The operation of the fuzzy logic controller is explained later on. The digital version of the actual control signal is updated using the relation: (2)
To obtain the actual RPM: Compute RPM a method based on a fixed time interval (time window) to count the revolutions of the main motor shaft. a counter is triggered at the initial time t i and it counts the pulses received from the Hall effect sensor up to the final increment t f. The RPM is computed using the relation : C f - final value of the counter C i - initial value of the counter C r = 12, number of counts/revolution G r = 30, the gear ratio (30:1) t f, t i are measured in seconds Computational Intelligence in Complex Decision Systems
first-order Takagi-Sugeno two inputs errfls and cerrfls one output ΔuFls The Fuzzy Logic Controller Fuzzy sets for the inputs Fuzzy sets for the output Computational Intelligence in Complex Decision Systems
Block diagram of the fuzzy logic controller errfls cerrfls Neg Zero Pos Neg N N Z Zero N Z P Pos Z P P Rule base of the fuzzy logic system
The defuzzification method, used to transform the partial output fuzzy sets resulted from the inference process into a crisp value is the weighted average method.
output Computational Intelligence in Complex Decision Systems Control surface of the fuzzy logic controller Err cerr
Control Circuit RPM ref + _ RPM err 1 z _ + cerr s e s c -1-1 +1 +1 errfls cerrfls Fuzzy logic system ΔuFls s u Δu - + 0 1 z 255 u Motor Driver u a DC Motor
System setup
Experimental results RPM from 0 to 1000 rise time = 8.8 s; max. positive error = 5 rpm ; max. negative error = 5rpm; RPM from 1000 to 500 fall time = 6.75 s; max. positive error = 6 rpm ; max. negative error = 9rpm; RPM from 500 to 750 rise time = 4.75 s; max. positive error = 8 rpm ; max. negative error = 6rpm; RPM from 750 to 0 fall time = 6.5 s;
Decreasing the time response To drastically decrease the time response of the control system, the control strategy should be slightly modified. Because the control characteristic of the DC motor driven by the H-Bridge is almost liner, when a large variation of the motor speed is required (larger than 60 rpm), the control signal is not determined by the fuzzy logic system, but it is estimated by a simple linear interpolation, that acts as a course adjustment of the control signal. Then, the fuzzy logic system regains its role for the fine adjustment of the speed.
Tracking mode operation: RPM tracks the temperature variation Computational Intelligence in Complex Decision Systems
Duty Cycle 23% Low Speed 55% Medium Speed 90% High Speed
4. Controlul pendulului inversat
4. Controlul pendulului inversat demonstratie video pendul.fis http://www.razorrobotics.com/articles/fuzzy-control-system/