+Nia Posted November 22, 2002 Share Posted November 22, 2002 I'm off topic again but.......... There are so many clever people who read these forums, I'm sure someone will help me. My son Joshua(10) needs to wire up a simple 12 volt on/off switch to his computer (controlled by software)I have not got a clue how to do this, can you help me look clever. 1) how do we connect to the PC usb/serial or.. 2) how do we then control this with software? 3) we see Map*** do various 12 volt relays for 99p but which do we need we do know how to solder PCBs ect Please feel free to conntact us by e-mail Steve@cobrapc.co.uk Tech-no notice Quote Link to comment
Seifer Posted November 22, 2002 Share Posted November 22, 2002 I have no idea!! I know HTML, basic electroics and all about pythagorean triples (My coursework at the moment) but NOT that Michael aka 1/2 of Team Blitz Wqablz-xqxw tdqml kwfwm twjowcl di klelqklqok ejw hepw gt dm lbw ktdl! 26 27.75 34.2(recuring) 41.09275 480.048 55.027777777(carrys on!) 62.01749271 Quote Link to comment
+BigNick Posted November 22, 2002 Share Posted November 22, 2002 There are a couple of different ways to accomplish this, the easiest would be using a solid state relay (optocoupler), you would then just connect the input (LED) side to one of the data lines of the PC's parallel port and the device you want to operate to the other side. This has the advantage in the fact that the 12v is isolated from the PC via the optocoupler. The other way is going to be using a couple of transistors operating as a switch to turn on the relay. Again the easiest way to connect to the PC will be via the parallel port. In order to write to the parallel port you will need to run either QBasic under DOS (on the old Dos 6.2 disks) or via C (GCC is free if you are happy with the command line) - you can't use VisualBasic as it won't let you access the parallel port on a low enough level (although I think you can via calls to a DLL, but I am not a VB programmer so I can't comment). If you run C under Linux I have some code that you can adapt to control the relay (I just use it to control LED's, but it would be easy enough to change) and could probably doodle some circuit ideas if you can't find a solid state relay (Radio Spares or Farnell should be able to help, don't know anything about Maplins, but if they are anything like Dick Smith here in NZ (an electronics retailer) they won't be much help) Cheers Nick (just a helpful foreigner ) Quote Link to comment
+Nia Posted November 22, 2002 Author Share Posted November 22, 2002 Thanks BigNick the helpful foreigner I can get an optocoupler for 59p so that wont hurt.. Wire it up to a parallel port we can do. We dont have linux and I've never used Qbasic, we were hoping to operate from Windows... Anyone else help? (We do use VB but only at the 10 year old level...) Tech-no notice Quote Link to comment
+BigNick Posted November 22, 2002 Share Posted November 22, 2002 Just found this site all about parallel ports with links to other sites about hardware interfacing - you should find all you need (including the VB DLL I was talking about ) Cheers Nick. Quote Link to comment
+BigNick Posted November 22, 2002 Share Posted November 22, 2002 Heaps more doing a Yahoo! search on "Visual Basic Paralled Port Access" Cheers Nick. Quote Link to comment
+bartman007uk Posted November 22, 2002 Share Posted November 22, 2002 You used to be able to get kits from maplin to do what you want, probably with example code. I have this book buried somewhere(not literally) Easy PC Interfacing (Babani Computer Books) R. Penfold ISBN: 0859345238 It has lots of diagrams and program examples BUT you need to program in a DOS or windows 3.11 environment. Win 95+ makes it harder for you to access the parallel or serial port. Apparently you can do something like this from VB to send information to the printer port open "LPT1" for output as #1 print #1, "thestufftosend" close #1 If you get something that works from the serial port you could use hyperterminal or similar to control it. Actually I have a kit somewhere that provides a serial pc interface, I've had it for about 5 years, you are welcome to it. Is this a school project or just something that sounds interesting. Steve G aka Bartman007uk When they want rain, native Americans do a dance. When I go geocaching, it rains. Is there a link? [This message was edited by Bartman007uk on November 22, 2002 at 05:30 PM.] Quote Link to comment
+Nia Posted November 23, 2002 Author Share Posted November 23, 2002 Bartman007uk Welcome to geocaching, I see you only joined us 2 weeks ago and have found 9 caches already. Good work. Thanks for your info; I’ve sent you an e-mail. As for the rain, maybe you should stop geocaching and give us a break J = BigNick I’ve spent the past 2 hours at “Parallel Port Central” reading and reading but it is all too complicated for me to understand. My VB is “Very Basic” I just want to send a simple on/off and everything is looking at doing much more. One line that interested me was:- “Q: In Visual Basic, I use MSComm to read and write to serial ports” so you can write to a serial port in VB but it does not say how. I’m now going to try and find out Thanks for the help. Tech-no notice Quote Link to comment
+BigNick Posted November 23, 2002 Share Posted November 23, 2002 Ok, I have found a little more information for you - it's not quite step by step, but should be a bit easier. First go to qbasic.com and follow the link to Microsoft to download the old QBasic software (it is going to be the easiest language to implement a simple on/off) Then go to this page about Parallel Port Relay Interface it has a couple of implemenations of an interface, the easiest being 'Fig A' if you can get a solid state relay (note that this is not exactly an optocoupler and I expect it to cost more than 59p, it is a full on relay (rather than just a led/transistor combo)). The first paragraph on this page gives a taste of the code (it's very simple, only one line OUT,&H378,0 (tho' it is dependent on LTP port and circuit you use)) you will just have to wrap a simple interface round it (QBasic.com should be able to help you there) Hope that helps - feel free to contact me off list if you have any questions (hopefully I may be able to answer some ) Cheers Nick Quote Link to comment
+paul.blitz Posted November 23, 2002 Share Posted November 23, 2002 quote:My son Joshua(10) needs to wire up a simple 12 volt on/off switch to his computer (controlled by software) 1) how do we connect to the PC usb/serial or.. 2) how do we then control this with software? 3) we see Map*** do various 12 volt relays for 99p but which do we need we do know how to solder PCBs ect What are you trying to actually do? make the PC control an external device, by switching a 12v supply on and off? One of the problems with the PC is a lack of "generic outputs"... for inputs, you can cheat and use a joystick port... but for outputs, you normally have to use either a printer port, or one of the control lines of a serial port. The problem of the printer port is that windows will probably stop you playing with it directly. Another possibility is that you can use an external serial-to-parallel interface: you send a command to it down the serial port, and it switches the outputs. And where do you get one of those? Well, you need to speak to me! I can "do you a deal" quite cheaply! Email me a few more details & I'll try & help! mailto:paul@blitzfamily.org Paul Team Blitz No, I gave YOU the spare batteries.... Quote Link to comment
+paul.blitz Posted November 23, 2002 Share Posted November 23, 2002 quote:My son Joshua(10) needs to wire up a simple 12 volt on/off switch to his computer (controlled by software) 1) how do we connect to the PC usb/serial or.. 2) how do we then control this with software? 3) we see Map*** do various 12 volt relays for 99p but which do we need we do know how to solder PCBs ect What are you trying to actually do? make the PC control an external device, by switching a 12v supply on and off? One of the problems with the PC is a lack of "generic outputs"... for inputs, you can cheat and use a joystick port... but for outputs, you normally have to use either a printer port, or one of the control lines of a serial port. The problem of the printer port is that windows will probably stop you playing with it directly. Another possibility is that you can use an external serial-to-parallel interface: you send a command to it down the serial port, and it switches the outputs. And where do you get one of those? Well, you need to speak to me! I can "do you a deal" quite cheaply! Email me a few more details & I'll try & help! mailtoaul@blitzfamily.org Paul Team Blitz No, I gave YOU the spare batteries.... Quote Link to comment
Team Tate Posted November 24, 2002 Share Posted November 24, 2002 which is a bit more expensive, but 'ready to go'. Maplin sell a multi-channel opto-isolated input/output board for around £60, which controls up to twelve relays via the LPT port. It is sold as a kit but they will make it for you for an additional fee. The best thiing about the board is that it comes with software! The best thing to do before you purchase one, however, is ring their technical support line to ensure it will meet your needs. I used one of these at work to control a test board we were making. The quality of the build and components were excellent. OK, it's quite a lot more that 60p, but the electronics are proven which provides some comfort in the fact that you are not going to mess up your computer if you make a mistake. Team Tate Remember - if it's moving, it's not dead... Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.