Results 1 to 6 of 6

Thread: ChipKIT UNO 32 Temp Center Kit

  1. #1
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default ChipKIT UNO 32 Temp Center Kit

    I designed this for a customer and crenn did the code. It's open source, all files are available for you to make your own.

    I've assembled and tested a unit and I've got 7 6 board sets left if anyone's interested in purchasing a set. I can ship bare boards, or I can assemble them for you with an LCD of your choice and cable length of your choice. PM me for details on that if you're interested.

    Without further adieu, I introduce the ChipKIT UNO32 12-port temp center kit!

    Shield Pics:













    LCD Board Pics:













    Code:
    Code:
    // ChipKIT UNO 32 12-port Temperature Center Shield
    // Code Written by Crenn (www.thebestcasescenario.com)
    // Designed by Will Lyon (www.computersandcircuits.com)
    
    //  This program is free software: you can redistribute it and/or modify  
    //  it under the terms of the GNU General Public License as published by  
    //  the Free Software Foundation, either version 3 of the License, or  
    //  (at your option) any later version.  
    //  
    //  This program is distributed in the hope that it will be useful,  
    //  but WITHOUT ANY WARRANTY; without even the implied warranty of  
    //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
    //  GNU General Public License for more details.  
    //  
    //  You should have received a copy of the GNU General Public License  
    //  along with this program. If not, see http://www.gnu.org/licenses/  
    
    
    // Libraries
    #include <LiquidCrystal.h>
    
    // Global Constants
    const unsigned short START_MES_DIS_TIME=3;
    const unsigned short ACTION_TIME=5;
    const unsigned short UPDATE_TIME=1;
    const unsigned short MILLIS_IN_SEC=1000;
    const unsigned short SMDT_IN_MS=START_MES_DIS_TIME*MILLIS_IN_SEC;
    const unsigned short AT_IN_MS=ACTION_TIME*MILLIS_IN_SEC;
    const unsigned short UT_IN_MS=UPDATE_TIME*MILLIS_IN_SEC;
    const byte TEMP_PINS=12;
    const byte NO_TEMPS_ON_LCD=2;
    const byte TEMP_SETS=TEMP_PINS/NO_TEMPS_ON_LCD;
    const byte TEMP_PIN_MAP[NO_TEMPS_ON_LCD][TEMP_SETS]={
        {14,16,18,20,22,24} , {15,17,19,21,23,25}
    };
    const byte LCD_COLS=16;
    const byte LCD_ROWS=2;
    // The +1 is to allow for the null character at the end of the string
    const char WELCOME_LA[LCD_COLS+1]="                ";                    // edit these to change the opening message display. Line 1 on top, line 2 on bottom
    const char WELCOME_LB[LCD_COLS+1]="                ";
    const char TEMP_L[]="TEMP ";
    const byte TEMP_CUST_CHARS=7;
    const byte TEMP_CUSTOM[TEMP_PINS][TEMP_CUST_CHARS+1]={
      
      {"TEMP  1"},{"TEMP  2"},{"TEMP  3"},{"TEMP  4"},                       // Change these to edit the temp zone display names. Max 8 characters each!
      {"TEMP  5"},{"TEMP  6"},{"TEMP  7"},{"TEMP  8"},                       // You will need to adjust the spacing and upload to get it where you want it
      {"TEMP  9"},{"TEMP 10"},{"TEMP 11"},{"TEMP 12"}
    };
    const char TEMP_S[]={0xDF,'C'};
    
    // Global Variables
    LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
    byte temp_pin_pointer=0;
    unsigned short temp_values[NO_TEMPS_ON_LCD][TEMP_SETS];
    byte temp_lcda=1;
    byte temp_lcdb=2;
    byte welc_disp=0;
    unsigned long tsla; // time_since_last_action;
    unsigned long tslu; // time_since_last_update;
    
    double convertTemp(unsigned short ttbc) {
      if (ttbc > 237 && ttbc < 748) {
        return (ttbc-237)*0.0939947781;
      }
      return 0.0;  
    }
    
    // Temperature Sensor Functions
    void newTemps() {
      temp_lcda=(TEMP_PIN_MAP[0][temp_pin_pointer]-13);
      temp_lcdb=(TEMP_PIN_MAP[1][temp_pin_pointer]-13);
    }
    
    void updateTemps() {
      for(byte i=0;i<TEMP_SETS;i++) {
        temp_values[0][i]=analogRead(TEMP_PIN_MAP[0][i]);
        temp_values[1][i]=analogRead(TEMP_PIN_MAP[1][i]);
      }
    }
    
    void displayTemps() {
      unsigned char spaces = 2;
      double temp_conv = 0.0;
      lcd.setCursor(0, 0);
      if(TEMP_CUSTOM[(temp_lcda-1)][0] != 0) {
        for (int i=0;i<TEMP_CUST_CHARS;i++) {
          if(TEMP_CUSTOM[(temp_lcda-1)][i] != 0) {
            lcd.print(TEMP_CUSTOM[(temp_lcda-1)][i]);
          }
    	  else {
    	    spaces = 8-i;
    		break;
    	  }
    	}
      }
      else {
        lcd.print(TEMP_L);
        if(temp_lcda < 10) {
          lcd.print(' ');
        }
        lcd.print(temp_lcda,DEC);
    	spaces = 2;
      }
      for (int i=0;i<spaces;i++) {
        lcd.print(' ');
      }
      if(TEMP_CUSTOM[(temp_lcdb-1)][0] != 0) {
        for (int i=0;i<TEMP_CUST_CHARS;i++) {
          if(TEMP_CUSTOM[(temp_lcdb-1)][i] != 0) {
            lcd.print(TEMP_CUSTOM[(temp_lcdb-1)][i]);
          }
          else {
            spaces = 8-i;
        	break;
          }
        }
      }
      else {
        lcd.print(TEMP_L);
        if(temp_lcdb < 10) {
          lcd.print(' ');
        }
        lcd.print(temp_lcdb,DEC);
        spaces = 0;
      }
      if (spaces != 0) {
        for (int i=0;i<spaces;i++) {
          lcd.print(' ');
        }
      }
      spaces = 3;
      lcd.setCursor(0, 1);
      temp_conv=convertTemp(temp_values[0][temp_pin_pointer]);
      if (temp_conv<10) {
        lcd.print(' ');
      }
      lcd.print(temp_conv,1);
      lcd.print(TEMP_S);
      for (int i=0;i<spaces;i++) {
        lcd.print(' ');
      }
      temp_conv=convertTemp(temp_values[1][temp_pin_pointer]);
      if (temp_conv<10) {
        lcd.print(' ');
      }
      lcd.print(temp_conv,1);
      lcd.print(TEMP_S);
    }
    
    void displayWel() {
      lcd.setCursor(0, 0);
      lcd.print(WELCOME_LA);
      lcd.setCursor(0, 1);
      lcd.print(WELCOME_LB);
    }
    
    void setup() {
      lcd.begin(LCD_COLS, LCD_ROWS);
      displayWel();
      tsla = millis();
      while (millis() < (tsla + SMDT_IN_MS));
      tsla = millis();
      updateTemps();
      displayTemps();
    }
    
    void loop() {
      if (millis() > (tsla + AT_IN_MS)) {
        if (welc_disp == 1) {
    	  temp_pin_pointer = 0;
    	  welc_disp = 0;
    	  updateTemps();
    	}
    	else {
    	  ++temp_pin_pointer;
    	}
        if (temp_pin_pointer >= TEMP_SETS) {
    	  displayWel();
    	  welc_disp = 1;
        }
        else {
    	  newTemps();
          displayTemps();
        }
        tsla = millis();
      }
      if (temp_pin_pointer < TEMP_SETS) {
        if (millis() > (tslu + UT_IN_MS)) {
          updateTemps();
          displayTemps();
          tslu = millis();
        }
      }
    }
    Eagle Files:

    Shield Board:
    .brd:
    http://www.thebestcasescenario.com/s...Center_Brd.brd
    .sch:
    http://www.thebestcasescenario.com/s...Center_Brd.sch

    LCD Board:
    .brd:
    http://www.thebestcasescenario.com/s...Center_LCD.brd
    .sch:
    http://www.thebestcasescenario.com/s...Center_LCD.sch

    Bill Of Materials (.pdf):
    http://www.thebestcasescenario.com/s...Center_BOM.pdf
    Last edited by SXRguyinMA; 11-02-2011 at 04:13 PM.

  2. #2
    Administrator OvRiDe's Avatar
    Join Date
    Dec 2005
    Location
    Tulsa, OK
    Posts
    4,586

    Default Re: ChipKIT UNO 32 Temp Center Kit

    I totally want to see this in action! Any videos of it?

  3. #3
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: ChipKIT UNO 32 Temp Center Kit

    I've got some. I'll get them uploaded soon
    Check Makro Specials and Pick n Pay Specials.
    Last edited by DaveW; 11-21-2020 at 07:59 PM.

  4. #4
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: ChipKIT UNO 32 Temp Center Kit


  5. #5
    Fox Furry crenn's Avatar
    Join Date
    Apr 2005
    Location
    In the shadows behind you
    Posts
    4,067

    Default Re: ChipKIT UNO 32 Temp Center Kit

    I'm apparently your associate according to the article ;P

    Although one of the comments, made me think a little. Maybe there should be an offset for each channel if it's needed. Or I can fix up the maths involved in the temp as I knew it's not exactly accurate.
    Antec Sonata II | Pioneer DVR-212
    Good news! You can follow my website or follow me on twitter!

  6. #6
    Resident 100HP water-cannon operator SXRguyinMA's Avatar
    Join Date
    Jun 2008
    Location
    MA
    Posts
    5,865

    Default Re: ChipKIT UNO 32 Temp Center Kit

    it's not 100% accurate but 1ºC-2ºC off isn't bad.

Posting Permissions

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