# Arduino In vehicle mood lighting



## ste2425 (Jun 13, 2013)

Since my University course has ended ive found my self with spare time 

So i decided to stay on the programming bandwagon and start an Arduino based project. Love these little boards the things you can do with them are fantastic and for the price you can pick them up for everyone should have one.

Anyhoo the grand plan:

To create a system that performs ambiance lighting within a vehicle that reacts to the way said vehicle is driven. Current plans are for it to fade from what ever colour is selected to red depending on how hard the driver accelerates and when the vehicle is about to red line it will flash red at you reminding you it doesn't like it. Then with the use of an accelerometer hard cornering will cause the outside side of the car to fade to red. The sharper the corner the more red. I believe it will have to take into consideration the vehicles speed as well as the reading from the accelerometer so that it doesn't give false readings. Then there will be the joy of pots holes, speed bumps that could cause the results to be unexpected but ill worry about that when the accelerometer arrives. 

Current progress so far is just bread boarded up. Because of the limited number of digital input and output pins ive employed the use of shift registers. As all im doing is basically routing a high or low signal to LED's there's no form of serial communication it'l be a good exercise to learn how to use shift registers. I could then expand that to hopefully run other devices such as TFT displays through a shift register as ive seen it done. Currently ive got one register in use and can control the PWM of each of the eight LED's connected to it individually. 

I have an array of predefined RGB values for various colours which the user can select between and the Arduino will fade each LED colour up or down to the new colour creating a nice transition between the two. The colour selected is then stored in the Arduino's EEProm so that colour is automatically selected when it next powers up. 

There's also a few functions which create some nice colour fades effects which the user can control the speed of the fades. Im thinking of implementing this to automatically be used when driving on motorways.

Currently the LED's draw power directly from the shift register so they are quite dim. Im awaiting some more registers to control more LED's and also some transistors. The plan it the sift register will control the transistor which will act like a switch between the LED's and the Arduino's power source giving me the LED's at full power.

Im really excited about this and even thought of what i could do next, creating a dock for my iPhone to interface with the stereo and give me steering wheel controls for it. Even better if i do get a TFT display working with shift registers to create a keypad entry entry system where the user has to enter a code before the vehicles ignition system is given power  That could then be expanded even further with the use of a OBD-II shield to give each driver of the vehicle their own code. You could then log how well each driver is driving it, how sharp they corner, hard they accelerate and their MPG per trip. Great fun 







I know how much you all like photo's with your logs but sadly thats it for now. When my new toys arrive ill get more and post a video of its functionality at the moment


----------



## micropage7 (Jun 13, 2013)

interesting project
waiting the update


----------



## Sasqui (Jun 13, 2013)

Me too... subscribed


----------



## ste2425 (Jun 13, 2013)

Thank you very much 






Not much of an update but new toy's arrived whilst i was at a job interview. Just waiting on the transistors and pcb boards before i can move onto the next step


----------



## ste2425 (Jun 14, 2013)

Sadly no more updates just yet but how many cores  does an Ethernet cable have and running 5v down them won't be an issue right?


----------



## t_ski (Jun 15, 2013)

Cores?  You mean wires?  There are four pairs of twisted cable, and depending on what kind of CAT you're using, there may be a shield in it as well.  5V probably won't be too bad on it, depending on what amps you're trying to draw through it.


----------



## Sasqui (Jun 17, 2013)

t_ski said:


> depending on what amps you're trying to draw through it.



Exactly...

Look here:  http://www.powerstream.com/Wire_Size.htm

3.5 A for "Chassis wiring"
0.577 A for "power transmision"



> Load Carrying Capacities (see table below)
> The following chart is a guideline of ampacity or copper wire current carrying capacity following the Handbook of Electronic Tables and Formulas for American Wire Gauge. As you might guess, the rated ampacities are just a rule of thumb. In careful engineering the voltage drop, insulation temperature limit, thickness, thermal conductivity, and air convection and temperature should all be taken into account. *The Maximum Amps for Power Transmission uses the 700 circular mils per amp rule, which is very very conservative. The Maximum Amps for Chassis Wiring is also a conservative rating, but is meant for wiring in air, and not in a bundle.* For short lengths of wire, such as is used in battery packs you should trade off the resistance and load with size, weight, and flexibility. NOTE: For installations that need to conform to the National Electrical Code, you must use their guidelines. Contact your local electrician to find out what is legal!


----------



## ste2425 (Jul 9, 2013)

Well finished moving house, job interviews are over, i got the job by the way  working for a company called Cascade creating payroll and HR software  so i can continue with this little project 

Well so far im about halfway through soldering various things onto PCB so i can make more room on my breadboard and work on other things.






Not much interesting really just using transistors to act as a switch so the LED's are not drawing power directly from the shift registers. Plus soldering them onto boards this size means bits can be upgraded and expanded easily rather then having to take apart one large PCB


----------



## ste2425 (Jul 10, 2013)

Right so I spent all yesterday messing around soldering my shift registers onto the PCB's and these transistor boards so my LED's arn't drawing power straight from the registers only to realise ive made a very stupid mistake.

First ill show pictures.





Here's my shift register board, ignore the sellotape im waiting for my shrink wrap to arrive. Three registers with eight outputs each controllable independently. 
The board to the left is the transistor board, where ive made a big mistake 





My soldering. Not the best in the world ill admit but ive never soldered onto a PCB before and the tip on my soldering iron is the size of a small moon. There's no shorts however and everything is secure so it does the job.





And a quick test and it all work fantastic 

Now the problem.

When i decided to use the transistors to seperate the power draw from the shift registers i didn't have my RGB led's so i set it up on the breadboard and tested on my single LED's at it all worked. I took photo's for reference and moved on to the next task. I since bought my RGB LED's then decided to solder up three of the above transistor boards, one for each colour. When to set them up and realised my mistake. The transistors work by switching the ground. My RGB LED's have a shared ground. 

As i don't know much about how the transistors work i liked them to a relay you get in cars and thought well if it passes the ground why can't they pass the live. So wired it and as you can guess it didn't work and made my shift register very toasty. So now i either have to by separate red, green and blue LED's which will make installing them in the car harder or sack off the money and time spent on the transistor boards and try to find a new approach. Not happy


----------



## Aquinus (Jul 10, 2013)

You shouldn't solder imho until you have the circuit completely figured out. You should get an extra large breadboard for prototyping. Just my 2¢.


----------



## AsRock (Jul 10, 2013)

Not seen one of those boards since my training many many years ago.  They look like they are made of plastic now ?.

You can get a wider beam of leds if you flatten the head of them too so if it's close to some thing the the light is more wide spread.


----------



## ste2425 (Jul 10, 2013)

AsRock said:


> Not seen one of those boards since my training many many years ago.  They look like they are made of plastic now ?.
> 
> You can get a wider beam of leds if you flatten the head of them too so if it's close to some thing the the light is more wide spread.



Do you mean the breadboard? Yes its plastic what were they made of?

And i know i probably should have developed everything before soldering but that's why its being developed modular.

I think ive found a solution. My led's are common cathode if i get a set of common anode ill be able to feed them a single separate live then switch each ground with the transistors right?

Everything else is working as it should, the board with the shift registers on works great with every pin being addressable and not interfering with each other. The transistor boards work great as well as long as their switching the ground. If the common anode LED's will work then that side of things is done. All the boards are soldered up. Now i can work on the input side of things with getting a reading on the cars rev's and look into using an accelerometer.


----------



## ste2425 (Jul 11, 2013)

Well its all soldered up now, tested and working brilliantly when switching the ground. Need to wait on new RGB led's to get the actual effect.

Ill hook it all back up and post some pics/vids of it all working as i took it all apart to stick to the cardboard.

Soon ill have to think about some form of case :/


----------



## mlee49 (Jul 11, 2013)

Hi!  Nice project 

Just curious though why you're using shift registers to power your LED's.  I would suggest a very simple LED driver, heres a good start:

http://people.eecs.ku.edu/~callen/501/Driving_your_LED.pdf

I made the LED driver circuit my Senior Year: 






Note the LED is on the left, with the transistor(metal tin can looking thing) next to it.

We used a Bias voltage of 10 volts though from a source, your Arduino only has a 5V supply at 1A(I think) so you're LED driving resistors will change significantly.

Also, why are you using the Digital IO for the LEDs?  I would think for the mood lighting effect you could use the Analog and just script some output voltage to drive your LED driver into different ranges(aka vary the brightness).


----------



## ste2425 (Jul 11, 2013)

mlee49 said:


> Hi!  Nice project
> 
> Just curious though why you're using shift registers to power your LED's.  I would suggest a very simple LED driver, heres a good start:
> 
> ...



Ha thanks  Your boards look much neater than mine.

Im using shift registers because i needed more outputs than the arduino has. From three digital outputs on the arduino i think i can link around 70 registers with eight outputs each (i intend to do more then the mood lighting). 

Also this is the first thing ive done with the arduino, besides knight rider lights. When i Googled how to get more outputs this was the first thing that looked like it would do the job, haven't seen anything about LED drivers until you mentioned it now actually 

Also im using a library called Shift PWM its quite compact and allows me to simulate using the PWM outputs on any output of the shift registers. Each output of each register can be addressed independently so i can do colour fades with my RGB LED's. Also i can make one LED dimer or brighter then the other, so they can be adjusted in-car in case one is more dazzling then the others.

EDIT:

Just had a look through that link and OHHHH MYYYY GOD my brain seriously hurts. 

Whilst browsing google to find a funny picture to try and show maths killing my brain i stumbled across this and it made me laugh.


----------

