Computer controlled relay

This is the place for any magazine-related discussions that don't fit in any of the column discussion boards below.
Mike
Posts: 1813
Joined: Thu Mar 06, 2003 1:01 am
Location: Illinois
Contact:

Computer controlled relay

Post by Mike »

I want to be able to control a standard small relay from my PC. Is there a way to connect it to the parallel port and switch it on/off with command from VB?
Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Re: Computer controlled relay

Post by Engineer1138 »

I just put a project like this up on my website at: www.veronasoftware.com/embedded/io.html
It's going to be a replacement for my fishtank lighting controller.<p>It uses the serial port, not the parallel port and the software is in Visual C++ (I know the link to the executable is broken, I'll have it fixed within a day, but all the source code is in the .zip file). It should be simple to convert it to VB using the MsComm DLL. I'll probably do it when I get the time.<p>Either way, you can build it for less than $5 in parts. If don't have everything it needs and you're interested, let me know and I can put together a parts kit.<p>I do have something that works off the parallel port also, but it will be a while before I put that up there. I lost the original schematic, so I'd have to draw a new one. That's my next project :-)
User avatar
jwax
Posts: 2234
Joined: Mon Feb 09, 2004 1:01 am
Location: NY
Contact:

Re: Computer controlled relay

Post by jwax »

Thanks, Engineer! I was looking for something like that myself!
When time permits, could you get the windows software link for it to work?
How about using the function keys to control various relays? Possible?
Appreciate your help! :)
WA2RBA
Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Re: Computer controlled relay

Post by Engineer1138 »

Yup. I'd do it now, but I can't access the administration page of the site from where I am. It'll be up later tonight. As far as using Fn keys, it uses a point-n-click Windows interface, but it's pretty simple to map the buttons to keypresses also.<p>For this particular project, I don't think you can get more than 2 relays per serial port without adding more hardware (but you could use multiple serial ports). It was intended to be dead simple! As time permits, I will put up expanded versions and PCB layouts.<p> <blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by jwax:
Thanks, Engineer! I was looking for something like that myself!
When time permits, could you get the windows software link for it to work?
How about using the function keys to control various relays? Possible?
Appreciate your help! :)
<hr></blockquote>
Mike
Posts: 1813
Joined: Thu Mar 06, 2003 1:01 am
Location: Illinois
Contact:

Re: Computer controlled relay

Post by Mike »

That looks great!<p>Now, does anybody know how to get a TMP100DK temperature sensor to be read in VB, display the temp on the screen, and also control the relay at a certain temperature?
User avatar
jwax
Posts: 2234
Joined: Mon Feb 09, 2004 1:01 am
Location: NY
Contact:

Re: Computer controlled relay

Post by jwax »

OMG! Showing my naivity here, Engineer, how do I now "Open Com Port first"?
:confused:
WA2RBA
myp71
Posts: 585
Joined: Wed Apr 23, 2003 1:01 am
Location: Colorado
Contact:

Re: Computer controlled relay

Post by myp71 »

<blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by jwax:
OMG! Showing my naivity here, Engineer, how do I now "Open Com Port first"?
:confused:
<hr></blockquote><p>
I'm wondering the same thing ?<p>
Ryan
Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Re: Computer controlled relay

Post by Engineer1138 »

I assume you guys are talking about the error message box that pops up when you try to turn relay on/off?
The device can run on com1:com4 (my Windows computer only has COM1, so that's all I could test it on) and these are selected from the list box in the lower left. just scroll to the one you want, e.g., COM1 and select it by clicking on it. That will open the COM port.<p>Thanks for the feedback; this means that there is something that's not clear and I should make it more obvious. Perhaps have a little status message that shows whether or not a port has been opened?<p>I also added a Linux command line utility to control the relay, but haven't written a GUI for it yet.<p>p.s.: the box above the red/green on/off buttons indicates the current state of the CTS line: I plan to add this to the schematic so a pushbutton can be read.
User avatar
jwax
Posts: 2234
Joined: Mon Feb 09, 2004 1:01 am
Location: NY
Contact:

Re: Computer controlled relay

Post by jwax »

OK, I have an OFF showing in the box now, but cannot toggle it ON. :confused:
WA2RBA
User avatar
jwax
Posts: 2234
Joined: Mon Feb 09, 2004 1:01 am
Location: NY
Contact:

Re: Computer controlled relay

Post by jwax »

Mike- the user pdf doesn't help you? http://focus.ti.com/lit/ug/slwr022/slwr022.pdf
WA2RBA
Engineer1138
Posts: 458
Joined: Thu Feb 05, 2004 1:01 am
Location: Minneapolis, MN
Contact:

Re: Computer controlled relay

Post by Engineer1138 »

The OFF indication you see is actually reading an input: the CTS line (that's not shown on the schematic yet as it's something I'm in the process of testing).
The Green and Red buttons are the relay ON/OFF controls.<p>I think I'll go back to just labeling them On and Off. I was trying to be fancy :-)<p> <blockquote><font size="1" face="Verdana, Helvetica, sans-serif">quote:</font><hr>Originally posted by jwax:
OK, I have an OFF showing in the box now, but cannot toggle it ON. :confused: <hr></blockquote>
Mike
Posts: 1813
Joined: Thu Mar 06, 2003 1:01 am
Location: Illinois
Contact:

Re: Computer controlled relay

Post by Mike »

Oh, wait, is the LED alarm feature only avaliable on the TMP101 kit? I have the TMP100. If it is only avaliable on the 101 kit I guess I'll need to get that one. So, I assume that the LED lights up at a programmed temperature?
User avatar
jwax
Posts: 2234
Joined: Mon Feb 09, 2004 1:01 am
Location: NY
Contact:

Re: Computer controlled relay

Post by jwax »

Mike, are we mixing projects here? I suggested the pdf data sheet to help with your temperature project.
Engineer- Thanks for the clarification! I finally built the device, and it works fine! :D
I'd be keen to see a parallel port application too! Many channels are then possible, right?
Thanks again!
John
WA2RBA
Mike
Posts: 1813
Joined: Thu Mar 06, 2003 1:01 am
Location: Illinois
Contact:

Re: Computer controlled relay

Post by Mike »

jwax, thanks for the pdf<p>what I mean is that I want a relay to trigger at a certain temperature. Would I need the TMP101 version because it flips on an LED when a certain temperature is reached? <p>what I was asking was if anybody knows how to read the data from this chip using VB and I could also program a relay control into it.
hp
Posts: 245
Joined: Sat Aug 09, 2003 1:01 am
Location: Friendswood, TX
Contact:

Re: Computer controlled relay

Post by hp »

Take a look at this thread that you posted a while back http://206.131.241.58/ubb/ultimatebb.ph ... 002193&p=1 . That thread has links to reading temperature using a dallas temp sensor. Then use the mscomm control to turn a relay on or off.<p>Seriously, don't try using some odd sensor that no one has ever heard of. Try using a real temperature sensor that is designed for digital applications. The sensor only costs a few bucks and is alot better than spending your time searching for answers on how to use a sensor that you have on hand.<p>Harrison<p>[ October 25, 2004: Message edited by: hp ]</p>
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests