View Single Post
Old 03-21-2024, 05:04 PM   #4 (permalink)
CigaR007
Master EcoModder
 
CigaR007's Avatar
 
Join Date: Jul 2010
Location: Canada
Posts: 706

GreenTurtle (Retired) - '01 Toyota Echo Sedan
90 day: 44.85 mpg (US)

Zulu - '14 Honda CR-Z
90 day: 49.05 mpg (US)
Thanks: 152
Thanked 267 Times in 162 Posts
Quote:
Originally Posted by aerohead
which, when de-energized, is spooled backwards under spring tension at the shutters? With 'fail-wide-open' safety protection?
From what I have seen and read thus far, there does not seem to be fail-safe OPEN mechanism in current grille shutters. I could be wrong though...In their OEM state, all they do is throw a CEL code if there is an issue.

As it stands, there is no spring tension to accommodate a fail-OPEN state, as it would be difficult to use with a servo motor.


Quote:
Originally Posted by Piwoslaw View Post
Nice!

Now I am interested in how the Arduino will control it.
The arduino control code will evolve over time. For the time being, given my limited coding knowledge, it will be pretty basic.

I managed to integrate a micro switch to detect the shutter position. A 1602 LCD was also integrated to monitor the OPEN/SHUT status.

Things I want to integrate into the code, eventually :
  • Coolant temperature
  • Ambient temperature
  • Rain/Snow sensor

Below is the LCD display and microswitch in action.



Arduino Code :

PHP Code:
#include <Servo.h>
#include <ezButton.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27162);             // I2C address 0x27, 16 column and 2 rows

// constants 
const int BUTTON_PIN 7;                       // Arduino pin connected to button's pin
const int SERVO_PIN 9;                        // Arduino pin connected to servo motor's pin
const int LED_PIN 2;                          // green LED connected to digital pin 2
const int POS_SWITCH 4;
Servo servo;                                    // create servo object to control a servo

// variables 
int angle 0;                                  // the current angle of servo motor
int lastButtonState;                            // the previous state of button
int currentButtonState;                         // the current state of button
int val 0;                                    // variable to store the read value

void setup() {
  
  
Serial.begin(9600);                            // initialize serial
  
pinMode(BUTTON_PININPUT_PULLUP);             // set arduino pin to input pull-up mode
  
pinMode(LED_PINOUTPUT);
  
pinMode(POS_SWITCHINPUT);
  
servo.attach(SERVO_PIN);                       // attaches the servo on pin 9 to the servo object
  
servo.write(angle);
  
lcd.init();                                    // initialize the lcd
  
lcd.backlight();   

}

void loop() {

  
lastButtonState currentButtonState;                       // save the last state
  
currentButtonState digitalRead(BUTTON_PIN);               // read new state

  
if(lastButtonState == HIGH && currentButtonState == LOW) {
    
digitalWrite(LED_PINHIGH);                              // turn the LED on (HIGH is the voltage level)
    
delay(1000);                                              // wait for a second
    
digitalWrite(LED_PINLOW);                               // turn the LED off (LOW is the voltage level)
    
delay(500);                                               // wait for a 0.5 second

    // change angle of servo motor
    
if(angle == 0)
      
angle 90  ;
    else
    if(
angle == 90)
      
angle 0;

  
servo.write(angle);                                         // control servo motor arccoding to the angle
 
}
 
    
delay(1000);                                              // wait for a second
 
 
val digitalRead(POS_SWITCH);                               // read the input pin
  
if(val == HIGH){
    
lcd.clear();                                              // clear display
    
lcd.setCursor(00);                                      // move cursor to   (0, 0)
    
lcd.print(" GRILLE SHUTTER");                             // print message at (0, 0)
    
lcd.setCursor(21);                                      // move cursor to   (2, 1)
    
lcd.print("  [ SHUT ]");                                  // print message at (2, 1)
}
  else {
 
    
lcd.clear();                                              // clear display
    
lcd.setCursor(00);                                      // move cursor to   (0, 0)
    
lcd.print(" GRILLE SHUTTER");                             // print message at (0, 0)
    
lcd.setCursor(31);                                      // move cursor to   (2, 1)
    
lcd.print(" [ OPEN ]");                                   // print message at (2, 1)
                      
}


Cheers !
  Reply With Quote
The Following 4 Users Say Thank You to CigaR007 For This Useful Post:
aerohead (03-23-2024), Ijeeep (04-05-2024), Logic (11-14-2024), Piwoslaw (03-22-2024)