SetNFix
Published © LGPL

DIY car steering wheel controller with volume control

Control head unit of the using your own switch

IntermediateFull instructions provided11,210
DIY car steering wheel controller with volume control

Things used in this project

Hardware components

Test Probe Connector, Multimeter
Test Probe Connector, Multimeter
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Arduino UNO
Arduino UNO
×1

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Schematics

Circuit

Progamming Attiny13

Code

Code

Arduino
 /* Read Quadrature Encoder
  * Connect Encoder to Pins encoder0PinA, encoder0PinB, and +5V.
  *
  * www.setnfix.com
  * 
  *
  */  


 int val; 
 int encoder0PinA = 0; 
 int encoder0PinB = 1; 
 int test = A2;
 int testdata=0;
 int volP = A3; // Volume control +
 int volM = A1;// Volume control -
 int encoder0Pos = 0;
 int encoder0PinALast = LOW;
 int n = LOW;
// int BOOT = 3; //boot up set
// int ampoff = 11;
/// int AMP=2;
 //int POWER = 5;

 // Variables will change :
//int ledState = LOW;             // ledState used to set the LED

// Generally, you should use "unsigned long" for variables that hold time
// The value will quickly become too large for an int to store
unsigned long previousMillis = 0;        // will store last time LED was updated

// constants won't change :
const long interval = 1800000;           // interval at which to blink (milliseconds)

 void setup() { 
   pinMode (encoder0PinA,INPUT);
   pinMode (encoder0PinB,INPUT);
   pinMode (test,INPUT);
   //pinMode (BOOT,OUTPUT);
   pinMode (volP,OUTPUT);
   pinMode (volM,OUTPUT);
 } 

 void loop() { 



testdata = analogRead(test);

    
   n = digitalRead(encoder0PinA);
   if ((encoder0PinALast == LOW) && (n == HIGH)) {
     if (digitalRead(encoder0PinB) == LOW) {
       VolumeUP();
       //delay(200);
     } else {
      VolumeDOWN();
      //delay(200);
     }
     //Serial.print (encoder0Pos);
    // Serial.print ("/");
   } 
   encoder0PinALast = n;
   
   
   //POWERON/OFF switch

     unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;

    // set the LED with the ledState of the variable:
    //digitalWrite(POWER, ledState);
  }
   
   
   
   }

   void VolumeUP(){
    digitalWrite(volP,HIGH);
    delay(500);
    digitalWrite(volP,LOW);
   }

   void VolumeDOWN(){
    digitalWrite(volM,HIGH);
    delay(500);
    digitalWrite(volM,LOW);
   }
   

Credits

SetNFix

SetNFix

17 projects • 35 followers
I am an accountant in profession but, I would more prefer to work with electronics based innovations.

Comments