Wednesday, 28 July 2021

Car Steering Wheel Control Unit with Arduino


 If you are a regular visitor to my website or YouTube Channel, you have already experience the same kind of project. The purpose of making this project is to make help the vehicle owner that they have no Steering Wheel audio control switches. But I know including me it is very helpful to control audio using such physicals switches.

The previous tutorial was about making a simple controller with switches. But I wanted to improve it especially for traditional volume controllers and few more important switches. 
Accordingly, I was done some researches to make this project successful. I will show those testing projects as well later.

Watch the Video Description.




The final project is included especially two controllers with Rotary Encoders. One is for Volume and another one is for move the back and next.




You may need the following parts,


Atmega 328P IC                     -    01


16Mhz Cristal                         -    01








22pf ceramic capacitors          -    02











D400 Transistors                     -    04











Rotary Encoders                      -    02











7805 Regulator                        -    01











104 pf Ceramic                        -    01











10uf capacitor                         -     01











IN 4001 Diode                        -    01






27k (1/4W)Resistors               -    04











100 pf Capacitors                    -    04











10k (1/4W)Resistors               -    10










5k Preset                                    -  01











1 k (1/4W) Resistors                    01

Wires











Arduino Board










Soldering equipment's







Connectors, etc,
























Plastic Box












Read the Following circuit diagram carefully before making the project.

You can use the following PCB plan for easy construction.




You can use the following link to download the diagram.


How to connect the wires.

01. Give the power 12 volts from the car ACC wire and ground the pin correctly.

02.Connect KEY 1 wire with the KEY 1 of the unit and 
    There may be two wires called “KEY” and “KEY 1” in-car head unit. Sometimes the “KEY” wire will not work correctly. If so connect the KEY 1 wire with the car steering wheel control unit.


03.Tune the correct delay to activate the switch using the 5k preset.

Go to the Settings >Steering Wheel Learning of your car head unit Then,








Touch the "volume UP button" of the car head unit and rotate to right side the rotary encoder 1. If the device is not detected or the click is too much long, adjust the delay time using 5k variable resistors (preset)

Then Touch the "volume DOWN" button of the car head unit and rotate to the left side the rotary encoder 1.

AliExpress.com Product - Scrubs Medical Uniforms Women 2021 Short Sleeve V-Neck Pocket Care Workers T-Shirt Tops Summer uniformes de enfermera mujer A50

 Accordingly, you can program all the keys.

Check the video for more details. Steering Learning



You can download the arduino code from the following link.



/*this car steering wheel audio control buttons is programmed as universal circuit.
 * This can be used to Volume up and down and, to back and next button. The both rotary encoder 
 * swiches are recommended for that purposes. and also more 2 switches are with the rotary encoders.
 * 
 * Programmed by : BMIAK Basnayaka
 * for SetNFix Youtube channel
 * web : http://www.setnfix.com
 * date : 08.06.2021
 * Video Link https://youtu.be/m4KO8INEGUo
 */





//Volume Controler
int testPin=A0;
int volOne = A2;
int volTwo = A1;
 int directionV=0;
 int counterV = 0; 
 int currentStateCLKV;
 int previousStateCLKV; 

//Next and previous Button
#define nextOne A4
#define nextTwo  A3
 int counterN = 0; 
 int currentStateCLKN;
 int previousStateCLKN;

int progSwitch = A5;
int progData=0;

int volUp = 12;
int volDown = 11;
int back = 10;
int next = 9;

int delayMe =0; // Time need to click a button to activate 1000 = 1 second
int delayBtn = 2000; // Time need to click a button to prgramme the buttons 1000 = 1 second



void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);

pinMode(volOne,INPUT);
pinMode(volTwo, INPUT);
pinMode(nextOne,INPUT);
pinMode(nextTwo,INPUT);
pinMode(progSwitch,INPUT);
pinMode(volUp,OUTPUT);
pinMode(volDown,OUTPUT);
pinMode(back,OUTPUT);
pinMode(next,OUTPUT);
pinMode(testPin,OUTPUT);

  previousStateCLKV = digitalRead(volOne);
  previousStateCLKN = digitalRead(nextOne);
}

void loop() {


progData = analogRead(progSwitch);
delayMe = map(progData,0,1023,200,2000);

//Serial.println(delayMe);
volumeControler();
nextPrevious();





//
//delay(1000);

}

  
void volumeControler(){
  //Volume Controler
// Read the current state of inputCLK
currentStateCLKV = digitalRead(volOne);

//Serial.println(currentStateCLKV);

   // If the previous and the current state of the inputCLK are different then a pulse has occured
   if ((currentStateCLKV == LOW)&&(previousStateCLKV==HIGH)){ 
       
//Serial.println(currentStateCLKV);
     // If the inputDT state is different than the inputCLK state then 
     // the encoder is rotating counterclockwise
     if (digitalRead(volTwo)==LOW) { 
           
        digitalWrite(volDown,HIGH);
        analogWrite(testPin,10);
        Serial.println("DOWN");
        delay(delayMe);
        digitalWrite(volDown,LOW);
        analogWrite(testPin,0);
       //previousStateCLKV = currentStateCLKV; 
       
     } else {
      
       // Encoder is rotating clockwise
        digitalWrite(volUp,HIGH);
        analogWrite(testPin,20);
        Serial.println("UP");
        delay(delayMe);
        digitalWrite(volUp,LOW);
        analogWrite(testPin,0);
      // previousStateCLKV = currentStateCLKV; 
     }
//Serial.println(counterV);
   } 
   // Update previousStateCLK with the current state
   previousStateCLKV = currentStateCLKV; 


/*if (directionV == 1){
digitalWrite(volDown,HIGH);
Serial.println("DOWN");
delay(delayMe);
digitalWrite(volDown,LOW);directionV =0;}

if (directionV == 2){
digitalWrite(volUp,HIGH);
Serial.println("UP");
delay(delayMe);
digitalWrite(volUp,LOW);directionV =0;}
*/



}

void nextPrevious(){

// Read the current state of inputCLK
   currentStateCLKN = digitalRead(nextOne);
    
   // If the previous and the current state of the inputCLK are different then a pulse has occured
   if ((currentStateCLKN==LOW) && (previousStateCLKN==HIGH)){ 
       
     // If the inputDT state is different than the inputCLK state then 
     // the encoder is rotating counterclockwise
     if (digitalRead(nextTwo) ==LOW) { 
       counterN --;
        digitalWrite(next,HIGH);
        analogWrite(testPin,30);
        Serial.println("BACK");
        delay(delayMe);
        analogWrite(testPin,0);
        digitalWrite(next,LOW);
       
       
     } else {
       // Encoder is rotating clockwise
       counterN ++;
        digitalWrite(back,HIGH);
        Serial.println("NEXT");
        analogWrite(testPin,40);
        delay(delayMe);
        digitalWrite(back,LOW);
        analogWrite(testPin,0);
       
     }

   } 
   // Update previousStateCLK with the current state
   previousStateCLKN = currentStateCLKN; 
 }




 
Previous Post
Next Post

post written by:

10 comments:

  1. Hi, im trying to do it but i dont really know which capacitors i need, 104pf and 100 pf Capacitors i cant find the difference to buy them, thanks a lot

    ReplyDelete
  2. Replies
    1. Ty, so what its this? https://gyazo.com/0915879a62b971a3754b35ba34113a9b

      Delete
    2. It is same. The value 0.1 uf is normally printed as 104

      Delete
  3. Ty, sorry for botther just a begginer :D

    ReplyDelete
  4. Hi, can you help me? I dont what im doing wrong, i cant reproduce anithing on serial monitor

    https://gyazo.com/29e14e8b8b6ce6cd4f8ad7cd67349c7b
    https://gyazo.com/1cab785099816125b218b4679a966a13

    I can upload the code wo problems muybe i did something wrong, ty for your time.

    ReplyDelete
    Replies
    1. Serial monitor should be worked. it is a nice PCB.

      Delete
  5. Hi, after expend a lot of time cause didnt work, i found you made a mistake on the code for that pcb and diagram, this its the correct

    //Volume Controler
    int testPin=A5;
    int volOne = A0;
    int volTwo = A1;
    int directionV=0;
    int counterV = 0;
    int currentStateCLKV;
    int previousStateCLKV;

    //Next and previous Button
    #define nextOne A2
    #define nextTwo A3
    int counterN = 0;
    int currentStateCLKN;
    int previousStateCLKN;

    int progSwitch = A5;
    int progData=0;


    instead of this


    //Volume Controler
    int testPin=A0;
    int volOne = A2;
    int volTwo = A1;
    int directionV=0;
    int counterV = 0;
    int currentStateCLKV;
    int previousStateCLKV;

    //Next and previous Button
    #define nextOne A4
    #define nextTwo A3
    int counterN = 0;
    int currentStateCLKN;
    int previousStateCLKN;

    int progSwitch = A5;
    int progData=0;


    After all, i learned a lot doing the projet, thank you very much.

    ReplyDelete
  6. Once you’ve decided how much to bet, you can mark your 4D combination numbers or use a Toto 4D number generator to make sure you’ve selected the correct combination before buying your ticket. 토토사이트

    ReplyDelete