Page 1 of 1

MH-FMD not outputting proper tones

Posted: Sat Mar 04, 2023 8:30 pm
by xXWesleyXx eckz
I'm trying to generate a loud tone, any loud tone, from a MH-FMD low level buzzer.
I've just started working with hardware, so I see no problem with what I'm doing, wondering if other people do.
vcc is wired to vin(5v), gnd to gnd and IO to D13.
my code is simple:

Code: Select all

#include <stdbool.h>

#include "driver/gpio.h"

bool reboot = false;

void app_main(void)
{
	gpio_reset_pin(13);
	gpio_set_direction(13, GPIO_MODE_OUTPUT);
	bool on = true;
	while(1)
	{
		gpio_set_level(13, on);
		on = !on;
	}
}
I'm trying to build an alarm clock and the sound produced by this code/wiring wouldn't wake me if I used the module as an earplug.
Any help would be appreciated.

EDIT: Turns out the buzzer was broken, ordered a new one and it worked perfectly.
How do I delete a post?

Re: MH-FMD not outputting proper tones

Posted: Sun Mar 05, 2023 2:17 am
by ESP_Sprite
Yeah, you're sending out an unknown and probably too high to hear frequency. If you're using ESP-IDF, check the RMT examples; there's a morse one that likely comes close to what you want.

Re: MH-FMD not outputting proper tones

Posted: Mon Mar 06, 2023 6:05 pm
by xXWesleyXx eckz
The frequency is a steady 2300Hz, I shouldnt even have to flip the signal. it's an active buzzer, no oscillation needed.
I'm no expert in Hertzes(this is the correct plural) but I've seen youtube video's where this thing creates a lot of noise, so the frequency should be fine.
I've been looking at the rmt examples but they seem to be busted, code doesn't want to compile. trying to fix it causes more errors in component library files.
Steady current should work but doesn't.... I think my buzzer might've been delivered broken.