Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Simple SMS Unit to integration into Alarm System

Status
Not open for further replies.
Greg,
You would not be able to use the phone line as a trigger. The 'on-hook' phone line voltage is about 48 VDC. The 'off-hook' voltage drops to somewhere around 40 VDC, dependent on how far away you are from the phone company switch (also, when a phone line is 'ringing', there is about 100 Volts AC superimposed on the line!)

It might be best to use your 12 volt bell as a trigger. Connect the bell to a small relay (eg Omron G5V-1-12DC, from Mouser electronics or elsewhere). Here is the pinout for the relay.
Omron G5V-1.jpg

The relay output can be connected to the RS-232 port. Do not use pin 2 (Receive Data) or pin 3 (Transmit Data). Perhaps use pin 1 (Data Carrier Detect). Here is the pinout
RS232.jpg

I will wait to hear from ReloadRon on the software he uses to monitor the RS232 serial port, and then how to call the script from that software.

Ron Sharpe
 
I tried running the script on my computer (Win7), but I am getting an error message
View attachment 71787
Does the script utilise an existing email application that has to be open? (I am currently using Windows Live mail)

Ron Sharpe (my first name is also Ron for those of you reading this thread)

Hi Ron

That could be a problem. The CDO method will look for a SMTP (Simple Mail Transfer Protocol) to send the message. Windows 7 isn't a problem as I am running this script on Vista, Windows 7 & 8 and have run it on XP. There is another script you can try:

Code:
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="[COLOR="#FF0000"]mymail@mydomain.com[/COLOR]"
myMail.To="[COLOR="#FF0000"]someone@somedomain.com[/COLOR]"
myMail.TextBody="This is a message."
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
="smtp.server.com"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
=25 
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing
%>

Update the fields in red to look like my example and put in your information. Let's see if this works.

Ron
 
OK as to the software. Here is what I did. I wrote a very simple program in old ancient VB 6 (Visual Basic 6.0). Originally this little program was used to monitor the digital I/O lines (Not the data lines) of the RS 232 port. WE will get into the code later but for now the form looks like this:

**broken link removed**

On the bottom of the form you see a button labeled Disabled. If we click that button the form sprouts more features and will look like the below:

**broken link removed**

A few things to note. The RS 232 port will have a COM Port Number. On the top of the form you must select the port FIRST before clicking Open The Port! Once the port is selected then click open the port. The program will show the status of the three DI (Digital In) lines of the RS 232 port. I have actually used this with a Dongle connected to the USB port (USB to RS232 Dongle Adapter) and it works fine.

The program can be downloaded here.

The program is in a Zip folder for download. Download the folder to the location of your choice and right click it and extract the files to a new folder. You should see a Setup.EXE and if you double click it the program will install. Just follow the prompts and the program can also easily be uninstalled using a normal uninstall procedure. It is only a few MB and will run on just about any OS.

Now without clicking the Phone Home button and leaving it disabled just run the program. Try jumping Ground (pin 5) on the RS 232 port to pins CTS, DSR and DCD pins 8, 6, and 1 respectively. You should see things happen. Let's make sure that much works.

The pins are Digital In, the must be a 1 or 0 with 0 being a grounded pin! Whatever is interfaced to these pins must provide a logic low.

Tomorrow I'll post the actual code in VB 6.0.

@ GREG, Ron - tech gave you some good advice as to how to interface the phone line.

Ron
 
Last edited:
Ron Sharpe

Can you give some help with what pins on relay to use. I have 14VDC from the bell line. So what pins do I connect those to and what are my out pins to feed my DB9. What I'm trying to do is once the alarm is tripped it will send a signal to my application watching the comm1 port and then send a email to text message.

Thanks to booth of you fro you help.
 
Greg,
The input coil to the Omron relay is not polarity sensitive. So you you could connect Relay pin 2, to the +positive side of the bell. Connect Relay pin 9 to the -negative side of the bell. the 'normally open' contacts of the relay are pins 1 and 10. Connect relay pin 1 to RS232 pin 1 (if you are going to 'monitor' the DCD status). Connect relay pin 10 to RS232 pin 5. In operation when the bell is energised, power is supplied to the 'coil' of the relay. This 'closes' the 'Normally Open' contacts of the relay. In effect, you are now providing a ground to pin 1 on the RS232 port.
Ron Sharpe
 
Reloadron
I have now tried your original (short version) script from my home computer and it worked fine there. My home computer is running Vista, with Windows Mail. The home computer email does uses SMTP. My work computer is the Win7 machine with Windows Live mail. The work machine is a 64-bit O/S but that shouldn't make a difference. I hope to run the application from home, so all is good (I will try your second supplied code on the work computer when I get a minute).
Ron Sharpe
 
Thanks for all of the info I have it kinda working. I'm using the carrier detect and some times when it's grounded it doesn't fire. Is the serial port unreliable? What I've been doing is just jumping the pins manually before I build my relay.
 
Ron,

Thinking back, I had that error. Not from home but when I tried to run it at work through our email server. This is an excellent write up on the subject and note where he gets into servers. The CDO replaced the old CDONTS on everything since Windows 2000 and Windows XP.

Maybe if I get some time I'll modify the software used in my program. Rather than call out things like Fire, Flood or Intrusion I should just make it Alarm 1, Alarm 2 and Alarm 3. Keeping it more generic would make more sense.

Anyway, what I basically did was let the program monitor the RS 232 port for a change. When a change happens on any of the 3 digital inputs my software triggers one of three VBScripts. The scripts are saved in a folder on my C:\ drive. Looks like this:

Code:
Shell "Wscript.exe C:\Notifications\Fire.vbs", vbNormalFocus

So on my C:\ drive in the root of the drive I have a folder named Notifications and in that folder are the 3 scripts. In the above the system runs the fire script. So I run a script from within my VB code.

One Big Downside I can see is every time the system is triggered it will send a message. So if for example connected to a phone ringer if each ring was a pulse, it would send a text and email for every ring. The ring signal would need to be configured through a retriggerable one shot of sorts so a series of ring signals would only generate a single low state on the RS 232 pin.

When I initially was testing this I made a mistake of placing some code under a timer function. When I ran it as soon as the pin went low the software began sending my cell phone text and emails. Poof and that quick before I realized what I did I sent myself about 100 of each. Took me about an hour to clear my poor phone. Oh well, as I said, I am NOT a programmer type. :)

Ron
 
Thanks for all of the info I have it kinda working. I'm using the carrier detect and some times when it's grounded it doesn't fire. Is the serial port unreliable? What I've been doing is just jumping the pins manually before I build my relay.

I never had any issues. It always worked for me. However, I never tried to do what you are planning but as to each time I grounded a pin it worked and I never had a problem. Since my PC does not have a RS232 port I used a USB to RS232 dongle and even that worked fine.

Ton
 
I just purchased a USB to Serial today to do some tests today. I also installed reloadron's monitoring software on a laptop.

Using a voltmeter, I noticed that pins 1, 6 and 8 on my serial port were already at 0 volts with nothing connected to the port. Using a 12 volt bench power supply (via a series resistor), I touched each pin and the software does detect it and changes from green to red (low to high). Therefore, the trigger circuit has to provide the transition from 'low' to 'high'.

I would think that is why you are having trouble reliably triggering the software Greg. Also Greg, I'm assuming your bell trigger is off of a home-type alarm panel? If so, you wouldn't even have to use a relay. You could connect a wire directly from the positive (+) side of the bell, to the RS232 port pin. I would suggest using a resistor in 'series' with that wire, just to provide some isolation to the port. I would suggest using a resistor of say 220 ohms to 1K (1000 ohms) - I tried both resistor values in my test setup and each worked ok.

Also, as reloadron pointed out, there would be a notification each time the bell is cycled.

BTW, these little RS232 testers are handy if you do much work with serial ports. They are available in 9-pin versions for DB9 connectors, and 25-pin versions for DB25 connectors. Some have LED's for all pins; some have LED's only for the commonly used pins.

RS232 Tester.JPG

Ron Sharpe
 
Last edited:
Uh Oh, a big "My Bad"! Been so long since I worked with this I did get it wrong. Ron-tech got it right. The lines are low by default and not high as I stated. When I was testing I used a 5 volt power supply and also a simple 9 volt battery works fine.

Ron
 
Again thanks for all your help.

I still don't get a consistent signal using the the serial port so I went the parallel port route its basically the same only instead of listening for a signal I use a timer to check for port (pin) value changes. The relay works great.
 
Again thanks for all your help.

I still don't get a consistent signal using the the serial port so I went the parallel port route its basically the same only instead of listening for a signal I use a timer to check for port (pin) value changes. The relay works great.

Glad that worked out for you. The old parallel port is getting harder and harder to find these days on new motherboards.

Something else people can consider is some of the great USB and Ethernet devices out there. For example I like devices like those from Dataq, especially their simple inexpensive Starter Kits. Also devices from Measurement Computing can be great to work with and inexpensive. Most units offer several analog inputs both single ended and differential as well as a host of DIO ports to use.

Ron
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top