I have a capacitive touch sensor that brings its output pin HIGH when it's sensor is touched. My device requires a pin to be brought low (74HC165 shift register) in order to activate. Can anyone offer any advice on how I could bring a pin to ground with a HIGH pin input?
Any tips on where I should look for a solution would be helpful.
You could put that output into the base of an npn transistor. Emitter to ground, collector to Vin through a pullup resistor, and take your output from the collector.
edit.... v2 of schematic, shows current limiting resistor into base, and pulldown from base to make sure the transistor is open when your sensor isn't high.
JimboZA:
You could put that output into the base of an NPN transistor.
You could, but you need to do it through a 10k (or 47k or 100k) resistor.
Alternatively you can use one gate in a CMOS inverter chip, such as a 74HC14, especially if you already have one, or a use for the other gates. Very useful for oscillators to flash LEDs and such or make noise. On the other hand, if your device was controlled by a microcontroller such as an Arduino, you would not need to invert the input as you would do that is software.
JimboZA:
You could put that output into the base of an NPN transistor.
On the other hand, if your device was controlled by a microcontroller such as an Arduino, you would not need to invert the input as you would do that is software.
My board is a DIY Arduino. Are you saying that there is a way in software to make the 74hc165 look for high values rather than low?
The inverter chip looks interesting as well. I might even have one handy. I will have to investigate that.
Are you saying that there is a way in software to make the 74hc165 look for high values rather than low?
He more likely means that you could read the sensor on an Arduino pin and put its inverse out on another, and put the '165 on there.
Ok. I get that. I am trying to avoid using new pins. I had this nice elegant shift register setup to read buttons then I had to go and find this touch sensor...
freddyk:
Ok. I get that. I am trying to avoid using new pins. I had this nice elegant shift register setup to read buttons then I had to go and find this touch sensor...
I cannot figure out exactly what you are doing with the HC165 that requires you to invert the pin. If it is a data pin and you are shifting data into a microcontroller, then you perform the inversion in logic in the sketch after you have read the data into the microcontroller. If you want it to look right as a byte, you simply perform an XOR with whichever (number of) bits you need to swap.
JimboZA:
Heed Paul__B on the size of R3
However the resistor from the base to ground (R2) - if you use it - must also be no less than half the value of R3.
Sorry that my explanations are not so clear. I have figured enough of this stuff out to be dangerous but that does not mean I know what I am doing.
I am going to investigate if I can do this in logic. That would be really nice. Currently if I connect the output of the touch sensor to one of the input pins on the 74hc165 I can see that some power is coming from the 74hc165 so I assume it is high and waiting to be pulled low. So what you are saying is that I can use logic to make the default state of the 74hc165 pins low and wait for high?
If I can't figure that out I may go with the Schmidt Triggers that were mentioned earlier. I have some of those.
freddyk:
I have figured enough of this stuff out to be dangerous but that does not mean I know what I am doing.
That may be the case!
freddyk:
I am going to investigate if I can do this in logic. That would be really nice. Currently if I connect the output of the touch sensor to one of the input pins on the 74hc165 I can see that some power is coming from the 74hc165 so I assume it is high and waiting to be pulled low. So what you are saying is that I can use logic to make the default state of the 74hc165 pins low and wait for high?
It begins to sound as if you have a serious misunderstanding of the situation, confusing "pull-ups" with logic states. A 74HC165 is a CMOS device with extremely high impedance inputs; there should be no "power coming from the 74hc165" at all; that is not the point.
I think you had better provide us with a diagram of your circuit and a web reference to the "touch sensor". Otherwise we have no idea what you are really trying to do and are clearly not talking on the same level.
JimboZA:
better probably to export as an image and post that.
Good idea. The area indicated in red is the focus. I have some terminal blocks that I have been used to connect switches. I want to connect the output from the touch breakout board.
OK, now the Adafruit touch sensor you cite requires an I2C interface, so you would need to connect it directly to the appropriate (and in fact, specific) pins on the Mega328 and include the necessary libraries to use it.
You may have imagined that you could use the "interrupt" output from the touch sensor breakout to indicate a touch. You cannot, as you must have the I2C interface in order to control the touch sensor to initialise it ("turn it on") and then when it does indicate a "touch" on the "interrupt" pin, you have to acknowledge the touch using the I2C interface or else the interrupt will simply stay permanently activated.
OK, this should be no problem as unlike the other breakout, this one runs with 5V logic. The outputs are open-drain (same as "open-collector") so you need to pull them up to 5V Vcc with a 10k resistor. Other than that, they can be connected directly to your 74HC165 inputs.
In fact, as I recall from your board pattern, you already have the pullups on the board and nothing further need be done - just connect them