Arduino/touch screen climate control

  • 6 Replies
  • 44 Views
*

Offline Scottfunk

  • Member
  • **
  • 4
    • 96 GMC Yukon 24valve
    • Idaho Diesel Conversions
Arduino/touch screen climate control
« on: December 02, 2017, 07:32:30 AM »
This isn't VGT stuff and I know there are arduino forums elsewhere but hey, I'm a Cummins guy. I spent a lot of time and money stuffing one into my obs Yukon because I think they're the bees knees! Now that the conversion is just about finished (I'm still wrapping up some small details) I'm moving on to another project: an arduino controlled climate control system with a touch screen user interface. I ended up with a bread van style power steering pump (basically an engine mounted hydraulic pump) and I have no vacuum.  I have located and purchased all the hardware to make this happen but I am just a dumb carpenter and not at all a computer programmer. That's not to say I'm not willing to learn, but man, coding is tough. Anyway, the synopsis is this: the arduino will control an electronic heater bypass valve, the fan motor, and the zone "flapper" motor. I have used the mit app inventor to make the basic layout, but before I continue I wanted to ask a couple questions. The fan part is easy: pwm through an array of mosfets controls fan speed, done. The flapper in my GMC has 4 positions that are indicated by a value from an internal potentiometer. I realize I will have to figure out which value equals which position, then the logic goes: if (sensor input value) < (desired value) then pin x = 1 and vice versa (pin y=1). My question here (two actually) are: is it better to hand data to the touch screen device (an old android phone) and have it perform the logic and just send a command back, or do I send the requested value to to arduino and let it collect the data, perform the logic and carry out the actions; and can I just fuzzy the resolution of the position pot signal so I'm just reading 245x ohms (where the represents the ones value that I don't really care about) rather than having the arduino constantly searching for EXACTLY 2453.6 ohms (these as just made up numbers for illustration purposes)? The heater bypass valve is essentially the same setup: a motor with a pot to indicate position. But there's a twist: the ui will be a slider bar with 27 positions; hi, lo, and 65°-85°. The arduino will read a temperature sensor installed in the flapper body and adjust the coolant flow to meet the requested temperature. Now obviously there will be a time buffer so the sensor has time to read temperature before the arduino commands the bypass valve or it would constantly overshoot but again the same questions: do I accomplish this through reduced resolution in the pot reading? And who performs the logic? Again, I am reading up on arduino coding as I write this so I am absolutely novice at this and any and all ideas are good ones (not necessarily useful ones, haha, but good ones). And thanks for any help.
96 GMC Yukon 24 valve Cummins swapped, dual triangulated four link front, King racing coilovers, 4 Inc down pipe, 5 inch straight exhaust, Allison 6 speed with stage 3 Suncoast, Dana 60/70, Fass 150 Titanium, Adrenaline Quadzilla. Vgt is next.

*

Offline hakcenter

  • developer
  • Hero Member
  • *****
  • 623
    • 1998 12v Ram
Re: Arduino/touch screen climate control
« Reply #1 on: December 02, 2017, 06:27:02 PM »
I am semi confused.

What is driving the touch screen ?
Are you keeping the stock hvac controls and integrating them ? Or are you bypassing them ?
Are you integrating the engine coolant sensor ? Kinda need to know what the coolant temp is unless you want the controller just blasting cold air at max fan speed thinking it is going to heat up the cabin.

*

Offline Scottfunk

  • Member
  • **
  • 4
    • 96 GMC Yukon 24valve
    • Idaho Diesel Conversions
Re: Arduino/touch screen climate control
« Reply #2 on: December 04, 2017, 07:51:11 AM »
The touch screen is an android device with an app I wrote. Three slider bars. Other than the flapper motor in the distribution box and the blower fan the whole hvac system is gutted. The coolant bypass valve is tied to a temperature sensor installed in the fan box so that the coolant flow is increased/decreased to meet the requested temperature on the touch screen (slider bar). This way the user can request an actual temperature and the arduino will adjust the coolant bypass until the air coming out of the vents is the requested temp. I have the logic mostly worked out for this part, I'll type it up and post it tonight. Can you share with me a bit of the coding (android and arduino) to pass the requested values from the android to the arduino. I'm new to this but I am reading up on c++ and java so I'm trying. Thanks
96 GMC Yukon 24 valve Cummins swapped, dual triangulated four link front, King racing coilovers, 4 Inc down pipe, 5 inch straight exhaust, Allison 6 speed with stage 3 Suncoast, Dana 60/70, Fass 150 Titanium, Adrenaline Quadzilla. Vgt is next.

*

Offline hakcenter

  • developer
  • Hero Member
  • *****
  • 623
    • 1998 12v Ram
Re: Arduino/touch screen climate control
« Reply #3 on: December 06, 2017, 05:18:32 AM »
Soooo you're going to use bluetooth to communicate between them ?

*

Offline Scottfunk

  • Member
  • **
  • 4
    • 96 GMC Yukon 24valve
    • Idaho Diesel Conversions
Re: Arduino/touch screen climate control
« Reply #4 on: December 06, 2017, 06:37:28 PM »
Yep. I think the data is passed as a bit (1 -1024)? Basically I need 1-53 to accomplish what I need, I'm just learning the syntax and implementation. So the temp slider goes like this: the user selects a desired temperature; the android device converts the requested Fahrenheit temperature to Celsius (the temperature sensor for the arduino I bought is Celsius); the android device sends the requested temperature to the arduino; the arduino compares the requested temperature to the actual temperature of the air exiting the blower box and adjusts the position of the bypass valve to achieve the requested temp. The adjustments are made in 4% increments with a 3 second delay to give the sensor some time to get up to temp and to prevent it from over shooting or constantly hunting for the right position. The arduino will know the exact position of the valve at all times because the bypass valve has an internal pot that modulates a ref signal. There will also be a hi and lo setting where the bypass valve will go straight to full open or full close (lo will also eventually activate the a/c). Fan speed is easy: duty cycle of a pwm signal by 10% increments. The flapper valve is basically the same as the bypass valve i.e. a motorized closure with a pot modulated ref, with the exception that there's only 5 requested positions. This one is a little tricky because I'm not sure how picky the arduino will be when it's evaluating the ref signal? If the requested position is at 3.25 volts will the arduino going until it sees exactly the desired voltage or is there a way I can tell it "well we want to see 3.25 volts but basically anything between 3.2 and 3.3V is ok"? I'll add my bypass logic when the kids are in bed.
96 GMC Yukon 24 valve Cummins swapped, dual triangulated four link front, King racing coilovers, 4 Inc down pipe, 5 inch straight exhaust, Allison 6 speed with stage 3 Suncoast, Dana 60/70, Fass 150 Titanium, Adrenaline Quadzilla. Vgt is next.

*

Offline hakcenter

  • developer
  • Hero Member
  • *****
  • 623
    • 1998 12v Ram
Re: Arduino/touch screen climate control
« Reply #5 on: December 06, 2017, 07:40:30 PM »
Best thing to do right now would be to download the LBB common code, and implement bluetooth on your arduino.

You can easily look for a desired voltage range on the arduino as it just will lookup on the ADC, you'll do all the computing based on the readout. The pic is more than capable of handling everything you want to do here, and just reference the lcd screen for desired temps.

You could setup communication where the LCD knows what the temp the arduino is see'ing and even if you wanted to get super technical, know what the device is deciding to do. All part of the code you'd write for it.

*

Offline Scottfunk

  • Member
  • **
  • 4
    • 96 GMC Yukon 24valve
    • Idaho Diesel Conversions
Re: Arduino/touch screen climate control
« Reply #6 on: December 06, 2017, 08:24:05 PM »
I'm not really trying to get what the temperature is because the temp sensor has a very specific formula it follows which I believe is 10mV per degree Celsius starting at 500mV:
//getting the voltage reading from the temperature sensor
19. int reading = analogRead(sensorPin); 
20.
21. // converting that reading to voltage, for 3.3v arduino use 3.3
22. float voltage = reading * 5.0;
23. voltage /= 1024.0;
29. float temperatureC = (voltage - 0.5) * 100 ;  //converting from 10 mv per degree wit 500 mV offset
30.                                               //to degrees ((voltage - 500mV) times 100)
32.
33. // now convert to Fahrenheit
34. float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;

This is just some code I copy/pasted. At the end of this function then the following logic is performed (this is just rough now, doesn't even really qualify as code yet, but you get the picture)

If temperature F < temprequest then //temperature is lower than requested, bypass valve opens
     while temperatureF < temprequest
          potvoltage = potvoltage - .191 //this sets the desired ref voltage to the next segment (4%) lower on the bypass valve position potentiometer
               while refvoltage != potvoltage //where refvoltage is the ACTUAL voltage coming out of the position pot
                    analog write (motorpinB, 255) //power applied to the opening circuit of the bypass
                   delay 3000

if temperatureF > temprequest the //temperature is higher than requested, bypass valve closes
     while temperatureF > temprequest
          potvoltage = potvoltage + .191 //sets the desired ref voltage to the next segment (4%) higher on the bypass valve position potentiometer
               while refvoltage != potvoltage //where refvoltage is the ACTUAL voltage coming out of the position pot
                    analog write (motorpinA, 255) //power applied to the closing circuit of the bypass
                    delay 3000

//requested temp = "LO"
if temprequest = "LO" then
     while potvoltage != (sigvoltage * .04 ) //sigvoltage is the total voltage being sent TO the position pot and 4% represents the refvoltage at full close
     analog write (motorpinA, 255) //close bypass

//requested temp = "HI"
if temprequest = "HI" then
     while potvoltage != (sigvoltage * 95.5) // 95.5% represents refvoltage at full open
     analog write (motorpinB, 255) //open bypass


 
96 GMC Yukon 24 valve Cummins swapped, dual triangulated four link front, King racing coilovers, 4 Inc down pipe, 5 inch straight exhaust, Allison 6 speed with stage 3 Suncoast, Dana 60/70, Fass 150 Titanium, Adrenaline Quadzilla. Vgt is next.