Adding a simple speaker

I did some digging around on the forum and online with no luck.

I have the v1.1 T-Beam and am wondering how hard it would be to add one of these buzzers to notify when a message is received, or location locked, etc. Surely someone has done this already.

I am pretty much starting from scratch with my coding skills, but if it shouldn’t be too hard I’m willing to learn it.

1 Like

That’s a good idea.

File a feature request. Wouldn’t be hard to build support for that.

Once you file the request, give me the url here and I’ll take it on. No promise on the timeline, I have some personal stuff coming up but this is totally doable.

When it’s ready and if you’d like, I’ll walk you through the code so you can learn how it works. Maybe you can then make changes to it to make it even more usable :slight_smile:

It might be possible to borrow the required code for the speaker from GitHub - jasonfish/TTGO-T-Beam

Actually, also the range testing part would be nice :grin:

2 Likes

I was thinking of generalizing it to work for multiple external signaling devices. Maybe you want a buzzer, maybe an led, or maybe you want a pneumatic fog horn.

Thanks for the link to that reference. I had never gone through it.

4 Likes

@IZ1IVA Ah yes that’s exactly what I had in mind! I was driving around a node on a mountain trying to range test, and driving and reading the minuscule screen was difficult!

@mc-hamster Here is the link!

You’re the bomb! I would love to learn that.

2 Likes

I was able to squeeze in a few moments tonight. Check your feature request for the work in progress. I won’t have time to get back to it for a few days. I kinda over engineered it, oops :). It’s been generalized so it’ll work for as many use cases as I could think up.

Feature list:

  • Disabled by default.
  • Can be configured by the python API or soon Meshtastic-Web (This is not yet done.)
  • The GPIO is configurable (you can use any GPIO), default is GPIO 13.
  • Configurable support for both active high and active low logic circuits. This means you can directly operate LEDs, Active Buzzers, P-Channel Mosfet, N-Channel Mosfets, all forms of transistors or relays – all without changing the code.
  • Configurable output notification period (eg: How long you want it to go buzzzzzzzz)
  • Configurable support for the ASCII BELL command. This is a special character on the ASCII character set that is supposed to trigger a bell. In other words, instead of being alerted on every incoming message, the sender can send a message that would directly trigger the external output. Support for this will need to be put into Meshastic Web and Android, but at least the plugin will do it.
  • Configurable support to alert on oncoming text messages. – This is what you originally asked for.

The change is currently untested, but we’ll have this … eventually.

Read more on the bell character:

… Now that I think of it, the Python API would be able to send the BELL command today without changes, so that would work.

6 Likes

Amazing!

Is this in your Jan 28th nightly build? I only had time to flash both of my T-Beams this morning with the latest nightly. But when I get home I have a speaker ready to give it a try as well as sanity.

Can I enable and configure this in Command Prompt?

Thanks again!

1 Like

The configuration piece is not done yet and its the plugin is completely untested. I won’t have time to test it out for a while or get back to it to finish off. It should work but this was three hours of code, written in bed, without running it on a device while watching reruns of Stargate SG1. :slight_smile:

If you wanna try it out (or help finish it off), it’s still in my private branch:

https://github.com/mc-hamster/Meshtastic-device/blob/master/src/plugins/ExternalNotificationPlugin.cpp

Easiest to use an led or active buzzer for this version. I built it with this in mind:

https://amzn.to/3t7Urm6

1 Like

Ah, right. I’m at the skill level where I can use the python API, but I wasn’t even sure what it was called hahaha.

I’d love to try it out, and I would love to contribute, but I’m not sure where to start, or what sort of tutorials I should even start with to learn the required skills.

Right now I only know how to flash my board using the .bin file, and configure a few things using the API. I’m not sure how I could try your plugin if I wanted to, but I want to learn! :joy:

2 Likes

This is a really fun project to learn. I started with one of the tickets marked as “Good first issue” that I thought would have been totally straight forward – adding just a few lines of information to the display. Here’s the list:

Even though that was to just add a few lines and really was just a lot of copy/paste, it took me two weeks to get the change done – and I spent way too many hours on it. I really struggled with platform io (my first time using it) and while I had recently done small projects, I wasn’t neck deep in C in almost 20 years and almost no prior C++ experience.

After working on the screen, I took a free course on Udemy “C++ Tutorial for Complete Beginners”, and honestly I’ve only finished half of it. It’s 18 hours long. Here’s a link to the course:

3 Likes