|
-
Apr 28th, 2003, 06:23 PM
#1
Thread Starter
Member
How can I use VB to interface with an electrical device?
Hello,
I mean :
How can i use programming using Visual Basic to interfece with external electrical devices.
for example ( very smiple ) :
i have a form in VB that has a button on it. and i also have a light bulb that has to be connected to my pc. after i click on the button i want the light bulb to turn on. is such programming and comunication possible. If so :
How?
What type of wire and port (on pc ) should i use to connect the pc and light bulb?
Do i need batteries, or once the connection is made there will be electricty ?
thank you very much.
-
Apr 28th, 2003, 06:32 PM
#2
Thread Starter
Member
-
Apr 28th, 2003, 06:53 PM
#3
Fanatic Member
first of all - dont connect visual basic directly to the 120V power socket, you may burn it and it will become unusable
seriously now, everything starts with an electronic device that switches your light bulb on and off. that device will be connected somehow to your computer - say to a serial port, or usb, or something. as you may have figured, your computer doesnt have a light bulb port like your lamp has. check a radio shack store and tell them what you want to do, first you have to choose the device and then come back here.
there are 2 reasons why i leave my work unfinished:
(1) i'm getting old.
-
Apr 28th, 2003, 07:46 PM
#4
I suggest either the serial or parallel port. Like Radum said, go to
raido shack and get the connector to either serial or parallel port.
Then you are going to need to soder wires to the pin outs on your
new connectors. To drive the light bulb you are going to need a
switch and perhaps a driver circuit. The switch will be what your
output from either the serial or parallel port will trip. Then the
switch will complete the circuit to power the light bulb. You are
going to wan to be very careful not to miswire the connections or
short out your computer. so you will need to place inline fuse also.
This is not a schol project is it? 
Also, while your at radio shack, ask them for a guide book that
contains the pinout configurations for the various ports on a
computer. They are usually pocket sized and not too expensive.
Why use a light bulb? Why not connect some IC chips and create
a useful circuit to control a stepper motor or something?
Last edited by RobDog888; Apr 28th, 2003 at 08:08 PM.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 28th, 2003, 09:50 PM
#5
Lively Member
Since you are a beginner you may want to start with the Basic Stamp, which can be bought at radio shack or check out http://www.parallax.com. You will have direct control over a micro-processor and it's alot of fun.
It's not real hard to do but you should be careful.
I can do all things with VB.
-
Apr 29th, 2003, 12:05 AM
#6
Addicted Member
the parallel port is probably the simplest way to go
the following link has alot of docs for it
http://www.lvr.com/parport.htm
in vb you will have to use a 3rd party control,
there are both freeware and commercial ones
for win 95/98 try the inpout dll, for win2k the only
one I could make work was ntport
parallel ports give you 8bits of data you can send
at a time and when they are in thier on state they
are enough to power a LED without driver circuit
make sure to read up on how to wire it before you
try it though because you can burn out your parallel port
if the circuit doesnt have enough resistance
its advisable to buy a second parallel port on an expansion
card so if something does go wack it does not hit the
motherboard, (or buy an old 386 to play with)
lots of docs on the net, read and experiment is the best way
to learn
Free Code, papers, tools, and more
http://sandsprite.com
-
Apr 29th, 2003, 12:27 AM
#7
If you use the parallel port to drive leds then use a 1K resister soldered in series before each led.
The resister is a brown, black, red, gold - 1K.
Pin 1 = the Strobe (ground - out).
Pin 2 - 9 are the 8 led pinouts.
Pin 10 = acknoweldgement.
Pin 11 = Busy indicator.
Pin 12 = Paper end.
Pin 13 = Select
Pin 14 = Auto feed.
Pin 15 = Error.
Pin 16 = Init.
Pin 17 = Sel Input.
Pin 18 - 25 are ground return for 1 - 10 (you can solder them together).
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Apr 29th, 2003, 03:21 AM
#8
Addicted Member
Lvr, mentioned above is good, but it's also worth a dig around at Boondog
-
Apr 29th, 2003, 06:02 AM
#9
Member
If you insist on playing with line voltage, consider an opto-isolator to protect your computer too.
-
Apr 29th, 2003, 07:11 AM
#10
Lively Member
If you want to switch low-current sources you could connect directly to a relay-card. Theese cards are very easy to control with Visual basic. There is a number of supplyers and the cards has reasonable pricing. (Look for example at www.advantech.com)
If you want to control more energy-consuming and high-current devices you must connect the relay-card to a unit (is contactor the english word for it?) that cand handle higher currents.
Relaycards usually have 8 or more relays built in.
If you want to measure or control analog inputs such as temperature sensors there is easy-to-use cards also for this.
In more advanced control applications with a lot of in/outputs it is possible to connect and control with some kind of bus-system such as profibus or interbus. This is a little more tricky, but far from impossible.
God luck
-
Apr 29th, 2003, 09:34 AM
#11
Lively Member
Definately use your printer port. I've seen some really cool things done with printer ports. When you interface a robot with a PC you usually have the robot run off of an independent power source and use PC input for switches. I've seen a doc somewhere about how to wire an N64 controller to a serial or printer port. It's cool stuff. Sorry I don't have any concrete information on the stuff.
-
Apr 29th, 2003, 11:17 AM
#12
Addicted Member
that boondog site is great
thanks for the link
Free Code, papers, tools, and more
http://sandsprite.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|