My arduino cyl head temp display, almost got it ! |
|
Porsche, and the Porsche crest are registered trademarks of Dr. Ing. h.c. F. Porsche AG.
This site is not affiliated with Porsche in any way. Its only purpose is to provide an online forum for car enthusiasts. All other trademarks are property of their respective owners. |
|
My arduino cyl head temp display, almost got it ! |
underthetire |
Jun 29 2010, 08:42 PM
Post
#1
|
914 Guru Group: Members Posts: 5,062 Joined: 7-October 08 From: Brentwood Member No.: 9,623 Region Association: Northern California |
My very first Arduino micro controller program. I've never used the Arduino language before ( think it c or C+ ? ) anyways, took me a few hours. Still need to order the thermocouple conversion chips, but looks like it will work. You can see when I put my finger over the analog pins, it does change as it should. Total cost will still be less than a single channel VDO gauge, and I will be able to calibrate it for more accurate readings.
https://www.youtube.com/watch?v=9UOUeEh11eg |
McMark |
Jun 29 2010, 10:03 PM
Post
#2
|
914 Freak! Group: Retired Admin Posts: 20,179 Joined: 13-March 03 From: Grand Rapids, MI Member No.: 419 Region Association: None |
Very cool! (IMG:style_emoticons/default/thumb3d.gif) Looks like fun. You might think about ditching the "Cyl. X temp" parts and just put all four temps on one screen, like this
2: 120 4: 120 1: 120 3: 120 I put the cylinders in an orientation that matches the motor. (IMG:style_emoticons/default/cool.gif) |
jabberwocky |
Jun 29 2010, 10:04 PM
Post
#3
|
Newbie Group: Members Posts: 40 Joined: 24-April 10 From: Cleveland OH Member No.: 11,653 Region Association: None |
I was thinking a similar rout as I have programed a few AVG microcontrollers and have been thinking of picking up an adrino. Care to share the code? Are you running type J or K thermocouples and what converters are you going to use?
Good luck finishing out the install. |
underthetire |
Jun 29 2010, 10:24 PM
Post
#4
|
914 Guru Group: Members Posts: 5,062 Joined: 7-October 08 From: Brentwood Member No.: 9,623 Region Association: Northern California |
I don't mind sharing the code at all. I'm no expert for sure. I did just finish doing a hold screen if the temps go above 400 and an alarm output for a piezo buzer or lamp. Planning on using K thermocouples since I have rolls of it. Mark I like the single page layout, I was thinking a larger screen in the future. Here is the conversion boards with the AD chips on them.
http://store.makerbot.com/electronics/elec...r-v1-0-kit.html |
underthetire |
Jun 29 2010, 10:30 PM
Post
#5
|
914 Guru Group: Members Posts: 5,062 Joined: 7-October 08 From: Brentwood Member No.: 9,623 Region Association: Northern California |
i'll put some more notes in it when I clean it up, but here it is..got a arduino and LCD shield on ebay, with shipping it was like 30 bucks total.
CODE /* The circuit: * LCD RS pin to digital pin 8 * LCD Enable pin to digital pin 9 * LCD D4 pin to digital pin 4 * LCD D5 pin to digital pin 5 * LCD D6 pin to digital pin 6 * LCD D7 pin to digital pin 7 * 10K resistor: * ends to +5V and ground * wiper to LCD VO pin (pin 3) */ // include the library code: #include <LiquidCrystal.h> void setup() { Serial.begin(19200); Serial.println("Start"); } void loop() { label:; int raw = analogRead(1); int celsius = ( 5.0 * raw * 100.0) / 1024.0; Serial.print("Celsius: "); Serial.println(celsius); int fahrenheit = (((celsius * 9) / 5) + 32); Serial.print("Fahrenheit: "); Serial.println(fahrenheit); int raw1 = analogRead(2); int celsius1 = ( 5.0 * raw1 * 100.0) / 1024.0; Serial.print("Celsius1: "); Serial.println(celsius1); int fahrenheit1 = (((celsius1 * 9) / 5) + 32); Serial.print("Fahrenheit1: "); Serial.println(fahrenheit1); int raw2 = analogRead(3); int celsius2 = ( 5.0 * raw2 * 100.0) / 1024.0; Serial.print("Celsius2: "); Serial.println(celsius2); int fahrenheit2 = (((celsius2 * 9) / 5) + 32); Serial.print("Fahrenheit2: "); Serial.println(fahrenheit2); int raw3 = analogRead(4); int celsius3 = ( 5.0 * raw2 * 100.0) / 1024.0; Serial.print("Celsius3: "); Serial.println(celsius3); int fahrenheit3 = (((celsius3 * 9) / 5) + 32); Serial.print("Fahrenheit3: "); Serial.println(fahrenheit3); int warning =13; pinMode(warning, OUTPUT); int backlightc = 10; pinMode(backlightc, OUTPUT); digitalWrite(backlightc,HIGH); delay(100); // initialize the library with the numbers of the interface pins LiquidCrystal lcd(8, 9, 4, 5, 6, 7); const int numRows = 2; const int numCols = 16; //void setup() { // set up the LCD's number of rows and columns: lcd.begin(0, 2); // Print a message to the LCD. lcd.print("Cyl. 1 temp "); lcd.setCursor(12,0); lcd.print( fahrenheit); lcd.print( "F"); lcd.setCursor(0, 1); if (fahrenheit >400) digitalWrite(warning, HIGH); if (fahrenheit >400) delay (10000); lcd.print("Cyl. 2 temp "); lcd.setCursor(12,1); lcd.print(fahrenheit1); lcd.print("F"); if (fahrenheit1 >400) digitalWrite(warning, HIGH); if (fahrenheit1 >400) delay (10000); delay (3000); lcd.setCursor(0, 0); lcd.print("Cyl. 3 temp "); lcd.setCursor(12,0); lcd.print(fahrenheit2); lcd.print("F"); if (fahrenheit2 >400) digitalWrite(warning, HIGH); if (fahrenheit2 >400) delay (10000); lcd.setCursor(0, 1); lcd.print("Cyl. 4 temp "); lcd.setCursor(12,1); lcd.print(fahrenheit3); lcd.print("F"); if (fahrenheit3 >400) digitalWrite(warning, HIGH); if (fahrenheit3 >400) delay (10000); delay(3000); if (fahrenheit <400) digitalWrite(warning, LOW); if (fahrenheit1 <400) digitalWrite(warning, LOW); if (fahrenheit2 <400) digitalWrite(warning, LOW); if (fahrenheit3 <400) digitalWrite(warning, LOW); goto label; } |
McMark |
Jun 29 2010, 10:39 PM
Post
#6
|
914 Freak! Group: Retired Admin Posts: 20,179 Joined: 13-March 03 From: Grand Rapids, MI Member No.: 419 Region Association: None |
At first glance, it looks like you're looping a lot of stuff that you don't need to...
|
underthetire |
Jun 29 2010, 10:43 PM
Post
#7
|
914 Guru Group: Members Posts: 5,062 Joined: 7-October 08 From: Brentwood Member No.: 9,623 Region Association: Northern California |
At first glance, it looks like you're looping a lot of stuff that you don't need to... Its more than likely that I am. I wasn't sure if i didn't loop from the beginning of the temp set up if it would still get real time data or not. Not using any of the higher speed of the processing capability so I wasn't to concerned about it. I'll play around tomorrow and see. Like I said it was my first time programming anything like this. |
underthetire |
Jun 29 2010, 10:50 PM
Post
#8
|
914 Guru Group: Members Posts: 5,062 Joined: 7-October 08 From: Brentwood Member No.: 9,623 Region Association: Northern California |
Yep, needs to re-read all the temp setup to update. BTW, with the usb plugged in it also shows deg C and Deg F on the monitor (serial) page of the arduino software.
|
McMark |
Jun 29 2010, 11:41 PM
Post
#9
|
914 Freak! Group: Retired Admin Posts: 20,179 Joined: 13-March 03 From: Grand Rapids, MI Member No.: 419 Region Association: None |
It's an awesome first project! (IMG:style_emoticons/default/aktion035.gif)
|
underthetire |
Jun 30 2010, 08:35 AM
Post
#10
|
914 Guru Group: Members Posts: 5,062 Joined: 7-October 08 From: Brentwood Member No.: 9,623 Region Association: Northern California |
Thank you mark. Coming from you thats quite a complement. The only way I can learn anything is to just do it. I couldn't and didn't do well in school, but i've made my way through life pretty well just figuring stuff out. If I would have gone to school, working for the company I work for now, I could be making double what I do, even though a bunch of the degreed EE's here are complete idiots. ( some are awe inspiring smart to) |
obscurity |
Jun 30 2010, 04:36 PM
Post
#11
|
Member Group: Members Posts: 411 Joined: 24-February 06 From: Atlanta ,GA Member No.: 5,628 Region Association: South East States |
I haven't looked at the code too closely but you don't need the lines for "label" or "goto label" it automatically loops all code in the loop.
Arduino is an awesome little micro controller. I would love to see your schemetic and final install pics. |
underthetire |
Jun 30 2010, 04:46 PM
Post
#12
|
914 Guru Group: Members Posts: 5,062 Joined: 7-October 08 From: Brentwood Member No.: 9,623 Region Association: Northern California |
I haven't looked at the code too closely but you don't need the lines for "label" or "goto label" it automatically loops all code in the loop. Arduino is an awesome little micro controller. I would love to see your schemetic and final install pics. Thats what I thought it should do, but nothing else I tried worked except the GOTO statement. I know a goto is frowned upon in the C+ language. I just thought of another cool idea for this same unit, I can use a servo with a oil temp sensor to control the cooling flaps as well. My car has headers and the little bellows thing just does not work right with them. |
narino |
Jun 30 2010, 04:54 PM
Post
#13
|
Member Group: Members Posts: 231 Joined: 14-August 07 From: Los Angeles, CA Member No.: 8,001 Region Association: None |
|
underthetire |
Jun 30 2010, 07:57 PM
Post
#14
|
914 Guru Group: Members Posts: 5,062 Joined: 7-October 08 From: Brentwood Member No.: 9,623 Region Association: Northern California |
Ok, got rid of the goto, your right didn't need it. Added some notes as well. Any more suggestions would be welcome (IMG:style_emoticons/default/biggrin.gif)
CODE /* The circuit: * Thermocouple amp [url=http://store.makerbot.com/electronics/electronics-kits/thermocouple-sensor-v1-0-kit.html]http://store.makerbot.com/electronics/elec...r-v1-0-kit.html[/url] * LCD keypad shield [url=http://www.robotshop.ca/dfrobot-lcd-keypad-shield-arduino.html]http://www.robotshop.ca/dfrobot-lcd-keypad...ld-arduino.html[/url] (found on ebay 7.99) * using LCD keypad shield * LCD RS pin to digital pin 8 * LCD Enable pin to digital pin 9 * LCD D4 pin to digital pin 4 * LCD D5 pin to digital pin 5 * LCD D6 pin to digital pin 6 * LCD D7 pin to digital pin 7 * wiper to LCD VO pin (pin 3) *thermocouple amp to analog pin1 (cyl1) *thermocouple amp to analog pin2 (cyl2) *thermocouple amp to analog pin3 (cyl3) *thermocouple amp to analog pin4 (cyl4) *warning to digital pin 13, also led on arduino */ // include the library code: #include <LiquidCrystal.h> void setup() { Serial.begin(19200); Serial.println("Start"); } void loop() { int raw = analogRead(1); int celsius = ( 5.0 * raw * 100.0) / 1024.0; Serial.print("Celsius: "); Serial.println(celsius); int fahrenheit = (((celsius * 9) / 5) + 32); Serial.print("Fahrenheit: "); Serial.println(fahrenheit); int raw1 = analogRead(2); int celsius1 = ( 5.0 * raw1 * 100.0) / 1024.0; Serial.print("Celsius1: "); Serial.println(celsius1); int fahrenheit1 = (((celsius1 * 9) / 5) + 32); Serial.print("Fahrenheit1: "); Serial.println(fahrenheit1); int raw2 = analogRead(3); int celsius2 = ( 5.0 * raw2 * 100.0) / 1024.0; Serial.print("Celsius2: "); Serial.println(celsius2); int fahrenheit2 = (((celsius2 * 9) / 5) + 32); Serial.print("Fahrenheit2: "); Serial.println(fahrenheit2); int raw3 = analogRead(4); int celsius3 = ( 5.0 * raw2 * 100.0) / 1024.0; Serial.print("Celsius3: "); Serial.println(celsius3); int fahrenheit3 = (((celsius3 * 9) / 5) + 32); Serial.print("Fahrenheit3: "); Serial.println(fahrenheit3); int warning =13; pinMode(warning, OUTPUT); int backlightc = 10; pinMode(backlightc, OUTPUT); digitalWrite(backlightc,HIGH); // initialize the library with the numbers of the interface pins LiquidCrystal lcd(8, 9, 4, 5, 6, 7); const int numRows = 2; const int numCols = 16; // set up the LCD's number of rows and columns: if (fahrenheit <400) digitalWrite(warning, LOW); if (fahrenheit1 <400) digitalWrite(warning, LOW); if (fahrenheit2 <400) digitalWrite(warning, LOW); if (fahrenheit3 <400) digitalWrite(warning, LOW); lcd.begin(0, 2); // Print a message to the LCD. lcd.print("Cyl. 1 temp "); lcd.setCursor(12,0); lcd.print( fahrenheit); lcd.print( "F"); lcd.setCursor(0, 1); if (fahrenheit >400) digitalWrite(warning, HIGH); if (fahrenheit >400) delay (10000); lcd.print("Cyl. 2 temp "); lcd.setCursor(12,1); lcd.print(fahrenheit1); lcd.print("F"); if (fahrenheit1 >400) digitalWrite(warning, HIGH); if (fahrenheit1 >400) delay (10000); delay (3000); lcd.setCursor(0, 0); lcd.print("Cyl. 3 temp "); lcd.setCursor(12,0); lcd.print(fahrenheit2); lcd.print("F"); if (fahrenheit2 >400) digitalWrite(warning, HIGH); if (fahrenheit2 >400) delay (10000); lcd.setCursor(0, 1); lcd.print("Cyl. 4 temp "); lcd.setCursor(12,1); lcd.print(fahrenheit3); lcd.print("F"); if (fahrenheit3 >400) digitalWrite(warning, HIGH); if (fahrenheit3 >400) delay (10000); delay(3000); } |
SirAndy |
Jun 30 2010, 10:13 PM
Post
#15
|
Resident German Group: Admin Posts: 41,606 Joined: 21-January 03 From: Oakland, Kalifornia Member No.: 179 Region Association: Northern California |
Any more suggestions would be welcome (IMG:style_emoticons/default/biggrin.gif) I put 'code' tags around your code ... (IMG:style_emoticons/default/shades.gif) As for the CHT display, i did this gauge mockup a few years back. I still think that would be a cool gauge to build .... (IMG:style_emoticons/default/popcorn[1].gif) Andy Attached image(s) |
jeffdon |
Jun 30 2010, 10:29 PM
Post
#16
|
Senior Member Group: Members Posts: 1,094 Joined: 24-October 06 From: oakland, ca Member No.: 7,087 Region Association: None |
Any more suggestions would be welcome (IMG:style_emoticons/default/biggrin.gif) I put 'code' tags around your code ... (IMG:style_emoticons/default/shades.gif) As for the CHT display, i did this gauge mockup a few years back. I still think that would be a cool gauge to build .... (IMG:style_emoticons/default/popcorn[1].gif) Andy F-NG cool!!! Your graphic skills rock! (IMG:style_emoticons/default/aktion035.gif) |
underthetire |
Jun 30 2010, 10:34 PM
Post
#17
|
914 Guru Group: Members Posts: 5,062 Joined: 7-October 08 From: Brentwood Member No.: 9,623 Region Association: Northern California |
Thanks andy. There is actually a demo program with the arduino to run something similar to that. (IMG:style_emoticons/default/idea.gif) I might have to order a couple more arduinos to play with, they are pretty cheap, and kind of fun for a geek like me.
|
Lennies914 |
Jun 30 2010, 10:46 PM
Post
#18
|
Slacker Group: Members Posts: 828 Joined: 9-January 10 From: NorCal Member No.: 11,216 Region Association: Northern California |
Very cool stuff Jeff, looking forward to seeing the results.
(IMG:style_emoticons/default/beerchug.gif) |
ottox914 |
Jul 1 2010, 06:39 AM
Post
#19
|
The glory that once was. Group: Members Posts: 1,302 Joined: 15-December 03 From: Mahtomedi, MN Member No.: 1,438 Region Association: Upper MidWest |
When you get it all figured out I want one. I bet lots of other guys here would say the same thing. Think about it.
|
jaxdream |
Jul 1 2010, 07:14 AM
Post
#20
|
Senior Member Group: Members Posts: 974 Joined: 8-July 08 From: North Central Tennessee Member No.: 9,270 Region Association: South East States |
Don't know what all the costs are for a setup of this nature , but if it is as good or better than a say Dakota Digital at a reasonably priced deal , I would be interested in the final results. Having all 4 CHTemps at display would be a great engine monitor ( one of the priority things to keep an eye on ) to have . Would the microcontroller have the capabilities to read / display AF ratioes with O2 sensors or am I dreaming ??? (IMG:style_emoticons/default/unsure.gif)
Jack / Jaxdream |
Lo-Fi Version | Time is now: 25th April 2024 - 01:37 PM |
All rights reserved 914World.com © since 2002 |
914World.com is the fastest growing online 914 community! We have it all, classifieds, events, forums, vendors, parts, autocross, racing, technical articles, events calendar, newsletter, restoration, gallery, archives, history and more for your Porsche 914 ... |