Welcome! Log In Create A New Profile


How to make buzzer beep at will?

Posted by R6_Addicted 
How to make buzzer beep at will?
May 16, 2014 09:15PM
Hi all,

I'm new here and wasn't sure if this question should be posted under the General or Electronics tab. Since you can't really go wrong with general, here I am.

My question is: how can i trigger the buzzer (I have one on my LCD panel, for example) either before/after or while printing? I did some research and found a gcode command (M300 S300 P1000 - where the SXXX defines frequency and PYYYY defines time in ms), but when using this command inside my gcode file I get no response from the buzzer when using Printrun 2014.03.10 nor when printing straight from the SD card.
I also saw that there is a command (run_script scriptname [arg1 ...]) that can be inserted in the gcode file to make printrun run a script (e.g. beep) but I'd have to know where to find this beep script, if it even exists within my system.

I'm assuming some firmware mods will be necessary here, just don't know where these should be done. Any help would be appreciated.

I'm using a Makerfarm 8' Prusa i3v with RAMPS 1.4. Let me know if you guys need any more information. Oh, and I usually use Slic3r 0.9.9 to generate my gcode files.
Re: How to make buzzer beep at will?
May 17, 2014 12:35AM
in marlin there is M42, it allows you to tun on any IO pin, even with PWM.

Depending on how you LCD buzzer is wired (check you pins.h for your board, look for #define BEEPER 37 for eg)

eg for a RRD LCD its

On: M42 P37 S255
Off: M42 P37 S0

You just add these you you start or end gcode file as needed.

So basically you have missed the two important bits, what firmware and what LCD with buzzer.

Edited 1 time(s). Last edit at 05/17/2014 12:37AM by Dust.
Re: How to make buzzer beep at will?
May 19, 2014 10:24PM
Hey Dust,

I knew I was missing something... my bad. The firmware is indeed Marlin and I'm not sure how to obtain the LCD type/version. But i took a look at the pins.h file you mentioned and you were spot on. Using the commands you posted worked just fine. Thank you.

Now, is it possible to set the duration of the beep? Right now I insert the 'turn on' command at a line within the code and the 'turn off' command at a couple of lines later, but it would be nice if I could specify a certain amount of time to have the buzzer on.
Re: How to make buzzer beep at will?
May 20, 2014 02:31AM
I don’t believe that possible with current firmware, you would need to hack that.
Sorry, only registered users may post in this forum.

Click here to login