PDA

View Full Version : Arduino controlled car led system.



Crimson13
01-06-2011, 04:58 PM
My newest project: Arduino controlled led system.

I'm cross posting this on a few sites so please let me know if something doesn't make sense.


What I am hoping to accomplish is a multi “zoned” led system for my car.
I participate in various things that allow me to use warning lights on my vehicle, some things are for a local government agency and some is for other things that involve police escorts. Currently I have a cheap led flasher from China that I bought off of ebay before the foreign sellers started jacking their shipping charges. The flasher came with 2 sets of lights with each set having 3 pods of 3 leds. The flasher has 3 patterns, mode A is side 1 flashes 4x then side 2 flashes 4x, mode B is alternating flash (1,2,1,2,1,2,1,2,1,2,1,2…..), mode C is both sides at the same time. These leds are amber and are mounted in the rear window. Since getting the flasher I have added some white led strips in the grill and tied them into the wires for the other lights.
So I don’t have many lights and would like to add more. But real warning leds are expensive and I don’t have a few hundred to drop into that. What I would like to do is have an arduino control all the leds around the car independently. Attached is a map of the different “zones” that I would like to control. The front and rear have two zones so the leds can have alternating flash patterns.
There are a few goals I have for this project to be able to do.
1. Individual zone control. (on, off, strobe, etc…)
2. Preset patterns or modes. (zones 11+12 alternate, zones 21,22,23,24 on, etc…)
3. Use a LCD display to scroll through the zones and modes.
Bonus Goals!!
4. Use RGB leds and control each color channel in the zones.
5. Have an additional zone for a traffic advisor (arrow stick).

Light zone map. Zone 24 would be the cargo area.
http://i2.photobucket.com/albums/y27/kc9fjb/zone-map.jpg

Possible RGB Leds to use. Each led has a chip which makes each led individually addressable with only using 2 pins from the arduino for the whole strand.
http://www.adafruit.com/index.php?main_page=product_info&cPath=37&products_id=307

I was going to use a playstation controller joystick for navigation of the menu, but I recently saw that someone has figured out a library for a wii nun-chuck so I can use the joystick, button, and accelerometers with only 2 pins and power.

Whooops looks like I put this in the wrong section! If someone could move this to microcenter that would be great!

TheMainMan
01-06-2011, 08:01 PM
Wow, wish I could help but this isn't in my repetoire. Definitely subscribed to see what people say.

crenn
01-11-2011, 04:15 AM
The problem you might have is interference from other electrical devices. It may not, but since these are warning lights, they might trigger by accident, you need to be careful in your design. Using a CAN (http://en.wikipedia.org/wiki/Controller_area_network) or LIN (http://en.wikipedia.org/wiki/Local_Interconnect_Network) is possibly an option, but these are not going to be supported by the arduino and will need a knowledge of these networks. There are other options, but they're going to need better understanding of how data is transmitted.

Crimson13
01-11-2011, 02:55 PM
I've kinda thought of that, and if it becomes an issue I'll just have the 12v going to the leds switched and then there would be no way for them to turn on. And I would think that if the arduino was off and they somehow turned on they would just be "on" not flashing which would just look like a lot of amber markers around the car.

Crimson13
01-18-2011, 12:54 AM
Well not too much progress has been made on this.

Still working on most of the code, the biggest part would be the menu system that the user would navigate on the lcd.

I'm also waiting for some my shipment of products from sparkfun that I was able to buy from their free day promotion. Some of the things are a wiichuck adapter, a screwshield, and 6 mosfets.

AND I'm also working on a ATX to bench powersupply mod that I'm going to use to test my led system.

If anyone has experience with a menu hierarchy system for the arduino and could help me, that would be great. I'm really new to arduino stuff, and just as new with coding in c/c++. I have some example code for menus but I've not been able to pick it apart yet.

Link (http://i2.photobucket.com/albums/y27/kc9fjb/menu-001.jpg) to an example of the menu hierarchy.

SXRguyinMA
01-18-2011, 11:34 AM
the menu system should be pretty easy. check out the arduino forums at www.arduino.cc as well for tips and advice, as well as examples. I want to do something similar with my bench PSU mod, and be able to switch between voltage and current, but I'm still trying to find a suitable inexpensive current monitor (3 actually, one for each line)

Crimson13
01-18-2011, 03:32 PM
I've been posting there too. So far they've only pointed me at the library (http://www.arduino.cc/playground/Code/Menu) and haven't explained much. I could be wrong but from what I gather, but in the example code it looks like there's only 2 levels to the menu. I know more are possible since I've seen things do it, but I'm not sure how.

What I would really like to be able to do is use ModKit, (http://www.modk.it/) but that's still in alpha testing and I don't think they are going to give out any more invites as they are so close to going into open beta.

So back to scouring the internet for a tutorial on the menus.

SXRguyinMA
01-18-2011, 05:38 PM
yea I want an invite for Modkit SOOOOO bad :D

Crimson13
01-19-2011, 04:21 PM
So I got my mosfets in today but when I tried to test them they just stayed "on" regardless of if there was 5v on the gate or not. I tried running both sides (12v & gnd) through it and both times it would just turn on.

Anyone have any ideas?

Crimson13
01-20-2011, 03:18 PM
So with some help I figured out the problem with the mosfets. Well the problem was more of how I was testing them. The gate of the mosfet needs to be able to "drain" the charge that's on that pin so it can go "low" and then when you send a signal (5v) to it, it goes "high". So to fix this I put ground on the gate and the leds turned off, and as soon as I hit it with 5v they turned on. So I'll have to add a 10k pull down resistor on the gate to gnd.

Crimson13
02-09-2011, 07:03 PM
Progress on the CARduino!

I have finally got the nunchuck working. It took a lot of help from a friend that's knowledgeable in C and bits and pieces of code from about 3 different examples of how to use the nunchuck with an arduino. But we got it to work. So now the arduino returns the position of the joystick and the status of the two buttons on the nunchuck.

Next step is to convert this sketch into a library so I can include it in the menu system code and use the values of the joystick and buttons to navigate the menu.

Crimson13
11-22-2011, 10:50 PM
Well this isn't dead yet!!

I put the "PRO" in procrastination, so sometimes progress takes time. And with most of the coding being done by a friend, I kinda let him work at his own pace.

But we've made progress: The LCD now reads the modes and zones with their current state. Navigation is done via nunchuck joysitck and state change (on/off) is done via the "C" button.

Next up is putting in the different patterns. Other than that the next big hurdle is going to be to get me to pull the trigger on some emergency vehicle grade led pods. After that will be some testing to see if I need to use heatsinks and/or a fan on the mosfets and working out some sort of case to mount everything into.

Another option that I may try to include is a traffic adviser or "arrow stick". That would have 6-8 pods that I could have light in sequence to the left or right to direct traffic. I think for that, I'll try to make the bar for that from scratch. Using some 3/4inch U-channel aluminum and "piranha" style leds. I might use a LPD6803 (http://www.adafruit.com/datasheets/LPD6803.pdf)chip in each of the pods of the traffic advisor so I can string them together and just call what pod I want.

Crimson13
07-25-2012, 07:30 PM
So finally got a chance to work on this some more.

Since my last update, I've added three different flash patterns.

I still haven't bought the led pods yet, and am still playing around with the idea for a traffic adviser.

I tried to talk to the LCD via I2C but the lcd and the nunchuck (also using I2C) didn't play well with each other. Soooo, I'm using SPI instead. I was also able to use some of the analog pins for this. I2C would have freed up the most amount of pins, SPI still frees up a bunch.

I think next up will be getting the RGB pixels working for the interior lighting.


Thanks for watching!