Page 1 of 1
The Poor Man Accelerometer.
Posted: Sat Feb 19, 2011 10:13 pm
by copterrichie
Here is an interesting find, not sure of the quality but the cost is very nice. Going to purchase four of them next week for testing. The documentation states, I2C. Hmm.
3 Axis Digital Accelerometer
http://gadgetgangster.com/find-a-projec ... ectnum=322
Re: The Poor Man Accelerometer.
Posted: Sun Feb 20, 2011 2:36 am
by Doron
from the spec sheet it looks like very low resolutions device (~7 bits) .... 70 counts/g....
Re: The Poor Man Accelerometer.
Posted: Sun Feb 20, 2011 2:57 pm
by copterrichie
However, in an auto-leveling environment, why would more be required? I read where it stated, 8 bits for up to 4 g and 10 bits for 8g, why is this so? I have no idea. There may be the possibility of bypassing the ADC and wiring the Accelerometer directly to the Arduino Analog ports. So, the title fits, a poor man's Accelerometer.

Re: The Poor Man Accelerometer.
Posted: Thu Feb 24, 2011 9:12 pm
by copterrichie
I ordered two of these for testing, will post an update of mu findings.
Re: The Poor Man Accelerometer.
Posted: Sun Mar 13, 2011 7:18 pm
by copterrichie
Here is an update on the MMA7455, Very interesting device to say the least. It requires no Calibration and when it is perfectly level, it output a value of 0 for both the X and Y axis. Because it outputs a negative number that relates to a negative tilt but it is in the form of two's complement
http://en.wikipedia.org/wiki/Two%27s_complement, the MultiWiiCopter code requires some adaptive code to fully integrate this device. The great and good news is, it does not require any calibration and it appears to be able to run at 400khz.
Here is the code that I have so far but I am having problems trying to figure out the two complement issue.
Code: Select all
#if defined(MMA7455)
static uint8_t rawADC_MMA7455[6];
void i2c_ACC_init () {
delay(10);
i2c_rep_start(0x3A); // I2C write direction
i2c_write(0x16); // Mode Control
i2c_write(0x25); // Set Sensitity Value @ 2g
//i2c_write(0x21); // Set Sensitity Value @ 8g
acc_1G = 63;
acc_25deg = 26; // = acc_1G * sin(25 deg)
accPresent = 1;
}
void i2c_ACC_getADC () {
static uint8_t counter;
TWBR = ((16000000L / 400000L) - 16) / 2;
i2c_rep_start(0x3A); // I2C write direction
i2c_write(0x06); //Registry to start reading from.
i2c_rep_start(0x3B); // I2C read direction => 1
for(uint8_t i = 0; i < 2; i++) {
rawADC_MMA7455[i]= i2c_readAck();}
rawADC_MMA7455[2]= i2c_readNak();
//accADC[ROLL] = (int(rawADC_MMA7455[1]<<8) | rawADC_MMA7455[0]);
//accADC[PITCH]= (int(rawADC_MMA7455[3]<<8) | rawADC_MMA7455[2]);
//accADC[YAW] = (int(rawADC_MMA7455[5]<<8) | rawADC_MMA7455[4]);
accADC[ROLL] = int(rawADC_MMA7455[0]);
accADC[PITCH]= int(rawADC_MMA7455[1]);
accADC[YAW] = int(rawADC_MMA7455[2]);
//accADC[ROLL] = (i2c_readAck() && 0x7F);
//accADC[PITCH]= (i2c_readAck() && 0x7F);
//accADC[YAW] = (i2c_readNak() && 0x7F);
}
#endif
Re: The Poor Man Accelerometer.
Posted: Mon Mar 14, 2011 6:58 pm
by captaingeek
very interesting will be looking forward to your findings
Re: The Poor Man Accelerometer.
Posted: Tue Mar 15, 2011 5:28 am
by copterrichie
I have set it aside for te moment, I received the BMA020 but I plan to return to this little gem because I am very curious about it.
Re: The Poor Man Accelerometer.
Posted: Mon Mar 21, 2011 11:00 pm
by copterrichie
Well, I finally cracked the two's complement and it was easy but seemed so hard at the time.
http://en.wikipedia.org/wiki/Two%27s_complementNow comes the task of integrating this with Alex's existing code but that should be fairly easy.

Re: The Poor Man Accelerometer.
Posted: Sun Mar 27, 2011 8:51 pm
by copterrichie
Here is the Code for MultiWiiCopter 1.7 that works in the GUI, I have not test flown it yet.
Code: Select all
// Developmental code for the MMA7455
#if defined(MMA7455)
static int8_t rawADC_MMA7455[6];
void i2c_ACC_init () {
delay(10);
i2c_rep_start(0x3A); // I2C write direction
i2c_write(0x16); // Mode Control
i2c_write(0x25); // Set Sensitity Value @ 2g
//i2c_write(0x21); // Set Sensitity Value @ 8g
acc_1G = 64;
acc_25deg = 27; // = acc_1G * sin(25 deg)
accPresent = 1;
}
void i2c_ACC_getADC () {
//TWBR = ((16000000L / 400000L) - 16) / 2; // change the I2C clock rate to 400kHz, ADXL435 is ok with this speed
//i2c_rep_start(0x3A);
//i2c_write(0x09);
//i2c_rep_start(0x3B);
i2c_rep_start(0x3A); // I2C write direction
i2c_write(0x00); //Registry to start reading from.
i2c_rep_start(0x3B); // I2C read direction => 1
for(uint8_t i = 0; i < 5; i++) {
rawADC_MMA7455[i]= i2c_readAck();}
rawADC_MMA7455[5]= i2c_readNak();
accADC[ROLL] = ((char(rawADC_MMA7455[1])<<8) | (rawADC_MMA7455[0]>>1)<<1);
accADC[PITCH]= ((char(rawADC_MMA7455[3]<<8)) | (rawADC_MMA7455[2]>>1)<<1);
accADC[YAW] = ((char(rawADC_MMA7455[5]<<8)) | (rawADC_MMA7455[4]>>1)<<1);
}
#endif
Re: The Poor Man Accelerometer.
Posted: Mon Mar 28, 2011 10:38 pm
by copterrichie
Here is a video of my very first test using the MMA7455. Can only get better from here.
http://www.youtube.com/watch?v=fLHuNcr_U9U
Re: The Poor Man Accelerometer.
Posted: Wed Apr 06, 2011 8:33 pm
by copterrichie
Here is a video of the Poor Man Accelerometer in action.
http://www.youtube.com/watch?v=hOWTP8wU-FE
Re: The Poor Man Accelerometer.
Posted: Tue Jun 28, 2011 10:53 pm
by captaingeek
hey Rich, you done with RCG?
Re: The Poor Man Accelerometer.
Posted: Tue Aug 30, 2011 11:13 pm
by copterrichie
MMA7455 Accelerometer Sensor Module AVR ARM MCU
These MMA7455 started appearing on eBay and I purchased two of the, Works really well and very easy to wire up.
http://cgi.ebay.com/ebaymotors/ws/eBayISAPI.dll?ViewItem&item=250883220033&viewitem=&sspagename=ADME%3AB%3ASS%3AUS%3A1123
Re: The Poor Man Accelerometer.
Posted: Tue Sep 06, 2011 9:31 am
by MacArell
Hi, I'm a newbie and want make a Quadcopter with this Accelerometer Sensor, my sensor is
KIT3468MMA7455L (From an old project) i will use an Arduino UNO (From an old project too) and i don't know for the gyro but certainly a WMP...
I'll let you know.
Sylvain
Re: The Poor Man Accelerometer.
Posted: Tue Sep 06, 2011 1:40 pm
by copterrichie
I am very well pleased with the performances of the MMA7455. KISS really works.

Re: The Poor Man Accelerometer.
Posted: Tue Sep 06, 2011 9:03 pm
by msev
Rich have you tried the bma020 acc - which is also a "poor man" acc choice

...Can you give a comparison between the two acc's?
Re: The Poor Man Accelerometer.
Posted: Tue Sep 06, 2011 9:53 pm
by copterrichie
msev wrote:Rich have you tried the bma020 acc - which is also a "poor man" acc choice

...Can you give a comparison between the two acc's?
Yes and no disrespect to anyone or the product, but for me, it is junk. I have two, one completely failed (stopped working) and the other one will not hold calibration. It drifts all over the place.
http://www.youtube.com/watch?v=UIkPb-qTfT0
Re: The Poor Man Accelerometer.
Posted: Tue Sep 06, 2011 10:26 pm
by msev
Good to know, I'll ask at rcgroups if someone knows what could cause problems for some guys with that one,..
Re: The Poor Man Accelerometer.
Posted: Tue Sep 13, 2011 10:54 am
by MacArell
MacArell wrote:Hi, I'm a newbie and want make a Quadcopter with this Accelerometer Sensor, my sensor is KIT3468MMA7455L (From an old project) i will use an Arduino UNO (From an old project too) and i don't know for the gyro but certainly a WMP...
I'll let you know.
Sylvain
Hi, i want just use this accelerometer with WM+ and i want make a board shield for Ardiuno UNO: for connection diagram i use the pdf file: "MultiWii Connection diagrams v1.8.pdf"
- What diagram is good for MMA7455 and WM+ ?
- In "Multiwii connection diagram with Nunchuk" if i replace Nunchuck with MMA7455 ?
- How i do with 3.3V voltage for MMA7455 ?
Thank

, Sylvain.
Re: The Poor Man Accelerometer.
Posted: Thu Sep 15, 2011 12:31 pm
by Dehas
Hello
I test your code for the MMA7455, but what is with the V1.7 or V1.8 ACC is not recognized.
Do you have a shema connection, I can be assembled incorrectly.
thank's
PS : Sorry for my bad english, I'am French

Re: The Poor Man Accelerometer.
Posted: Thu Sep 15, 2011 1:57 pm
by copterrichie
Here is the WMC version 1.8patch1 with the MMA7455.
Re: The Poor Man Accelerometer.
Posted: Thu Sep 15, 2011 5:08 pm
by Dehas
Thank you very much for your code, it works fine on the GUI.
Another question, I did not put logic level converter, I have just connected in parallel the MMA7455 in A4 and A5, it works but I'm afraid of having problems, what do you think.
thank you again
Re: The Poor Man Accelerometer.
Posted: Thu Sep 15, 2011 5:42 pm
by copterrichie
It depends upon which one you have and who made it. the one that I purchased from this ebay vendor, you can use 3.3 or 5 volts and do not require the logic changer.
http://www.ebay.com/itm/270808909360?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1439.l2649
Re: The Poor Man Accelerometer.
Posted: Thu Sep 15, 2011 5:55 pm
by Dehas
It is the same and I have a 3.3 V power supply on my board (personal build), I plugged it on.
Re: The Poor Man Accelerometer.
Posted: Thu Sep 22, 2011 9:41 am
by MacArell
Thank You, finaly i buy
"AeroQuad Shield v1.9" with voltage level converter for my Arduino Uno.
I will use my KIT3468MMA7455L after... thank you again.
Sylvain

Re: The Poor Man Accelerometer.
Posted: Sun Sep 25, 2011 4:36 pm
by copterrichie
Maybe if we are nice to Alex, he will include the code for MMA7455 in the maintained MWC code. In my opinion, there are great for the Multi-Rotor copter environment. They are selling on Ebay for as little as 6 bucks with free shipping.
MMA7455 Acceleration Module Tilt Slant Angle Sensor
http://www.ebay.com/sch/i.html?_from=R40&_trksid=p4634.m570.l1313&_nkw=mma7455&_sacat=See-All-CategoriesFeature:
Onboard MMA7455 digital output (I2C/SPI), low power, compact capacitive micromachined accelerometer;
Support 5V/3.3V input ,
onboard RT9161, lower pressure drop than the 1117, faster load the appropriate speed, ideal for noisy power environment;
Common pin, pin standard 100mil (2.54mm), easy for the matrix board;
PCB size: 26 (mm) x14 (mm)
Re: The Poor Man Accelerometer.
Posted: Sun Sep 25, 2011 4:48 pm
by copterrichie
Here is a copy of the updated 1.8patch1, I made a mistake in the other copy posted because of the 2's complement. I have corrected the problem and proud to say, the MMA7455 is ROCK SOLID in the MWC 1.8. I had to remove the first bit from the lower byte.
Code: Select all
void ACC_getADC () {
TWBR = ((16000000L / 400000L) - 16) / 2; // change the I2C clock rate to 400kHz speed
i2c_getSixRawADC(MMA7455_ADDRESS,0x00);
ACC_ORIENTATION( ((rawADC[3]<<8) | (rawADC[2]>>1)<<1) ,
((rawADC[1]<<8) | (rawADC[0]>>1)<<1) ,
((rawADC[5]<<8) | (rawADC[4]>>1)<<1) );
ACC_Common();
}
Re: The Poor Man Accelerometer.
Posted: Sat Oct 08, 2011 4:07 pm
by Dehas
This also works with the 1.8 patch2

Re: The Poor Man Accelerometer.
Posted: Sat Oct 08, 2011 6:39 pm
by copterrichie
Awesome!
Re: The Poor Man Accelerometer.
Posted: Sun Oct 09, 2011 9:42 am
by Dehas
Try this
Re: The Poor Man Accelerometer.
Posted: Mon Oct 17, 2011 3:33 pm
by gjerbic
I also bought mma7455 from ebay and I have couple question:
I have 3,3 v from regulator going in ITG 3205(WMP cone) directly with onboard nunchuck pull-up resistors(pullups in software disabled).
Is it ok to connect mma7455 in parallel regarding two pair of pull-up resitors?
What about orientation?
Thank you in advance!
Re: The Poor Man Accelerometer.
Posted: Mon Oct 17, 2011 4:34 pm
by copterrichie
I have had them connected both ways, with the Pullup Resistors enable in the software and without and the MMA7455 worked very well under both conditions. I would suggest using 3.3 volts with the ITG3205 because I have seen some weird behavior running it at 5 volts, the MMA7455 purchased from eBay will operate at either 3.3 or 5 volts. The MMA7455 has built-in Pull-ups so you are good with the ITG3205, just disable the Arduino pull-ups.
Re: The Poor Man Accelerometer.
Posted: Mon Oct 17, 2011 4:41 pm
by copterrichie
Note: When using version 1.8 or higher, make sure to fully check the movements in the Gui, there is a very weird bug that I thought was due to the 2's compliment but I now believe it is related to the Calibration procedure. This bug only shows up when the Calibration Offset value is at a partial value and I don't believe this problem is isolated to just the MMA7455. The Calibration procedures for the MMA7455 is somewhat difference then the other Accelerometers, actually much simpler but I have not made the modifications yet. With version 1.7, the MMA7455 is rock solid.
Re: The Poor Man Accelerometer.
Posted: Wed Oct 19, 2011 8:16 am
by gjerbic
Thank you copterrichie!
Re: The Poor Man Accelerometer.
Posted: Tue Oct 25, 2011 9:48 am
by misslins2011
GY-29 is a small, thin, low power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through the I2C digital interface.
http://module.blog.com/gy-29-3-axis-acc ... r-arduino/
Re: The Poor Man Accelerometer.
Posted: Tue Oct 25, 2011 1:48 pm
by copterrichie
misslins2011 wrote:GY-29 is a small, thin, low power, 3-axis accelerometer with high resolution (13-bit) measurement at up to ±16 g. Digital output data is formatted as 16-bit twos complement and is accessible through the I2C digital interface.
http://module.blog.com/gy-29-3-axis-acc ... r-arduino/
It used the ADXL345 and is fully supported in the WiiCopter firmware.

Re: The Poor Man Accelerometer.
Posted: Thu Oct 27, 2011 10:10 pm
by Peck
copterrichie wrote:Note: When using version 1.8 or higher, make sure to fully check the movements in the Gui, there is a very weird bug that I thought was due to the 2's compliment but I now believe it is related to the Calibration procedure. This bug only shows up when the Calibration Offset value is at a partial value and I don't believe this problem is isolated to just the MMA7455. The Calibration procedures for the MMA7455 is somewhat difference then the other Accelerometers, actually much simpler but I have not made the modifications yet. With version 1.7, the MMA7455 is rock solid.
Hi, any progress on this? I mean, is there really problem with the MMA7455 calibration?
Re: The Poor Man Accelerometer.
Posted: Thu Oct 27, 2011 11:43 pm
by copterrichie
Peck wrote:Hi, any progress on this? I mean, is there really problem with the MMA7455 calibration?
I have not worked on it, been busy with another project. As stated however, just make sure to check using the GUI all sensing directions and make sure there are no abnormal jumps in the readings.
Re: The Poor Man Accelerometer.
Posted: Mon Oct 31, 2011 6:02 pm
by Peck
copterrichie wrote:I have not worked on it, been busy with another project. As stated however, just make sure to check using the GUI all sensing directions and make sure there are no abnormal jumps in the readings.
Thanks! I just asked, because I think I have the same problem, but I don't know where's the calibration offset. I had issues only on one axis.
I played today a lot with it, and I think I figured it out... I don't know much about microcontrollers, but I had the MMA7445 code from the 1.7 version, which was stable for me too.
This works for me:
Code: Select all
static int8_t rawADC_MMA7455[6];
i2c_rep_start(MMA7455_ADDRESS); // I2C write direction
i2c_write(0x00); //Registry to start reading from.
i2c_rep_start(MMA7455_ADDRESS+1); // I2C read direction => 1
for(uint8_t i = 0; i < 5; i++) {
rawADC_MMA7455[i]= i2c_readAck();}
rawADC_MMA7455[5]= i2c_readNak();
accADC[ROLL] = -((rawADC_MMA7455[1]<<8) | (rawADC_MMA7455[0]>>1)<<1);
accADC[PITCH]= -((rawADC_MMA7455[3]<<8) | (rawADC_MMA7455[2]>>1)<<1);
accADC[YAW] = ((rawADC_MMA7455[5]<<8) | (rawADC_MMA7455[4]>>1)<<1);
ACC_Common();
I know it's not using the i2c_getSixRawADC, but does basically the same, but I figured out, that the "big" difference in 1.7 and 1.8 code is,
that rawADC is uint8_t, but rawADC_MMA7455 is int8_t type, which I used.
I also tried it with the original code (using i2c_getSixRawADC), and only changed the type of rawADC, and the problem disappeared too, but it's not a good idea to change it, my servo gone nuts on my tricopter

However the gyro values seemed to be good too on the GUI.
Re: The Poor Man Accelerometer.
Posted: Mon Oct 31, 2011 10:48 pm
by copterrichie
Peck wrote:copterrichie wrote:I have not worked on it, been busy with another project. As stated however, just make sure to check using the GUI all sensing directions and make sure there are no abnormal jumps in the readings.
Thanks! I just asked, because I think I have the same problem, but I don't know where's the calibration offset. I had issues only on one axis.
I played today a lot with it, and I think I figured it out... I don't know much about microcontrollers, but I had the MMA7445 code from the 1.7 version, which was stable for me too.
This works for me:
Code: Select all
static int8_t rawADC_MMA7455[6];
i2c_rep_start(MMA7455_ADDRESS); // I2C write direction
i2c_write(0x00); //Registry to start reading from.
i2c_rep_start(MMA7455_ADDRESS+1); // I2C read direction => 1
for(uint8_t i = 0; i < 5; i++) {
rawADC_MMA7455[i]= i2c_readAck();}
rawADC_MMA7455[5]= i2c_readNak();
accADC[ROLL] = -((rawADC_MMA7455[1]<<8) | (rawADC_MMA7455[0]>>1)<<1);
accADC[PITCH]= -((rawADC_MMA7455[3]<<8) | (rawADC_MMA7455[2]>>1)<<1);
accADC[YAW] = ((rawADC_MMA7455[5]<<8) | (rawADC_MMA7455[4]>>1)<<1);
ACC_Common();
I know it's not using the i2c_getSixRawADC, but does basically the same, but I figured out, that the "big" difference in 1.7 and 1.8 code is,
that
rawADC is uint8_t, but rawADC_MMA7455 is int8_t type, which I used.
I also tried it with the original code (using i2c_getSixRawADC), and only changed the type of rawADC, and the problem disappeared too, but it's not a good idea to change it, my servo gone nuts on my tricopter

However the gyro values seemed to be good too on the GUI.
BINGO!!!
2's Complement!
Re: The Poor Man Accelerometer.
Posted: Mon Jan 02, 2012 11:03 pm
by kaikai
Hi, I was wondering if you all know where I can access the datasheet for the GY-29 accelerometer. I purchased one recently, and don't know what pin is associated with what. Any help is appreciated. Thanks
Re: The Poor Man Accelerometer.
Posted: Mon Jan 02, 2012 11:15 pm
by copterrichie
My quick search reveals that the GY-29
MAYBE the same as ADXL345.
http://module.blog.com/gy-29-3-axis-acc ... r-arduino/
Re: The Poor Man Accelerometer.
Posted: Mon Jan 02, 2012 11:35 pm
by kaikai
Yes, it uses the ADXL345, but I don't know what the pins on the breakout board is associated to . There are more pins on the ADXL345 than on board the GY-29 provides
Re: The Poor Man Accelerometer.
Posted: Tue Jan 03, 2012 12:40 am
by copterrichie
Sorry, I don't have that information. Would the seller have this information?
Re: The Poor Man Accelerometer.
Posted: Wed Jan 04, 2012 1:39 am
by flyman777
Hi,
here would be what can help you
flyman777
Re: The Poor Man Accelerometer.
Posted: Wed Jan 25, 2012 6:58 pm
by copterrichie
Better late than never right? Well, I finally got around to adding code for the MMA7455 to version 1.9 and I also changed the Accelerometer's sensitivity from 2g to 8g.
This copter is using an original WM+ running at 2kHz and the MMA7455 Accelerometer as stated above.
URL Link to codeURL Video of Test Hover
Re: The Poor Man Accelerometer.
Posted: Sat Feb 04, 2012 7:23 pm
by crashlander
Hello,
MMA7455 is rated for 3.3V and 5V, does that mean it will work directly connected to Arduino (without level converters)?
Regards Andrej.
Re: The Poor Man Accelerometer.
Posted: Sat Feb 04, 2012 8:15 pm
by copterrichie
That would depend upon the breakout board. The ones on Ebay, you can use 3.3 or 5 volts and they have a logic leveler on the board.