Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17237 Discussions

Hysteresis for temperature measurement

Altera_Forum
Contributeur émérite II
2 352 Visites

Hello all, 

 

I am using MAX10 FPGA and want to measure the temperature via built-in temperature sensor. I have some LEDs on my PCB and I am controlling LEDs through PWM engine. I am measuring PCB temperature also. For this I am using ADC ip in quartus II and I am able to read Temperature sensor values. All is working but now I need to control PCB temperature from 30 °C to 50 °C. When PCB temperature reaches to 30 °C LEDs should de-rate its brightness to 10 % (90% ON) and when 35 °C LEDs should decrease brightness to 20% (80% ON) and so on and vice versa. So for this I get to know that I need to apply Hysteresis of 5 °C in my VHDL coding. Please help me to make hysteresis technique in my code. Thanks. And don't hesitate to ask questions.  

 

Regards 

Usman
0 Compliments
4 Réponses
Altera_Forum
Contributeur émérite II
1 271 Visites

Hi. 

You may introduce signal called 'direction' for storage where temprature moves to. 

the you can create several conditions, for example 

cond1 := (direction = down) and (temp < 30) 

cond2 := (direction = up) and (temp > 35) 

then you can trigger events based upon conditions. 

Hopy you'll catch an idea.
0 Compliments
Altera_Forum
Contributeur émérite II
1 271 Visites

Hi Alex, 

 

Thanks for your reply. Sorry, I don't understand the 'direction' signal. Temperature values are already going to temp signal so what is the purpose of 'direction' signal. And I got the idea when I need to trigger the events based upon condition. But dont understand the condition. Can you please elaborate. Thanks for your time.
0 Compliments
Altera_Forum
Contributeur émérite II
1 271 Visites

Oh. it's easy. 

for example, let's give name for expression (new_temperature minus old_temprature) dT, 

then we need to know the sign of dT. so if temprature has 16 bit, you should extend the dT by 1 bit, so dT is 17 bit  

if it is negative so you have direction = down, otherwise direction = up if dT /= 0, in other case it is untouched. 

but you can introduce 'temp_change' like condition3 and asssign it like condtion3 := (dT /= 0); 

 

So you problem may be clear if you'll write the graph for yourself on paper and determine several condition from your hysteris painted on peace of paper.  

Finally, if condition3 = false so temprature doesn't change.  

then you can use 

outside you hysteresis 

condition3 = true and condition1 = true - it means temparure move towards small values,  

condition3 = true and condition2 = true - it means temprature move towards big values 

inside you hysteresis you can make yourself.
0 Compliments
Altera_Forum
Contributeur émérite II
1 271 Visites

Usman, 

 

To introduce some hysteresis into your calculation you need to store one (or more) calculated temperature values and use the stored value(s) when calculating your new temperature. 

 

You'll need some time interval appropriate to your system - this might be 1ms, 1s, 1 minute or 1 hour (or something else). At each time interval you calculate a new temperature based on your newly read temperature AND your stored value(s). You will need to 'weight' each value used for the calculation appropriately - typically older values contribute less to the newly calculated value. 

 

This will introduce hysteresis into your temperature calculation. 

 

Cheers, 

Alex
0 Compliments
Répondre