View Full Version : paralell or serial plugin to drive external relays ???

January 14th, 2003, 05:36 PM
is there such a pluggin for girder ???


Mark F
January 14th, 2003, 05:52 PM
It really depends on how you plan to wire the relays to the PC.

The LUA Port IO (http://www.girder.nl/downloadn.php?Link=447) plugin would let you write anything to the parallel or serial ports.

January 14th, 2003, 05:54 PM
i havent built the hardware yet (or found any schematics),, but i hope to have girder controlling several things via external relays, door latches, curtains, control motors, etc etc, so i will need a bank of relays that can be addressed and directly controled by girder

hardware recomendations (that i can source parts and build) would be nice if you know any :-)


Mark F
January 14th, 2003, 06:01 PM
Check out the link in this (http://www.girder.nl/phpBB2/viewtopic.php?t=2255) thread. I ordered one of these but haven't taken the time to try it out. (Work really interferes with my free time) :)

January 14th, 2003, 06:04 PM

i did find that post when i searched the forum (like a good boy) :-) hehehe ....before posting,, was looking or something to build myself though,, i have a surplus of parts and the ĢĢĢ situation isnt good, so cant really afford to buy new things :(

Mark F
January 14th, 2003, 06:07 PM
I'm a software weenie, not a hardware weenie. I have to buy electrical stuff pre-made or it has a VERY low probability of working. :D

January 14th, 2003, 06:14 PM
lol,, im more of a hardware,, well bit a both really,, but better on hardware, the IT background i spose :-)

have found a few schematics on the web, but most work via lpt just using any of the 7 ouputs and a 3704 to invert the signal,, so its a simple on and reset,,

would prefer serial and pic based maybe so theres a little more control

in that case i hope someone else reads this post :-)

thanks anyways Mark

January 14th, 2003, 06:29 PM
would girder be capable of driving this ?


January 14th, 2003, 07:57 PM
this time it's my turn to help Mark :)

i guess that girder can drive your device, you just have to know the deveice protocol,and also to see how many relay u want to control.

if only 8 relays are enought for you, u should use a lighter device plugged to your parrallel port, without any processor that need hardware to be programmed.

you also should opt for a little more complexe device that should return relays states ;)

January 14th, 2003, 08:29 PM
here the cheapest i found (parrallel port input) ;)




but those devices do not protect your port agains electik shock. :-?

i've also found this device that is protected , but include a microcontroller , and only control 4 relays (serial port) :


if you have comments about all of this, or find something interresting in this way, plz tell us :)

January 15th, 2003, 01:51 AM
hey guys!

I know about nothing about relays... more the software type guys.

anyway, I'd like to have a way to power on/off the VGA monitor, TV, sound system and such... any relays powerfull ennough for wall current to be controlled by girder??

The post from Mark on the other thread leading to

<a href=http://www.audon.co.uk/relay.html>this location</a>

is speaking of 12A 250V (3000Watts????) did I read fine?
this would work if I understood correctly...

anyhow, this seams interesting.

Mark F
January 15th, 2003, 05:49 AM
Looking at all of these links, I don't see any that Girder wouldn't drive (in theory). If you are not getting feedback, attaching to the parallel port is easy and the plugin I mentioned above will allow you to control it.

Mark F
January 15th, 2003, 05:50 AM
Mars -

I bought one of those to try out but haven't tested it yet. It IS supposed to handle wall plug type levels of current. We will see. :)

January 15th, 2003, 01:26 PM
so all this summed up,, the LUA port io can write to a paralell device, and the paralell device would be easier to build and program,,



Mark F
January 15th, 2003, 01:39 PM
Sounds right to me.

January 15th, 2003, 02:38 PM
yes it is, because with parrallel port there is not any protocole to manage, just set D0 to 1 to close first relay, set D0 to 0 to open the first relay, set D1 to 1 to close second relay, etc...
And you do not have to program a processor, it is also cheaper.

but personnaly i would not opt for a device that do not protect my parrall port from electric shocks !!!! i d'ont want to have to buy a new computer is case of pb.

so it would be really better to find something that use optocoupler.

January 15th, 2003, 06:59 PM
anyone got a schematic for such a device ???

Paul C

January 16th, 2003, 08:59 AM
:roll: i've allready putted 4 shematic in this thread, open your eyes :o :)

January 16th, 2003, 12:22 PM
on behalf of my stupid brain and close eyes :) i apologise,, i thought the devices posted were serial or buy product without schematics,, ill go examine further



January 16th, 2003, 03:23 PM
no problem :)

if u find more, tell us ;)

i suggest u to use the optocoupler of the last shematic on the other shematics to protect ur PC from electric shocks. Good luck, and tell us about ur investigations.

January 16th, 2003, 03:27 PM
i 've also found (well i guess, have to read more) a shemati to buid a X10 Transmitter, would be very interresting, to parse.......


January 16th, 2003, 03:29 PM

I have the same problem. To solve I need a plugin setting single ports (pins) to high/low. Is this possible by using the serialIO plugin written by Mark F? How to? What Data I have to send to enable/disable a Pin continously until changing by girder again?
Any one tested LUAportIO? (Installed the driver, but do not want to reset...)


@Mark F seen this? www.ee.ualberta.ca/~ee401/archive/fall2002/pcremote/ ee401briancalverleyandgarthhanson.pdf

January 16th, 2003, 03:50 PM
(WARNING !!! all of what i said have to be certified by Mark or LUA pluggin user, because i didn't test it yet)

yes u can with LUA I/O pluggin and your parrallel port to do it.

here a little lecon:

your parallel port contains 8 data wires D0, D1... D7
each wire can be set to 0 ot 1. All of this represent a 8 bits word that in binary can have values 00000000 to 11111111, and in decimal 0 to 254

all you have to do is to use the windows calculator to convert from binary to decimal.

a little exemple:

let's say that each data wire of your parrallel port is connected to a relay.

you just want to set close the first relay, so you have to set D0 to 1, so it represent the word 00000001
and in decimal 1

you want to set it to your LPT1 port , this port has this adress : 768

so in the LUA pluggin, you have to specify those parameters :
PORTIO_WriteBYTE( 768, 1)

other example : u just want to close the second relay, so the binary word is 00000100 , in decimal it is 4
PORTIO_WriteBYTE( 768, 4)

here a little table that represent decimal to binary convertion :

0 = 00000000
1 = 00000001
2 = 00000010
3 = 00000011
4 = 00000100
5 = 00000101
6 = 00000110
7 = 00000111
8 = 00001000

PS : your link is dead :-?

January 16th, 2003, 04:31 PM
ta,, i think i shall build it with a few relays now :)

January 16th, 2003, 05:07 PM
witch one? will u include optocoupler?

January 16th, 2003, 05:16 PM
was gonna build that serial one

but im not too familar with this device, and i havent got 1 = PIC-ISCP/ICD

so ill probably do the paralell one

paul c

January 16th, 2003, 05:41 PM
in this case parrallel devices are the best choice, but once again i insist on that point : use optocoupler of the serial device, on ur parrallel device to protect your PC (exept if you want to buy a new PC at the first electrik shock ;) )

January 16th, 2003, 07:34 PM
just a thought, could the opto design and Transistor drive be replaced with something like a ULN2003/4 which can safely handle output voltages of 50V (according to data sheet)

one of the schematic u posted does mention about replacing the common Transistor driver with a uln2003 or similar, but if im correct wouldnt that also reduce the need for the opto isolator, since the input pins of the uln2003/4 are protected from the max 50V output drive ???


January 17th, 2003, 12:34 AM
I have built exactly such a gadget... it's a daisy chainable addressable serial driven relay driver card. I have one driving motorized drapes (which I also built) and plan to add 2 more sets of drapes onto the chain when I get time. I use the generic serial driver plugin, and send a start byte, a relay number, an on/off command, and an end byte. Each card (which carries a PIC 16F628) is set to an address (0-255) and if the relay number matches the address, that card obeys.

You are free to have my picbasic code, if you want a quick schematic, I could do that too, however I really don't have time to build you one - unless I got orders for a dozen or so at say US$40 each for them (which I think is too much, but...), then I could justify making the time.
Your other option is the UIRT2 which has PIC pin outputs available for driving 3 or so relays, but at the moment I AM HAVING A PROBLEM WITH THE UIRT ADDRESSABLE PINS (I can't get them to latch on) and no-one has confirmed or commented on this, so I don't know what the deal is. Of course the other thing about the UIRT2 is that it does a bunch of other stuff which you may or may not have a use for.

Hope that helps.

January 17th, 2003, 02:55 AM
Hi, thx for repley

I want to build the device like http://www.franksteinberg.de/erel.htm there you can find a schematic that should work on serial and parallel! Itīs youre choice. Itīs very basic concept without PICīs and ICīs, price of the parts 1,34€ ( ~$1,40).

I prefered the serialport, steering with LUA PlugIn like parallel, only changing the portadress?

thx a lot

January 17th, 2003, 04:10 AM
PS: Link is not dead, itīs wrong ;-) There is to much space...


Mark F
January 17th, 2003, 08:17 AM
dummy32 -

WOW! :o Are you one of the authors?

All -

If/when you decide on the relay circuit you plan to use, I'd be happy to help with the Girder support code/commands/scripts/etc.

January 17th, 2003, 09:05 AM
That is a very cool project, and you manged to do this all in 4 months ? Full time work I presume ?

I'm sure *many* will be interested especially the part with the RF linking to to other rooms. Do you have something of a homepage or can I link to, maybe the PDF ?

January 17th, 2003, 01:00 PM
Mars -

I bought one of those to try out but haven't tested it yet. It IS supposed to handle wall plug type levels of current. We will see. :)

well, could you keep us informed when you know. :)

Mark F
January 17th, 2003, 01:06 PM
Absolutely. :D

January 18th, 2003, 03:20 AM
Sorry, but I am not one of the autors. I found(?) it searching for Mark F and serial plugin by google. I thought you could be interested in. Could be they have send you a message. (correct grammer?)

Mark thx for your plugins, recognized that the LUA plugin is also a project of you.

January 18th, 2003, 08:02 PM
if the LPT port is writable using the LUA i/o plugging, shouldnt it apear in the plugins output tab,, for configuring and writing to !!!!

cos it aint in mine,, or am i missing something ?

paul c

January 19th, 2003, 03:05 AM
Are you using the DLinxPort driver?

January 19th, 2003, 04:45 AM
I've also built a system to control ligts etc. from my computer. It's controlled by the lpt-port to a remote control for my RF-switches. I'm using girder and the i/o lua plugin to send command to the lpt-port and voiceflux to make it voice-commanded.

Mark F
January 19th, 2003, 05:21 AM
SatMan - You are missing something. ;)

The LUAPortIO plugin provides functions for LUA scripts to use. It doesn't provide commands that are added directly to the command tree. It has NO configuration.

To use it:

Add a command to the tree
Choose the Girder tab
Choose Variable Manipulation Script from the dropdown box
Press the Script button
Put a LUA script in the editor (see example below) and press OK
Press Apply

An example using the LUAPortIO plugin:

-- this will place a byte &#40;with value = 1&#41; in a parallel port
-- NOTE&#58; You MUST pass decimal values through this interface
-- NOTE&#58; 378 &#40;hex&#41; = 888 &#40;decimal&#41;
PORTIO_WriteBYTE&#40; 888, 1&#41;

February 16th, 2004, 02:08 PM
I have built a relay and can control it with software i found here http://www.electronickits.com/kit/complete/elec/ck1601.htm, but there driver wont work with xp, I use xp's printer port diver and it does work but it sets all pins high at the same time, for now thats ok with me I am only useing one relay :D , does any one know of a driver for xp? I have also tryed the above script and it does turn on my relay but it wont shut it off, what can I do to make it shut it off???

February 16th, 2004, 02:12 PM
ok, PORTIO_WriteBYTE( 888, 0) turns it off, now this is ok for 0ne relay how would I break it down to each pin for other relays?

February 22nd, 2004, 11:42 PM
the Portiowritebyte writes the binary parallel data through the D0-D7 lines, a value of 0 to 255. So to control individual D0,D1,D2... lines you simply need to try numbers 1,2,4,8,16,32,64,128 decimal for each pin and then addition of each of these numbers to turn on multiple pins at once such as 1+2+4=7 have fun
I've already had a little fun with this
Might i suggest you read the port value then binary add or binary subtract the port you wish to turn off. then write to the port.
if you need a sample let me know

February 23rd, 2004, 06:59 PM
Could you post some sample code for what you are talking about?

I built a parallel-relay system and use it control the buzzer panel in my brownstone from my cell phone. I've been using the command-line software that i found online, but I'd love to integrate it more fully into Girder.


February 24th, 2004, 11:00 PM
PORTIO_WriteBYTE( 888, 0) is off
PORTIO_WriteBYTE( 888, 1) is on

February 29th, 2004, 11:30 PM
Here is some sample code i found.

This section makes certain to write only a 0 to portIO location D0 without changeing other port lines
--this code turns only one port pin off or on
PortValue = PORTIO_ReadBYTE( 888 )
--THis code sets the port value to 0
NewPort= bxor(1,PortValue)
PortValue = band(NewPort,PortValue)
PORTIO_WriteBYTE( 888, PortValue)

This section Makes certain to write only a 1 to portio location D0 without changeing other point lines
--THis code sets the port value to 1
PortValue = (bor (1,PortValue))
print (PortValue)--simple debugging line
PORTIO_WriteBYTE( 888, PortValue)

Suppose you wish to toggle any one of the ports try this code

PortValue = PORTIO_ReadBYTE( 888 )
-- this line toggles the D# line
PortValue = bxor(pld1,PortValue)
PORTIO_WriteBYTE( 888, PortValue )
PortValue = PORTIO_ReadBYTE( 888 )
However pld1 must be a decimal number of 1,2,4,8,16,32,64,128 for each of the d0,d1,d2,d3,d4,d5,d6,d7 ports
I use the the menu osd to send the pld1 to the scripts.

March 1st, 2004, 12:06 AM
i also found this link here for a simple device.
it shows several ways to hook a relay to the lpt port and i know if you power the 5V relay from a sacrificed USB cable you should not need to worry about spikes as much.
add a few filter caps into the design and it works.

P.S. i used figure c with 5V supply and didn't have to change anything other than a 5V relay.

March 2nd, 2004, 03:41 PM
I have been using the RS232 Port to drive relays for some time
First with basic, then qbasic now Homeseer
Could anyone tell me the syntax to output from Girder please?
I am used to outputting something like CHR$(45) will this work in Girder
If anyone needs information on switching relays please ask

March 2nd, 2004, 04:22 PM
What exactly are people using these relays for?

I already mentioned that I use mine to connect to the com-box for my brownstone, allowing me to unlock my front door with cell phone. Works great for when i forget my keys and wow-factor.

But my driver has 8 relays and I only use 3. What are some nifty things I can do with the other 5?