I'm planing to use a atmega328p running it at 8Mhz and put it in deep sleep mode so to
wake it up I need a interrupt button but instead of the button I'm thinking to use a
capacitive sensor :
but will it work?
Using a button we put a pullup resistor to +5 or GND and while pressing the button we
send a pulse to wake it up but using a capacitive sensor is more like sending analog inputs
0~255, will a capacitive sensor work as interrupt, yes/no? Is that a good idea or not?
The capacitiveSensor method toggles a microcontroller send pin to a new state and then waits for the receive pin to change to the same state as the send pin.
Is there another way to wake up instead of using a button? I want to make it like touch or just hover something, I got a box and I want to put everything sealed inside / water proof and I don't want to add
a button for that.
Then you need an external chip doing the capacitive sensing. I'm sure that there are some out there that can provide a wakeup on touch, and some can even do more long-range proximity sensing up to a couple dozen centimeters away. They can run on microamps while the processor is sawing logs.
Unfortunately, the couple times I've tried to look into this with Digikey and Mouser's parametric search it's been a crappy experience. You'd probably have better luck searching manufacturer's websites like Microchip or Cypress Semi. I'd also recommend checking out Maxim Integrated, NXP, Atmel, and maybe ST Micro just in case.
Well I thought for a sec about using other kind of way to yse capacitive sensors sensors
with other chips or even using IR sensor or other but I'm using my board as full power
efficiency and I can not use any other chips/modules to put that out.
If I put something else just to interrupt that will be waste of energy for me.
I will keep searching to find something or somehow to use capacitive sensor.
EDIT:
I was thinking about something like that, it will not be a capacitive sensor
but at least only touch.... still not sure if I should use such way ..
If you are doing that to create an interrupt, I would have the collector connect to an input pin with pullup resistor that is then pulled low when the NPN is turned on by the finger.
How tight is your power budget? I found this on NXP's website: PCF8883, which can run on 3 uA if I'm reading the datasheet correctly, and is available in SOIC package, probably the easiest SMT to work with. It's a single channel sensor with a digital output.
If you want to add features to your project, you need to know what compromises you can make. Capacitive sensing requires active excitation of the electrode. A lot of the ones I've seen use the electrode as part of an RC oscillator, and measure the oscillator's frequency as a proxy for capacitance. A sharp decrease in frequency represents a touch due to the presence of a human finger increasing the pad's self-capacitance.
Even if you could get the CapSense library to work in sleep mode, it would also draw it's own power from continually charging and discharging the sense capacitor. Do you know how much that is? Do you know how that compares against the different kinds of capacitive-sensing chips?