MH-FMD not outputting proper tones

xXWesleyXx eckz
Posts: 4
Joined: Fri Jun 10, 2022 12:12 pm

MH-FMD not outputting proper tones

Postby xXWesleyXx eckz » Sat Mar 04, 2023 8:30 pm

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?
Last edited by xXWesleyXx eckz on Wed Mar 08, 2023 8:06 pm, edited 1 time in total.

ESP_Sprite
Posts: 9589
Joined: Thu Nov 26, 2015 4:08 am

Re: MH-FMD not outputting proper tones

Postby ESP_Sprite » Sun Mar 05, 2023 2:17 am

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.

xXWesleyXx eckz
Posts: 4
Joined: Fri Jun 10, 2022 12:12 pm

Re: MH-FMD not outputting proper tones

Postby xXWesleyXx eckz » Mon Mar 06, 2023 6:05 pm

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.

Who is online

Users browsing this forum: No registered users and 125 guests