Hey guys I'm working on a project for my car and have all the hardware laid out. However I need a push in the right direction as far as programming goes. This is a very long post and I thank/appreciate everyone in advanced for reading through it....or at least clicking on the link!
I'm designing a custom LED angel eye setup for my car and want the LEDs to be controlled via a logic board using an ambient light sensor. When it is daylight out, I want the LEDs to be brighter...so you can see them in daylight. As night falls, I want them to dim according to the ambient light detected. I also want to program a delay in so that the LEDs do NOT dim right away under overpasses, etc.
My plan is as follows:
I will be using Cree X-Lamp SMD LEDs. They will be glued to the back of acrylic rings using clear RTV silicone. The LEDs will be wired in parallel with each other.
I will be soldering about 450 of the LEDs across 4 rings. 2 rings per headlight. The rings will be wired in series to an LED driver....one per headlight.
Here are the LEDs: http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=MLBAWT-A1-0000-000WE3CT-ND
Lux Drive Buck Puck Driver 3023-D-E-1000PmA: http://www.ledsupply.com/03023-d-e-1000p.php
I'll be using an Arduino Pro Mini: http://www.sparkfun.com/products/9218
A FDTI Breakout board for programming: http://www.sparkfun.com/products/9716
And a TEMP6000 as the ambient light sensor: http://www.sparkfun.com/products/8688
Now. The driver has a REF output which is regulated at 5V...perfect for powering the logic board. I will be using a 12ohm resistor inline with the positive lead of the driver to eliminate errors in my car. The REF output will go to the arduino board's VCC? (I think that's what it's called) to power it. And a CTRL input from the driver will be wired to the arduino board. Do I use an analog or digital port?
Now that everything is wired. On to the programming. I found this basic code and wiring diagram on here:
http://bildr.org/2011/06/temt6000_arduino/
But I see the TEMP6000 is wired to the 5V pin on the arduino. Don't I need that port to power the board (from the driver)? If so, can I use the other 5V REF output on the other driver to power the TEMP6000? The sensor will be located above my rear view mirror, next to the existing photo sensor there used for auto wipers. Should I just wire a separate power supply, closer to the sensor? The driver's will be located inside the headlights. I was planning on mounting the arduino board in the ECU box of my engine bay.
Anyway, the code is as follows:
int temt6000Pin = 0;
void setup() { Serial.begin(9600); }
void loop() { int value = analogRead(temt6000Pin); Serial.println(value);
delay(100); //only here to slow down the output so it is easier to read }
Serial port to 9600? I'm guessing this is a standard/constant I do not need to worry about? The site also mention that the values will be from 0-1023; 0 being the lowest, 1023 being the highest. Where is that value displayed? In the first line? So does it change?
Also this is just the reading from the sensor. How do I use it to control the driver? I think I would use PWM? And the values would be from 0-255; again 0 being the lowest, 255 being the highest.
I know I need to specify ports. For example, the ports which the drivers will be on and the analog port which the TEMP6000 will be on. But I'm lost relating them to each other. Can somebody make a basic code for me? Or at least explain where to go from here?
I just started programming in one of my electrical engineering classes so I am a newb at programming. But this logic board got me so interested in using the sensor to control the LEDs!
I've been reading the guides on the main Arduino site about programming. But it's all #'s and letters to me.
Again thank you guys for reading!