FLORA accelerometer and Arduino UNO
Moderators: adafruit_support_bill, adafruit

FLORA accelerometer and Arduino UNO

by sekjal on Sun Feb 10, 2013 8:27 am

I'm new with Arduino hardware, and I've recently acquired an array of equipment to help me learn. One of the products in my kit is a FLORA accelerometer/compass, which I'm hoping to connect to an Arduino UNO. The accelerometer has SDA and SCL ports, which line up with FLORA's SDA and SCL. According to the FLORA pinout diagram http://learn.adafruit.com/getting-started-with-flora/flora-pinout-diagram, SDA and SCL map to Arduino pins 2 and 3 respectively.

Can I simply connect the FLORA accelerometer SDA and SCL to the Arduino UNO's pins 2 and 3, and make use of the Adafruit LSM303 library https://github.com/adafruit/Adafruit_LSM303 as is, or do I need to make some modifications to the software to account for the slight difference? If so, would that change be in the library itself, Wire.h or the Arduino IDE?

I suppose it would also be a good idea to ask, am I putting the FLORA accelerometer at any risk by experimenting? I don't plan to make any connection to the 5V output, but other than that, could a thoughtless circuit damage anything?
sekjal
 
Posts: 2
Joined: Mon Feb 04, 2013 10:24 am

Re: FLORA accelerometer and Arduino UNO

by adafruit_support_rick on Sun Feb 10, 2013 11:49 am

Actually, on the UNO, SDA is A4 and SCL is A5.

If you have a Rev 3 UNO, these are also brought out to the last two header pins nearest the reset button. They are labeled on the underside of the board.

You can use the LSM303 library as-is!
User avatar
adafruit_support_rick
 
Posts: 11519
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: FLORA accelerometer and Arduino UNO

by sekjal on Sun Feb 10, 2013 3:49 pm

Thanks, driverblock! That's not only incredibly helpful, but very encouraging!
sekjal
 
Posts: 2
Joined: Mon Feb 04, 2013 10:24 am

Re: FLORA accelerometer and Arduino UNO

by deivkk on Thu May 02, 2013 1:41 pm

Hello!

I have an Arduino UNO Rev 3 and I was wondering if it is possible to connect two different Flora accelerometers and distinguish between the two read signals.

Thanks!
deivkk
 
Posts: 10
Joined: Thu Apr 25, 2013 2:09 pm

Re: FLORA accelerometer and Arduino UNO

by adafruit_support_rick on Thu May 02, 2013 3:33 pm

Unfortunately, no. Both the Flora accelerometer and the equivalent LSM303 accelerometer breakout use the same fixed I2C addresses, so you can't use more than one of them.

However, the ADXL345 accelerometer breakout has a different I2C address, so one of these could be combined with either the Flora accelerometer or the LSM303 breakout.
User avatar
adafruit_support_rick
 
Posts: 11519
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: FLORA accelerometer and Arduino UNO

by deivkk on Sun May 05, 2013 11:59 am

Thank you so much!

Just one more question. I'm about to start a project with two accelerometers that will emulate mouse gestures in a connected computer depending on the movements you make. This is basically for a kid with physical disabilities. However I just realized that USB libraries only work for Leonardo, Micro, Due, and Esplora.

Knowing that I'd need to connect the two accelerometers (Flora and ADXL345), is there any of the above boards compatible with this idea?

Thanks!
deivkk
 
Posts: 10
Joined: Thu Apr 25, 2013 2:09 pm

Re: FLORA accelerometer and Arduino UNO

by adafruit_support_rick on Sun May 05, 2013 1:24 pm

Either the Leonardo or the Micro will work.

The Due is a work-in-progress; I'd stay away from it. I'm not sure whether the Esplora brings out the I2C bus or not.
User avatar
adafruit_support_rick
 
Posts: 11519
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: FLORA accelerometer and Arduino UNO

by thekitty on Mon May 06, 2013 7:10 pm

The Esplora has SPI but not I2C available. See http://arduino.cc/forum/index.php/topic,148602.0.html for the pins you have to play with.
thekitty
 
Posts: 598
Joined: Sat Mar 24, 2012 7:56 pm
Location: Mid-Atlantic

Re: FLORA accelerometer and Arduino UNO

by deivkk on Wed May 08, 2013 4:48 pm

I finally got the Arduino Micro as well as the two mentioned accelerometers. I have no idea about anything else than programming so I thought that wiring all together was going to be really easy just by following the tutorials. However I'm a bit worried after reading the description of each component.

With the ADXL345 http://www.adafruit.com/products/1231) seems that I won't have any problem to connect it to the 5V provided by Micro. But what about the Flora accelerometer (http://www.adafruit.com/products/1247)?

Thanks again!!
deivkk
 
Posts: 10
Joined: Thu Apr 25, 2013 2:09 pm

Re: FLORA accelerometer and Arduino UNO

by adafruit_support_rick on Thu May 09, 2013 7:31 am

Shouldn't be a problem. Just use the Micro's 3.3V output to power both accelerometers. Don't use the 5V output at all.
User avatar
adafruit_support_rick
 
Posts: 11519
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Re: FLORA accelerometer and Arduino UNO

by UndeadManatee on Sat Feb 01, 2014 3:04 pm

Hi there,
I'm trying connecting the LSM303 to an arduino Uno R3 as directed above (on pins 4 and 5 rather than pins 2 and 3 as the Flora pinout diagram suggests, http://learn.adafruit.com/assets/2845). I went ahead and tried the LSM303 test sketch. It uploads fine but doesn't give any output when it runs. I added a couple extra serial.print() commands to figure out how far it gets through the sketch.

I used the following:

Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include <Adafruit_LSM303.h>

Adafruit_LSM303 lsm;



void setup()
{
  Serial.begin(9600);

 
  // Try to initialise and warn if we couldn't detect the chip
  if (!lsm.begin())
  {
    Serial.println("Oops ... unable to initialize the LSM303. Check your wiring!");
    while (1);
  }
   Serial.println("init done");
}

void loop()
{
  Serial.println("looping ");
  lsm.read();
  Serial.println("read done ");
  Serial.print("Accel X: "); Serial.print((int)lsm.accelData.x); Serial.print(" ");
  Serial.print("Y: "); Serial.print((int)lsm.accelData.y);       Serial.print(" ");
  Serial.print("Z: "); Serial.println((int)lsm.accelData.z);     Serial.print(" ");
  Serial.print("Mag X: "); Serial.print((int)lsm.magData.x);     Serial.print(" ");
  Serial.print("Y: "); Serial.print((int)lsm.magData.y);         Serial.print(" ");
  Serial.print("Z: "); Serial.println((int)lsm.magData.z);       Serial.print(" ");
  delay(1000);
}


...and in the serial monitor I get back:

Code: Select all | TOGGLE FULL SIZE
Wire
init done
looping


...which seems to suggest that the initialization test passes, but that for some reason the lsm.read() function hangs and never returns. Based on the fact that the initialization works fine it seems like a software issue to me, not a connection issue.

Any suggestions on this?

Thanks!
UndeadManatee
 
Posts: 1
Joined: Fri Jan 24, 2014 12:20 pm

Re: FLORA accelerometer and Arduino UNO

by adafruit_support_rick on Sun Feb 02, 2014 11:38 am

Actually, lsm.begin() always returns true.
I assume that you connected it to A4 and A5, not D4 and D5, right? And you have SDA connected to A4 and SCL connected to A5?
User avatar
adafruit_support_rick
 
Posts: 11519
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY