I am building a custom tail light.

Hi everyone, I am new to this forum so please be nice to me :smiley:
I'm new to Arduino and only have basic knowledge on electronics..

I am planning to make something like this:

Since I am just starting, I only want to copy the rear bumber lights of the toyota vios (00:47 on the video)

Please don't be concerned about street legal. I will only use them for show.

Here are my thoughts so far. Since car battery is 12V and can reach up to around 15v when running, I am planning to power the arduino with a step down buck converter to 5v. And then control the 5mm LED lights using MOSFET and connected as serial to positive of car battery.

Here's a circuit I made. Please think of the "5V LM7805" as buck converter. The other 5V on pin2, I will use it as an input which will be connected to the brakes positive..

I haven't tested this on actual yet. But will this work? And if does, since I will be using pin 3-13 as output, I will then need 11 MOSFETs.

Please let me know what you think and if there's a better and easier way to do this. I am total noob so any suggestion and replies will be appreciated. Thanks in advance! :smiley:

What do the lights do? Animate in any way or do they just flash? Do you need to control every single LED?
So you have any 5mm LEDs on hand? Do you think they will be bright enough for your purposes?
You can buy small WS21812 prewired matrices that are very very bright (and you can of course dim them down to whatever you'd like) and you wouldn't have to deal with a bunch of transistors and a whole lot less wiring.

Here are my thoughts so far. Since car battery is 12V and can reach up to around 15v when running, I am planning to power the arduino with a step down buck converter to 5v

Some people like to use an external voltage regulator, but the Arduino has an on-board regulator and it's rated up to 20V through the barrel jack or Vin. (I have an Arduino in a car powered by '12V' through the barrel jack.)

The LEDs can be powered by 12V, through the MOSFETs & usual current limiting resistors. If you try to power all of those LEDs through a 7805 (or the Arduino's built-in regulator) the regulator will probably overheat.

[u]Here is a MOSFET driver circuit[/u]. (You can leave-out the diode, it's for inductive loads like a motor or solenoid.)

The other 5V on pin2, I will use it as an input which will be connected to the brakes positive..

Don't use a voltage regulator for "signal". Voltage regulators are for power supplies. Use a [u]Voltage Divider[/u] (2 resistors) with an added [u]over-voltage protection diode[/u].

I haven't tested this on actual yet. But will this work? And if does, since I will be using pin 3-13 as output, I will then need 11 MOSFETs.

Try it first with just one LED per channel and without the MOSFETs. Then "build-up" the circuit a little at a time.. Add the MOSFET with one LED before adding the others.

Cant see it mentioned but you have run a 5v regulator into the Vin which runs to the input of a 5v onboard regulator.
Run it to the 5v

Daz

Thank you everyone for your replies!

INTP:
What do the lights do? Animate in any way or do they just flash? Do you need to control every single LED?
So you have any 5mm LEDs on hand? Do you think they will be bright enough for your purposes?
You can buy small WS21812 prewired matrices that are very very bright (and you can of course dim them down to whatever you'd like) and you wouldn't have to deal with a bunch of transistors and a whole lot less wiring.

I want to make them just like on the video. I don't have to control every single LED. If you notice on the video, around 8 LEDs are controlled by only 1 pin.. And yes, I have LEDs on hand. I already have a code for animation and brake input but only 2 LEDs for every pin and arduino connected to USB on PC.

Yes, these 5mm LEDs are bright enough for my purpose. I have read WS21812 are not ideal for automotive because they have shorter life and 5mm LED bulbs are what everyone uses on all tail light projects I see..


DVDdoug:
Some people like to use an external voltage regulator, but the Arduino has an on-board regulator and it's rated up to 20V through the barrel jack or Vin. (I have an Arduino in a car powered by '12V' through the barrel jack.)

Arduino's recommended input power is only at 7V - 12V. The car voltage can spike and stay up to 15v. I just want to play it safe that is why I am planing to use a buck converter.. And when you said "external voltage regulator", that is a buck converter, right? Do you think this one would work?
https://shopee.ph/Super-mini-Step-Down-buck-3A-DC-DC-Converter-Power-Module-i.31595899.475167820

DVDdoug:
The LEDs can be powered by 12V, through the MOSFETs & usual current limiting resistors. If you try to power all of those LEDs through a 7805 (or the Arduino's built-in regulator) the regulator will probably overheat.

[u]Here is a MOSFET driver circuit[/u]. (You can leave-out the diode, it's for inductive loads like a motor or solenoid.)

Okay, I will try this one.. But, won't my current MOSFET setup work?

DVDdoug:
Don't use a voltage regulator for "signal". Voltage regulators are for power supplies. Use a [u]Voltage Divider[/u] (2 resistors) with an added [u]over-voltage protection diode[/u].
Try it first with just one LED per channel and without the MOSFETs. Then "build-up" the circuit a little at a time.. Add the MOSFET with one LED before adding the others.

Won't the resistors overheat or something? Also, since the voltage fluctuates, how will I be able to calculate the resistance? Should I just calculate it as 12V then let the over-voltage protection diode do it's job?


Daz1712:
Cant see it mentioned but you have run a 5v regulator into the Vin which runs to the input of a 5v onboard regulator.
Run it to the 5v

Daz

Ohh, thanks.. On where should I put the inputs?

I didn't see a video link, but anyway, I don't understand your concern or even belief about lifespan of smart LEDs. They'll outlast your car's 'off-road' use timeframe.

Daz1712:
Cant see it mentioned but you have run a 5v regulator into the Vin which runs to the input of a 5v onboard regulator.
>>> Run it to the 5v <<<

Actually (I) wouldn't do that.

The on-board regulator provides you with an extra layer of supply protection.
I'd rather get a clean +9-12V (nominal) into the +VIN pin, and go from there.

For the block of LEDs, I'd use a similar arrangement (bulked up to support the higher current needed)

Finally - I'd seriously look at the WS281x LED matrices. Easy to develop, and all the brains are within the actual LED chips.

DVDdoug:
Some people like to use an external voltage regulator, but the Arduino has an on-board regulator and it's rated up to 20V through the barrel jack or Vin. (I have an Arduino in a car powered by '12V' through the barrel jack.)

The onboard Arduino regulator is unsuitable for the automotive electrical system. That 20V rating is not actually good for 20V. Even 12V without all the nasty surprises can cook the Arduino's regulator under the wrong conditions.

This project is looking to supply many LEDs from that 5V supply. That's exactly the wrong conditions which will cook the Arduino's regulator.

The easiest way to get an automotive-rated 5V power supply is to use a phone charger adapter. $5-$15 at your local discount store will get you something good.

The brake lights connection is much simpler than a power supply. Two resistors configured as a voltage divider will work quite well. A 5V TVS diode or BAT16S shottkey pair after the resistors will protect the Arduino input from problems.

Thank you again for all your replies and bearing with me! :slight_smile:
Btw, my main concern is powering the LED bulbs.. And is connecting the bulbs in series and use MOSFETs for every pin the only option here? Also, won't MOSFETs overhead or something?

ADDED:
My main goal is to create something like this: CLICK TO SEE VIDEO
But for now, only on the rear bumbers. Here's the image again.
This is exactly the same car model as mine:


INTP:
I didn't see a video link, but anyway, I don't understand your concern or even belief about lifespan of smart LEDs. They'll outlast your car's 'off-road' use timeframe.

Here is the video link:

I like the colors and looks of the 5mm LED bulbs more than LED strips.


lastchancename:
Actually (I) wouldn't do that.

The on-board regulator provides you with an extra layer of supply protection.
I'd rather get a clean +9-12V (nominal) into the +VIN pin, and go from there.

What do you mean by clean? What do you think about this buck converter?
https://shopee.ph/Super-mini-Step-Down-buck-3A-DC-DC-Converter-Power-Module-i.31595899.475167820

lastchancename:
For the block of LEDs, I'd use a similar arrangement (bulked up to support the higher current needed)

Similar arrangement as mine? Or as sent by DVDdoug?
Here's the link: Gammon Forum : Electronics : Microprocessors : Driving motors, lights, etc. from an Arduino output pin

lastchancename:
Finally - I'd seriously look at the WS281x LED matrices. Easy to develop, and all the brains are within the actual LED chips.

And as I mentioned above, I like the colors and looks of the 5mm LED bulbs more than LED strips.


MorganS:
The onboard Arduino regulator is unsuitable for the automotive electrical system. That 20V rating is not actually good for 20V. Even 12V without all the nasty surprises can cook the Arduino's regulator under the wrong conditions.

Agreed, that is why I am planning to use a step down 5V buck converter and plug it to the arduino so the arduino's regulator won't get overheat.

MorganS:
This project is looking to supply many LEDs from that 5V supply. That's exactly the wrong conditions which will cook the Arduino's regulator.

Nope. As like on the circuit I showed on my original post, I am planning to connect the LEDs in series and connected to the car battery and control them via MOSFETs.

MorganS:
The easiest way to get an automotive-rated 5V power supply is to use a phone charger adapter. $5-$15 at your local discount store will get you something good.

Sure, I can do this if the buck converter is a risk. I can get a really long usb cable and connect it to the cigarette lighter inside the car. But I always prefer to keep it clean and hidden that is why the buck converter crossed my mind.

MorganS:
The brake lights connection is much simpler than a power supply. Two resistors configured as a voltage divider will work quite well. A 5V TVS diode or BAT16S shottkey pair after the resistors will protect the Arduino input from problems.

Great, thank you for this. I should be able to do this without a problem.

I suggest tpic6b595 chips. They are like a 74hc595 shift register but with higher voltage and current capabilities. Each chip has 8 outputs which have built-in mosfets and can drive your groups of LEDs. Two chips, daisy-chained together will give you 16 channels and needs only 3 Arduino pins.

Tpic6b595 outputs can switch up to 150mA and up to 50V. If you can find them more cheaply, there is also tpic6c595 which can switch 100mA and up to 33V.

I agree with @MorganS about the phone charger and just hardwire it. no need for a long cable ???
If you want use a buck converter get one that outputs 7 volts and run it thru the arduino regulator for a little extra input protection.

For the brake switch sensing instead of a voltage divider use an optoisolator like this: H11L1 Optoisolator
cheap, total circuit protection and automatically handles switch debouncing. Protect your Arduino - use an Opto Isolator!

PaulRB:
I suggest tpic6b595 chips. They are like a 74hc595 shift register but with higher voltage and current capabilities. Each chip has 8 outputs which have built-in mosfets and can drive your groups of LEDs. Two chips, daisy-chained together will give you 16 channels and needs only 3 Arduino pins.

Tpic6b595 outputs can switch up to 150mA and up to 50V. If you can find them more cheaply, there is also tpic6c595 which can switch 100mA and up to 33V.

tpic6b595 and tpic6c595 sound interesting. So if 1 LED is around 20ma, I can drive up to 7 LEDs per output of the tpic6b595, right? I will research about how to connect them.. And since you said they have build in MOSFETs, won't I be able to just series LEDs to main power and connect as much as I want just like with regular MOSFETs?

Also, if I could not find stocks of the tpic here in my area, do you think the 74hc595 will be fine for my project?

Hutkikz:
I agree with @MorganS about the phone charger and just hardwire it. no need for a long cable ???
If you want use a buck converter get one that outputs 7 volts and run it thru the arduino regulator for a little extra input protection.

I couldn't find a good car regulator that outputs 5v on a female USB here in our country, they all ship from abroad which takes weeks to deliver.. I guess I will just use a buck and set 7v and connect it to Vin like you said..

Hutkikz:
For the brake switch sensing instead of a voltage divider use an optoisolator like this: H11L1 Optoisolator
cheap, total circuit protection and automatically handles switch debouncing. Protect your Arduino - use an Opto Isolator!

Okay thanks. I will research about it.. But if I can't find stocks here, will the voltage divider work fine?

So if 1 LED is around 20ma, I can drive up to 7 LEDs per output of the tpic6b595, right?

More than that. In your diagram above, you show 2 parallel groups each of 6 LEDs in series. I think 6 is probably too many. 5 might be ok. You can do this because your supply voltage, which could be as low as 12V, is still many times higher than the forward voltage of a single red led, which is normally around 2V. The total forward voltage of 5 LEDs is 10V, leaving 2V to be dropped by the series resistor (eg. 100R). The important point is that the LEDs in series are not drawing 5 X 20mA, the same 20mA flows through all 5 LEDs. That means a single output of the tpic chip could support 7 parallel groups of 5 LEDs in series, 35 LEDs in total.

, do you think the 74hc595 will be fine for my project?

No, the max current for 74hc595 is 70mA total for 8 outputs and the max voltage is 5 or 6V, so not suitable at all.

PaulRB:
More than that. In your diagram above, you show 2 parallel groups each of 6 LEDs in series. I think 6 is probably too many. 5 might be ok. You can do this because your supply voltage, which could be as low as 12V, is still many times higher than the forward voltage of a single red led, which is normally around 2V. The total forward voltage of 5 LEDs is 10V, leaving 2V to be dropped by the series resistor (eg. 100R).

Got the point here.

PaulRB:
The important point is that the LEDs in series are not drawing 5 X 20mA, the same 20mA flows through all 5 LEDs. That means a single output of the tpic chip could support 7 parallel groups of 5 LEDs in series, 35 LEDs in total.

Sorry I didn't understand it. Are you are saying those 5 LEDs per series only consume a total of 20mA? How? Then if 35 LEDs for each pin, I will have 35 x 8 outputs = up to 280 LEDs per single tpic6b595?

PaulRB:
No, the max current for 74hc595 is 70mA total for 8 outputs and the max voltage is 5 or 6V, so not suitable at all.

Ohh.. Right, that current is way less than what I need.


BTW: I can only get tpic6b595/tpic6c595 through online stores in US/China which will either take few weeks to deliver or cost me a fortune for express shipping. Though, I believe the tpic are the perfect chips for my project and I can pay it if it's the only way to get my project done.. I really like tpic6b595 so far, but if there's an alternative way, please let me know too ..

EDIT: Will the tpic6b595 and tpic6c595 support multiple blinking LEDs? I am not only creating a brake light. They will be in "show mode" most of the time and only lights up all when the brake input is HIGH/LOW.

Yes, 5 LEDs in series only consumes 20mA. So you can have many of these series strings on each output. However you must have separate ballast resistors for each string. You can't just tie them all together to one resistor.*

Looking at the video, it seems like the tail light switches on in segments that are about 4 LEDs wide. So they have done exactly what you are about to do - 4 strings of LEDs connected to a single output of the driver.

  • A resistor may be a poor choice for current regulation in this case. The car's electrical system is at 12V when the engine isn't running and above 14V when it is. With a resistor such as PaulRB recommends, the LEDs will get twice the current at 14V than at 12V.

With a resistor such as PaulRB recommends, the LEDs will get twice the current at 14V than at 12V.

That's true. It may be better to limit your design to 4 LEDs with a 300R series resistor for each group. Then the current will be around 20mA at 14V and drop to around 13mA at 12V.

MorganS:
Yes, 5 LEDs in series only consumes 20mA. So you can have many of these series strings on each output. However you must have separate ballast resistors for each string. You can't just tie them all together to one resistor.*

Looking at the video, it seems like the tail light switches on in segments that are about 4 LEDs wide. So they have done exactly what you are about to do - 4 strings of LEDs connected to a single output of the driver.

  • A resistor may be a poor choice for current regulation in this case. The car's electrical system is at 12V when the engine isn't running and above 14V when it is. With a resistor such as PaulRB recommends, the LEDs will get twice the current at 14V than at 12V.

Ohh, I see .. tpic should be the solution for my problem! I will order them from USA.

PaulRB:
That's true. It may be better to limit your design to 4 LEDs with a 300R series resistor for each group. Then the current will be around 20mA at 14V and drop to around 13mA at 12V.

Ahh, right. I will follow that..

Thank you everyone. I will post an update once I got my tpic and tried the setup!
Oh and BTW. I have edited the original post. I hope you can still help me with it :slight_smile:

No. Post new information in a new post.

Edits should only be used to fix mistakes like typos or forehead-slapping bad advice.

MorganS:
No. Post new information in a new post.

Edits should only be used to fix mistakes like typos or forehead-slapping bad advice.

Oh, okay sorry about that. I have re-updated the original post..

ADDED: Since I currently have a possible solution and few things to test, may I ask for a recommendation on what material and how to create this huge "protoboard" like panel where I will put the LEDs?

Here is an example: