I'm totally stuck. I've got an Arduino Duemilanove that I am trying to use with a ULN2065B IC, which is a high-powered Darlington Array quad. The thing is, the pinouts don't match your typical Darlington Array. Here's the datasheet:
I know normally you would hook up your digital output to the "B" (base) and your voltage would be coming in on your (C) collector and this will flow through the (E) emitter when switched by the signal from B. The ULN2065B has no identifable Emitter... It has pins labeled B, C, K, and Ground. I believe you are supposed to hook up a heat sink to the 4 middle ground pins. But what the heck is "K"? I really cannot figure out how to work this chip! Please help!!!!
By the way, this is for a halloween prop that I am building -- a giant spider that will be equipped with a pneumatic spitter that sprays a mist of water. I'm intending to control the spitter with a 12V solenoid, hence the need for a darlington array. I am somewhat new to electronics, so forgive me if I seem like an idiot!
There isn't really an emitter. You are right that your digital signal goes to B, and C is the "output". When B is high then the C output pulls to ground, thus "sinks" current. When B is low then the C output is off and does not allow current to flow. If you look at a typical Darlington array they work the same way, they just show discrete transistors in the diagram instead of logic symbols.
The K is a common node which is usually the supply voltage for the thing you're switching on and off (a solenoid in your case). So you would connect K to the 12V source that you are applying to one side of the solenoid. The other side of the solenoid goes to the C pin.
--
The Flexible MIDI Shield: MIDI IN/OUT, stacking headers, your choice of I/O pins
Wow, thanks for the quick reply! I got a few wires corrected and also noticed I had accidentally connected GND pin (the one next to pin 13) to the B on the ULN2065B instead of digital I/O pin 13! Doh! It is working now with a test LED. Thanks very much for the help!
Hmm, I may still have a problem. I removed the power source from K and the LED was still lighting when the Arduino was sending a signal to the Base. I'll try hooking up a motor and see if it works properly. If I have somehow blown the chip, I have a couple of spares.
I hooked up the actual 12Volt solenoid that I want to use and unfortunately it is not working. I think my ULN2065B chip might be fried. I don't want to try another one without verifying that I am doing this right. Is GND on this thing supposed to be hooked into negative on the power supply, or is it just for the heat sink? I've tried it both ways. Any suggestions?
// Test Analog of PIR and triggering of solenoid
int analogPin = 0;
int motionDetectedLedPin = 13;
int solenoidPin = 12;
int val;
boolean motion = false;
void setup()
{
Serial.begin(9600);
pinMode(motionDetectedLedPin, OUTPUT);
pinMode(solenoidPin, OUTPUT);
digitalWrite(motionDetectedLedPin, LOW);
digitalWrite(solenoidPin, LOW);
}
void loop()
{
val = analogRead(analogPin); // read the input pin
Serial.println(val); // debug value
if (val > 100)
{
if (motion == false)
{
motion = true;
digitalWrite(motionDetectedLedPin, HIGH);
digitalWrite(solenoidPin, HIGH);
Serial.println("Switch ON!");
}
}
else
{
if (motion == true)
{
digitalWrite(motionDetectedLedPin, LOW);
digitalWrite(solenoidPin, LOW);
Serial.println("Switch OFF!");
motion = false;
}
}
delay(50);
}
And here is an ugly picture of what I currently have on the breadboard. My apologies for only having 1 color of wire -- it is driving me nuts, too.
Pin 12 is being used to trigger the solenoid via the ULN2065B. Pin 13 is being used as an indicator LED for when I should have switched the solenoid on. The purple wires go to the solenoid. The top right hand part of the breadboard with 3 wires going into the top strip is the ground for the 10 Volt switched power supply I am using for the solenoid. The 10Volts is plenty to switch the solenoid, that has already been tested. In fact, you can see a video of that here: Spitter Test - YouTube
Let me know if you have any other questions.
Okay now I am thoroughly confused. I put my meter's + probe on the C and the meter's - probe on the ground. Whenever B goes high, the meter reads 257 V! What the heck? How is that even possible? When B goes low, the meter reads 0V. By the way, this is with a fresh chip thrown on. I put on a 10K resister in between C and the solenoid and now the meter reads 2V when B is high. So... maybe if I get the resister right I'll have around 12V?
EDIT: I replaced the resistor with two 100 ohm resistors (200 ohm total) and now I'm getting 10.3 volts but the solenoid is still not activating. I also measured mA and I'm getting 0.24 mA. The solenoid says 400 mA by the way.
I gave up on using the ULN2065B. I probably destroyed 2 of them already by not knowing what I'm doing. I went out and bought a TIP31C and found an instructable here:
I was able to get it working using the TIP31C and the diode as described in that instructable. Now I can focus on building my sequence of solenoid events and triggering them when the motion sensor sees motion. Thanks for the help. I'd still be curious as to what I was doing wrong with the Darlington Array quad.