ADXL345 Connection Help!

Can someone please help me I am trying to get my adxl345 accelerometer to work with my raspberry pi 3b+ and no matter what I try I still get Invalid adxl345 id (got 0 vs e5). I have tried 3 different sensors and 3 different types of wire. I have tried cat5 twisted pair and regular single strand wire and nothing works. I am long and cant figure this out I have searched and searched please help

Thanks in advance Tony

Hello @TonyM4119 !

Have you seen this when you opened this thread?


Basic Information:

Printer Model:
MCU / Printerboard:
klippy.log

Fill out above information and in all cases attach your klippy.log file. Pasting your printer.cfg is not needed

Sorry about that

Printer Model: CR-10S Style ā€œHeavily Modifiedā€
MCU / Printerboard: Raspberry pi 3b+/SKR 3 Mainboard
I dont have the klippy log right now i am currently at work i will post it later today

This kind of error typically is due to bad wiring of the sensor. The ADXLs are very sensitive (you might be tempted to say ā€œoverly bitchyā€) when it comes to this.

Use a shielded ethernet cable (Cat 5E or above) and make sure you do a highly meticulous job when crimping or soldering the contacts.
A proven way of assigning the wires is:

  • GND on Shield on the mainboard (MCU) side
  • One pair for GND+MISO (SDO)
  • One pair for 3.3V+MOSI (SDA)
  • One pair for SCLK (SCL)+CS

I have tried cat6 cable and my pairs were a little different from what you said tho.Also when you say GND on Shield on mainboard (MCU) side what do you mean

Ideal thing would be to put the cableā€™s shield on protective earth. Iā€™m running a 75cm Cat5E without this and it works reliably (self crimped Dupont pins).
I tried a lot of cables before and all failed but now it is really working good. There are a lot of similar reports and all boil down to cable quality.

I have tried everything i dont know what i am doing wrong.

i have attached my klippy.log and printer.cfg

klippy.log (117.0 KB)
printer.cfg (4.1 KB)

The logs unfortunately are of little help here and I cannot offer any more advice.
You might want to try an RPi Pico as described here:

I appreciate the help. one last question do you think there is any chance Iā€™m using the wrong pins on the rpi header. I followed this guide to install the adxl345

https://www.klipper3d.org/Measuring_Resonances.html

The description under the a.m. link is correct. Just verify your wiring against the Fritzing diagram https://www.klipper3d.org/img/adxl345-fritzing.png

Did you check the power supply requirements for your ADXL board? Some of the boards have a 3.3V regulator and require 5V to operate.

Do you have an example of a board that would require 5V?

I have one on my V2.4 that came from Magicphoenix. It has a 4B2K 3.3 V regulator on board, so it will not run from 3.3 V. I use 5 V (pin 2 or 4 from Raspberry Pi header) and it works fine. Iā€™m using a shielded cable, but not twisted pair about 1 m long.

I tried 3.3v and 5v and still nothing, I also tried single wires and cat6 cable and still had no luck I ordered a raspberry pi Pico today figured Iā€™d give that a shot maybe itā€™s because I am using a raspberry pi 3b+ I really donā€™t know

Interesting. I have around 6 or 7 different boards. With and without voltage regulator. Have not seen any that would not run with 3.3V.
Yes they do have voltage regulator but this only allows them to run of 5V as well. You can see a short discussion on them in the link I posted above.
Be especially careful with models that have voltage regulators and level shifters. If supplied with 5V they may fry your board.

The ADXL board I have only has one connection for power. There is no way to provide 3.3 V directly. I donā€™t know of any 3.3 V regulators that will work with 0 V headroom. The one in the image you liked looks like it has connection points at both the regulator input (5 V) and output (3.3 V).

So i decided to try out the MPU-9250 sensor and now im getting this error and klipper restarts
MCU ā€˜rpiā€™ shutdown: Unable write i2c device
Once the underlying issue is corrected, use the
ā€œFIRMWARE_RESTARTā€ command to reset the firmware, reload the
config, and restart the host software.
Printer is shutdown

Unable to obtain ā€˜i2c_read_responseā€™ response

Make sure to have i2c enabled, e.g. see Enable I2C Interface on the Raspberry Pi - Raspberry Pi Spy
Also triple check your wiring.

Yup I have done both of those things tried 2 different wires one long wire and one really short wire, also i enabled i2c in raspberry config and made sure to set the baud rate 400000ā€¦ Ah why is this being so difficult i feel like this should be a super simple setup.

Sorry no idea anymore.
For me it was a very straight forward process for both the ADXL (once you get the cable right) and the MPU.
Maybe some Linux OS / distribution thing or other issue with your RPi