Jump to content
Sign in to follow this  
iragdoll

Connecting Piezo Vibration Sensor to LaunchPad

Recommended Posts

Ebay is often the best for one-off part orders. Unless you are ordering 15+ dollars worth of parts, shipping from web-stores hurt.

Agreed. I often get parts from eBay, and I usually get 10-20 for the price I would pay for 1 locally or in an on-line store (once you add shipping). Be sure to just look at the "free shipping" eBay offers, though.

Share this post


Link to post
Share on other sites

I see... I just figured out that our local Fry's Electronics Store carries lots of zener diodes, so I'm going to check if they have a 3.3 volt version. If they don't, I will go with the options you guys have suggested.

 

Thanks!

Share this post


Link to post
Share on other sites

I really need some serious help with the ADC on the LaunchPad! I looked at NJC's code but did not really understand it. I need help please and fast!

 

I need to read input of a Piezo Vibration Sensor. I also need to set a threshold that sets the mark to which if passed, an LED should turn on. Otherwise, it should stay off. Any help will be much appreciated please!

Share this post


Link to post
Share on other sites

I am building a small vibration detector. Its job is to detect vibration, and turn on an LED for a fixed amount of time.

 

I will see to reading the voltage i guess?

Share this post


Link to post
Share on other sites
Do I need to use CUTTER and CYCLE on my project? Also, what is INCH?

Do I need the map function as well?

 

Your analog value will be returned when you call analogRead(PIN_CONNECTED_TO_SENSOR)

 

CUTTER and CYCLE are pin defines. I think he missed out a header file defining INCH_X

You don't need map(). He created that to scale values from one range(0-1023) to another range(1-1000)

Share this post


Link to post
Share on other sites
A small AC and large voltage (up to +/-90V) is created when the film moves back and forth. A simple resistor should get the voltage down to ADC levels.

Since this will be an AC voltage, you may want to put a rectifier and maybe a capacitor to smooth out the signal. Don't forget the zener diode mentioned in your other thread to protect the MSP430 from high voltages.

 

From there, have a look at the MANY examples of ADC use both in these forums and all around the web (check TI's site for examples as well).

 

BTW: This really should not have been a separate thread. We'd have seen your renewed request if you'd posted at the end of your previous thread. @bluehash: perhaps combine the two threads?

Share this post


Link to post
Share on other sites

Okay, so all I need to do is call analogRead() on the pin that I am reading the Vibration Sensor, make an if statement comparing it with a threshold, and turn on an LED if it passes it?

 

Is the rectifier/capacitor necessary? Is it required?

 

Oh and sorry about the two posts. I actually was in a hurry in the beginning and forgot about my previous post. Wont happen again!

Share this post


Link to post
Share on other sites

No, val should contain a representation of the voltage read. You can just leave that val assignment by itself in the for loop.

On the line #define PHOTOCELL INCH_0, INCH_0 means input 0. The sensor(a photocell) is connected to P1.0. If it said INCH_1, that would mean it was connected to P1.1.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...