Jump to content

Interface with pushbuttons (physical buttons) ?


Myicq
 Share

Recommended Posts

I have been asked to interface with physical buttons.

Customer would like to update a controlling device within 1-2 seconds using one or more pushbuttons. Assuming just 3-4 buttons at most for now.

Idea is:

Push button A ==> send RS232 text "A" to device

Push button B ==> send RS232 text "B" to device

etc

The size and type of button is not known, but it will be the kind that closes a switch which is normally open. Like an arcade button.

I can do it using PC keyboard, but client wants something more industrial. So how to go about this - which port / IO card should I choose, and how do I actually read from such a card ? (or a PC port?)

Any experience / example programs welcomed with thanks!

I am just a hobby programmer, and nothing great to publish right now.

Link to comment
Share on other sites

It's not so difficult and there are lots of ways to do it.

For the push buttons search for an electrical control gear distributor and control panel push buttons. Some sell ready-made boxes with 2 or three switches fitted ready to connect.

To read the state of the switches you need an input interface of some sort. Search for RS232 Input interface and usb input interface.

One unit I can recommend is this module.  It is unusual because it only needs a usb lead and it is ready to go. Also it is in a neat box which clips to a din rail and has screw terminals for all the connections. Many interfaces are more like circuit boards which require extra work to deal with. You don't need a powersupply or anything else apart from some switches to connect to the inputs. 

The usb driver acts like a COM port  and my COM port udf is used in the script to read the switches, so it would be easy to add features like sending text to a serial port.

I have a small script to read the inputs and set the output relays which is available to anyone who wants it.

If you need to operate lamps with the relay outputs then you would need a power supply, but a battery would be sufficient for LEDs. 

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 1 year later...

Sorry for the necroposting, but this sounds exactly like what I need... in my case I need to control three 24VDC valves, while using another serial port to interface with with some other equipment (which I'm already doing with Martin's comm port udf).

Martin, have you actually used this device?  Do I understand correctly that it's USB, but the computer sees it as a COM port that I control by sending strings to?  Then I'd just use the commmgr udf and CommSwitch to handle the two com ports?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...