Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How to use serial or usb to count admissions

Status
Not open for further replies.

tickets

New Member
I am the box office manager for a sports facility in California. Our facility has 26 admission gates located it three areas. Counting admission through the gates is kind of old school. We have a turnstile with a manual counter. I would like to add a system to count turns (admissions) and upload to a web based app so I can monitor admissions on an hourly basis. Each admission gate has a computer with an internet connection.
I have a basic understanding of electronics (ham radio) and envision a system something like this:
When someone goes through the gate the turnstile triggers a normally off, momentary on switch. The signal is sent to the computer through a serial or usb port to a web base app. I can handle the software end but how to do the hardware?
Thanks in advance.
 
Take a look here https://nanorivertech.com/index.html at some of the API's especially because they have implemented callbacks in their API. Thus, your able to detect a state change without continuously polling.

Interrupts and edge-triggering and schmidt trigger are a few concepts. Yes, you do need some way of detecing the turnstyle. A switch, a hall effect switch (magnet), and optical are some ways of doing that.

It could be as simple as glueing/tapping a hole for a tiny magnet and a sensor.
 
Thanks for that.
Yes, a normally off momentary on switch would do it.
What I don't understand is how to wire it using serial or usb.
 
Thanks for that.
Yes, a normally off momentary on switch would do it.
What I don't understand is how to wire it using serial or usb.

Does your computer have a Parallel Port that is not being used? Detecting if a switch wired to a PP is open or closed is fairly trivial. A PP can handle about a half dozen inputs easily; more inputs is doable but slightly harder...

Other option is a usb dongle designed for digital I/O. The link is the expensive model; I have seen cheap knock offs for a few bucks.
 
What I don't understand is how to wire it using serial or usb.
To use the serial port, you can simply connect the switch between the TX and RX pins. You can then just send blocks of data to TX, and you will get data received events when the switch is closed.

There are many other ways to do connect it too, e.g. connecting the switch between a control line (e.g. CTS or DSR) and TX (TX provides a negative voltage in idle) with a pull-up resistor to RTS or DTR (which will provide the positive voltage). You can then use the change of state event for that control line to detect when there's some activity at the turnstile.

To use the USB connection, you can use converter between the USB and your switch **broken link removed** The connections will be pretty much the same as above. This converter is <$3 delivered.
 
I picked something, but take a better look here: https://nanorivertech.com/viperboard.html#api Particularly this function: Nano_GPIOAGetInterruptInput()

In microcontroller terms, a typical port can be configured as an input or an output. Some systems allow the resistor pull ups and pull downs to be configured. A "pull-up resistor" is a resistor to the logic supply. A pull down is a resistor to ground. Logic suplies can be anyhing, but 3.3, and 5V are common with 1.8 V now showing up on the market.

So, the "port" can have a resistro to the "logic supply", thus forcing the port to a logic High. A switch, an opto isolator, whatever, can then be attached to the port and ground.

So, let's say you had a switch that closed when the turnstyle switch was in the quiesent position. When the turnstyle is moving, the "switch" opened. Thus, the port would be a logic high when stopped, and would go to a logic low while it is moving. This negative going edge can be detected with the API and the callback interrupt function.
 
I am the box office manager for a sports facility in California. Our facility has 26 admission gates located it three areas. Counting admission through the gates is kind of old school. We have a turnstile with a manual counter. I would like to add a system to count turns (admissions) and upload to a web based app so I can monitor admissions on an hourly basis. Each admission gate has a computer with an internet connection.
I have a basic understanding of electronics (ham radio) and envision a system something like this:
When someone goes through the gate the turnstile triggers a normally off, momentary on switch. The signal is sent to the computer through a serial or usb port to a web base app. I can handle the software end but how to do the hardware?
Thanks in advance.

Maybe you can considered using a cheap PC USB keyboard , dismantled it and wire a switch to any key. (there are numberic USB keypad that are very inexpensive) . Reading the key is very easy with any PC programming language. I built a project with my kids to interface to a custom music program (Visual Basic) and it works perfectly. Buy one an experiment.
 
Maybe you can considered using a cheap PC USB keyboard , dismantled it and wire a switch to any key. (there are numberic USB keypad that are very inexpensive) . Reading the key is very easy with any PC programming language. I built a project with my kids to interface to a custom music program (Visual Basic) and it works perfectly. Buy one an experiment.

Now THAT'S what I call a good idea :cool:

Cheap and easy - why reinvent the wheel?.
 
If you do the KB thing, won't it interfere with the operation of the PC? e.g. An "a" being typed whenever someone goes through the turnstyle?
 
If you do the KB thing, won't it interfere with the operation of the PC? e.g. An "a" being typed whenever someone goes through the turnstyle?

The program (VB.Net, C#,etc) will read the keyboard as any other regular program waiting for " certain" keys. This will be no different than any other PC program that use the keyboard as an input device. For starting/stopping my custom Visual Basic program I used the mouse to click a button on the program main screen.
 
Status
Not open for further replies.

Latest threads

Back
Top