Help needed, DFROBOT Speaker Module v2, klipper raspberry pi

Hi Gaolst

I tried using the config parameters that you shared. No errors but also no sound. A new web ui element has now appeared called buzzer under fans and outputs on fluidd main page. It moves to 0.5 when i try play a tune or enter the console command you shared but again no sound.

I successfully tested it a couple of hours ago on the uno r3, it played sound, so the speaker is definitely working. I’ve played both monotonic and polyphonic sounds and able to play part of wav file that I tested. All played loud and clear.
I can’t upload the recording of it here though

I have no idea what im doing wrong on the pi.

Ok, it’s a working module - good
Now explain which pin (or pins) you are using and how did you reference them.
BTW is this your printer board ?
https://www.reddit.com/r/ender5plus/comments/ruu51r/ender_5_plus_board_pinout_mapping_i_spent_hours/#lightbox

1 Like

this is in my printer.cfg currently however i have also used GPIO 2, 3 , 14, 15, 23 and 24 as well as PA12 and PB0 from the printer pinouts for the screen ribbon as per reddit post, pinouts tested with led’s, (connector pin 6 is actually PB0) Reddit - Dive into anything

[pwm_cycle_time buzzer]

pin = PB0

value = 0

shutdown_value = 0

cycle_time = 0.001

my board is as per pic, not like the ender 5
ive also attached my most recent klippy log, after updates and changes


klippy.log (1.1 MB)
ender-3-v3-se-board-photo-v0-ab08n9dfb3sb1

Your board is a mystery - no clear good indication on pins and their states, etc …

Let’s try to work with your Raspberry PI which is clear and well documented, if we can make it work with PI then we can try to transfer it to printer board.

I understand you have Rpi 5
If so try to hookup your module to GPIO headers on RPi.

I found pinout of RPi5 here
so i will use it to describe where you should connect your module and which config to define in klipper.

connect VCC from module to Rpi.pin 1 (+3.3v)
connect GND from module to RPi.pin 40 (GND)
connect Signal from module to RPi.pin 39 (GPIO12)

redefine your buzzer in config this way:

[pwm_cycle_time buzzer]
pin = rpi:gpio12
value = 0
shutdown_value = 0
cycle_time = 0.001

save config and restart klipper.
then try to execute command in klipper

SET_PIN PIN=buzzer VALUE=2 CYCLE_TIME=0.001

if it’s not working try these variants of pin definitions

pin = !rpi:gpio12
pin = ^rpi:gpio12
pin = ^!rpi:gpio12

Now i’m not actually sure that is correct pinout :face_with_symbols_over_mouth:
thru internet I did see different pinouts for RPi5

but you can try to use tool “pinout” which you can run in RPi shell
as i undestand by official documentation it should show your pinout
it’s mentioned in official site here:
https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#gpio-pinout

Your goal is to use +3.3, GND, GPIO12

some tables tell that they are located at
pin1-+3.3, pin40-gnd, pin39-gpio12

other docs mentioning that they are this way
pin1-+3.3, pin39-GND, pin32-gpio12

Good mornign Gaolst

I tried gpio12 with the line commands as well as the ^ and !^ variants but still no sound with the line command.
pin = ^rpi:gpio12 and pin = ^!rpi:gpio12 returned erros
Unknown pin chip name ‘^!rpi’
Unknown pin chip name ‘^rpi’
Once the underlying issue is corrected, use the “RESTART”
command to reload the config and restart the host software.
Printer is halted

i double checked with a vmeter and seems like gpio 12 at pin 32 with ground at 39 seems to be the correct gpio pin layout as per my board.
so with that info ive tried gpio12, gpio13, 14 and 15

no luck so far. it boggles my mind

I slowly come to the conclusion, that the Klipper fork you use can’t do what regular Klipper can.

It should work, i compared it with vanilla - in this fork only some additional stuff was
added related to some “dirzctl” and “hx711s”

1 Like

Good morning.

Ok, so from your last statement I understand that these pin definitions was accepted

pin = rpi:gpio12
pin = !rpi:gpio12

but this one - no

pin = ^rpi:gpio12
pin = ^!rpi:gpio12

Now let’s confirm that klipper is driving gpio12 in RPi and we addressing it correctly. Do following

  1. temporary change pin in [pwm_cycle_time buzzer] to PB0
  2. define this section
[output_pin my_pin12]
pin: rpi:gpio12
value: 0
shutdown_value:0
  1. save + restart
  2. hook your vmeter to pin32 and pin39 on RPi5
  3. toggle this pin in klipper and monitor voltage change in vmeter

commands for changing state of that pin

SET_PIN PIN=my_pin12 VALUE=1
SET_PIN PIN=my_pin12 VALUE=0

you should see that when you are setting it to “0” - vmeter should show “0v”
when setting it to “1” - vmeter should show approx “+3.3v”

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