Marking Time - Controlling a Noisemaker from a PC?
fallen1 asks: "My company is engaged in making trusses for various home, business, and industrial applications. One thing our truss plant does not have is a signal device to keep everyone on schedule for shift starts, breaks, lunch, and so on. Currently the plant manager is responsible for making sure everyone takes off when they are supposed to. This is, of course, highly inefficient and is causing problems. They approached me, asking to research into time control devices that can signal all the starts and stops (our time clock is integrated into our POS/sales system). Of course, one of my first stops was Slashdot ;-). Please keep in mind I am fairly new to Linux. So, in the interest of trying to keep the cost down, does anyone know of a Linux software/hardware combo that can control a horn or bell - as well as length of ring/tone - for multiple events? Any feedback would be greatly appreciated." A friend of mine once wired his CD remote control to the computer and wrote a simple timer in C: Voila! A simple alarm clock (assuming the remote was pointed in the right direction). A similar principle would also work here. You could tie a computer to the aux-in of an amp, which is in turn tied to LARGE speakers at both ends of the plant, and have it make the right noises at the right time. I'm sure this has been done in a variety of ways, before. If you've done something like this with a computer, particularly at an industrial scale, please share the details.
Wouldn't it make sense to buy one of those bell systems for far less? One that configures itself? Maybe a Linux box connecting to the time tracking system would make sense if you changed schedules a lot, but having a computer do this kind of work seems like overkill.
Well, seeing as the computer has a good clock, just use cron to either :
a. play an MP3/WAV/AU whatever over the sound card, which in turn is plugged into the speaker
b. make some noise over the PC speaker (if for whatever reason you don't have a sound card, course this would require a little wiring, but not a whole hell of a lot)
all you need to do is hook up a piezoelectric alarm to a voltage capacitor connected to the serial port.
No fancy serial port crap. No goofy controllers.
Crontab.
mpg123.
Appropriate sound card drivers.
A decently loud speaker setup.
A refurbished laptop would work excellent for this. Even an old one. Hell, I gotta 133mhz sitting here. Gimme 50 bucks for it. I'll even do the install.
Hm. No, I think I'll use it for a firewall. But you get the idea.
- billn
There are two ways to do it.
:) ).
I will assume that this is a large place.
Your going to have to install wiring for speakers and the speakers themselves (or whatever your favorite 110 decibel alarm system has.. >:) ). Make sure all the wiring terminates in the room with the computer.
If they are speakers, sure, that $50 amp at radioshack would prolly work. (louder if needed, but the point is the same). In this case, mpg123 or xmms would would perfectly. (provided no one has a playlist running
Of course, if your a hardware hacker, there are numerous ways to write simple C programs to interface with the printer port, and also corresponding eletronic kits that can be set up as computer controlled relays and such.
Of course, where you where wanting different sounds for different events ("everyone stand for the coporate anthem"), then the mp3 or a wav player hooked up to an amp would be much more versitile, cost about the same, and be a lot easier to set up.
This
I wrote a program to control a parallel (printer) port. It's easy, in several languages. There are eight data lines, so you have eight outputs.
It is possible to buy power controllers that control 30 amps from an isolated 5 milliampere 5 volt input, which is perfect for controlling from a computer.
My comment above is only relevant if you need a seriously loud siren. In many large factories, this is necessary, because speakers just don't make enough sound. The sirens run on AC power, and would need to be controlled from a PC port.
If you have a sound system that is loud enough to signal to everyone, it is better to use a PC sound card, and control that from a timer program, as someone has said above. An advantage of a sound system is that you can configure the sound easily, and you can use it for voice.
I've seen x86 hardware running linux being used to control bells, lights, radios, etc at firestations for dispatch alerting. It was done with some custom made hardware controlled from the serial port that had relays that were used to control the devices. It was a headless solution that took all its user input from at keypad and display on a multiline text lcd. I'm pretty sure the relay box and software was custom for this, but you may be able to find a vendor that sells gear like this. So, yes, its possible, but no I don't know of an off the shelf solution.
Step 1: FORGET LINUX
Step 2: Go down to walmart and pick up 3 or 4 five-dollar alarm clocks.
Step 3: Wire the speaker outputs of each alarm clock to your PA system.
Label each clock for what the alarm is set for. Or maybe you could spend a few extra bucks and get one that has multiple alarms instead of 3 separate alarm clocks.
Or even better, use windows, download a shareware program that plays sound events. Then you don't have to worry about compiling in sound support, x,y,z, the headaches, trials and tribulations you will go thru being "new to linux" just to get some stupid clock setup.
Don't bother. I'm almost certain you can get some sort of standalone commercial timer unit also. For much cheaper.
Cool! Amazing Toys.
After realiseing just how quiet my alarm clock is, Ijust use my computer... set it to play full volume when I want to wake up (Beethoven's 5th Symphony is great to wake you up... rather starling too... never slept past the first 4 notes yet!)
As others have said, there's countless ways to do it, the simplest is to have a audio player play a file at a given time (or, for a schedualed event. IE, all shift changes have one sound, breaks another etc). Provideing your computer has a sound card in it, should be simple enough to hook it up to your PA system.
Forget cobbling up a Goldberg contraption. Go to your local marine store and buy some air power horns. Have the shop foreman blow the horns.
Honestly Linux is overkill, as is a full computer. Chances are, however, very good that speed of development is paramount - it doesn't have to work so good the first time, just make it work. Then we'll evaluate it and refine it.
.NET server, including every reasonable Linux/Unix/BSD solution you can come up with.
Therefore I'm going to stun, and yes, even shock, the slashdot crowd. I may be publicly skewered, but in the interest of your job and sanity:
Use DOS - 6.22 ought to work fine, but whatever you can find lying around will work. Make a simple QBasic program that has a simple interface, and makes simple sounds. It all fits onto one floppy disk, and runs under dos 3.x, through windows
Make it do simple beeps to the PC speaker and amplify it, or hook the parallel port up to a large bell or beeper. It'll fit on a single floppy, and will run on that old accounting computer no one wants to use.
If you want to have different sounds you can throw a sound card and hard drive in there and load a simple dos WAV player which won't take much CPU power. These can be called from Qbasic (or your language of choice - Turbo C 2 is free and comes with a useful IDE)
This project should take you an hour if you buy a PA system from Radio Shack. Your Boss will be impressed at your elite hacking skills, and you will be revered by workers across the factory floor.
And when you leave/get fired you can have it play "Who let the dogs out" or somesuch.
-Adam
Don't bother setting up a computer system and hacking something out. Instead, just use something like The Work Alerter, which is ready-made and allows up to 32 events. It even includes a speaker and you can set the duration of the sound from 1 to 99 seconds. It looks like additional speakers can be attached. It has a low cost of $389 and probably more reliable than hacking out a computer setup. Sometimes the right tool for the job is not Linux on a computer system.
(I'm not affiliated with them, it was just the first place listed in my search results.)
First, get one of those atomic clock receiver cards to keep the PC time right, then pick one of the dozens of scripts that will cover this page to do the work and output through a sound card to an amp and the existing speakers.
Eve Fairbanks says I drive a hybrid!LOL
I realize that you most probably know your environment - certainly better than I do - and that you have been given a task to do (implement scheduled noise alerts), but from your brief description I can't help but wonder if the degree of, um, discipline that you seek to enforce is really counter-productive. Environments where I've worked where employees are free to decide where their breaks will be, how long they are, or if they should skip them to finish this detail they are working on, things seem to be happier and more in control.
I know, I'm being idealistic and probably unrealistic, but it needs to be said, and there, I said it.
Good luck.
DB
If it was connected to the internet, you could even have cron make sure the time was correct to some atomic clock every now and then.
Not to belabor the bleeding obvious or anything... But, back when I played EverQuest, I found I had a duty cycle (time actively playing vs time spent sitting there staring at the screen) of about 20%. (Generally 8+ minutes down to 2 minutes of fun. There's a reason I quit the game.) So I wrote this quick timer script to let me know when it was time to stop what I was doing and play the game again.
Nowadays, all I use it for is to time my laundry... Perhaps it would be of use to you? Particularly when combined with:
date "+%H"
date "+%M"
date "+%S"
For output: Run the soundcard line-out into your PA system with a patch-cord.
Sound files: I'm using .snd files from an old NeXT archive I found on the net, (http://www.peak.org/next/sound/soundfiles/), which is why I need to pass "-t .au" to play. You could always just record your own...
#!/bin/tcsh -f
.au ${SOUND}
# This will clear the screen in an X-TERM.
# Note: ^[ is a single character -- the ESCAPE character.
echo -n "^[[H^[[2J"
set TIMES = ""
set SOUNDS = ""
while ( $#argv > 0 )
if ( $1 =~ *.snd ) then
set SOUNDS = ( ${SOUNDS} $1 )
else
set TIMES = ( $TIMES $1 )
endif
shift
end
if ( "x${TIMES}" == "x" ) then
set COUNT = 500
else if ( ${#TIMES} == 1 ) then
set COUNT = ${TIMES[1]}
else if ( ${#TIMES} == 2 ) then
@ COUNT = ( ${TIMES[1]} * 60 ) + ${TIMES[2]}
else
if ( ${#TIMES} > 3 ) echo "Warning Ignoring extra numbers: ${TIMES[4-]}"
@ COUNT = ( ${TIMES[1]} * 3600 ) + ( ${TIMES[2]} * 60 ) + ${TIMES[3]}
endif
while ( ${COUNT} >= 0 )
@ HOURS = ${COUNT} / 3600
@ MINUTES = ( ${COUNT} % 3600 ) / 60
@ SECONDS = ${COUNT} % 60
echo -n " "
if ( ${HOURS} > 0 ) echo -n "${HOURS}:"
echo -n "${MINUTES}:${SECONDS}"
echo -n " "
echo -n "(${COUNT})"
echo -n " "
echo -n "\r"
sleep 1
@ COUNT --
end
echo ""
if ( "x${SOUNDS}" == "x" ) then
echo "\a"
echo "\a"
else
foreach SOUND ( ${SOUNDS} )
play -t
end
endif
--
This is filler to bring up the average number of characters per line to avoid the slashdot/slashcode lameness filter. What an annoying piece of crud. I have to sit here typing endless worthless characters, and you need to pay for the bandwidth for them, all so my entry won't be considered lame. La de da... Oh what to say. How about griping about how Slashcode doesn't support the < PRE > HTML tag, which makes it such a pain to enter properly indented code... Oh well. At least it has < TT >, without which things would really be difficult. Ok. Is that enough nonsense yet? Nope. Not yet. Still needs more. Oh what to say. What to say... Running out of things to say here... Do you guys have any thoughts? Probably not... Ok. Lets try again... Still nothing. Needs yet more characters. And more. And more. Ok. Repeating entire line so far... This is filler to bring up the average number of characters per line to avoid the slashdot/slashcode lameness filter. What an annoying piece of crud. I have to sit here typing endless worthless characters, and you need to pay for the bandwidth for them, all so my entry won't be considered lame. La de da... Oh what to say. How about griping about how Slashcode doesn't support the < PRE > HTML tag, which makes it such a pain to enter properly indented code... Oh well. At least it has < TT >, without which things would really be difficult. Ok. Is that enough nonsense yet? Nope. Not yet. Still needs more. Oh what to say. What to say... Running out of things to say here... Do you guys have any thoughts? Probably not... Ok. Lets try again... Still nothing. Needs yet more characters. And more. And more. Ok. Repeating entire line so far...
start->run "tasks" (at least in XP. you should be able to find it for other versions). add a task to play a sound file, and leave your speakers on.
My server