Help needed, DFROBOT Speaker Module v2, klipper raspberry pi

Basic Information:

Printer Model: Ender 3 V3 SE
MCU / Printerboard:
Host / SBC RPI
klippy.log

Fill out above information and in all cases attach your klippy.log file (use zip to compress it, if too big). Pasting your printer.cfg is not needed
Be sure to check our “Knowledge Base” Category first. Most relevant items, e.g. error messages, are covered there

Describe your issue:

Good day all

I have been gifted a few electronics that im looking to install on my enclosure. one of them being this speaker module, would it work with klipper? ive tried connecting it with the 3 wires ,let’s say gpio 15, declared it in printer.cfg but it’s not working. I am very new to this so any and all guidance on how to set it up, what to type in printer.cfg or elsewhere will be greatly appreciated.

was able to get the gifted bme680 sensor working but really struggling with the speaker module.

this is the product wiki for the module although i have the v2 version.

i’ve installed arduino ide(not sure if it’s needed or detrimental to the system/build

By documentation samples for Arduino it’s driven by “tone” function, if you read about that function you will find that it’s using PWM output, and most probably PWM signal frequency and duty cycle will define a tone.

So if you wish to hook it up - you need to setup your pin as PWM output
Possible klipper candidates:
pwm_tool
pwm_cycle_time

1 Like

Hi Gaolst

Thank you. I think i have that set up. I’ll share my config when i get home.

It’s been driving me crazy for that last couple of days.

Hi Gaolst,

This is my printer.cfg speaker section

[output_pin speaker]

pin: PB0

pwm: True

value: 0

shutdown_value: 0

cycle_time: 0.001

still not working though, i have tried the pin out on the pi as well as through the pins on the lcd connector, PB0 being the original/default buzzer/beeper pin for the SE printer

Ok, this is just a config which is setting PWM to 0 freq.

What commands do you use to drive it ?

1 Like

Wait a minute - your config is using [output_pin]
i was pointing to others like [pwm_cycle_time] or [pwm_tool]

1 Like

oh okay, so this?

[pwm_tool]

pin: PB0

pwm: True

value: 0

shutdown_value: 0

cycle_time: 0.001

if i do that then i get a klipper start error:
Section ‘pwm_tool’ is not a valid config section

Once the underlying issue is corrected, use the “RESTART”
command to reload the config and restart the host software.
Printer is halted

and same for [pwm_cycle_time]

Interesting …
We have documentation about it
https://www.klipper3d.org/Using_PWM_Tools.html

And sample config file in config/sample-pwm-tool.cfg

maybe you need to define some name for it
like so
[pwm_tool buzzer]

1 Like

BTW what Klipper version do you use ?

1 Like

tried it with [pwm_tool buzz] returned an error as well:

Option ‘pwm’ is not valid in section ‘pwm_tool buzz’

Once the underlying issue is corrected, use the “RESTART”
command to reload the config and restart the host software.
Printer is halted

found this numer under klipper by software updates in fluidd 25778772

send your klippy.log file - it will have all versions.
Another way is to use Fluidd, go into Settings/Update
that page will display klipper, fluidd, moonraker versions.

1 Like

klippy.log (7.4 MB)
thank you for the assistance Gaolst

config/sample-pwm-tool.cfg returns a 404 error

M115 returned version 25778772

yepp
it did look suspicions for me because usually klipper have this kind of versions
v0.12.0-125-gbfb71bc2

but your is just a number.

Ok Your log is showing that you are using not Vanilla klipper
it’s from here: GitHub - 0xD34D/klipper_ender3_v3_se: Klipper is a 3d-printer firmware
what kind of changes are there - i don’t know
and as i understand your version is approx. 50 updates behind from your master source.

I’m not advising to do upgrade (i don’t know what is happening in that branch)
and i don’t know why your config is not working, from official klipper documentation - it should work.

BTW your MCU firmware have higher version than klipper host !

1 Like

as im sure you can tell im very new to this,
and as i understand your version is approx. 50 updates behind from your master source.: what do you mean? i keep the "software updates’’ section in the settings up to date and update whenever i see an update pending. is there a better way to do this? im confused as all of the software updates say up to date.

BTW your MCU firmware have higher version than klipper host !: do you mean my raspberry pi is more up to date than the one with GitHub - 0xD34D/klipper_ender3_v3_se: Klipper is a 3d-printer firmware not sure what you mean and how to fix it, if it should be fixed.

yeh ive been trying for days now to et this speaker working. no idea what else to do

Ok, forget about my statement that your firmware is fresher than klipper - i misread it.

I don’t know how your updates are configured and what your “Update” is considering as latest version. You use some custom build of klipper.
I see that your Master sources are located here
you can walk thru all the changes in that sources here: Commits

Your klipper have version “25778772” it’s from Mar 16, 2024 - you can find it in commits - just scroll to March 16 - it will be aprox 50 changes down

Your klipper.log indicate that your MCU Firmware was build with version “de89acf1” which is dated Mar 1, 2024

Your master sources did have aprox 50 changes from 16 March to today.

From all this information I can conclude and state following:
Your Klipper host module is from 16 March
Your Klipper MCU Firmware is from 1 March
I see additional aprox 50 changes in your Master source which you don’t have yet.

Don’t worry, currently it seems your Master source is constantly pooling new changes from official klipper and maintaining some customizations - but you should be aware that it’s always lagging behind official klipper and they can introduce any changes they like. Some day they can stop/forget to maintain it and it will stop updating from official klipper.

I did touch this question about Version because you could have very old klipper version which didn’t have PWM tools - that could explain why configuration is not working.

Let me do some investigation in PWM tool area, I will try to build some config and will share my findings.

2 Likes

Good day Gaolst

Thank you for the help with this issue. its much appreciated. thank you for explaining things to me, old dude here so the help is appreciated.
Ive spent some time going through the required updates, i tried to update as much as i can, reinstalled some packages and removed others like wiringpi(think i installed it in some attempt to get the speaker working)

updated the klipper version as much as i could FIRMWARE_NAME:Klipper FIRMWARE_VERSION:0512a7c0-dirty

I’ll upload the klippy log again now with this reply. ive moved the wiring to multiple gpio’s but still no luck. would it be easier to wire it up to a gifted arduino uno r3 and then connect that to the pi via usart/uart or whatever it’s called? or just keep it simple with the pi and not complicate things by adding other variables?
klippy.log (1.1 MB)

Ok, i went thru some official samples and found a sample for a buzzer
/config/sample-macros.cfg
it have section for a beeper and some explanation

[pwm_cycle_time BEEPER_pin]

Then i went to your klippy.log which have your configuration,
your latest configuration have this section

[pwm_tool buzzer]
pin = PB0
value = 0
shutdown_value = 0
cycle_time = 0.001

And klipper did accept it without any issue - so your klipper is accepting pwm configurations.

What to do next:

  1. If you have Arduino - launch it and try to test your Speaker module in arduino (you have some samples in device description link which you did post), this way you will be sure that your speaker module is working as intended and you are not trying to use faulty module.
  2. read about klipper architecture here: Klipper Architecture / Ecosystem
  3. try to change your definition of a buzzer to this:

[pwm_cycle_time buzzer]
pin = PB0
value = 0
shutdown_value = 0
cycle_time = 0.001

  1. I see in your config that you already have defined gcode command M300 which is very similar to /config/sample-macros.cfg for a BEEPER_pin, but for initial testing you should avoid it’s usage, use direct command

SET_PIN PIN=buzzer VALUE=2 CYCLE_TIME=0.001

  1. If you will get it working, then you can start using M300 command and other macros which uses M300 to play some sound sequences.
  2. Report your results.

Why i’m sending you to read about klipper architecture:
During this thread you was mentioning following

By looking at your logs and your few configs which you did post i see that you always was using pin = PB0 which is referencing some pin on your printer board (Main MCU) i did see usage of Rpi pins in logs but only for your chamber sensor, but nothing else, So you need to be clear what exact pin you are trying to use and where, how correctly reference it in config, because each MCU have different names for pins and you should use prefix if you referencing non main MCU.

1 Like