Quick advice on PIC choice?

Discussion in 'The Projects Forum' started by urb-nurd, Aug 11, 2014.

  1. urb-nurd

    Thread Starter Member

    Jul 9, 2014
    269
    3
    Hey guys. i am trying to control a small DC heater with some Soft Pid control using a PIC and PWM via a mosfet.

    I understand the theory behind all this, however this will be my first physical attempt at this project.

    I was wondering if anyone could help me pick some parts here, first off. I use Mikroc at university and will be using it this year - therefore i would like to be able to use mikroc with my PIC and Board.

    I also am not sure what type of mofset to use as a switch for the PWM control of my heater.
    I was thinking something like this http://www.hobbytronics.co.uk/irf1405-mosfet
    However, i have no real solid idea.

    I also would like to measure the temperature of my heater and so considered a thermistor or RTD.

    Any advice on the following is greatly appreciated:

    What Pic and Board can i use with mikroc (funds are very low, so cheap as possible! hence why im not looking at the microelectronica boards)

    What mosfet is best used a a switch for PWM a heater vis soft PID.

    What would be better for accurate PID control of a heater that would get in excess of 300 Celcius - RTD, thermistor or other?

    thanks alot guys!

    Edit: for clarification, the heater will be cooled frequently with air flow. possibly loosing it's set point about once every ten seconds.
     
    Last edited: Aug 11, 2014
  2. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,689
    2,750
    My guess, off the top of my head, is that you are going to be better off with an RTD or thermocouple at 300C. I use thermistors for temperature measurement, but only close to room temperature.

    RTDs are easier to drive accurately than thermocouples. Pay attention to the resistance curve vs. temperature and design appropriately.

    Remember that a physical heater has a significantly large thermal mass. It doesn't change temperature all that quickly, so you don't really need a fast pid or pwm. In fact, I assume you will be driving considerable power into the heater, so switching it at a much longer period would help to eliminate noise. A one second PWM period, or longer, should be acceptable.

    Also, the switching transients may couple into the small temperature signal. Syncronize your A/D conversions with the transients to eliminate this as a noise source.

    There will be more good advice to come from others, I am sure.
     
  3. urb-nurd

    Thread Starter Member

    Jul 9, 2014
    269
    3
    Wow, more in depth than i imagined! thanks!

    I meant to say thermocouple not thermistor haha! thanks for the recommendation.

    could you elaborate on the switching of the mosfets effect on the RTD's sensitivity?
     
  4. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    Heaters are very slow. Electric range, for example, switches only few times a minute. Therefore, you probably do not need PWM. You simply measure the temperature once a second. If it gets too cold, you switch it on. If it gets too hot, you switch if off.
     
  5. urb-nurd

    Thread Starter Member

    Jul 9, 2014
    269
    3
    thanks for the input!

    The heater will be cooled frequently by rapid air flow, the aim of the temperature control is to try maintain this temperature as soon as cooling begins.

    As air is drawn past the heater i would like the air to be a consistent temperature through out.
     
  6. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,689
    2,750
    I have an application very close to what you are trying to do, albeit at much lower temperatures. Here is a thread I made about it, there might be some useful information for you:

    http://forum.allaboutcircuits.com/showthread.php?t=64095&highlight=thermistor

    You said you want DC control of the heater. I assume this means that the heater is going to operate off the same supply as the controller. Every time the heater switches on or off, a significant transient will be produced that may (probably will) perturb your low-level, high-impedance temperature signal. This will introduce synchronous (i.e. correlated) noise into your measurement.

    Even if you use separate supplies for the controller and the heater, synchronous noise can be inductively coupled into your low-level analog signal.

    Synchronous noise is different than asynchronous (uncorrelated) noise in that, a) it is predictable and b) no amount of filtering will remove it. Worse, if you sample at a rate different than the noise signal, your samples will acquire an additional beat frequency that, under some conditions will start to look like a bad, variable DC error.

    OTH, synchronous noise is *easy* to eliminate entirely, if you know its source, and if you can align your a/d conversions with the transients.

    I would approach your case like this:

    Pick a PWM period, say 1 second.
    Pick a PWM frequency, say 1024 hz -- therefore, your minimum time slice is just less than a millisecond, and your PWM resolution is 1024 counts.

    Each millisecond, start (and complete) an a/d conversion just prior to the switching of power (which may, or may not, happen, depending on the PWM duty).

    In this way, the a/d has had a full 1ms to settle prior to the conversion, and any transients occur only after the conversion is complete.

    Clear as mud, I know.
     
  7. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    Should still be very slow. Remembering how it works with soldering station, it takes nearly a minute for it to cool down (about 5°C/sec). At any rate, if you measure once per 100ms, and then switch according to the last measurement (if higher than Ton then switch on, if lower than Toff switch off), it is still very slow for a PIC. You may get some overshoot (which you can control by manipulating Ton and Toff), but overall this type of control works much better than PID over PWM.
     
  8. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,689
    2,750
    The problem is, a bang-bang controller, as you are proposing, will not compensate for the thermal lag between when the power is applied and when the air/RTD is heated. Therefore, there *will* be overshoot and undershoot.

    A properly tuned pid will predict power requirements in advance, eliminating the over/undershoot.
     
  9. urb-nurd

    Thread Starter Member

    Jul 9, 2014
    269
    3
    Thank you for that, i really do appreciate the time spent!
     
  10. urb-nurd

    Thread Starter Member

    Jul 9, 2014
    269
    3
    i have used PID controllers in conjunction with PLC's before.
    I (wrongly) assumed i could implement a similar algorithm using code only.
    What would you recommend to control the temperature?
     
  11. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    It depends on how much of an overshoot you get. If you want your temperature to vary between Tl and Th, and overshoot is O then you set your switch points to Ton=Tl+O anf Toff=Th-O. Overshoot will be a problem only if O > (Th-Tl)/2, although by introducing a waiting period you can make it work well with O close to (Th-Tl).

    The problem might be of two sorts:

    Too big of an overshoot. If you put a heater at one end of a long corridor and measure temperature at the other end, you get enormous overshoot, so PID will do better.

    Too strict requirements - too narrow (Th-Tl) - in which case PID won't do any better.
     
  12. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,689
    2,750
    And if you desire no overshoot/undershoot at all???
     
  13. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,689
    2,750
    Wrongly? I have said nothing to the contrary with respect to your original post. You may approach the problem with a PID controller. And the PID controller may be implemented as a mcu/software solution. I even referred to a thread where I did the exact same thing, but at a lower temperature.
     
  14. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    Every switching system has some sort of ripple. Then there are measurement errors, noise etc. So, if you desire absolute accuracy, you're not going to get it in the real world.

    Every design should start from defining the acceptable range of parameters, then designing a method to meet the goal.
     
  15. urb-nurd

    Thread Starter Member

    Jul 9, 2014
    269
    3
    To clarify, my RTD would be fixed to the heater.

    The accuracy im looking for will be around 4-5 Celsius either way.

    Im afraid i have been lost in the discussions of this thread.
    What is the general consensus?
    I can use a PIC with a mosfet to PWM the heater? However there are caveats that will need to be addressed?

    I am still looking for advice on the Mosfet and PIC programmer that i can use with Mikroc if anyone has an idea.

    Thanks again to everyone for their input
     
  16. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    Yes. Since your switching frequency is low, going with bigger mosfet with low Rds(on) will help to conserve power and possibly eliminate the need for a heatsink. What is your voltage and current?
     
  17. urb-nurd

    Thread Starter Member

    Jul 9, 2014
    269
    3
    Fantastic!
    My voltage will be 7.4V (peak at 8.4) and the curent will be 1.5 amps from the heater.
     
  18. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,689
    2,750
    urb-nurd likes this.
  19. urb-nurd

    Thread Starter Member

    Jul 9, 2014
    269
    3
  20. NorthGuy

    Active Member

    Jun 28, 2014
    604
    121
    Wow! I expected something like 24V 50A :)
     
Loading...