Hi, I am trying to power two 12 volt automotive LED bulbs through a TIP127 transistor that is controlled by an arduino through 2 LTV-816 optoisolators.
Tip127 datasheet.
http://www.st.com/st-web-ui/static/active/en/resource/technical/document/datasheet/CD00000911.pdfOptoisolator data sheet:
https://www.sparkfun.com/datasheets/Components/LTV-8x6.pdfThe bulbs are 12 volt common cathode White/Amber switchbacks. this means a common - side and 2 positive sides. I want to PWM control the amber side on each bulb separately. each bulb only draws about 0.16 to 0.20 amps. I have a power supply that simulates vehicle power, it puts out about 13.3 volts at 5.8 amps. I have that connected to the barrel jack on the arduino.
I dont know of a good way to illustrate the circuit, so i will try to describe it as best i can.
the arduino and the breadboard all share the Vin, Gnd, and 5v rails. the optos are connected pin 5 and 6 on the arduino uno to pin 1 on the opto (anode?) the cathode (pin 2?) is connected to ground through a 220 ohm resistor. the tip127's base is connected to pin 3 on the opto, collector is connected directly to the + on the amber led. emitter is connected directly to the 12 volt rail. pin 4 of the opto is connected to the 12 volt rail. i do not have anything else on the breadboard. (Edit) And the LED 'bulb' is connected to common ground, all grounds are connected at the gnd pin on the arduino board.
Will this function as desired? if i make the pins high on the arduino the led should come on correct?
(Update: solution has been posted below. thanks. Any other info and advice is appreciated for anyone else looking for information)
here is the code used to test the circuit.
int L1Pin = 6; // LED connected to digital pin 6
int L2Pin = 5; // LED connected to digital pin 6
void setup() {
pinMode(L1Pin, OUTPUT);
pinMode(L2Pin, OUTPUT);
}
void loop() {
// fade in from min to max in increments of 5 points:
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) {
// sets the value (range from 0 to 255):
analogWrite(L1Pin, fadeValue);
analogWrite(L2Pin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {
// sets the value (range from 0 to 255):
analogWrite(L1Pin, fadeValue);
analogWrite(L2Pin, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}