I have a project that I consider a little crazy, I need to connect 26 accelerometers / gyroscopes in a arduino. I did not buy the Arduino and sensors to keep me spend money for nothing. I've been researching and believe it is possible to make a Multiplexing with the sensors and the Arduino, the problem is that I am beginner and I have no idea if this will work and how. In addition to the sensors think about connecting to a "Raspberry Pi 3" since it has WiFi and Bluetooth connectivity and compatibility with java.
Any idea how I can do this or if this is possible?
I think to use the Raspberry Pi 3, Arduino Mega and multplex
Any mistake, I'm sorry, I'm new to the forum and my English is very bad.
It may be worth considering sensors with SPI interface rather than I2C, given the number of sensors and speed required. A Mega would have enough pins for the chip select of each sensor. It may be simpler to connect the sensors direct to the Pi's SPI pins, if you can figure out a circuit to get the Pi to control 26 CS pins. Mega or no Mega, with so many sensors on the same bus you will probably need some line buffer/drivers.
I'm still a beginner, so it's a little hard haha, the problem is that sensors with I2C are easiest to find, practically most only have I2C, I want the system to be the lowest possible. Do not discount the possibility of using the SPI but need to find where to buy the sensors. I just need someone to help me decide what to use and how.
In my opinion, the problem with i2c sensors and your project is that they were never designed to have more than 1 or 2 sensors on the same bus. On an i2c bus, each device has to have it's own unique address. The sensors will come with one fixed address which it may be possible to change to a second, different address by using a jumper. But you need 26 addresses! So even if you can attach 2 sensors to a bus, you will need 13 buses. The Mega only has one or two buses built-in so the other 11 would have to be implemented in software. This would be slow, maybe too slow to work at all, and much too slow for the 30 reads per second you are aiming for.
Before we go any further, can you tell us more about your project? What is the purpose? Why 26 sensors?
Mpu-6050 modules seem to be cheapest at around $2.00 but i2c only. Mpu-9250 have SPI but around $4.50. LSM6DS3 modules have spi and cost around $3.50, but not sure about Arduino library and 5V compatibility. GY-BMI160 and L3G4200D also have spi... I did not realise there were so many! Perhaps some are the same chip in reality.
Perhaps you should ask the moderators to move this post to the Sensors section of the forum. Perhaps there will be an expert there who can advise.
Out of interest, @ElCaron, have you heard of accel/gyro modules with spi interface that can be Daisy-chained, like shift registers or Max 7219? That would have been the ideal design for the OP's strange requirements.
I have not forgotten the post, I was just a little busy to answer, I'm registered a little time in the forum so do not even know how to call a moderator if someone can tell me how, I thank you.
The goal of the project is perhaps one of the most stupid, need to put the sensors in the body of a person, each sensor will be placed in a mobile part, to capture the movement and transfer it to the software. The software will use this data as a real-time animation, although it already exists, this technology is very expensive and difficult to import.
AWOL is a moderator, so you can just ask him (nicely).
In other circumstances you would click "report to moderator" and ask for your post to be moved and where to. Just don't make a habit of it, those guys do it for love not money.
Not a stupid project, now we understand. Interesting and quite a big challenge for a beginner. We will help of we can.
Here is something that might enable you to use those cheaper i2c sensors. It is an i2c bus multiplexer. You can connect 8 devices to it and connect up to 8 multiplexors to the same i2c bus, so that's 64 devices in total. Question is, will this be fast enough for you to get your minimum 30 readings per second per sensor.
These mpu6050 sensors are only $1.32 each. I think you may be able to put 2 sensors on each bus, which means you would need 2 of the above multiplexers @$4.90 each for your 26 sensors, total $44.12
If I use the SPI with 26 sensors, it would be possible to 60 readings per second for each sensor?
I'm thinking that even if more expensive, it falicitaria more to me.
I searched and found some LSM6DS3 sensors for $ 3.52 each sensor.
It would be a total $91.52.
My doubt is, what would be the safest way? That would work of at least 30 readings per second?
SPI or I2C?
SPI is faster than i2c. If it is possible to get 30 readings from 26 sensors every second, then SPI can do it. But maybe i2c can also do it.
I suggest you should buy one sensor that can do both i2c and spi. Then you can perform some timing experiments to see how many readings per second you can achieve with i2c and how many you can achieve with spi.
But even if i2c is fast enough to get 26 x 30 readings per second, it will then be necessary to get these readings to the PC at the same rate. Have you decided how you will do that? Your timing experiments will have to include sending the data to the PC also.
I can even buy the sensor and perform the tests, but it would take too long, sensor import to here can take about one month to arrive or more, moreover I did not find these sensors here.
Why do you think that all 26 sensors have to be connected to 1 Arduino? Use a bunch of them!
On eBay, Arduino Pro Minis are as just about cheap and small as the sensors.
You still haven't explained how and where all these data will end up.
It would cost too much, moreover 26 sensors and 26 micro controllers would not make sense since I can easily use only 1. As this project is a clothing then there is no where I can put 26 micro controllers in an outfit along with another 26 sensors and a rapsberry 3.
PS: The sensors have only a few centimeters, since microcontrollers almost double.