Teensy 3.0 and MMA8452Q Accelerometer

Status
Not open for further replies.

frgl

Member
Hi All,

Im attempting to build a specific motion detector for blind people using a Teensy and an accelerometer. Ive picked the MMA8452Q due to power consumption, but Im not sure what is exactly meant by l2C interface. Which is needed for both of these to work together. I was told i wont need a external circuit in order to use the two. Is this true? and where do I find the library for my code to run in Arduino? Or is there a library?

Id appreciate the help. The aim is to detect when a blind person starts a rocking motion when sitting down, the device has to detect the motion and then alert the person they are performing the action.

Thanks

Fergal
 
Did you buy the MMA8452Q as a raw chip, or a breakout board? Specific info about *exactly* what you have is best, so answers can be more specific....

I2C is a communication technique using 2 wires, called SDA and SCL. In Arduino, the Wire library is usually used for I2C communication. The Sparkfun example seems to be designed for that chip, and it uses the Wire library.

https://github.com/sparkfun/MMA8452...A8452Q_BasicExample/MMA8452Q_BasicExample.ino

On Teensy 3.0, real pullup resistors are required. This Sparkfun module has them.

https://www.sparkfun.com/products/10955

If you're using a different module, you may need to add them. Hard to know, since you didn't give more specific info.
 
Hi Paul,

Appreciate the response! Yes thats the exact module I have ordered from Sparkfun itself. Does this mean all I have to do is import the library at the beginning of the code and thats me done?? I can continue on with my code in Arduino?

Excuse my ignorance.
 
When I download the GitHub full library and try run the advance code on the teensy, this is the one which utilises the interrupt capability, it fails to allow me to verify it. Instead it opens up the l2C.h code, the defs.h code and the types.h code as separate windows rather than opening them as libraries. It then gives me an error about a specific variable "TWCR" not being declared in the scope? Did i down load the whole file wrong? or where was my mistake?
 
Did you buy the MMA8452Q as a raw chip, or a breakout board? Specific info about *exactly* what you have is best, so answers can be more specific....

I2C is a communication technique using 2 wires, called SDA and SCL. In Arduino, the Wire library is usually used for I2C communication. The Sparkfun example seems to be designed for that chip, and it uses the Wire library.

https://github.com/sparkfun/MMA8452...A8452Q_BasicExample/MMA8452Q_BasicExample.ino

On Teensy 3.0, real pullup resistors are required. This Sparkfun module has them.

https://www.sparkfun.com/products/10955

If you're using a different module, you may need to add them. Hard to know, since you didn't give more specific info.

Does it work with Teensy 2.0?
I am not having much luck using the sample code pointed above. It does work with Teensy 3.0 (which I can't use for my current project)
 
Since both the teensy 3 and the chip run on 3.3V, you do not need the 330 Ohm resistors that a standard 5V-based Arduino requires. However, you will need to provide power (3.3V and GND) as well as the SCL/SDA communication lines on A5/A4. Good luck!

I will be trying to hook up MMA8452Q breakout board to my teensy 3.2 in the nearest future, and I think I'm not getting something right.

That is, if I power my teensy from usb (which gives 5V), how come I don't need 330 Ohm resistors? (You mentioned that teensy 3 runs in 3.3V, but in order for it to run on 3.3V, shouldn't it be modified?)
 
Hate to bring something up from the dead, but I'm not able to get it to work, using this accelerometer with a teensy 3.2 , I'm getting a stream of data, but it is limited at 15.xxx and does not correlate with the nice 8g scale I'm seeing when running the same code on an arduino (Mega/Uno), is this possibly due to I2C clock differences? Not sure how to debug this....
 
Status
Not open for further replies.
Back
Top