Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

VB Light Switch

  • 22-08-2004 12:53pm
    #1
    Registered Users, Registered Users 2 Posts: 2,587 ✭✭✭


    Dont even know if this is possible.

    Im looking for a where to start, i need a small board with 4 smal light bulbs, demo purposes, and when a button is pressed on a VB form a bulb would light up.

    Does anybody have any ideas on where would be a good starting point to start to build this?


Comments

  • Registered Users, Registered Users 2 Posts: 629 ✭✭✭sparkthatbled


    thats complicated...it would combine vb with other languages and special hardware...just make a pizza order form! :D:D:D


  • Registered Users, Registered Users 2 Posts: 2,587 ✭✭✭gerire


    Well im thinking it would have to be through the serial port sending signals using the mscomms tools or something but im thinking im way out of my league even thinking about this


  • Closed Accounts Posts: 1,541 ✭✭✭finnpark


    It is quite a simple process and there are many ways to do it. I beleive what your trying to do is to control small little lights outside a computer using a VB interface. Is this correct, if yes read on.

    I have used Visual C++ to do this via parallel/printer port, serial port and 82C55A interface card.


    First of all your lights can be coloured LEDs. Is this acceptable. Say red in colour. Bulbs would a little more awkard maybe. Your external harware should consist of 4 LEDs. You need 4 resistors also to limit current to the LEDs. You may also need a buffer IC to supply current to the LEDs because if you drive the LEDs/bulbs directly from a port you may destroy the port by trying to sink too much current. The value of resistors to use I will tell you later. You must connect the ground line of your external cct to the ground line of whatever port your using. All this may seem really difficult to you if you have never built electronic hardware before but its actually really simple and you could do it in an hour. I can give you a schematic and instructions tomorrow on how to do this, do you want me to.?

    You could use the serial port. However you would then need some kind of serial/parallel converter or Shift register.

    You could use an interface card you insert yourself like a NIDAQ card or 82C55A interface card. These fit into the PCI slot on your PC and you program external pins by writing to the address of each pin/port. This is quite easy with instructions but will take you time and money.

    The simplest and best option is to use the parallel port. You will only need a very simple externel circuit and your computer allready has one. As I said above I can show you how to construct this.

    As far as programming the parallel port is concerned it is quite straight forward. Search the internet (google) for "Programming Parallel Port using Visual Basic". However if you are using Windows you must download a special kernal/driver thing to allow access to the parallel port. Its called inpout32.dll. My advice is to use the parallel port. If you have Windows 95 and C++ you could do it in an hour without any downloading of kernals/drivers(direct access). :D

    Here are some links(http://www.aaroncake.net/electronics/vblpt.htm is very good):

    http://www.lvr.com/parport.htm
    http://www.aaroncake.net/electronics/vblpt.htm
    http://www.computer-mentors.co.uk/computermentors/basic-parallel-port-programming-visual.html
    http://www.control.com/1026186588/index_html
    http://www.planet-source-code.com/URLSEO/vb/scripts/ShowCode!asp/txtCodeId!55712/lngWid!1/anyname.htm
    http://www.control.com/1026192591/index_html
    http://www.control.com/1026164136

    Hope this helps. I think parallel port is way to go. Talk to me when you want to build a simple interface Light cct and I can advice you. I am currently trying to control the parallel port on my PC via internet-anywhere in world.

    Good Luck
    :D


  • Registered Users, Registered Users 2 Posts: 2,587 ✭✭✭gerire


    finnpark, im looking to get this done asap, if possible this working week. And would love if you could help. A list of things i need to buy using the simplest method, and ill get them today in peats. Im running Win2k with Visual Studio 6 for coding this. Ive used VC++ in coding OpenGL so know it a little bit

    I can code but have never taken control of ports or anything in the past but will start googling it now. Using 4 red LED's would be perfect for the demonstration.

    I have little or no experience building circuits in real life only drawing them in theory on parer. My little brother might be able to help tho he and his gf's bro have built circuits and stuff in the past so I reckon they could build it, weather they will or not is a different story.
    Looking forward to hearing from you


  • Closed Accounts Posts: 1,541 ✭✭✭finnpark


    "WARNING: PC parallel port can be damaged quite easily if you make mistakes in the circuits you connect to it. If the parallel port is integrated to the motherboard (like in many new computers) repairing damaged parallel port may be expensive (in many cases it it is cheaper to replace the whole motherborard than repair that port). Safest bet is to buy an inexpensive I/O card which has an extra parallel port and use it for your experiment. If you manage to damage the parallel port on that card, replacing it is easy and inexpensive".
    http://www.hut.fi/Misc/Electronics/circuits/parallel_output.html



    The following circuit will do you. Your biggest problem is not damaging the parallel port and getting windows to allow you to access the parallel port. You make sure your circuit is fully right before experimenting. Test your cct 1st. Here is the simplest circuit:
    http://www.hut.fi/Misc/Electronics/circuits/lptleds.gif
    You have to make sure your resistor values are large enough so not to damage port and small enough to light LEDs. Whatever you do do not make them too small in value. You connect one resistor in series with one LED for each pin. I will put a schematic on here tomorrow for you.


    Get 4 LEDs(ones that take as little current as possible to light -small ones) and resisors (values-You could chance 1K ohm resistors) . Also if you can get the 74HC4050 IC this would be brilliant. A buffer IC means would not need to worry as much about damaging the pins as it would provide the current to the LEDs.

    Another very good link below:
    http://www.beyondlogic.org/spp/parallel.htm.

    All you need to buy is 4 LEDs, 4 resistors and a buffer IC would be an advantage. If you do not use a buffer you run the risk of destroying your parallel port. Instead of using 4 LEDs could you start with just 2? Also instead of using LEDs why not connect nothing and just monitor voltage changes using the DMM? This would by far the easiest, quickest and safeist. I will get back to you 2moro.


  • Advertisement
  • Closed Accounts Posts: 1,541 ✭✭✭finnpark


    Check out the non-Ideal and the ideal schematic I put together:
    http://www.geocities.com/letterkennyitrobots/ParallelPort.doc

    Can you get your hands on a 74HC4050 IC which has 6 built in buffers?


  • Registered Users, Registered Users 2 Posts: 2,587 ✭✭✭gerire


    Hey finnpark, thanks very much for your help unfortunately time is against me so amn't going to be able to get it up and running
    Thanks again


Advertisement