|
||||||
|
Welcome to the TBCS Community Forums forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
![]() |
|
|
Thread Tools |
|
#1
|
||||
|
||||
|
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 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();
}
}
}
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
__________________
![]() Tempest SXR * Power House * Red Comet * ICHIWZ * Acrylic Headphone Hook Continuing sponsorship support from PCBoard.ca Last edited by SXRguyinMA : 11-02-2011 at 04:13 PM. |
|
#2
|
||||
|
||||
|
I totally want to see this in action! Any videos of it?
__________________
|
|
#3
|
||||
|
||||
|
I've got some. I'll get them uploaded soon
![]()
__________________
![]() Tempest SXR * Power House * Red Comet * ICHIWZ * Acrylic Headphone Hook Continuing sponsorship support from PCBoard.ca |
|
#4
|
||||
|
||||
|
__________________
![]() Tempest SXR * Power House * Red Comet * ICHIWZ * Acrylic Headphone Hook Continuing sponsorship support from PCBoard.ca |
|
#5
|
||||
|
||||
|
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.
__________________
<IMAGED REMOVED: OMEGA MADE FOXY DISAPPEAR> JDBNSN MADE FOXY CRY Antec Sonata II | Pioneer DVR-212 Good news! You can follow my website or follow me on twitter! |
|
#6
|
||||
|
||||
|
it's not 100% accurate but 1ºC-2ºC off isn't bad.
__________________
![]() Tempest SXR * Power House * Red Comet * ICHIWZ * Acrylic Headphone Hook Continuing sponsorship support from PCBoard.ca |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
|
|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
thebestcasescenario.com























