Shop OBEX P1 Docs P2 Docs Learn Events
How to wire up the Piezo Film Vibra — Parallax Forums

How to wire up the Piezo Film Vibra

RagtopRagtop Posts: 406
edited 2010-11-30 17:30 in Accessories
Piezo.jpg

I still have a hard time understanding circuit diagrams. Is
there no power going to this?

Comments

  • kwinnkwinn Posts: 8,697
    edited 2010-11-18 07:26
    No power going to piezo unless P0 is an output and set to high (1).

    Power is not required. The piezo produces a voltage when it is flexed. That is why there is a zener diode there to limit the voltage to 5.1V (btw if it is going in to a prop should the diode not be 3.3V or the resistor 2.2K or more?).
  • RagtopRagtop Posts: 406
    edited 2010-11-23 13:40
    I tried a 3.3v zener diode with a 330 resister. I can not get a high enough signal for the prop.

    I hooked the circuit to an led without the prop. I can not get the led to light at all with the diode.

    Without the diode, I have to shake the thing like mad to just get the led to barely light.

    Do these piezo film vibra's come in different ranges? I got this one here:

    http://www.sparkfun.com/products/9197
  • kwinnkwinn Posts: 8,697
    edited 2010-11-23 21:16
    The signal is only produced when the piezo is subject to vibration, and a single tap or shake decays very rapidly so a spin program may not be fast enough unless you use a waitpeq/pne instruction, and the led may only be lit very briefly. Try turning the led on for several mSec when a signal is detected.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-23 21:33
    Ragtop wrote: »
    ....
    I hooked the circuit to an led without the prop. I can not get the led to light at all with the diode.

    Without the diode, I have to shake the thing like mad to just get the led to barely light.

    ...

    kwinn is correct.

    The Tab only produces a voltage signal during changes in its bending position, so these signals might be so fast that you could not see the LED blink even if it indeed does blink when you're shaking it. Because the Tab output signal is so transient, you might need to use an oscilloscope to measure the voltage output. But remember, too, that the Tab creates a voltage signal but not much current. The LED needs a certain amount of current and voltage to light up, and your voltage clamping diode might be dumping current, too. The inputs to the Propeller don't need much current to read a voltage, but you should limit the voltage to 3.3 volts by using a diode and make sure your software is set up so you can deal with the fast signals - for example have your software count Tab pulses on a pin and then perform functions based on the number of pulses you count in a given amount of time: see the information about the Propeller counter modules, for example.

    hope that helps,
    :)
  • RagtopRagtop Posts: 406
    edited 2010-11-24 06:03
    This is the program I am trying to get to work. Not sure how to count pulses when I am not getting a single 1 value.
    CON
             _clkmode        = xtal1 + pll16x
             _xinfreq        = 5_000_000
    
    
        vibrasensor  =  0
        indicator    =   5
    OBJ
       vp     : "Conduit"
       
    VAR
    
      long trigger      'sensor state
    
    Pub start
      vp.config(string("start:dso"))
      vp.share(@trigger,@trigger)
      dira[vibrasensor]~  'input from sensor
      dira[indicator]~~ ' output to LED
      outa[indicator] := 0
      trigger := 0
    
      repeat 
          trigger := ina[vibrasensor]
          if trigger == 1
             outa[indicator] := 1  'turn led on
             waitcnt(clkfreq*4 + cnt)
          else
             outa[indicator] := 0 'turn led off
    
    
    
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-24 07:12
    The first thing that leaps out at me is this line of code:

    Ragtop wrote: »
    ....

      
          trigger := ina[vibrasensor]
          
    

    In your software, the state of the vibrasensor pin must be high at the exact moment the software happens to look at the vibrasensor pin. Because the voltage signal from the Tab changes so rapidly, the chances of the software seeing that pin in the high state is not 100 percent.

    If you read how the Propeller counter modules work, you will see that they can be configured to "look" for pulses all the time and then you can occasionally check the counter registers to see if any pulses have been counted, then act on that information . And there are other ways, such as what kwinn suggested, for getting the Propeller to respond to transient signals.
  • RagtopRagtop Posts: 406
    edited 2010-11-24 07:17
    I changed the code to this, but still no go.
    repeat
          waitpeq(%0001,%0001,0)    'check for high state on pin 0
          outa[indicator] := 1      'turn led on
          waitcnt(clkfreq*4 + cnt)  'leave on 4 seconds
          outa[indicator] := 0      'turn led off
    

    I wonder if the sensor is defective.
  • RagtopRagtop Posts: 406
    edited 2010-11-24 07:30
    Or I could just have it completely wired up wrong.

    sensor.jpg
  • RagtopRagtop Posts: 406
    edited 2010-11-24 10:25
    Or it could be something wrong with my pin 5. Switched pins and it now works........
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-24 10:57
    Ragtop wrote: »
    Or it could be something wrong with my pin 5. Switched pins and it now works........

    If you used Pin 0 without a diode protecting it from voltage spikes coming from the Tab, perhaps those spikes might have zaped that pin???
  • RagtopRagtop Posts: 406
    edited 2010-11-24 12:04
    I put the sensor to an led without the diode, not the prop. Pin 0 seems to work.

    The sensor is not as sensitive as I had hoped. I wanted to use it as part of an alarm system for my motion sensor/camera project, so that nobody walked off with my camera.

    As the video shows, I can only seem to set it off by flicking it.

    http://www.ragtopvideo.com/me/vibrasensor.wmv

    BTW, switched it to turning the led off when sensor pin goes high.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-24 13:10
    Ragtop wrote: »
    ...I wanted to use it as part of an alarm system for my motion sensor/camera project, so that nobody walked off with my camera....



    See if the Tab can wiggle around by its pins (without the tab itself actually bending) while plugged into your breadboard. If the Tab body can wiggle around without actually bending, then that wiggle is effectively isolating the body of the Tab from some of the vibration around it. If that's the case, then the Tab might give a much better signal if its pins are soldered to a PCB or plugged into something that won't allow the pins to "pivot" or wiggle within their sockets.

    Also, is the alarm sensor going to be somehow attached to the camera? If so, have you considered using an accelerometer?
  • RagtopRagtop Posts: 406
    edited 2010-11-24 13:32
    It is going to be part of a large box. I have an accelerometer, but with the mess of wiring I already have I was hoping this would be more straight forward and I was hoping this
    could even sense the vibration of someone unscrewing the screws on the box.

    149949_10150126810355550_830440549_7820761_2574008_n.jpg
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-24 13:52
    Interesting rig you have there. Cool. What's it for?

    Have you considered making a simple pendulum-type device that would close a contact if somebody were to pick up the unit? It's hard to imagine somebody could lift your unit and walk away without tripping a pendulum switch. Of course, you would have to be careful that floor vibrations can't set it off, too.

    As for detecting the Dr. Evil Unscrewer attacking your device.... perhaps you could place some contact switches that can detect when the main panels have been opened. Inside, you could place a disarming switch or two that allows you to turn off the alarm when you need to access the device yourself, or for example use a reed switch or something to allow you to disarm the system even before opening it up.

    Contact switches could be wired in series so that configuration would use up only one Propeller Pin.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2010-11-24 17:18
    I have a geo-phone sensor that I bought from one of the surplus outlets, attached to the front door of my office, and it lights a bank of bright LEDs that shine out through the window whenever anyone so much as taps the door. It is entertaining and, I hope, also somewhat of a deterrent to would be thieves. The geo-phone signal goes through a simple op-amp+transistor circuit to light the leds, and I imagine the same thing would work with a piezo tab.

    In another direction, I've wondered out loud a couple of times why not use the PVDF piezo tab as a capacitor in a Prop sigma delta converter.

    attachment.php?attachmentid=75700&stc=1&d=1290647099

    The PVDF tab generates charge, and the Sigma Delta acts to counter-balance in real time to hold the voltage across the tab constant.

    The attached program is based on the above circuit, and it displays an ascii graph of response against time on the Parallax serial terminal. The response is dynamically offset against a low-pass average.

    Remember that the tabs are also pyroelectric: they respond to heat unbalance as well as to flexing.
    490 x 146 - 26K
  • RagtopRagtop Posts: 406
    edited 2010-11-24 19:33
    Interesting rig you have there. Cool. What's it for?

    It is a rather large "game cam" for catching photos of bears that have been spotted roaming the neighborhood at night.

    It is made from re-purposed parts from my Halloween project. A car alarm and offroad lights that run off a 12v battery and my digital Canon. The motion sensor turns on the spots and takes a series of photos.

    150541_10150127807200550_830440549_7835477_1095235_n.jpg

    So far no bear, but without the alarm system I haven't felt confident leaving it out all night.
  • kwinnkwinn Posts: 8,697
    edited 2010-11-24 20:56
    You might try using one of the counters to count pulses from the vibra sensor instead of trying to sense when it is active.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2010-11-25 11:42
    I'm surprised you are not seeing a signal or a trigger. When you put these things on an oscilloscope or on a voltmeter they generate several volts when they are flexed, and on a high impedance meter the charge can stick around for some time. Also, they have quite a large pyroelectric response. Flex in one direction, the output goes negative (away from the Prop threshold). Flex it the other way it goes up, and should easily cross the high-impedance Prop threshold.

    Are you sure the zener diode is installed the right way? In my opinion, the zener is not necessary. These sensors are not capable of producing much current, and the protection diodes in the Prop are capable of absorbing all of the energy. To be sure, increase the resistor from 220Ω up to 1kΩ or 10kΩ.

    Another thing to try would be a 10MΩ resistor in parallel with the sensor. That allows charge to leak off. The diodes can rectify the charge and leave the sensor with a net negative bias. I'm suspicious that something like that is going on.

    Another suggestion, tie the 2nd side of the sensor to a the wiper of a potentiometer instead of to ground. Adjust the potentiometer wiper close to Vdd/2, near the Prop threshold. Put a 10MΩ in parallel with the sensor, too, over to the input pin. That should really push up the sensitivity, adjustable.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2010-11-26 12:12
    Hi again ragtop,
    I tried the circuit with tab, resistor, zener, and LED as you have it hooked up and did not have any trouble making the LED light up. (I used a high intensity LED). Is your LED okay? To check the piezontab, just hook it alone across a voltmeter and see if there is a reading when it is flexed. I was using the following program snippet to both light the LED on p4 and to read the tab on p1. The LED was bright even without the pulse extender.
    PUB pvdf
      pst.start(115200)  ' Parallax serial terminal
      dira[4]~~   ' output for LED
      repeat
        pst.char(ina[1]+$30)    ' shows 0 for low or 1 for high
        outa[4]:=ina[1]    ' blink LED
    
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-26 13:36
    ... To check the piezontab, just hook it alone across a voltmeter and see if there is a reading when it is flexed. ...

    Tracy,
    if he's got a slow voltmeter, is there some chance it won't see the transient signals from the Tab?
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2010-11-26 15:39
    Good point about the slow voltmeter. I tried it on several that I have around here and none of them had any trouble picking it up on either the DC or AC ranges. All of these have at least 10MΩ input resistance. Flexing in one direction and holding it there generates charge and voltage of one polarity across the capacitance of the film. If left in the same position it can hold that charge and voltage for quite a long time, and the discharge rate is a function of the film's leakage in parallel with external resistance.
  • ElectricAyeElectricAye Posts: 4,561
    edited 2010-11-26 17:23
    ... If left in the same position it can hold that charge and voltage for quite a long time...

    That's interesting. I didn't know it could do that.

    thanks for the info!
    :)
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2010-11-29 09:32
    I tried out the following circuit both with the Prop and with the Stamp. It positions the tab output very near threshold, so that it is extremely sensitive.

    attachment.php?attachmentid=75802&stc=1&d=1291050499

    with this demo Prop code that lights an LED on p4 and throws out 0's and 1's on the debug screen:
    PUB pvdf_LED {alternative uses second circuit above  }
      pst.start(115200)
      dira[4]~~         ' high brightness LED on p4
      repeat
        pst.char(ina[1]+$30)    ' pvdf input on p1
        outa[4]:=ina[1]   ' LED follows pvdf
    
    Or Stamp
    OUTPUT 4         ' high brightness LED on p4
    DO
      DEBUG BIN IN1   ' pvdf input on p1
      OUT4 = IN1  ' LED follows pvdf
    LOOP
    
    329 x 80 - 11K
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2010-11-30 17:30
    Here's a refinement of the program I posted a couple of days ago for using the Prop's sigma-delta to read the piezo tab response in analog mode. The photo shows the response to a tap on the table. This one uses a linear instead of a logarithmic display, so it looks much more sensitive. There is baseline correction going on, so the resting level always gravitates to the center. The foreground of the photo shows the tab with a paper clip attached. I soldered the resistors to the tab legs in an effort to minimize noise, but I don't think that really worked too well. I'm still throwing away 12 least significant bits. The connection might need to be closer to the Prop pins, and the tab itself might benefit from EMI shielding.
Sign In or Register to comment.