It has to be said that I'm pretty tight when it comes to parting with cash, I was wanting my home alarm and cctv to be able to text me - I started looking at GSM based diallers but they are stupid money. So I though the easier way would be to interface with the PC.
I already have a network based IO board I erm fashioned out of a WRT54G which lets me communicate with inputs and outputs - so interfacing shouldnt be a problem, however I will probably knock up a USB based IO board given the lack of parrallel ports or anything else on my new HP Microserver and save me having to pass things over the network to the wrt54..
Anyway quick google turns out that a 3G dongle will let me send texts.. hmm :) - Quick look in my laptop bag finds me a Huawei K3765 (Or a white vodaphone 3g dongle to me and you) - It belongs to work but it will do for a quick POC!
Given my linux knowledge is bordering on being a beginner I relied on google and typing commands and hoping for the best as you do, Windows would have been easy but my HP Microserver is running Ubuntu Server 10.10 as it does the simple things I need easier than windows, as much as it pains me to say that!
I shoved the thing in and ran the following:
lsusb
This returned the following:
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 002: ID 0566:3002 Monterey International Corp.
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 002: ID 0680:0002 Realtek Semiconductor Corp., CPP Div. (Avance Logic) Arowana Optical Wheel Mouse MSOP-01
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 12d1:1465 Huawei Technologies Co., Ltd.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
So at least it could see the device..
running this command:
dmesg | grep -e "modem" -e "tty"
got me this:
[ 0.000000] console [tty0] enabled
Not much there other than the console, so I dont think that found any modems..
Reading between the lines on an another post / link suggested I needed usb_modeswitch, So I ran sudo apt-get install usb-modeswitch-data
Then looking for the device again didnt show much, so I removed it and reinserted it which didnt seem to do too much, or at least I dont think it did!.
I then found another link so blindly pasted the following commands:
rmmod usb-storage
rmmod usb-serial
mknod /dev/ttyUSB0 c 188 0
mknod /dev/ttyUSB1 c 188 1
mknod /dev/ttyUSB2 c 188 2
(there was a modprobe somewhere but dont ask me where! - something like the following: modprobe usbserial vendor=0x12d1)
dmesg | grep -e "modem" -e "tty"
Now got me this:
[ 0.000000] console [tty0] enabled
[5094746.677111] USB Serial support registered for GSM modem (1-port)
[5094746.677229] option 1-3:1.0: GSM modem (1-port) converter detected
[5094746.677409] usb 1-3: GSM modem (1-port) converter now attached to ttyUSB0
[5094746.677447] option 1-3:1.3: GSM modem (1-port) converter detected
[5094746.677529] usb 1-3: GSM modem (1-port) converter now attached to ttyUSB1
[5094746.677549] option 1-3:1.4: GSM modem (1-port) converter detected
[5094746.677636] usb 1-3: GSM modem (1-port) converter now attached to ttyUSB2
[5094746.677673] option: v0.7.2:USB Driver for GSM modems
[5094747.213946] option 1-3:1.2: GSM modem (1-port) converter detected
[5094747.214211] usb 1-3: GSM modem (1-port) converter now attached to ttyUSB3
Looking better :)
Now to launch minicom, hmm no.. not installed.. Installed that (I dont think I need to post how)
I ran minicom -s to configure the required terminal settings which were:
Serial Device : /dev/ttyUSB0
Bps/Par/Bits : 115200 8N1
Hardware No
Software Flow Control : Yes
Now when I relaunched minicom I got the following:
Welcome to minicom 2.5
OPTIONS: I18n
Compiled on Feb 5 2011, 06:31:42.
Port /dev/ttyUSB0
Press CTRL-A Z for help on special keys
AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0
OK
Result..
So to send a Text / SMS you need to switch mode..
AT+CMGF=1
then to send a Text / SMS to a number you do..
AT+CMGS=”+44077******” [Enter]
> This is a test Message[Enter]
Cntrl + Z
You should then get
OK
To recieve you can do (un-tested yet)
List SMS
AT+CMGL=”all”
Get individual msg
AT+CMGR=0
Delete message number (n)
AT+CMGD=n
I'll try and make more notes at configuring it when I get a dongle to use permanantley and also ensure that it still works after a reboot, after that it's work out how to make it into something usable for the UPS, Alarm, and CCTV :)
Sad I know, but its kept me out of the pub tonight.
I try to specialise in doing the out of the ordinary stuff (A Challenge!) - And generally making life as easy as possible using any of the technologies within reach without having to re-invent the wheel where possible! Technologies and products can include -> .NET, VBS, Powershell, DSC, Systems Center, NetApp, VMWare, Windows Server, Linux, Python, Microcontrollers and others!
No comments:
Post a Comment