# Connecting Piezo Vibration Sensor to LaunchPad

## Recommended Posts

I type slow

##### Share on other sites
I type slow

That's okay, I can't read fast.

##### Share on other sites

Okay, How do I know if I am reading the voltage correctly?

##### Share on other sites

Apply different voltages to the ADC by using different resistor values connected to vcc.

EDIT: Try connecting to ground too

##### Share on other sites
Okay, How do I know if I am reading the voltage correctly?

Hmm, you'll need to know the basics of an ADC, instead of us holding your hand. Lets see, a couple of simple questions(select the right one) and you should know the answer to your question after that:

1) Whats the range of the MSP430 ADC in volts.

a) 0 to 10V

0 to 5V

c) 0 to 3V

2) After making a conversion, what is the range of ADC register values

a) 0 to 65535

0 to 1023

c) 0 to 255

edit: Slower than you, NTM.

##### Share on other sites

Umm...

1. C

2. B

As far as I know, for number two, you can constrain the values any way you want. I have seen both 0 to 255 and 0 to 1023 used.

##### Share on other sites
As far as I know, for number two, you can constrain the values any way you want. I have seen both 0 to 255 and 0 to 1023 used.

I'm pretty sure the ADC just returns 0-1023 (10 bits). You can convert it to any range you want in code. The map() function you asked about earlier just changed the 0-1023 to 0-1000.

##### Share on other sites

Thats correct for 1)

For 2), the reason it goes between 0 and 1023 is because the MSP430G2231 has a 10bit ADC.

2^10 = 1024 steps which results in values from 0 to 1023.

If it were an 8 bit ADC, it would range from 0 to 255 or 256 steps.

Now, to check if your ADC is working properly, a simple test would be:

1- Connect the ADC pin to 3V - the val should read 1023

2- Connect the ADC pin to GND - the val should read 0V

3- Connect the ADC pin to 1.5V - the val should read _____?

##### Share on other sites

Yea I am really confused man... I think Ill need some serious help please. Any help?

The problem is I cant read the voltage levels on the Local Debug window. It keeps saying 86...

##### Share on other sites

Do you know how to look at the contents of a register with the debugger?

##### Share on other sites

Dude you are going to be ALL RIGHT!

##### Share on other sites

Man I dont think so... I need to get this working by tomorrow... I underestimated the complexity of MSP430 Programming. I made tons of projects with the Arduino, but the LaunchPad coding is much more confusing...

Yea I know how to read it, sort of. Can you guys sort of edit the code and I will test it out and sort of guide me through it?

##### Share on other sites

Well, how much is it worth to ya?

Like money wise?

## Create an account

Register a new account