basically, I'm using stock car switches to trigger arduino pins by wiring them in in series on the positive wire, but the voltage of the circuit will kill the board. Want to use a comparator to 'trigger' the arduino pin as 'on' or 'pressed' when car button is pressed (i.e. rear defroster), but I have no idea what 'type' of comparator to use, or how to wire it up for this purpose!
See this pic - the 'green box' would be where the comparator would go - (oh, and switch the neg and pos signs - car body is ground and assuming switch shorts to ground). http://www.freeimagehosting.net/q2pop
You don't need a comparator... You just need to knock-down 12V to 5V, right?
If you are switching between 12V and ground, a [u]voltage divider[/u] (two resistors) might do it. But the "12V" in a car van vary a fair amount, and you can get voltage spikes. So a resistor (maybe 10k Ohms) and a pair of [u]protection diodes[/u] would be a better option.
Thanks for the reply - I need to use something that won't affect the original switch circuit to the point where it won't work (e.g. I want to be able to use my rear defroster button -as well- as having it operating as a button in a sequence - I hope this makes sense
The stuff that DVDdoug linked to won't affect the original circuit, other than to place a small load on it of a few mA. The second link he gave is what I would recommend following if you are connecting up in a car; only I would use a 10k series resistor instead of 100ohm before the 5.1V Zener. The IN side connects to your 12V circuit power lead and the OUT side connects to the microcontroller input pin.
afremont:
The stuff that DVDdoug linked to won't affect the original circuit, other than to place a small load on it of a few mA. The second link he gave is what I would recommend following if you are connecting up in a car; only I would use a 10k series resistor instead of 100ohm before the 5.1V Zener. The IN side connects to your 12V circuit power lead and the OUT side connects to the microcontroller input pin.
It would be a good idea to check the zener's data sheet for the appropriate zener current before arbitrarily using a 10K series resistor. For example, if the recommended zener current is 5 mA, then 10K would be too high.
SInce 100uA is more than enough to push most (normal sized) Zeners above 5V, I think 1.2mA will be fine. I'm more concerned about keeping the load off the internal protection diodes than keeping the Zener flat.
What do you mean by "recommended Zener current"? I see test currents that establish the stated Zener voltage and maximum currents in the datasheets that I've looked at, but nothing that I would call a "recommended" current.
afremont:
SInce 100uA is more than enough to push most (normal sized) Zeners above 5V, I think 1.2mA will be fine. I'm more concerned about keeping the load off the internal protection diodes than keeping the Zener flat.
It might be. It would depend on the zener. I don't know what a "normal sized" zener is in this context.
What do you mean by "recommended Zener current"? I see test currents that establish the stated Zener voltage and maximum currents in the datasheets that I've looked at, but nothing that I would call a "recommended" current.
In years past when zeners were used as power supply reference voltages, I suppose vendors supplied more complete data sheets. The test current could be used for want of a better set of curves. At any rate, it seemed to me that your selection was rather arbitrary, since the zener part number was not mentioned. This forum is an appropriate place to suggest how to calculate an appropriate value for certain conditions just like for selecting the proper base resistor for a transistor switch or the proper series resistor for an LED, I think.
Sometimes, I think people coming here for help are given "rule of thumb" suggestions because it is assumed that the questioner doesn't want to know any more or won't be able to understand it anyway. Maybe that's so. On the other hand I don't think it hurts to go a little bit into the theory just in case.
That's all I have to say about it. OP nor you should take my comment as an attempt at lessening the value of yours.
I'd say that 1n4733a is about as close to normal as anyone is going to come. I'll admit that the 10k was kind of "arbitrary", but I picked it for the reason stated, to protect the micro. I certainly wouldn't recommend using 100R. I feel that 100R in a vehicle application for input pin protection is questionable, I would be worried about the Zener specs then at 120mA an 840mW. Higher current will just expose the micro to higher voltage, and I sure don't see any benefit to that. Just sayin' what I think. No offense to anyone.
I can see where you are coming from and I can agree with you to a point, but it's just not that critical in this application. Now if we were building a regulated supply (as you were mentioning) then we would certainly want to be a lot more specific about the current going thru it.