PDA

View Full Version : Wake on piezo vibration detection A/D?



gmglickman
- 7th October 2013, 16:50
I'm using a piezo disc with 1Meg resistor in parallel to detect vibration, using an analog channel on 16F690. (And planning migration to 8pin PIC, eg. 16F683.)

A/D works great to detect the very small voltages generated by the piezo. I'd like to use vibration to wake the PIC but it doesn't generate sufficientvoltage for a digital high logic level, therefore I can't use IOC or the like. Any clever way to wake without complex amplification? Thanks.

peterdeco1
- 7th October 2013, 18:34
Hello. I did something like this a long time ago. You can also experiment with the nap command, use word variables instead of bytes and change IF X <> Y Then... to if X > (Y + 001) to adjust sensitivity.

'12f675
@ DEVICE MCLR_OFF, INTRC_OSC, WDT_ON, BOD_ON, PWRT_ON, PROTECT_ON
ANSEL = 0 'all inputs digital adcin command converts to analog
CMCON = 7 'comparators off
trisio = %00000001 'input for piezo
GPIO = 0 'ALL LOW
X VAR BYTE
Y VAR BYTE

START:
ADCIN 1,X
NAP 0 'GIVES TIME BETWEEN SAMPLES
ADCIN 1,Y
IF X <> Y Then PLAY
GoTo START

play:
High GPIO.4 'RELAY ON
Pause 5000
Low GPIO.4 'RELAY OFF
GoTo START

HenrikOlsson
- 7th October 2013, 18:50
Hi,
The 12F683 (and the 16F690) has a built in comparator which can wake the PIC when being tripped, perhaps you can use that.
You need to check the datasheet for minimum input levels and compare that to what your piezo sensor outputs.

/Henrik.

pedja089
- 7th October 2013, 18:52
I think that best way is to use internal comparator to wake up pic.

towlerg
- 7th October 2013, 21:11
Hi,

I'm thinking of doing something similar, I'm curious about how sensitive your set up is? Can you detect a tap (knuckles) on the surface the piezo is attached to? (I'm trying to emulate the tap people feel inclined to give a barometer.)

George

gmglickman
- 8th October 2013, 17:17
Lowest comparator voltage seems to be 0.2v, which may work. Fixed Vref is 0.6v. Thanks for the suggestions.
George - definitely should be able to detect that. You may need to glue the disk to the surface being tapped.

towlerg
- 8th October 2013, 20:12
@gmglickman - thanks a million for that info. I've never used a comparator, hope you find a solution, maybe you could post some code when you get it working?

George