M1nn code to trigger an "alarm/sound loop" when G-code finishes?

  • clunc
  • clunc's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
18 Jan 2023 19:21 #262360 by clunc
Has anyone here seen user M-code to trigger an alarm or other audible indication that a program has finished?  It's fairly easy for a trained ear to understand when a program is done, but audio confirmation would be good to indicate when it has ended predictably.

Thank you.

Please Log in or Create an account to join the conversation.

  • my1987toyota
  • my1987toyota's Avatar
  • Away
  • Platinum Member
  • Platinum Member
More
18 Jan 2023 19:32 - 18 Jan 2023 19:39 #262361 by my1987toyota
Are you looking for just a simple buzzer or for it to make different sounds to mean different things when the program ends?
Also what kind of board are you using ? Parallel port , mesa, ect? You may also want to try an  M64 P code to turn the
alarm on and an M65 P code to turn it off.
Last edit: 18 Jan 2023 19:39 by my1987toyota. Reason: adding info

Please Log in or Create an account to join the conversation.

More
19 Jan 2023 14:12 #262417 by andypugh
The M100+ codes can be any executable file, so maybe

M101
#! /usr/env python
import os
file = "file.mp3"
os.system("mpg123 " + file)

Maybe?

mpg123 is not part of a standard LinuxCNC install, you would need to install it, or some other sound-making app.

There is also the possibility of triggering the pc speaker direct from HAL. There is a component "hal_speaker"
github.com/LinuxCNC/linuxcnc/blob/2.8/sr...rivers/hal_speaker.c
Though it seems to have no documentation so is hard to know about.
So feeding a siggen into that is a way to make an (unpleasant) noise.
The following user(s) said Thank You: my1987toyota

Please Log in or Create an account to join the conversation.

  • clunc
  • clunc's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
19 Jan 2023 15:34 #262420 by clunc

Are you looking for just a simple buzzer or for it to make different sounds to mean different things when the program ends?
Also what kind of board are you using ? Parallel port , mesa, ect? You may also want to try an  M64 P code to turn the
alarm on and an M65 P code to turn it off.
 

I was thinking a simple noisemaker that passersby could recognize to go turn the machine off. 

I'm now running a 6i25 (5i25 variant) parport interface.

I was not familiar with M64/M65, but a software solution would be easier for me to pull off.

Please Log in or Create an account to join the conversation.

  • clunc
  • clunc's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
19 Jan 2023 15:50 #262421 by clunc

The M100+ codes can be any executable file, so maybe

M101
#! /usr/env python
import os
file = "file.mp3"
os.system("mpg123 " + file)

Maybe?

mpg123 is not part of a standard LinuxCNC install, you would need to install it, or some other sound-making app.
 

Oh, boy, this is exactly the possibility I hoped for.

There is also the possibility of triggering the pc speaker direct from HAL. There is a component "hal_speaker"
https://github.com/LinuxCNC/linuxcnc/blob/2.8/src/hal/drivers/hal_speaker.c
Though it seems to have no documentation so is hard to know about.
So feeding a siggen into that is a way to make an (unpleasant) noise.

Sound-making apps I got.  PC speaker possibly not (Dell OptiPlex 780)...

...WHICH I see makes questions about "how to make a sound" appear premature...

...AND a search of the "setup" documentation from Dell for that model for the word "speaker" turns up nil.

(I suppose this is the part where I go out and buy a sound board more expensive than the original computer.)

Thanks, all!

Please Log in or Create an account to join the conversation.

More
19 Jan 2023 16:16 - 19 Jan 2023 16:17 #262425 by Aciera
While it may not have a speaker it will probably have a connector for head phones to plug in an active speaker.
Last edit: 19 Jan 2023 16:17 by Aciera.

Please Log in or Create an account to join the conversation.

  • clunc
  • clunc's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
20 Jan 2023 14:23 #262493 by clunc
Aciera, indeed, but I don't have the shelf space or power outlet to supply it!

At one time, I had a video cam setup to record a snapshot every so often to disk which a tiny webserver then offered for remote access through a hole in my firewall so I could check progress at work and phone home to get someone to turn it off. (I don't even recognize the fellow that was able to do that! I can barely remember where I left my glasses.)

Thanks and cheers!

Please Log in or Create an account to join the conversation.

More
20 Jan 2023 14:45 #262497 by Aciera
These days there are active speakers that run on 5V (your PC does have a power supply) and fits into the palm of your hand. But then you would have to stand there and hold it all the time ;)

Please Log in or Create an account to join the conversation.

  • clunc
  • clunc's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
20 Jan 2023 14:47 #262498 by clunc
I found out that while Dell shipped OptiPlex 780s with "PC Speaker optional" (and mine doesn't have it), a beeper remained standard issue to issue diagnostic beep codes at boost.

This helpful site offered a number of ways to sound the beeper and speaker, and I verified that I can make the beeper work with:
for i in {1..1000000}; do echo $i; sudo sh -c "echo -e '\a' > /dev/console"; sleep 2; done

At the moment, it can't be heard over the machine while it's cutting, but if it still can't be heard over the machine at-idle, I'll see if I can upgrade the 12-yr-old machine with a speaker.  (The baeldung site referenced even has code to play tunes on the speaker! DA-da-da-DA-da-DA!)

Please Log in or Create an account to join the conversation.

  • clunc
  • clunc's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
20 Jan 2023 14:52 #262499 by clunc
Aciera, I'm glad you told me about "These days" because increasingly I find myself asking myself "WHEN did THAT happen?!" I know there's 5V on USB, so I'll guess there's such things as a USB speaker and hunt one down.

Thank you.

Please Log in or Create an account to join the conversation.

Time to create page: 0.075 seconds
Powered by Kunena Forum