Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

16F628A for PWM for LED TailLights and TurnSignals

Status
Not open for further replies.

Tightwad

New Member
I am trying to figure out the right way to implement my ideas, but I am getting stuck.

I have a Motorcycle Trunk which I added LEDs to. I used 3 arrays, each array consisting of 6 leds and a resistor in series. One array is for the Left Turn, one for Right Turn, and one for Middle/Brake.

I would like:

PWM power to all 3 circuits if Brake is not applied and turn signal is not activated

PWM power to center and left, if the right signal is activated...same for right side if left is activated.

I would like to go full power to all lights (remove PWM) if brake is activated.

The last part is the hardest. If the turn signal is activated, I get an On-Off power source from the turn signal wiring. I want this to flash the left or right sides, and I want the side to go out(not PWM low) when in the "off" cycle...I imagine I need some sort of timer to see if that source has been high in the last 3 seconds or whatever?

Any info I didn't provide? LED are common 2.1V, 20mA red LEDs. 47 ohm resistor was used, 13.5 volts the usual source (may be as low as 12.6)
 
What is "PWM power"?

I could not understand what you mean. Say it again.

PWM power is when LEDs become very bright or dim?
 
PWM makes the LEDs dim, for driving lights. Driving them from DC makes them bright, for brake lights and the "on" cycle of turn signals.

Assuming the bike has 3 signals: left turn signal, right turn signal, and brake on, you could do the following table for the turn signals:

Code:
Signals				Left LED	Middle LED	Right LED
All off				PWM		PWM		PWM
Left Turn Signal On (cycle)	ON		PWM		PWM
Left Turn Signal Off (cycle)	OFF		PWM		PWM
Right Turn Signal On (cycle)	PWM		PWM		ON
Right Turn Signal Off (cycle)	PWM		PWM 		OFF

For the "off" cycles of the turn signals, you might have to use a delay, unless you can wire in a "signal active" line from the turn signal switch to tell the uC that a turn signal is on.

For the brakes, simply override any PWMed LEDs to be full on when the brake signal is on (substitute "ON" for "PWM" in the table above). The turn signals will still work since they're alternating between ON and OFF (instead of ON and PWM).
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top