TEC controller


Closed Thread
Results 1 to 19 of 19

Thread: TEC controller

Hybrid View

  1. #1
    Join Date
    Oct 2012
    Posts
    82

    Default TEC controller

    Hi All,

    I’ve been away from this forum as an active poster for some time now due to some health and work problems.
    I’m slowly going back in my old routines and I got a small challenging project involving the resurrection of a nice, two compartment wine cooler (about 21 bottles).
    My preliminary troubleshooting shows that both TEC controller boards are no longer doing their job and there are a lot of missing segments in the LED display. The TECs are still performing well (using a PC PSU I had them running for less than 30 minutes and the temperature inside went down to less than 50⁰F with a 75⁰F ambient). I’m planning on using the same PSU for my rebuild. I’m using the 12V outputs from it and each TEC draws about 5A.
    I decided, just to impress the wife, to replace all the electronics with my own. To keep it challenging I’m planning on doing it with as little part orders and use / recycle some of the junk I almost forgot I had.
    There will be a 4x20 LCD display with or without serial backpack (“in stock”). I have different samples of different calibers of 16F series PICs on prototyping boards ready to re-wire and program.
    I will be using two temperature sensors / thermostats (DS1820 / DS1821 type (“in stock”)). One sensor will be on the TEC cold side heatsink monitoring the possible TEC freeze and the other will help maintain the set temperature in each chamber.
    I can easily write PBP code to drive the display, set / display temperature and so on but the only thing I’m missing is a simple, reliable, safe and efficient TEC controller.
    My goal is to create a standalone module, linear or PWM (preferably), that will deal with the TEC under a master controller. I only need the cooling so this should simplify the device a little.
    Some Google search got me few results but most of the good ones are only working in up to 5V.
    The bottom line here is: can someone recommend the best approach to this and eventually send me some information on an actually proven working controller?

    In mean time I will start exploring the PWM avenue using my learnings in this thread:
    http://www.picbasic.co.uk/forum/showthread.php?t=18317

    As soon as I get my setup and some results I will return with a report.

    Thank you for your attention.

    Nick

  2. #2
    Join Date
    Oct 2012
    Posts
    82


    Did you find this post helpful? Yes | No

    Default Re: TEC controller

    Hi All,

    After gathering all the stock ingredients I ventured to prototype something to get me started (see attached schematic). Most of the stuff was already made from older projects so I just needed some re-wiring.
    To my surprise, at the first try, I was able to drive a TEC with an 80KHz output from an older PIC 12F683 board. I will have to look back to find the code that runs it but it basically outputs 80KHz of about 40% duty cycle PWM for about 3 seconds and about 75% for 3 seconds.
    The output voltage to the TEC goes from 5.5V to 8.5V with a current draw of 1A and respectively 3A.
    Checking with an old scope the TEC voltage is pretty clean.
    I separately built a refrigeration box out of ¾” Styrofoam and I was able to maintain a bottle of wine at about 45⁰F for two days running the TEC under 5.5 V from a separate PSU. I will do some more testing like this to figure out the minimum voltage that is needed to maintain a decent temperature in the cooler without having to turn the TEC OFF. I will do so after replacing the first wine bottle which became “a casualty of the project” and I opened it to celebrate the first successful test. This is becoming a fun project. LOL
    Next step will be to fine tune the switching frequency for efficiency and the needed PWM range to get my lowest and highest output.

    I will keep you posted and I might come back with some clarifications and maybe questions. I will also post the code that I’m running after I get it optimized.

    Nick
    Attached Images Attached Images

  3. #3
    Join Date
    Oct 2012
    Posts
    82


    Did you find this post helpful? Yes | No

    Default Re: TEC controller

    I trying to control PWM output on a PIC12F683 and I wrote the following code for a quick test:
    Code:
    @ device  pic12F683, intrc_osc_noclkout, wdt_on, mclr_off, protect_off
    
    OSCCON=%01110111     
    DEFINE OSC 8        
    
    ADCON0=%00001101
    ANSEL   = %00111000       
    TRISIO=%00011000        
    CMCON0=%00000111        
                
    i           var         byte
    pwm_out     var         GPIO.2
    
    CCP1CON = %00001100     
    PR2 = 15            
    CCPR1L = 0         
    CCP1CON.5 = 0
    CCP1CON.4 =0
        
    
        Pause 200
        T2CON.2 = 1             
        Goto main
    Main:
         for i=8 to 14
         CCPR1L = i
         CCP1CON.5=0
         CCP1CON.4=0
         pause 250
         CCPR1L = i
         CCP1CON.5=0
         CCP1CON.4=1
         pause 250
         CCPR1L = i
         CCP1CON.5=1
         CCP1CON.4=0
         pause 250
         CCPR1L = i
         CCP1CON.5=1
         CCP1CON.4=1
         pause 250
         next
         for i=14 to 8 step -1
         CCPR1L = i
         CCP1CON.5=1
         CCP1CON.4=1
         pause 250
         CCPR1L = i
         CCP1CON.5=1
         CCP1CON.4=0
         pause 250
         CCPR1L = i
         CCP1CON.5=0
         CCP1CON.4=1
         pause 250
         CCPR1L = i
         CCP1CON.5=0
         CCP1CON.4=0
         pause 250
         next
         CCPR1L=0
         Pause 5000
    Goto Main
    What I’m trying to do is use the finest possible steps in controlling the PWM.
    Please ignore the low case spelling on some lines of the code. I did not realized I have the auto capitalize feature enabled and I became lazy. The code works since the Micro Code Studio fixes them for me. I know is a bad and risky habit and I will try to fix it.
    The code rumps up and down from 5.5V output to 9.5V in 28 steps and after 5 seconds stop repeats the cycle which should take 14 seconds without the pause. It is just to easily explore all possibilities.

    The question is: Can I somehow combine the CCPR1L and CCP1CON<5:4> in one single variable so it is easier to handle in the FOR / NEXT loop and make the code more elegant?

    Any input will be greatly appreciated.

    Nick

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: TEC controller

    This is how I do it for a word sized variable that gives you 10 bits of resolution:

    CCPF = CCPF MIN MAXPWM
    CCPR1L = CCPF >> 2 'UPDATE PWM1 UPPER 8 BITS
    CCP1CON = $0C | ((CCPF & $3) << 4) 'UPDATE PWM1 LOWER 2 BITS
    Dave Purola,
    N8NTA
    EN82fn

  5. #5
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: TEC controller

    For CCP1CON bits this is much faster
    CCP1CON.5=CCPF.1
    CCP1CON.4=CCPF.0

  6. #6
    Join Date
    Oct 2012
    Posts
    82


    Did you find this post helpful? Yes | No

    Default Re: TEC controller

    Thank you Dave and Pedja089 for your input.
    I will try implementing your suggestions and report back the results. Unfortunately I just started work so it has to wait for a few good hours.
    I was thinking to try something like this subroutine but it was too late last night:

    Code:
    Set_pwm_pars:
    	CCP1CON.4 = Pwm_pars.0
    	CCP1CON.5 = Pwm_pars.1
    	CCPR1L = Pwm_pars >> 2
    	RETURN		
    Main:
    	FOR i = min_pwm to max_pwm
    	Pwm_pars = i 
    	GOSUB Set_pwm_pars
    	PAUSE 250
    	NEXT
    	PAUSE 5000
    	GOTO Main
    My goal for now is to get enough steps with about 0.25V between them so the TEC will not complain.
    BTW does anyone know if slow, occasional (every few minutes) 0.25V steps combined with heavy capacitor filtering will affect the TEC?

    Thanks again for your input.

    Nick

Similar Threads

  1. Repeater ID and controller
    By Macgman2000 in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 29th March 2012, 23:06
  2. SMS Controller
    By savnik in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th September 2006, 15:12
  3. temperature controller
    By PoTeToJB in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th April 2006, 20:01
  4. PID CONTROLLER help..
    By tkly36 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th April 2006, 07:19

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts