# Button Push to Computer Input

#### silverwood

Joined Feb 11, 2009
2
I don't know if this is the right place to post this but i've been searching the internet and a lot of my hits are the forums on this site.

I am looking for a tracking system. Basically I am trying to track money being put into a box.
When the money is put into the box a switch or trigger is shorted/activated (like when you put a quarter in a arcade game). I have no idea on how to get that signal onto a computer so that I can track how many times money is put in the box. I know that it can be done I just don't know what I need to do it.
Any help would be greatly apreciated.

Thanks,

Danny

#### beenthere

Joined Apr 20, 2004
15,808
A simple method if to arrange a beam of light to be broken by the coin. Arrange the output from the sensor to be a logical 0 (unbroken) or 1 (broken) and it can be applied as an input to any computer/microprocessor. You caould use an IR LED abd phototransistor, or a photointerrupter for the job.

Hopefully, this isn't for serious use. Modern coin operated devices use somewhat sophisticated means to distinguish between real coins and fake. If you intend to use the sensor to accept that a coin has been fed in, what happens when a washer of the right size, or a slip of opaque paper is inserted?

#### silverwood

Joined Feb 11, 2009
2
I have a way to detect when money is put into the box, but I don't know what kind of device to use that would take that signal and convert it so that the computer can make record of it in a database.

#### RiJoRI

Joined Aug 15, 2007
536
Life was a lot easier with the older computers where you did not need to battle the OS. You could scan the printer signal lines or the serial port control lines. These days I would grab a microcontroller and use it to transfer the pulse(s) into an ASCII character, and send it out the serial port to the computer.

--Rich

#### Barry M

Joined Feb 11, 2009
35
So theres a mechanism in place and you want to computerise it?

I think you'll need to give the specs of the mechanism in place first to see what signals are readily available off of it and then theres the software to capture those signals and convert it and the database stuck on the end ... but Im a noob so who knows.

#### PIC_User

Joined Sep 22, 2008
20
I have a way to detect when money is put into the box, but I don't know what kind of device to use that would take that signal and convert it so that the computer can make record of it in a database.
Hi Danny,
Could get your circuit to actuate a small reed relay to give dry (no outside voltages) on/ off contacts?

#### cmartinez

Joined Jan 17, 2007
6,377
Danny,
You need to use a microcontroller for that. I strongly suggest an ATMEL with an 8051 architecture since it's rather easy to program.
Use an optical sensor as beenthere suggests, and then transfer the detection to the computer via RS232
So the questions are:
- How experienced are you with digital MCU's?
- What's your expertise with sensors and signal conditioning?
- How much time are you willing to put into this project?

Czar

#### cmartinez

Joined Jan 17, 2007
6,377
Danny,
You need to use a microcontroller for that. I strongly suggest an ATMEL with an 8051 architecture since it's rather easy to program.
Use an optical sensor as beenthere suggests, and then transfer the detection to the computer via RS232
So the questions are:
- How experienced are you with digital MCU's?
- What's your expertise with sensors and signal conditioning?
- How much time are you willing to put into this project?

Czar

#### PIC_User

Joined Sep 22, 2008
20
Hi Danny,

If you can control the reed relay with your circuit:

Get a standard cheapest ($5-$7) available USB 3 button Mouse.

Open it.
Wire the relay contacts across the middle button.
Every time the relay is actuated, the computer thinks the middle button of the mouse has been pressed.

Use simple free software to read the middle button press.
This is open source, freeware that seem to work great.
autohotkey.com
You can set up a script. It lets you do all kinds of things.
Their forum has a lot of code examples.
Some of the examples show mouse button clicks.

The good part is that you do not need any driver software for the device because Windows reorganizes it as a mouse (Human Interface Device - HID). The mouse contains the debounce conditioning for it's normal push-button.