STT Trailer Converter


hello! pretty new programming microcontrollers please not harsh.

the application diy stop-turn-tailight conversion application 2010 jetta.

vw uses pwm control brightness of signal lamp. using osciliscope , frequency meter have discovered following:

car off:
? = ~98 hz (~10ms)
duty cycle (tail light) = ~2ms (20%)
duty cycle (brake light) = ~9ms (90%)
turn light same brake light pulses on , off (about 1 sec on/off). not sure how explain knows how turn signal works think.

car on:
? = ~110 hz (~9ms)
duty cycle lights remained consistent percentage wise.

i think should easy; however, have no idea should doing information.

i thought use 20k , 10k resistor voltage divider lower signal voltage read signal directly digital pin using pulsein. 20k resistor limit current preventing computer seeing large current draw cause car disable light , throw error code. values give me 1/3 voltage reduction bringing 12.5v ~4.17v @ 6ma.

i used ohm meter across voltage divider , found vin = vout. assume has fact signal pwm. thing did that, else think have fried arduino.

i wanted microprocessor suppose use comparator circuit if had to.

does have ideas on how proceed?

code: [select]


int leftsignal; // variable left signal input
int rightsignal; // variable right signal input
int dutycycle1; //for testing
int dutycycle2; //for testing
float dutycycle; //for testing

void setup() {
 serial.begin(19200);
 digitalwrite(9, high); // turns on tail lights
 for (int thispin = 5; thispin <= 11; thispin++)  { // init i/o
   pinmode(thispin, output);  
 }
 for (int thispin = 2; thispin <= 3; thispin++)  { // init i/o
   pinmode(thispin, input);  
 }
}

void loop() {
 analogwrite(5, 65); //25% roughly
 dutycycle1 = pulsein(2, high) / 4;
 dutycycle2 = pulsein(2, low) / 4;
 float dutycycletemp = dutycycle1 + dutycycle2;
 dutycycle = dutycycle1 / dutycycletemp;
 serial.println(dutycycle, dec);
 serial.println(dutycycle1, dec);
 serial.println(dutycycle2, dec);



the above code sort of way work through how pwm works , how read it. not @ point grab signal yet, need with.

below idea comparing left , right signal values 'thresh hold' outputs 2n7000 driving p-channel mosfet turns on appropriate light/lights. works when generating own signal arduino.


code: [select]

/* disabled testing pwm functions
 int threshhold = 145; //value greater 20% ds of running light lot less 90% of stop/turn
 leftsignal = pulsein(2, high); // left signal input condition
 rightsignal = pulsein(3, high); // right signal input condition
 if (leftsignal < threshhold && rightsignal < threshhold) // no signal or brakes
 {
   digitalwrite(10, low); // left light off
   digitalwrite(11, low); // right light off
 }
 else if (leftsignal > threshhold && rightsignal > threshhold) // brakes applied
 {
   digitalwrite(10, high); // left light on
   digitalwrite(11, high); // right light on
 }
 else if (leftsignal > threshhold && rightsignal <= threshhold) // left turn signal  
 {
   digitalwrite(10, high); // left light on
   digitalwrite(11, low); // right light off
 }
 else if (leftsignal <= threshhold && rightsignal > threshhold) // right turn signal  
 {
   digitalwrite(10, low); // left light off
   digitalwrite(11, high); // right light on
 }
 else // unknown condition
 {
   digitalwrite(10, low); // left light off
   digitalwrite(11, low); // right light off
 }
*/
}



note: above code in 1 pde file, split here add comments between code boxes.

quote
i think should easy; however, have no idea should doing information.


no offence, neither  :) in fact trying do? application "diy stop-turn-tailight conversion" mean?

your 1/3 voltage reduction circuit should work fine, check, sketch quick schematic of how wired it?

quote
used ohm meter across voltage divider , found vin = vout.


oh-oh...red flags here. can't use ohm meter on powered circuit. trying measure voltage? resistance?  always measure resistance power off, , preferably resistors not connected else.

or trying measure voltage? mean "vin=vout"? referencing schematic you're going sketch helpful  ;)

quote
does have ideas on how proceed?


not until tell we're proceeding!

--
the gadget shield: accelerometer, rgb led, ir transmit/receive, light sensor, potentiometers, pushbuttons



Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > STT Trailer Converter


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums