Home automation using a PC as controller

This is a group to discuss all details on home automation, home security technology and related technologies.

Home automation using a PC as controller

Postby Tomi Engdahl on Thu Mar 31, 2005 1:29 pm

Here is some material that is ment as a start of discussion and give ideas.
I received one mail asking on those topics and wrote an answer.
After writing a long e-mail answer I though posting the information here would also be useful.

Different technologies are available to control different things through PC.
And there various technologies that are useable
depending what devices needs to be controlled and how long away they are from PC.

One simple way to do controlling is connect several relays to PC parallel
port, and then make their contacts to switch power to different devices on
and off. There are circuits and software for this at
http://www.epanorama.net/circuits/parallel_output.html

This can be used to control anything (on or off) what you can wire to PC and back to appliance.
In some cases it could be a good idea to modify the appliance so that the relay outputs
from PC are connected in parallel with existing control switches/buttons on the device.
When connecting mains voltage to relay board or modifing electrical appliances you
need to be very careful on electrical safety issues.
You need to do things in right safe way and remeber hat you are liable what you do.

Other way of doing things is to have this relay controller connected to PC,
but instead of wirign mains power directly to it, you have the following
setup. Electrician installs suitable high power relays/contactors to your
main electrical panel. You can for example use relays/contactors that use
24V AC or DC power for relay coils. There is suitable 24V power supply
installed on electrical panel (or next to it) to power those relays. Then
you have some suitable control cable (just enopugh wires to control all your
relays, eother 2 wires per relay or one wire per relay plus one common)
between the relay set and you PC relay control board. The PC relay baord
just makes connection between two wires on the cable, and this makes the
larger relay/contactor on electrical panel to turn on. When connection
between wires on control cable is diconnected, relay turns off.

With suitable software on the PC you could use the PC for controlling
whatever that is wired to those relays on electrical panel. Depending the
software used the controllign could done locally and/or through network
(maybe with web interface or using some other protocol).

The control PC and relay card combination could be also replace with some
other small controlling device that you can control through your PC form
some distance away. This coudl be for example some small industrial PCL
logic device with network connectivity, some industiral I/O device with
sutiable connectivity (Ethernet, some industrial bus, RS-232 etc..), some
home automation device that can be remotely controlled in some way..


There are also other ways to make thigns work. One idea is to install those
cheap radio controllable mains power switching systems where you have a
small remote controller and siwthcing modules between electrical outlet and
your device. You ca modify the radio transmitter so that you wire your PC
relay card relay outputs in parallel with the switch contacts on your
remote. Now when you activate relay, it is same as you would manually press
the button on remote. Easy as this. It is a best idea to select a remote
system that has separate on and off buttons for most reliable operation
(those that turn load on with first press and turn it off at secont button
pressing etc.. are not suitable because sometimes the presses can be missed
by the receiver if there is lots of RFI around).

There are also many different home autiomation systems, that consist of
controller and device controlling modules (relays, light dimmers etc.). Many
of thsoe systems can be interfaced to a PC. For example X10 system that
communicated through mains wiring is popular in USA.
There are also other systems. Some use existing wiring,
some need their own conrol wiring. For lighting controlling theatres, rock shows, TV studios, discos,
show/conference rooms on fancy hotels etc.. rely on DMX-512 standard.
There are lots of commercial devices available for this (prices from very
expensive to resonably cheap) and there are many DIY projects in Internet related to DMX-512
(this includes PC interfaces, control software and devices that are controlled with DMX-512)
Take a look at http://www.epanorama.net/links/lights.html#dmx512

Then there are those appliances that are IR remote controllable originally,
for example modern TV, VCR, HIFI systems etc.. There is hardware and
software available for PC top do this. Take a look at
http://www.epanorama.net/links/irremote.html
Tomi Engdahl
Site Admin
 
Posts: 1839
Joined: Mon Oct 20, 2003 6:15 pm
Location: Espoo, Finland

Postby jprampolla on Sat Apr 23, 2005 3:10 pm

Hi Tomi,

Thanks for the information about the parallel port. A question for you if you have the time: How do I run BASIC on my Windows 98 machine?

I now use an old Timex/Sinclair 1000 with an I/O board by Byte-Back, from the late '80s, to help automate a toy train layout. But the program is very slow to load and run. I am now just finishing up a little, simple project playing sound effects in IE with embedded media in html with hotkeys, with my Windows 98 machine. There is an INKEYS function in BASIC that reads the keyboard, so if my solenoid idea to depress the keys works, I will have input by way of an INKEYS statement, and output with your parallel port idea. With my old Timex and the I/O board, I use one output to switch between 2 banks of 4PDT relays, so I get a lot out of the just the 8 outputs. I use 2 tape players controlled by the old Timex now for sound effects on the train layout.

Thanks again!

Take care, Joe.
jprampolla
 
Posts: 16
Joined: Tue Mar 29, 2005 7:21 pm
Location: US

Postby Tomi Engdahl on Sun Apr 24, 2005 6:53 am

According http://www.computerhope.com/qbasichl.htm there is a Qbasic basic included in Windows 98 distribution. It is not by default installed to your system, but can be found on the original Windows 98 installation CD.

QBasic is a variant of the BASIC programming language designed by Microsoft. QBasic is a DOS based programming language. It is used primarily by teaching instititions around the world to introduce students to programming languages, because of its simplicity. However it is a slow language, without some of the powerful functions available in languages such as C, which is why it is not used for profit today. There are a few programmers out there that still use QBasic where they think it is required for business purposes.

The Qbasic should be at TOOLS\OLDMSDOS directory of your Windows 98 CD. There shoudl be two files qbasic.exe and qbasic.hlp, copy these two files to a directory of your choice on the hard disk drive.
If you have a OEM Restore CD then the QBasic can be located in different locations on that CD. To locate QBasic place your Windows 95 CD within the computer click Start / Find and search for QBASIC*.*, and ensure that your looking in the CD-ROM drive.

Command line options and other usage instructions can be found at
http://www.computerhope.com/qbasichl.htm
Some programming tips can be found at http://www.hitmill.com/programming/qbasic.html
"QBasic Programming is a Web page primarily for students new to QBasic programming but an effort is being made to include information for advanced QBasic programmers"

The web pages claim to have Qbasic for download (I have not tested the versions on them):
http://www.geocities.com/Area51/5967/qbasic.html
http://www.uv.tietgen.dk/staff/mlha/Download/DOS/

The web page http://qbnz.com/pages/faq/index.html recommends to download and use QuickBASIC 4.5, as it is the most popular version of QBasic and comes with its own compiler.

Other basic options also exist. For example Visual Basic from Micrsoft comes to my mind if you want to write Windows programs.

You cna find some basic links also at http://www.epanorama.net/links/pc_progr ... html#basic
Tomi Engdahl
Site Admin
 
Posts: 1839
Joined: Mon Oct 20, 2003 6:15 pm
Location: Espoo, Finland

Postby jprampolla on Sun Apr 24, 2005 8:56 pm

Hi Tomi,

Many thanks for the information! I do have the restore disk for Win 98 SE and I will get the files off of it. For my purposes, a slow running BASIC program will be fast enough, provided it is faster than the old Timex BASIC. I guess the hardest part would be to try to play the wave files from the BASIC.

I have a few pages on my site about my old Timex if you are interested: http://yourpage.blazenet.net/jprampolla/Fifth.html

Take care, Joe.
jprampolla
 
Posts: 16
Joined: Tue Mar 29, 2005 7:21 pm
Location: US

WAV playing using basic

Postby Tomi Engdahl on Wed Apr 27, 2005 1:17 pm

For my purposes, a slow running BASIC program will be fast enough, provided it is faster than the old Timex BASIC.


Most propably the QBASIC running at any decent PC is very very much faster that old Timex BASIC running at that old computer.

I guess the hardest part would be to try to play the wave files from the BASIC.


You might be right on this. The original DOS QBASIC has some commands to make PC speaker to beep, but it does not have any standard commands for soundcard controlling. And because the sourdcards on DOS environment did not have any common API for all of them, controllign them was card specific. Dound blaster cards became popular, and many soundcard at least emulated that...
In more modern systems like Windows and Linux, the soundcard is accessed through a standard API (the drivers make the different sound cards to look pretty mich the same to the application).

Here are some links that could be useful for QBASIC sound programming (I have not tried them, just result of quick google search):

Using a sound card in QBasic
http://www.fys.ruu.nl/~bergmann/soundblaster.html
http://www.geocities.com/SiliconValley/ ... avplay.bas
http://piptol.qbasicnews.com/files/dmaplay5.bas
http://www.petesqbsite.com/sections/tut ... APLAY6.BAS
http://www.jake.dk/programmering/QBASIC ... maplay.bas
Tomi Engdahl
Site Admin
 
Posts: 1839
Joined: Mon Oct 20, 2003 6:15 pm
Location: Espoo, Finland

Postby jprampolla on Wed Apr 27, 2005 7:09 pm

Hi Tomi,

Thanks, again, for all the information and links! I wasn't able to find the QBASIC on my restore disk, but did get it from the Compaq site. I still have to play around with it after I reacquaint myself with DOS. I am very rusty with DOS since I practically went from my little Timex (with CompuServe) to Windows 98, spending only a few months with DOS in-between.

Take care, Joe.
jprampolla
 
Posts: 16
Joined: Tue Mar 29, 2005 7:21 pm
Location: US

Postby jprampolla on Thu Apr 28, 2005 7:05 pm

Hi Tomi and Folks,

I have to correct what I said in the last post. I got a patch or fix from the Compaq site regarding running QBASIC, but the restore disk did not have QBASIC, and Compaq directed me to the following: http://members.lycos.co.uk/brisray/qbasic/qdload.htm
However, this site makes no guarantees. Perhaps I'll try Visual BASIC instead.
Take care, Joe.
jprampolla
 
Posts: 16
Joined: Tue Mar 29, 2005 7:21 pm
Location: US

Visual BASIC

Postby Tomi Engdahl on Tue May 03, 2005 9:10 am

Visual BASIC might be useable for this.
I have not used that much myself, because I have not wanted to pay the amount of money Microsoft wants for their Visual Basic tools.

That's the reason I have not made any application examples for parallel port controlling using Visual Basic at http://www.epanorama.net/circuits/parallel_output.html
Tomi Engdahl
Site Admin
 
Posts: 1839
Joined: Mon Oct 20, 2003 6:15 pm
Location: Espoo, Finland

Re: Home automation using a PC as controller

Postby melody on Wed May 04, 2005 1:10 am

Have a nice day sir! May I just inquire if mobile phone can do home automation with thehelp of PC. thaks a lot. More power......... :D
melody
 

Home automation using a PC as controller

Postby Tomi Engdahl on Wed May 04, 2005 6:43 am

Have a nice day sir! May I just inquire if mobile phone can do home automation with thehelp of PC.


You can combine a mobile phone and a PC doe your home automation system. One approach to do this is that you use the mobile phone as controller and let the PC to do the actuial controlling. With a normal GSM mobile phone two possibilities come first to my mind for mobile to PC communications.

First one is to make it as remote controlling done with normal telephone, meaning tha tyiou have a PC with suitable voice modem answering your normal telephone line. Then just call to that line using your mobile phone and do the needed controlling with mobile phone keys (those send out DTMF tones like normal telephones during the call).

Second possibility is to use SMS messages for controlling. The idea is that you have your mobile phone that you have with you, and in addition you have another mobile phone (can be an older model) connected to your PC with data cable (and getting power with it's own mains adapter). To do the controlling, you just send an SMS to mobile phone connected to that automation PC. Then you have a suitable software running at the PC that reads the received SMS messages from the mobile phone, does whatever needed (checks who has sent them, does what is commanded in them etc..) and possibly sends back a reply SMS message through that mobile phone. The mobile phone connected to PC can be replaces with a SMS to HTTP gateway service provided by some suitable service operator, this kind of service receives SMS messages and send them to your computer using suitable protocol (usually using HTTP GET or PORT method) through your fixed Intenet connection. This kind of services are targeted usually to make all kinds of SMS based mobile services (like those servcies you can order ring tones, logos etc..).

Third possibility what comes to my mind is to use Bluetooth option that is found on some new mobile phones. Just get that type of phone and suitable Bluetooth adapter for your PC. Then figure out how to transfer data between those (propably involves some of your software running at the phone and in the PC.)
Tomi Engdahl
Site Admin
 
Posts: 1839
Joined: Mon Oct 20, 2003 6:15 pm
Location: Espoo, Finland

Postby pebe on Wed May 04, 2005 8:53 am

jprampolla wrote:Hi Tomi and Folks,

I have to correct what I said in the last post. I got a patch or fix from the Compaq site regarding running QBASIC, but the restore disk did not have QBASIC, and Compaq directed me to the following: http://members.lycos.co.uk/brisray/qbasic/qdload.htm
However, this site makes no guarantees. Perhaps I'll try Visual BASIC instead.
Take care, Joe.

QuickBasic ver 4.5 is available from many sites and I can assure you it works OK in Win98 or WinXP. You can run your programs as .BAS files or compile them and run them as .EXE files.

There is also FreeBasic (see http://freebasic.tk/) that is compatible with standard Basic and uses a windows type GUI interface. I have not tried it yet but there is a forum dealing with it.
pebe
 
Posts: 94
Joined: Wed Oct 08, 2003 9:06 pm

mobile and computer for home automation

Postby melody on Thu May 05, 2005 1:29 am

:D Thank you very much for the reply. sir. Can you suggest me websites to where i can surf for additional info? Thanks a lot again sir.
melody
 

Postby jprampolla on Mon May 23, 2005 4:43 pm

Hi Tomi, Pebe, and Everyone,

Thanks for the info about the Quick BASIC. I haven't given up on the project, just have been involved with other things.

My reason for perhaps going with the Visual BASIC was for the ability to play sound files (in Windows Media Player) and control the parallel port.

I will check into all the links.

Thanks, again, everyone!

Take care, Joe.
jprampolla
 
Posts: 16
Joined: Tue Mar 29, 2005 7:21 pm
Location: US

using sms to control home appliances

Postby vishal on Tue May 24, 2005 6:43 am

I know that sms from GSM mobile can be sent to other GSM mobile connected to PC which inturn will control home appliances.Can i know the software that can be used in PC to recognise the SMS content?.Is there any such opensource so that i can trial in my home?.
Eagerly expecting reply!
[/b]
vishal
 

SMS messages to PC

Postby Tomi Engdahl on Tue May 24, 2005 8:30 am

Can i know the software that can be used in PC to recognise the SMS content?.Is there any such opensource so that i can trial in my home?.


There are software that can be used for a PC to recognise the SMS content. At least the building blocks to build such system.

I did a such system around 5 years ago for one testing.
I used the following parts to implement that:
- a Nokia cellular phone
- cable to connect phoen to PC serial port
- Linux operating system on PC
- Gnokii software from http://www.gnokii.org/ to communicate with cellular phone
- my own control program (a simple sheel script)


The simple shell script worked something like this:

1. Check if there is any new received SMS message on the phone. If there is one, go to step 2, otherwise sleep for few second and start step 1 again.
2. Read the new SMS message from the cellular phone and remove it from there
3. Write the SMS message information to a file (telephone number of sender, message contents)
4. Check that the telephone number of people who sent the message that it is in allowed users list
5. Check the first word of message content, and call some external scripts based on what word is found (I had table for keywords to script name). Each script then takes input the saved SMS file. The output of scripts is written to a file.
6. Sent the script output text as SMS message to the person who sent the SMS message (we have the number stored)
7. Go to step 1

This worked pretty well. When I had a Linux system running, the other things too just two evenings (few hours each) from the beginning to the end. And this was my first SMS project of this kind. And some of the hours were lost in debugging the broken serial port problem on my computer (the reason was a loose cable from otherboard to connector on the back of the computer I I remeber right)...

I do not have the source code to give you.
I am not sure if I have it somewhere or not.
The system at that time did not get business applications,
and later on some data form that old computer was lost on
hard disk crash. I have tought setting up this system again,
but later I have nod had the right amount of need / time / resources
ratio. To this I would need a suitablr spare GMS cellular phone,
a suitable SIM card (needs to pay to some operator),
and the time to put this up again.
Tomi Engdahl
Site Admin
 
Posts: 1839
Joined: Mon Oct 20, 2003 6:15 pm
Location: Espoo, Finland

Next

Return to Home Automation

Who is online

Users browsing this forum: No registered users and 6 guests

cron