Jump to content
43oh

Brake Signal Light


Recommended Posts

a friend of mine recently got a new car and he wants me to do somthing to it to make it different. he has a led light bar as a brake light in the middle of his trunk and i wanted to mod it. but i am haveing trubles. what i want to do is have it so when he presses the brakes the lights go from the center and out to each side and back to the middle. and when he signals it will go from one side to the other. i have a few options in msp chips. i have the MSP430G2211 MSP430G2131 MSP430G2231 MSP430G2252 and MSP430F2012. Any advice on witch chip to use. the led bar will be broke into 8 segments. i also have multiple ULN2803's SN74HC595N's and TLC5916IN's. i will need to have 3 inputs and i will have to drop the voltage from 12v to a voltage that the chip will handle. And i Am useing Code Composer Studio v4 to program via a launchpad. any help will be appreciated.

Link to post
Share on other sites

ok so i figured something out. i dont think it is the best way but it works. i am useing the MSP430G2252 along with a ULN2803. i am probally going to use resisters to drop the signal voltage from 12 to 3 volts. when you signal left the leds go from right to left. and the opposite for right. when you brake the leds go from center out to the edges and back again. and if you signal and brake it will do both sequences one after the other. if anyone has any tips on making the code better feel free to let me know. will post vid when done installing on car.

#include "msp430g2252.h"
#define     LED0                  BIT0
#define     LED1                  BIT1
#define     LED2                  BIT2
#define     LED3                  BIT3
#define     LED4                  BIT4
#define     LED5                  BIT5
#define     LED6                  BIT6
#define     LED7                  BIT7


void delay_ms(unsigned int ms ){ 		// Not really a milliseconds delay!
     unsigned int i;
     for (i = 0; i <= ms; i++){ 		// The operator is <=, I've yet to fix this site bug.
       __delay_cycles(500);
     }
}
void do_led( int led, int delay ) {
P1OUT = led;
delay_ms( delay );
}




void main (void)
{
  WDTCTL = WDTPW | WDTHOLD;
  P1DIR = LED0 | LED1 | LED2| LED3| LED4| LED5 | LED6 | LED7; //Sets all the LEDs to output	
   P1OUT &= ~(LED0 + LED1 + LED2 + LED3 + LED4 + LED5 + LED6 + LED7);

  for(; //Infinite loop
  { 
  	volatile unsigned int i;
  	P1OUT &= ~(LED0 + LED1 + LED2 + LED3 + LED4 + LED5 + LED6 + LED7);
  		if((P2IN & BIT0) != 0) {
	do_led( LED3+LED4 , 500);
	do_led( LED2+LED5 , 500);
	do_led( LED1+LED6 , 500);
	do_led( LED0+LED7 , 500);
	do_led( LED1+LED6 , 500);
	do_led( LED2+LED5 , 500);

  	}else{}

if((P2IN & BIT2) != 0) {
       do_led( LED0 , 500);
	do_led( LED1 , 500);
	do_led( LED2 , 500);
	do_led( LED3 , 500);
	do_led( LED4 , 500);
	do_led( LED5 , 500);
	do_led( LED6 , 500);
	do_led( LED7 , 500);


  }else{}

if((P2IN & BIT1) != 0) {
	do_led( LED7 , 500);
	do_led( LED6 , 500);
	do_led( LED5 , 500);
	do_led( LED4 , 500);
	do_led( LED3 , 500);
	do_led( LED2 , 500);
	do_led( LED1 , 500);
	do_led( LED0 , 500);
  	}else{}




  }
}

Link to post
Share on other sites

Uhm, from a power dissipation point of view, using a linear regulator to drop 12V to 3V would be a rather hot proposal. Literally.

 

Depending on the current draw of the circuit, you would have (12-3)Volts * Amps = Power dropped across the regulator. It comes out as heat.

 

Might I suggest a switching regulator to do the same thing?

 

Here's a part to prime your imagination.

 

Just a thought to consider.

Link to post
Share on other sites

i plan on using a UA78M33 (3/4 Pin 500mA Fixed 3.3V Positive Voltage Regulator) for power to the msp. there shouldnt be much current because i am using the uln2803. the leds will have resisters to operate at 12 v. but i am haveing problems. the code works when in my launchpad but when i put it on a circuit board that i made it wont work. it is getting 3.3volts and i did ground the reset but it wont seem to do anything. any thoughts?

Link to post
Share on other sites
  • 1 month later...

well i got it all wired up and in the car and the realized the the brake and signals share bulbs. so i need to work on my code. i need to figure out how to read two inputs and based on them do something. so if P2.3 is high and P2.4 is low then do one pattern. and if P2.3 is low and P2.4 is high do a different pattern. and if P2.3 is high and P2.4 is high do another.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...