Hey everybody,
for a university project I have to set up a measurement of two adxl345 with a raspberry pi 4B. The required sample rate is 3200hz so according to the data sheet of the adxl345 I have to use SPI communication because I2C can't reach this data rate - so far so good. I've found some Code examples in C (from nagimov in github) and changed it so it fits for my use case. This worked well for the data rate. The problem is that I have to code it in python because of other requirements of the project and this doesn't work at all so far... It can't reach the required data rate and when I force it to do so I get some measurement data with 0.0 or the data from both sensors is the same or some lines are the same (all in all every data time error you could get haha). I'm a Python beginner so I think it is possible to reach this goal but with beginner skills and no examples over the internet I am not able to code it that efficient so it could reach the 3200hz for both sensors...
Little Edit: The adxl345 sensors are connected with different power supply and several cs on the gpio Pins but same sdo and sda and clk (i simply connected the wires to one to go to the pins on the pi), no extra pins yk. The Raspberry pi only has the spi(0,0) and (0,1) bus.
Maybe some of you have tried this as well and got an solution that worked? Or you know some example I haven't found yet? Or you're just motivated to help me with the troubleshooting?
I would be grateful for any kind of help...
Thank you![🫶🏼]()
for a university project I have to set up a measurement of two adxl345 with a raspberry pi 4B. The required sample rate is 3200hz so according to the data sheet of the adxl345 I have to use SPI communication because I2C can't reach this data rate - so far so good. I've found some Code examples in C (from nagimov in github) and changed it so it fits for my use case. This worked well for the data rate. The problem is that I have to code it in python because of other requirements of the project and this doesn't work at all so far... It can't reach the required data rate and when I force it to do so I get some measurement data with 0.0 or the data from both sensors is the same or some lines are the same (all in all every data time error you could get haha). I'm a Python beginner so I think it is possible to reach this goal but with beginner skills and no examples over the internet I am not able to code it that efficient so it could reach the 3200hz for both sensors...
Little Edit: The adxl345 sensors are connected with different power supply and several cs on the gpio Pins but same sdo and sda and clk (i simply connected the wires to one to go to the pins on the pi), no extra pins yk. The Raspberry pi only has the spi(0,0) and (0,1) bus.
Maybe some of you have tried this as well and got an solution that worked? Or you know some example I haven't found yet? Or you're just motivated to help me with the troubleshooting?
I would be grateful for any kind of help...
Thank you
Statistics: Posted by lisa_l12345 — Sat Jan 04, 2025 9:05 pm