Help setting up LIS2DW sensors

Basic Information:

Printer Model: Wanhao Duplicator i3
MCU / Printerboard: Rasberry Pi 4B
Host / SBC
klippy.log

Describe your issue:

Hi

I have been trying to set this up for days and I have hit a wall. I just can’t figure it out and I ended up going all back to stage 1 so I can do it all over again, but with your guidance.

Basically I am trying to setup two of the BTT S2DW V1.0 via USB so that I can leave them both permanently mounted on the printer and so that I can run the calibration any time I want.

My printer is working so that part is out of the way.

My challenge is how to get both of the sensors working at the same time.

I plugged one into the RPI and it gives me accel values. (yay)

But I just can’t figure out how to get the 2nd to be read and give me data.

I have lots of spare RPIs kicking around so if the answer is that I need one per sensor, that’s fine, I really don’t mind using them for these functions.

I just need some step by step instructions on how to get the two sensors running. One as a tool sensor and the other as a bed sensor.

I can’t imagine I am the first person to want to do this. :wink:

I have tried countless processes I have found from all over the web, but nothing works. I even tried using chatGPT to walk me though it. It’s close, but nothing in the end works.

Thank you very much in advance for any help you can offer.

Thanks!
D

Something like the following should do the trick:

[mcu lis_hotend]
# Change <mySerial> to whatever you found above. For example,
# usb-Klipper_rp2040_E661640843545B2E-if00
serial: /dev/serial/by-id/usb-Klipper_rp2040_<mySerial>-if00

[mcu lis_bed]
# Change <mySerial> to whatever you found above. For example,
# usb-Klipper_rp2040_E661640843545B2E-if00
serial: /dev/serial/by-id/usb-Klipper_rp2040_<mySerial>-if00

[lis2dw bed]
cs_pin: lis_bed:gpio9
spi_software_sclk_pin: lis_bed:gpio10
spi_software_mosi_pin: lis_bed:gpio11
spi_software_miso_pin: lis_bed:gpio8
axes_map: -y,x,-z

[lis2dw hotend]
cs_pin: lis_hotend:gpio9
spi_software_sclk_pin: lis_hotend:gpio10
spi_software_mosi_pin: lis_hotend:gpio11
spi_software_miso_pin: lis_hotend:gpio8
axes_map: -y,x,-z

[resonance_tester]
accel_chip_x: lis2dw hotend
accel_chip_y: lis2dw bed
probe_points:
    # Somewhere slightly above the middle of your print bed
    115,115,20

Worked like a charm!

I think what was throwing me off is that the instructions said not to run both sensors off one rpi.

Question:
Is it at all possible to off-load the sensors to a 2nd and/or 3rd rpi?

I’ve got them kicking around and thought it might be a good idea to spread the work to others.

I read something about people doing this with their different axis? Is this something? One rpi doing X, one doing Y, one doing Z…

or is this just silly and a dumb thing to do (if it can be done)

Thanks!

D

Apologies, one more question.

Why do you have the axes like this: axes_map: -y,x,-z

is Y and Z negative for a reason?

I have a typical bed slinger and the sensors are positioned with the Y pointing to the front and X pointing to the left (when looking at the printer)

D

To understand how Klipper is working you may want to read Klipper Architecture / Ecosystem. In short:

  • Both the LIS sensors are already using their own RPi Pico MCU (RP2040) that does manage this single sensor and is 99% bored with it
  • The data from these MCUs is crunched on the RPi 4B you are using as host and this is the very task of the host

So, no, it makes no sense to distribute the sensors to other RPis.

To be honest, I just copied it from the BTT default example. It does not really matter regarding the computed results.
Where it might be a thing is when you graph the results and see that, e.g. X and Y are switched etc.
If you take a look at the sensor, you will see some coordinate system. You can use this setting to align with your actual movement direction:

Fantastic! Thanks for all the help.

Sorry for breaking in here

I thought the axis information on the PCB was immaterial - When Klipper does the resonance compensation it determined the actual direction of the movement.

My understanding is:

  • The marking on the PCB denotes the default directions of the chip
  • For the matter of calculating the input shaper compensation, it makes no difference. You can even mount the chip in an arbitrary angle
  • For the matter of creating graphs or when looking at the raw values it does indeed matter
  • So if the markings on the PCB do not align with the movement direction of the head / bed, the axes_map settings allows you to correct this (only regarding 90° steps and not at arbitrary angles)
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.