Accelerometer help
jayee165
Posts: 6
I recently purchased the memsic accelerometer for a project. I am not quite understanding the correct use of it. Attached to a breadboard is the accelerometer and 9 volt battery. I am aware that the acceleromater only requires 3 to 5 volts, but I also used 4.5 volts and recieved the same outcome. I wired the accelerometer as instructed by it data sheet. The X and Y reads to be around 3.8 Volts flat on the ground. Aren't they suppose to read 0 Volts until I start to tilt it? I seen some projects use a resistor coming out of the X and Y outputs. Will I need to use a resistor and what size? Lastly, a microcontroller is mainly used when u want to read the data coming from the accelerometer on a computer screen?
Comments
BUT....
If you read the datasheet, this Parallax-packaged device outputs a PWM signal, not an analog voltage. "Each axis has a 100 Hz PWM duty cycle output in which acceleration is proportional to the ratio tHx/Tx."
You can measure the signal with a microcontroller capable of counting the duration of the high pulse width. "This is easy to accomplish with the BASIC Stamp PULSIN command or with the Propeller chip’s counter modules." My DMM has a %duty measurement; I would expect this would work, too. Hope this helps.
I also hope you didn't fry the chip but there's a pretty fair chance you did.
I have no idea whether or not 9 volts will fry that chip, but it's well outside of the limits in the user materials. Unless you know a LOT more than I do about these things, you should never exceed those limits. The Memsic data sheet says
so you're not quite as far from the limits as you'd think based just on the Parallax documentation, but you're still outside the manufacturer's "absolute maximum". Unless you know something I don't know, don't do this.
=====================
I just put a Parallax 2125 into a breadboard, and fed it 5 volts. I can measure the output using just a voltmeter. When it's laying flat, I get about 2.5 volts - the midscale voltage you'd expect, given that it is at the 0 G point. When I tilt it one direction, it goes up to a little over 3 volts, or about 1/3rd of the way to the 5V maximum - again, what you'd expect from going from 0 G to 1 G (1/3rd of the unit's 3 G max). When I tilt it the other way, I go about the same distance down.
If you're putting in 4.5 volts, you should get about 2.25 volts when it's laying flat on the ground. If you're not, I'm afraid my best guess is that you fried it with the 9V.
Gadget Gangster's USB Propeller Platform http://www.parallax.com/Store/Microcontrollers/PropellerDevelopmentBoards/tabid/514/CategoryID/73/List/0/SortField/0/Level/a/ProductID/711/Default.aspx
Propeller Demo Board: http://www.parallax.com/Store/Microcontrollers/PropellerDevelopmentBoards/tabid/514/CategoryID/73/List/0/SortField/0/Level/a/ProductID/340/Default.aspx
These offer the much more capable Propeller micro-controller for less money plus there is demo code in the library that comes with the Propeller Software tool. I plugged my accelerometer into a breadboard, wired it up and was running the demo program in no time.
I don't think you can get it to do anything without a micro-controller.
At $5, that tilt sensor is quite a bargain. Unfortunately, it looks like it's always triggered in one of the 4 directions, there's no provision for level.
If that doesn't work for you, jayee165, consider ball tilt switches or even mercury switches (if you can find them). You could wire your LEDs & buzzer directly thru the mercury switch, no uC required.
You can implement this is code. It would have a flow something like this: