CNCzone.com-The Largest Machinist Community on the net!



Home Page Mark Forums Read Today's Posts My Replies Classifieds Reviews Photo Gallery Web Links Share Files Advertise With Us Ad List
Go Back   CNCzone.com-The Largest Machinist Community on the net! > Electronics > General Electronics Discussion


General Electronics Discussion Discuss basic electronics, power supplies and anything else electronic related here.


This forum is sponsored by:

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Ban this user!
Old 08-05-2003, 12:39 AM
NeoMoses's Avatar  
Join Date: Apr 2003
Location: Prolly' in the Shop :)
Posts: 326
NeoMoses is on a distinguished road
How to control a relay with a PC

I need help. I'm trying to do some development on a project, and I would like to be able to energize a circuit with a PC or other device that would give me an adjustable and repeatable on/off signal. For example, I may want to turn the circuit on for 1 minute, then off for 5 minutes, or I may want to have the circuit on for 45 minutes then off for 30 minutes, depending on the circumstances.

The on/off will be controlled with a relay. That part I'm comfortable with. What I'm not comfortable with is how to control a PC port from windows to send the on/off signal. I don't care if I use a serial, parallel, or USB port.

Are there any readily available programs to send a signal like this? Or am I gonna have to find someone who is comfortable with C or C++ to help me with this? Any help would be much appreciated.

I'm not dead-set on using a PC to control this, so if there is another method of making a timer that has the needed flexibility, I am all ears.
__________________
My name is Electric Nachos. Sorry to impose, but I am the ocean.
http://www.bryanpryor.com

(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Tweet this Post!Share on Facebook
Reply With Quote

  #2  
Old 08-05-2003, 12:51 AM
wms's Avatar
wms wms is offline
Moderator
 
Join Date: Mar 2003
Location: United States
Posts: 938
wms is on a distinguished road

NeoMoses,

How about a cheap Plc, (programable logic controler)?

That's what they are made for. To turn things on and off and time things or to sense presure or voltages, current ect....

I don't know tons about them, but maybe someone here does.

I also have a friend that works with this stuff for a living.
I could ask if need be.

Here's a quick link:http://www.thomasregister.com//Catal...1&uuid=TRGuest

Sorry this link doesn't get you all the way to the plc's. So you'll have to navigate to them> products>plc.
Then look at the Nano series. They have starter packages.
__________________
(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)

Last edited by wms; 08-05-2003 at 01:07 AM.
Tweet this Post!Share on Facebook
Reply With Quote

  #3   Ban this user!
Old 08-05-2003, 03:12 AM
bunalmis's Avatar  
Join Date: Jul 2003
Location: Turkey
Posts: 246
bunalmis is on a distinguished road

I send simple hardware and software.

Hardware and software use max 8 relay.
System uses PC parallel port.
I wrote for dos but not problem for Win 98.



unsigned port=0x378;
unsigned char rly0,rly1,rly2,rly3,rly4,rly5,rly6,rly7;

void on_off()
{
unsigned char dat;

dat=rly0;
dat=dat|(rly1<<1);
dat=dat|(rly2<<2);
dat=dat|(rly3<<3);
dat=dat|(rly4<<4);
dat=dat|(rly5<<5);
dat=dat|(rly6<<6);
dat=dat|(rly7<<7);
// printf("%02X ",dat);
outportb(port,dat);
}


void main()
{

rly0=0;rly1=0;rly2=0;rly3=0;
rly4=0;rly5=0;rly6=0;rly7=0; on_off();

// rly0 on 1 sec
// rly1 on 1 sec
// rly0 and rly1 off 5 sec (relay0 2 sec on, 5 sec off)
// loop again (relay1 1 sec on, 5 sec off)



while(rly0==rly0)
{
rly0=1;on_off();delay(1000);
rly1=1;on_off();delay(1000);
rly0=0;rly1=0;on_off();delay(5000);
}


}
Attached Thumbnails
Click image for larger version

Name:	relay.jpg‎
Views:	220
Size:	33.1 KB
ID:	664  

Last edited by bunalmis; 08-05-2003 at 03:19 AM.
Tweet this Post!Share on Facebook
Reply With Quote

  #4   Ban this user!
Old 08-05-2003, 04:47 AM
abasir's Avatar  
Join Date: Apr 2003
Location: Malaysia
Posts: 361
abasir is on a distinguished road

NeoMoses,

A trivial VisualBasic code could achieve what you want (unless you timing is very critical, i.e., milliseconds accuracy).

For such things, I normally use a PIC (www.microchip.com) microcontroller (programming required). In most cases, it just need a chip and some transistors (& resistors, caps) and switches. Accuracy to microseconds and fully repeatable.

I could offer some help on both methods. I do need to know your 'circumstances' before suggesting a solution.

Regards
__________________
Stupid questions make me smarter...
See how smart I've become at www.9w2bsr.com ;-P
Tweet this Post!Share on Facebook
Reply With Quote

  #5   Ban this user!
Old 08-05-2003, 08:32 AM
ToyMaker's Avatar  
Join Date: May 2003
Location: United States
Posts: 325
ToyMaker is on a distinguished road

NeoMoses:
for a relatively cheap (<USD100) highly portable (it's smaller than a credit card) solution look into the BASIC Stamp controller. It has to be programmed but you could learn everything you need in a couple of hours. The manual is free online at http://www.parallaxinc.com in .pdf format.

robotic regards,

Tom

p.s. I have no connection with Parallax, just a satisfied customer. I have purchased several hundred of their units over the years and only had one DOA, which they replaced over-nite free of charge.
Tweet this Post!Share on Facebook
Reply With Quote

Sponsored Links
  #6   Ban this user!
Old 08-06-2003, 06:55 PM
NeoMoses's Avatar  
Join Date: Apr 2003
Location: Prolly' in the Shop :)
Posts: 326
NeoMoses is on a distinguished road

I think I'm gonna go with this. It's a kit that I get to put together, and it's got some data acquisition channels along with it!
__________________
My name is Electric Nachos. Sorry to impose, but I am the ocean.
http://www.bryanpryor.com

(Note: The opinions expressed in this post are my own and are not necessarily those of CNCzone and its management)
Tweet this Post!Share on Facebook
Reply With Quote

Reply




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
G-Code to DXF WayneHill OpenSource Software 189 01-30-2012 11:15 AM
Visual Basic Controller Project dwwright Visual Basic 29 02-14-2011 02:24 PM
How to set a relay for a spindle motor ON/OFF control TTaki TurboCNC 2 03-09-2005 07:26 AM
Parallel Port / Relay Control Question Verboten Computers and Networking 7 12-21-2004 05:17 PM
E-Stop Hard Wire and to Software? Sanghera General Electronics Discussion 20 10-30-2004 12:22 AM




All times are GMT -5. The time now is 11:38 PM.





Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO
Template-Modifications by TMS

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353