Two Tone Detect and Batch file - Alert System

nated1992

Member
Premium Subscriber
Joined
Feb 9, 2013
Messages
168
Location
Asheville NC
#1
Hey i have been playing with two tone detect using a batch file to set off station tones when we receive a call. I wrote a short bat script which plays a audio file then when the record time starts the audio is past threw and i figured out how to rout this threw the computer and to our station amplifier to feed the speakers. With testing it i found it gets really clear sound and allows for configuring specific alert tones such as it announcing engine call on a tone or EMS call for another. I also found i liked it better then the Informer we had.

Has any one had any other use with this..

Im curious to find away to make it control other stuff such as lights or doors...

Thus would have to be software controlled. For apparent reason a relay isn't practical

So who else has used two tone and batch files and what have you came up with?
 

DC31

Member
Premium Subscriber
Joined
Feb 19, 2011
Messages
1,010
Location
Massachusetts
#2
Hey i have been playing with two tone detect using a batch file to set off station tones when we receive a call. I wrote a short bat script which plays a audio file then when the record time starts the audio is past threw and i figured out how to rout this threw the computer and to our station amplifier to feed the speakers. With testing it i found it gets really clear sound and allows for configuring specific alert tones such as it announcing engine call on a tone or EMS call for another. I also found i liked it better then the Informer we had.

Has any one had any other use with this..

Im curious to find away to make it control other stuff such as lights or doors...

Thus would have to be software controlled. For apparent reason a relay isn't practical

So who else has used two tone and batch files and what have you came up with?
My experience is with the raspberry pi $35 micro computer and python scripts rather than windows. Yes, you can make it do nearly anything that you can think of. You will need a relay that is CONTROLLED by the software. Then use this relay to control lights, open doors, etc. while you are at it you can also set up a web page on the pi that you can access from your smart phone with buttons that allow you to do all these things manually from your phone also.

Do a search on Amazon for sainsmart relay. http://www.amazon.com/SainSmart-2-C...s=Sainsmart&qid=1459857476&ref_=sr_1_5&sr=8-5

Be careful with overhead door control. You don't want someone in Over Yonder closing the door as your apparatus is driving through it! One of the most useful applications I can think of would be to control an electric door striker on a personnel door at an unmanned station. Your tones could make the door go unlocked for say 15 minutes upon tone activation. Or you could put a "open button" for your bay door on the outside of the station and wire the relay to make it active only for that 15 minute post-tone window.

I know of another user also putting together a station audio alerting system as you describe, using a pi.
 

nated1992

Member
Premium Subscriber
Joined
Feb 9, 2013
Messages
168
Location
Asheville NC
#5
My experience is with the raspberry pi $35 micro computer and python scripts rather than windows. Yes, you can make it do nearly anything that you can think of. You will need a relay that is CONTROLLED by the software. Then use this relay to control lights, open doors, etc. while you are at it you can also set up a web page on the pi that you can access from your smart phone with buttons that allow you to do all these things manually from your phone also.

Do a search on Amazon for sainsmart relay. http://www.amazon.com/SainSmart-2-C...s=Sainsmart&qid=1459857476&ref_=sr_1_5&sr=8-5

Be careful with overhead door control. You don't want someone in Over Yonder closing the door as your apparatus is driving through it! One of the most useful applications I can think of would be to control an electric door striker on a personnel door at an unmanned station. Your tones could make the door go unlocked for say 15 minutes upon tone activation. Or you could put a "open button" for your bay door on the outside of the station and wire the relay to make it active only for that 15 minute post-tone window.

I know of another user also putting together a station audio alerting system as you describe, using a pi.
Hey this sounds great i will have to look into it!
 

nated1992

Member
Premium Subscriber
Joined
Feb 9, 2013
Messages
168
Location
Asheville NC
#6
I build tone alert units for FD and volunteers, I also decode tones.
I have mine trip a gamewell bell for fire and a horn for the rescue / ambulance.
need more info k4stb@aol.com use gamewell in subject line
denis
Do you use software to do this our a pager and amplified charger... It sounds like the pager setups i have seen?
 

KB4RU

Member
Premium Subscriber
Joined
Jan 23, 2015
Messages
1
#7
I have been working on setting up TwoToneDetect in order to turn on a red LED light to illuminate a room, flash either a Blue, Green, or Red light indicating which tones dropped, and turn the radio on to overhead speakers. I was trying to use the SainSmart relay board, but had nothing but problems. I found using the KMTronic relay board is MUCH easier to right .bat files for. I put the USBRelay.exe on the C drive and uses command line to turn the relays on and off.

I made another .bat file that acts as a failsafe and turns on the radio audio all the time when TwoToneDetect closes or the computer turns off. When TTD is opened, it turns off the failsafe and turns the radio off.
 

davidVT

Member
Premium Subscriber
Joined
Aug 29, 2010
Messages
102
Location
Washington County,Vermont
#8
FYI I use MQTT , NODE-RED and inexpensive SONOFF wifi modules for alerting when my wood boiler needs wood or overheats. It works great!

I will soon connect the TTD system to NODE-RED in pursuit of alerting / turning on lights with pages.

I believe NODE-RED comes in the normal raspian OS for Pi and should coexist with TTD for those using TTD on Pi. NODE-RED will connect to the SONOFF wifi switch via your local wifi. You will also have to install a simple MQTT server (mosquito).

One could simply call a URL into NODE-RED from a batch file to trigger a light or other item with just NODE-RED and one of these wifi switches.

https://www.itead.cc/sonoff-wifi-wireless-switch.html

These switches need to have firmware changed to operate with MQTT&NODE-RED ( I prefer ESPEASY). The first time is challenging then quite easy after that. I am using the 4 channel SONOFF versions now. They might work well for having a different relay for different tones.

Once you get into NODE-RED there are a ton of things you can do with that including email, tweeting, etc.
:)

Ah, boiler light just came on, time to go out and feed the beast....

Sent from my iPad using Tapatalk
 
Last edited:

nated1992

Member
Premium Subscriber
Joined
Feb 9, 2013
Messages
168
Location
Asheville NC
#9
FYI I use MQTT , NODE-RED and inexpensive SONOFF wifi modules for alerting when my wood boiler needs wood or overheats. It works great!

I will soon connect the TTD system to NODE-RED in pursuit of alerting / turning on lights with pages.

I believe NODE-RED comes in the normal raspian OS for Pi and should coexist with TTD for those using TTD on Pi. NODE-RED will connect to the SONOFF wifi switch via your local wifi. You will also have to install a simple MQTT server (mosquito).

One could simply call a URL into NODE-RED from a batch file to trigger a light or other item with just NODE-RED and one of these wifi switches.

https://www.itead.cc/sonoff-wifi-wireless-switch.html

These switches need to have firmware changed to operate with MQTT&NODE-RED ( I prefer ESPEASY). The first time is challenging then quite easy after that. I am using the 4 channel SONOFF versions now. They might work well for having a different relay for different tones.

Once you get into NODE-RED there are a ton of things you can do with that including email, tweeting, etc.
:)

Ah, boiler light just came on, time to go out and feed the beast....

Sent from my iPad using Tapatalk
I will have to look into this I've been doing a lot with it and have came up with a pretty good system
 

DC31

Member
Premium Subscriber
Joined
Feb 19, 2011
Messages
1,010
Location
Massachusetts
#10
FYI I use MQTT , NODE-RED and inexpensive SONOFF wifi modules for alerting when my wood boiler needs wood or overheats. It works great!

I will soon connect the TTD system to NODE-RED in pursuit of alerting / turning on lights with pages.
I believe NODE-RED comes in the normal raspian OS for Pi and should coexist with TTD for those using TTD on Pi. NODE-RED will connect to the SONOFF wifi switch via your local wifi.

One could simply call a URL into NODE-RED from a batch file to trigger a light or other item with just NODE-RED and one of these wifi switches.

https://www.itead.cc/sonoff-wifi-wireless-switch.html

These switches need to have firmware changed to operate with NODE-RED. The first time is challenging then quite easy after that. I am using the 4 channel SONOFF versions now. They might work well for having a different relay for different tones.

Once you get into NODE-RED there are a ton of things you can do with that including email, tweeting, etc.
:)

Ah, boiler light just came on, time to go out and feed the beast....

Sent from my iPad using Tapatalk
Interesting. Are you controlling your wifi switches locally, or is that being done through a remote server as outlined on the Sonoff pages?

I have my domestic hot water heated by my wood boiler using a dedicated circulator pump and heat exchanger. A pi monitors top and bottom temperatures in the hot water tank and controls the circulator through Cayenne (mydevices.com). I have found their server a little unreliable so have also hard coded a high temp limit directly into the pi as a backup to the Cayenne control. Curious as to how reliable you have found the sonoff server, if your setup uses it.

I have had no trouble controlling a SainSmart relay with my pi.
 

davidVT

Member
Premium Subscriber
Joined
Aug 29, 2010
Messages
102
Location
Washington County,Vermont
#11
I like the Sainsmart relay idea. I need some switches for low power switching and those might work well. I am moving away from Pi towards esp8266 for wifi hardware control. Will see if these relays will work on the slightly lower voltage.

The SONOFF are only switching mains voltage so 110vac in most cases here but ok in Europe also.

The SONOFF server is replaced with a local MQTT server and NODE-RED which both can easily run on the Pi. My MQTT is on a virtual Debian box. The SONOFF needs to have it's firmware flashed to use the above for which there are many options. I use EASYESP which does what I need. What I like about EASYESP is that it has local rules. Example you could connect a temp sensor to the SONOFF and use that SONOFF to not only do the communication to your local server but also program a fail safe temperature to power the circulator on it's own. Of course a mechanical thermal snap switch or aquastat could do that also but what is the fun in that?

My 4 relay SONOFF also now has a RJ45 jack to support a string of one wire temperature sensors.

So, sensors feed MQTT server which feeds NODE-RED. NR evaluates the temp data and makes decisions to alert us by turning on SONOFF switches with lights attached.
The setup is IOT so house lights are on sunset timers etc.
I can log into the house from anywhere and check on things.
IFTTT can see my phone when I get home so to automatically turn lights on via a URL to NODe-RED if needed.. :)

Some good YouTube stuff on the SONOFF mods.

UPDATE:
For just turning on a light, you can skip most of the above.
Use EASYESP firmware update on SONOFF and command the unit directly via a URL from TTD batch file.
Example: (the IP is one of the Sonoff's at my home)
http://192.168.0.183/control?cmd=GPIO,12,1
Turns relay on
http://192.168.0.183/control?cmd=GPIO,12,0
Turns relay off
(Or perhaps use the local rules for a timer to turn it off)

So on my TTD Pi I made a script (lighton.sh) and did chmod +x and ran if from the command line successfully. The SONOFF connected light came on!!
----lighton.sh---
content=$(wget http://192.168.0.183/control?cmd=GPIO,12,1)
echo $content
-----------------
Can someone help me with my TTD Pi for exactly how to put this script in tones.cfg and where the script needs to live so I can finish the test??


Remember with the MQTT server and NODE-RED you can control countless of these SONOFFs all over a house (or fire house) and make complicated rules for them etc etc


Sent from my iPad using Tapatalk
 
Last edited:

DC31

Member
Premium Subscriber
Joined
Feb 19, 2011
Messages
1,010
Location
Massachusetts
#12
I



So on my TTD Pi I made a script (lighton.sh) and did chmod +x and ran if from the command line successfully. The SONOFF connected light came on!!
----lighton.sh---
content=$(wget http://192.168.0.183/control?cmd=GPIO,12,1)
echo $content
-----------------
Can someone help me with my TTD Pi for exactly how to put this script in tones.cfg and where the script needs to live so I can finish the test??
From TwoToneDetect.net:

Version 51 Release Notes:
– Added two optional parameters that can be added to each tone set in the tones.cfg file:
alert_command – this is a command line that will be executed immediately upon detection of a valid tone set
post_email_command – this is a command line that will be executed after a valid tone set has been detected and emails have been sent
– The program will now re-read the email information from the tones.cfg file each time a valid tone set is detected. Note that it does NOT reread all info from the tones.cfg file, only the email info

So, add another line in your [ToneX] section: alert_command = lighton.sh

Your lighton.sh script needs to be in the same directory as your TTD program file.

I think that will work, the ones that i have used are python scripts and i use alert_command = python XXX.py

Jim
 

davidVT

Member
Premium Subscriber
Joined
Aug 29, 2010
Messages
102
Location
Washington County,Vermont
#14


Four channel din mount SONOFF all set for test tones. 3 of the 4 relay/LED combos are set to my three important tone sets. Just using the alert command script in TTD. Fingers crossed.

Currently the relay will simply be reset by the button on the unit. A timer can be implemented locally to reset but no time to do that for now.


Sent from my iPhone using Tapatalk
 

nated1992

Member
Premium Subscriber
Joined
Feb 9, 2013
Messages
168
Location
Asheville NC
#16
Just an interesting update:
There are new sonoff 'pro' 4 channel units with dry contacts rather than line powered contacts. That creates new options for using the sonoff with TTD for signaling and perhaps audio switching (ymmv).

https://www.itead.cc/sonoff-4ch-pro.html




Sent from my iPad using Tapatalk
I actually have a extremely stable version of this working on both Linux and Windows. The windows version uses USB Relays and the Linux uses the Pi GPIO pins.

I have a contract with The Maker of TTD to resale it as a whole unit, Or i sell just the pi and scripts with instructions on how to use it with TTD "Usually its easier to sale the whole unit If i would actually sell any" I hope to add more features to the scripts but currently...
Will do all the features of the TTD Software.
Will turn on relay boards USB or GPIO "I like the Pi version better"
Will sound an alert tone before playing the audio can do a different sound to each separate tone set "alternatively the audio can be constantly passed through to always here the scanner/radio"
The audio can be set to play for different duration 1 to whatever seconds
The relays can be set to time out or stay on until a rest is pressed.

I am sending a message today to see if i can get a editable version to the GUI to change and add some options for my scripts.
 
Top