Hi. I am trying to use the IMU-3000 (motion sensor) and a microSD datalogger with an Arduino Uno. The IMU uses I2C and the datalogger uses SPI. I need to communicate with both of them in the same sketch and possibly in the same function. Will having communications on I2C and SPI simultaneously cause any problems? Even if they can run together, I'd still have to figure out how to hook it up...
Any help would be great! Thanks!
There should be no problem. SPI uses the SPI pins (10-13) and I2C uses the I2C pins (A4 and A5).
....Will having communications on I2C and SPI simultaneously cause any problems?
There are no inherent interactions that will cause problems.
Even if they can run together, I'd still have to figure out how to hook it up...
Implement things one at a time.
Just hook up the data logger.
Run SD library (or SdFat library) examples with the datalogger. Make sure that your setup can initialize and read from and write to the SD module. Test it a lot. Then make your own sketch that just creates a file and writes the kind of data that you would be using in your final sketch (events with time stamp or whatever...) Test it a lot.
Then take the data logger out of the circuit.
Hook up the motion sensor. If the vendor supplies some sample code, make sure it works. Test it a lot.
Then make your own sketch that prints out event messages to the Serial port. Make sure that you know exactly how the motion sensor works. Test it a lot.
Next, connect both devices to the Arduino.
Create a sketch that makes sure that the things that you did with the SD test program work in the presence of the motion sensor (create a file and write dummy events or whatever).
Create a sketch that makes sure that the motion sensor still reports events the way that it did before you connected the SD circuitry.
Combine code in the sketches into one that (probably) continuously monitors the motion sensor and writes events to the SD card. Stuff like that.
My point: Check out the hardware (and whatever software that you are going to create) one thing at a time. Thoroughly test at each step before going on to the next.
If you have any specific questions along the way, it's always OK to ask.
Thank you so much! I look forward to getting into it! I really appreciate your guidance in how to implement each peripheral on its own first, I probably would have rushed in and tried to do both and failed. I have just learned a really valuable lesson without have to endure the headache and frustration for once!