cancel
Showing results for 
Search instead for 
Did you mean: 

(Answered) MCSDK 5.Y.4: Use motor as speaker to output an audible Alarm (beep, siren, ...)?

TThan
Associate III

Hi All,

Background: during my very first experiments with the STM32 Motor Control SDK 5.Y.2 I did hear something like a two tone alarm coming from the motor when a critical overcurrent or overload situation occured. I was pretty sure at that time, there there must be some routine that uses the motor as a speaker to emit such a beep when required.

Topic: With my current project it would be quite handy to be able to output a short beep in some situations without having to assemble dedicated speaker or beeper. But I could not find a piece of code in the MCSDK-Lib that is related to such a function.

Question: My question is now, whether the alarm I did hear with the older MCSDK was just an artifact of the motor control. Or was this an intended functionality and got removed during the code cleanup in 5.Y.4?

Has anyone used a motor as speaker with the MCSDK already? In my opinion that should be possible since a motor and a speaker are not very different.

Regards

Thomas

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

I have in mind MC Workbench 5.Y.4. look at the attached screen shot.

The example is not ported yet on version 6.

Regards

Cedric

0693W00000SwFrIQAV.png

View solution in original post

7 REPLIES 7
Javier1
Principal

>In my opinion that should be possible since a motor and a speaker are not very different.

A motor is built to spin , not to make sound.

Every sound you hear from a motor (For example drone ESCs beeping their motors before starting up) comes from mechanical stress/ air violently being pushed away by violent shaking.

There is many ways of archieving this but the one i have seen is to toggle back and forth the motor at the desired frecuency around one of the windings, this creates the beeep sound, heats the coils (youre shorting the coils at low/idle speeds) and makes the motor sad if sustained for a long time.

Take a look at Vesc project https://vesc-project.com/node/647 you might find useful stuff

we dont need to firmware by ourselves, lets talk
TThan
Associate III

Hi Javier,

thank you for the insights. Yes, I am aware that producing sound with the motor puts some stress on the device. And yes, creating a piece of code that tortues a motor in a way to produce sound is definitely a possible solution.

But I think there might be such a piece of code already hidden inside the dungeons of MCSDK, because I did hear a well defined sound output from my motor (sounded like a low/high frequency toggle with a well defined period of about 1 second) some a time ago when still using MCSDK 5.Y.2.

If there is such a funtion still avalible in the MCSDK, I would like to use it for a little user feedback. If not, then it is okay.

I just would like to knwo of any other user has heard this sound from a motor controlled by the MCSDK, too.

Regards

Thomas

Hi Thomas,

You are right, we have indeed specific code to generate some tones with the motor. To have access to it, select the ESC-G4 board from the example list. (Be aware to select it from the example list and not from the board selector).

The code you are looking for is in esc.c file and there is a dedicated esc_beep_loop function.

Best Regards

Cedric

Hi Cedric,

thank you very much! This is answer I was looking for :grinning_face:

Best Regards

Thomas

Dear Cedric,

please allow me one more question,

When you say "select the ESC-G4 board from the example list" which application or web site do you have in mind?

I did create some code from the MotorControl Workbench 5.Y.4 and 6.0.0, but none of them do have somthing like "new project from example". And the generated code does not contain an esc.c file.

And although the STM32CubeMX 6.6.1 does have an example list, it knows nothing about a ESC-G4 (B-G431-ESC1) board. So which application should I look for? Thank you!

Best Regards

Thomas

Hi,

I have in mind MC Workbench 5.Y.4. look at the attached screen shot.

The example is not ported yet on version 6.

Regards

Cedric

0693W00000SwFrIQAV.png

TThan
Associate III

Hi Cedric,

thank you very much for helping a blind man to find his project :beaming_face_with_smiling_eyes:

Best Regards

Thomas