interface Arduino I2C with multiple sensors

Hi 

I am trying to building a flight controller with Arduino

for that, I need a magnetometer and barometric altimeter

http://www.sparkfun.com/products/9694.....................Altimeter

http://store.diydrones.com/HMC5843_Triple_Axis_Magnetometer_p/br-hmc5843-01.htm...Magnetometer

 

The problem is communication to both sensors are via I2C, is this possible with the ArduinoMega, which only has pin 20 and 21 assigned for I2C

 

i got this from another tutorial forum: "I2C is a bus, with multiple slave devices on a single pair of wires. You can chain a number of devices off the same pair of wires, up until you exceed the 400 pF total capacitance of the combined inputs on your devices as well as the total length of cables."

Does this mean I should make Arduino the master and the two sensors slaves?

 

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • so how will the master distinguish between which slave device it wishes to read from?

    I saw a fn from the Arduino Wire library calle Wire.begin(address)

    i'm guessing address should contain the address of my magnetometer and altimeter?

    if so how do I find this address

  • Developer

    Yes, I think it will work.  I2C is a bus and each slave as an address and it should ignore messages sent to other addresses.

     

    As you say, the arduino would be the master and the two sensors the slaves.

     

    If you want to hitch them up using those you can use the i2c splitter from the diydrones store.  Note that this is only useful if you want to use gps connectors to attach the sensors.

This reply was deleted.

Activity

DIY Drones via Twitter
2 hours ago
DIY Robocars via Twitter
2 hours ago
DIY Robocars via Twitter
Friday
DIY Robocars via Twitter
Friday
DIY Drones via Twitter
Thursday
DIY Robocars via Twitter
RT @Heavy02011: @diyrobocars : A Home-brew computer club* for Connected Autonomous Driving on Jan 23rd, 2021 https://www.meetup.com/Connected-Autonomous-Driving/events/275728684/ #Meetu…
Thursday
DIY Robocars via Twitter
Thursday
David Hori liked Isabella Domi's profile
Wednesday
DIY Robocars via Twitter
RT @Heavy02011: ⁦@diyrobocars⁩ Autonomous Driving Assembly at #rC3. join us at https://rc3.world/rc3/assembly/diyrobocars-f1tenth/ ⁦@f1tenth⁩ ⁦@DAVGtech⁩ ⁦@DWalmroth⁩…
Jan 11
DIY Robocars via Twitter
RT @chr1sa: New car designs coming for our next @DIYRobocars @donkey_car virtual race on the 23rd. Choose any one you want at race time Le…
Jan 11
DIY Robocars via Twitter
RT @RoboticMasters: Thanks to @EllerbachMaxime and the Sydney Uni Capstone Students the @donkey_car @diyrobocars simulator is getting a ma…
Jan 11
DIY Robocars via Twitter
Jan 6
DIY Robocars via Twitter
Dec 28, 2020
DIY Robocars via Twitter
An interesting line-following simulator to use with with your robocars: https://github.com/ron-grant/LFS
Dec 23, 2020
DIY Robocars via Twitter
Dec 23, 2020
DIY Robocars via Twitter
An improved version of the @IntelAIResearch OpenBot: https://diyrobocars.com/2020/12/14/an-improved-version-of-the-intel-openbot/
Dec 14, 2020
More…