Jump to content

The Beeper Thread


ChicagoKeri

Recommended Posts

 

 

Hi everyone!

Let's start a thread to discuss adding beepers to our often entirely mute Vorons...

I often do prints with a color change. Thus, it would be convenient to have the printer beep or make some kind of noise when it needs attention.

Unfortunately, I built my 2.4 with Klipper Screen, using a Pi TFT43.  Neither the TFT43 or the Octopus has an onboard beeper.  The Raspberry Pi does have a speaker output, but I couldn't find a way to utilize this in Klipper.

At first I thought to use a small 5v powered MP3 player and connect it to a fan port.  This actually worked, but only plays one tune.

Then I found beeper tunes for Klipper. This could be great, but there is no speaker. But there can be one!

A look at the schematic for the Octopus shows a dedicated Beeper pin on Display Connector EXP1, pin 1. 

OctopusEXP1pinout.png.e850a54945c11e1bcb1aae63264a9f15.png

 

So, I connected a piezo beeper between EXP1-1 and EXP1-9 , installed some Beeper tunes and Yuck! it sounds really bad! 

It seems that the most common piezo beepers are Active, with a small oscillator built in.  The allows the beeper to work with a DC voltage connected to the wires.

What I needed is a Passive piezo beeper, as the input signal from EXP1-1 is already an alternating current, or at least rapidly switched DC.

So, I salvaged a small computer beeper and it works! The tunes play as intended.  Pretty quiet though.... I would have to be nearby to hear it.  

 

 

A further look at the schematic for a compatible LCD controller with a beeper shows what I need to see... a rudimentary amplifier in the form of a single NPN transistor increases the current to the passive piezo beeper.

ControllerEXP1pinout.png.69fa8afab755857e5b2d2da3b7e0b718.png

 

So, I gutted my Active piezo beeper, ripped out the oscillator board and stuck in an NPN transistor and a 470 ohm resistor... and it didn't work very well.

IMG_4747.thumb.jpg.3f8e8fda2862b40389bc64af33239541.jpg

 

So, I tried it with various small speakers. The best result was with a 16 ohm 36mm diameter speaker with the NPN transistor soldered directly onto a speaker terminal in the "Dead Bug" style. It is plenty loud running on VCC 5v from EXP1-10. For more power, one could build a small mono amplifier and even utilize the 24v power supply. That could potentially rattle windows with a suitable speaker...

IMG_4752.thumb.jpg.4c9e22a4f98a2199c234243c41ffbb2c.jpg

 

Fortunately, the 36mm speaker fits right into the housing of the now defunct piezo beeper. I made a very short video of it playing but it won't upload here...

 

So, it's time for some Klipper Kode! I have a separate file for the tunes called "tunes.cfg" with some fun tunes to choose from.

 

 

######################################################################
# Beeper
######################################################################

# M300 : Play tone. Beeper support, as commonly found on usual LCD
# displays (i.e. RepRapDiscount 2004 Smart Controller, RepRapDiscount
# 12864 Full Graphic). This defines a custom I/O pin and a custom
# GCODE macro.  Usage:
#   M300 [P<ms>] [S<Hz>]
#   P is the tone duration, S the tone frequency.
# The frequency won't be pitch perfect.

[include tunes.cfg]

[output_pin BEEPER_pin]
pin: PE8
#   Beeper pin. This parameter must be provided.
#   ar37 is the default RAMPS/MKS pin.
pwm: True
#   A piezo beeper needs a PWM signal, a DC buzzer doesn't.
value: 0
#   Silent at power on, set to 1 if active low.
shutdown_value: 0
#   Disable at emergency shutdown (no PWM would be available anyway).
cycle_time: 0.001
#   Default PWM frequency : 0.001 = 1ms will give a tone of 1kHz
#   Although not pitch perfect.

[gcode_macro M300]
gcode:
    # Use a default 1kHz tone if S is omitted.
    {% set S = params.S|default(1000)|int %}
    # Use a 10ms duration is P is omitted.
    {% set P = params.P|default(100)|int %}
    SET_PIN PIN=BEEPER_pin VALUE=0.5 CYCLE_TIME={ 1.0/S if S > 0 else 1 }
    G4 P{P}
    SET_PIN PIN=BEEPER_pin VALUE=0

 


Yay! beeps, boops, Mario tunes and various other noises.  Now I just gotta figure out how to play them for specific events like change filament, end print and so on...

 

 

 

 

 

 

 

  • Like 4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...