Temperature controller using 8051

Discussion in 'The Projects Forum' started by makarandsd, Feb 28, 2011.

  1. makarandsd

    Thread Starter New Member

    Feb 20, 2011
    13
    0
    Hi, This is makarand.
    I want to design an automatic temperature controller using an 8051. I'll be using a resistive temperature sensor, or an LM35. I have the following in mind.

    Sensor output will be amplified and given to an ADC, that to the uC. I want to control the heater according to the sensor output. I am confused whether to use a thyristor or a relay to control the heater. If a thyristor, how do I control it's firing angle. I understood the basics, but what exactly do I have to do to fire the SCR at say, 50 degrees? How would the controller help me in achieving this? Is it right that the time instant when the SCR will be fired would be dependent upon the AC frequency of 50Hz? Please help, I am dead confused with all this.
     
  2. wayneh

    Expert

    Sep 9, 2010
    12,154
    3,060
  3. tracecom

    AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    Although you didn't ask this, I don't think you will need to amplify the output of an LM35. I have a PICAXE circuit that compares the LM34 (in my case, I think in F) output to a voltage divider via two different ADC inputs on the μC. No amplification used and it works fine. However, I know nothing about an 8051.

    Secondly, if you are switching AC to a completely resistive load (like a heater element), I don't think it matters about when the switch takes place. Attached is a circuit which works perfectly well for me; I use it at 60 hertz and 117VAC of course, but I don't think that changes things. If you truly need to switch at zero crossing, I believe there is a optoisolator in the same family as the one that I used that will take care of it automatically. I don't recall the number.
     
  4. makarandsd

    Thread Starter New Member

    Feb 20, 2011
    13
    0
    I was thinking about the 8051 because there are other things to be done, like a display to show the temperature. I understand that the uC can be used to generate variable delays to control the phase angle. Another question which came in my mind was, the system would be like, if the set point was 50 degrees, and the temperature is say 40 degrees maybe I'll need a higher angle. Likewise for a temperature slightly lower than the set point the scr can be fired earlier. How can I accomplish this using the sensor output?
     
  5. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Why not use a microcontroller with built in A/D such as a PIC or AVR.
     
  6. makarandsd

    Thread Starter New Member

    Feb 20, 2011
    13
    0
    That would be a good option. Please help me with the SCR part too.
     
  7. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    A Triac would be better IMO but solid state relay might be safer.
     
  8. tracecom

    AAC Fanatic!

    Apr 16, 2010
    3,871
    1,394
    One of us is totally confused...maybe me, but I can't figure out what phase angle has to do with temperature except that they are both measured in degrees - albeit degrees of two completely different sorts.

    What are you trying to accomplish, a simple thermostat?
     
  9. makarandsd

    Thread Starter New Member

    Feb 20, 2011
    13
    0
    I want to control the phase of the AC signal and that signal has to be given to the heater element. I've learnt that this can be accomplished using the thyristor by firing it at a suitable delay according to the required phase angle. The phase angle of the signal to the heater will change the rate of change of temperature; higher angle for faster temperature increase. The process needs to be automated. Hence I've thought of the following system.
    E.g.
    1. Sensor detects temperature.
    2. uC reads temperature.
    3. uC detects that temperature is terribly lower than set point.
    4. uC provides delay to the thyristor gate terminal so that phase angle of signal will be high, heater will heat up faster.
    This is exactly what I want to accomplish.

    I'm new here. Please tell me how to I attach an image from my computer so that I would be able to show you the flowchart.
     
  10. mjhilger

    Member

    Feb 28, 2011
    119
    16
    The choice of using an SCR or TRIAC depends on which quadrants you want to trigger and sustain on timing. If you plan on switching on each cycle, you will create a power factor issue you might want to investigate.
    The way to accomplish is via a digital timer [counter] and a zero crossing detector. The timer can count up or down depending on your implementation. Lets say you use a count down timer. You will drive the timer with a reduced version of your main clock, so if your uP clock is 4Mhz then divide it down to 500 kHz, each count is 2 usec. You load the timer (from the uP) with the turn on count, the zero crossing detector starts the timer counting down, when it reaches 0 the signal drives the gate of your SCR or TRIAC. Ideally the counter has a preload register that holds the count down beginning count and reloads itself each time - the uP only intervenes when a change is necessary.
    I know there are many variants of the 8051 out there, maybe some with this type of thing built in. But I KNOW Microchip has parts that have this type of counter built in as well as the A/D and other useful things. It can certainly be done with an 8051, but a $9 part that would make life easy seems pretty cheap to me.
     
  11. makarandsd

    Thread Starter New Member

    Feb 20, 2011
    13
    0
    Thank you mjhilger. I understood the part of loading the timer to produce the delay required. Where does the ZCD come into picture? For the zero corssing of the sine wave? And how can I auto load the timer depending upon sensor output? Using the ADC, I believe?
     
  12. mjhilger

    Member

    Feb 28, 2011
    119
    16
    Zero crossing detectors circuits can be found on the web, maybe on here I have not looked. Basically if you form a voltage divider network 1K at bottom and 2 50K 1/4 w on top in series, you will divide the sine wave by about 100. This gets fed into an op amp so we now have a sq wave output of the sine wave. You can use the rising edge or falling edge or both to start your counter.
    The number you load into the timer is your choice and relates to the timing offset from the zero crossing. I assumed you wanted to change this via your program, in which case you connect your 8051 to the load register some how (could be 1 bit pushed out via a clk from another bit, or parallel - lots of choices here). But this is how it is done.
     
  13. makarandsd

    Thread Starter New Member

    Feb 20, 2011
    13
    0
    Thank you. I'll try doing it.
     
  14. lespaul

    Active Member

    Jan 30, 2008
    49
    2
    I know I jumped on here a bit late. How about a proportional controller. Utilize the 8051 to create a duty cycle and send to a simple mosfet h-bridge or similar to control the heater. The heater 'on' cycle is dependent on the duty cycle...well in this case it may never REALLY tun off, but close to off.
     
  15. makarandsd

    Thread Starter New Member

    Feb 20, 2011
    13
    0
    Lespaul, can you elaborate on your idea? Duty-cycle is fine, I didn't quite understand the h-bridge.
     
  16. lespaul

    Active Member

    Jan 30, 2008
    49
    2
Loading...