MMA7361 Accelerometer

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
Frank607
Posts: 194
Joined: Mon Mar 04, 2013 8:07 pm
Has thanked: 29 times
Been thanked: 15 times

MMA7361 Accelerometer

Post by Frank607 »

Hi,

I have here a MMA7361 accelerometer module and want to connect this to a PIC16F690 with LCD. Does someone have a quick example of a flowchart. Just the basics, XYZ.

I look in this forum and the examples folder from Flowcode but there is no example for a accelerometer.


(OT: @Martin; I’m still waiting for my 20MHz crystals from the shop…. :( (SR04 topic))

Thanks and regards,

Frank

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times

Re: MMA7361 Accelerometer

Post by JohnCrow »

Hi Frank

Have a look at one of my projects using an accelerometer

http://www.matrixmultimedia.com/mmforum ... ter#p46326
1 in 10 people understand binary, the other one doesn't !

Frank607
Posts: 194
Joined: Mon Mar 04, 2013 8:07 pm
Has thanked: 29 times
Been thanked: 15 times

Re: MMA7361 Accelerometer

Post by Frank607 »

Thanks John,

I will “strip dowm” your flowchart to what I need. On this moment I try to figure out the connections between the accelerometer component and the MMA7361.

The component has:
Data Available
Power
SDA / SDI
SCL / SCK
N/A / SDO
N/A / CS

The MMA7361 has pin’s:
X
Y
Z
ST
GS
OG
SL

How can I know which connections to use with the component? Can I use X to SDI, Y to SCK and Z to SDO ?

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times

Re: MMA7361 Accelerometer

Post by JohnCrow »

Hi Frank

This is the device Im using

http://www.001tech.co.uk/Forum/viewtopic.php?f=8&t=3

This is the data sheet for the actual chip.

http://www.001tech.co.uk/Projects/MoACC ... LV02DQ.pdf

I've just had a quick look at the datasheet for the device you have and I dont think it will work with the flowcode component.
It needs to have either a I2C or SPI bus, which I dont think yours has.
My impressions from scanning the data sheet is it has a direct mV/g output.

I can certainly recommend the board I have used, and it will be a lot simplier to setup. It does need to run on 3.3V so a seperate voltage regulators such as I've used will be needed to power the device from a PIC, though the data lines are 5V tolerent.
1 in 10 people understand binary, the other one doesn't !

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: MMA7361 Accelerometer

Post by dazz »

Hi Frank
have a quick try with this flowchart, i don't own one but had a look at the data
sheet this should read in the raw x,y,z values and display them on an lcd
you will need to change the chip to the ones you use also the adc pins and switch need changing to your chip
I don't know if it works try it and have a play, the display variable G= should change to a 1 if all the axis =0
Let us know if it worked
Regards
Dazz
Attachments
accel.fcf
(17.89 KiB) Downloaded 269 times
MMA7361L.pdf
(170.2 KiB) Downloaded 248 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Frank607
Posts: 194
Joined: Mon Mar 04, 2013 8:07 pm
Has thanked: 29 times
Been thanked: 15 times

Re: MMA7361 Accelerometer

Post by Frank607 »

Thanks for helping me! :-)

Tomorrow I can test and read the two new topics. I will let you know.

Regards,

Frank

Frank607
Posts: 194
Joined: Mon Mar 04, 2013 8:07 pm
Has thanked: 29 times
Been thanked: 15 times

Re: MMA7361 Accelerometer

Post by Frank607 »

Hi Dazz,

I tried today your flowchart and made it compatible for my pic. Unfortunately it can’t get this to work.

The XYZ numbers are “dancing” from 0 to 100 without moving. Do I miss something ?

Attached is the flowchart what I use now.
Attachments
accel - PIC16F690.fcf
(17.91 KiB) Downloaded 251 times

dazz
Posts: 1314
Joined: Sun Jan 15, 2012 3:15 pm
Has thanked: 474 times
Been thanked: 458 times

Re: MMA7361 Accelerometer

Post by dazz »

Hi Frank
So the readings don't Vary when the sensor is moved is that correct ??
if so try this flowchart
you will need to connect the sleep pin to b4 this should hold sleep high ,which will allow the senor to operate (if it doesnt change the sleep variable initial value to 0 and reprogram and try again)
Also i think that the g select must be held either high or low so add a switch to port if you can b5 and the GS pin to port B4 on the pic if you can if not set port B4 to either high or low and connect to the GS on the sensor, this should make the reading range change

Let me know how you get on

Regards
Dazz
Attachments
accel - PIC16F690 2.fcf
(18 KiB) Downloaded 274 times
To sign up to the V5 forum follow this link http://www.matrixmultimedia.com/forum_upgrades.php

Frank607
Posts: 194
Joined: Mon Mar 04, 2013 8:07 pm
Has thanked: 29 times
Been thanked: 15 times

Re: MMA7361 Accelerometer

Post by Frank607 »

Hi Dazz,

Thanks, its working now. I always power my breadboard with a simple 12V battery pack and this is always working. In this case I take my multi meter and measure the voltage from pin Y. When I moved the accelerometer nothing happened. Then I power the accelerometer with a LAB power source and all is working very well. Strange, but ok :)

The 0G ( zerro G) function is also working. When I drop the accelerometer to my table I see a short activation on the LCD from 0 to 1.

The needed information I get from this video: http://www.youtube.com/watch?v=-4WvADos_eg (very long annoying but good :) )

I have a little bit modified your flowchart to my conditions and have attached it for other people who want also to have this.

Explanation flowchart:

PIC16F690

MMA7361 (Complete board from eBay)

Connections to the pic:
X to port A0
Y to port A1
Z to port A2
GS to port B4 (G Select)
0G to port B5 (Zerro G, free fall)
SL to port B6 (Sleep)

LCD to port C
5V Power
Attachments
accel - PIC16F690 2-1.fcf
(17.94 KiB) Downloaded 250 times

Post Reply