F
F
forest_engine2018-11-05 11:24:08
Do it yourself
forest_engine, 2018-11-05 11:24:08

Is there an easy way to check if a signal is being sent to the computer?

Just for fun, I decided to make something like an alarm for the door. The system is simple - a little foil on the door and on the jamb, when the door is closed - the contact closes and the current flows. But making a simple beep when a door is opened is an easy task, so I wanted to get the information directly to the computer, read it and process it in a self-written Java program. Let's say that an indicator appears on the screen when the door is opened. But the problem is that I don't have any idea how to get just one bit of information. If via USB, then you need to buy a microcontroller and program it. But it's all too complicated for such a simple task. Is there any way to check if the door is open?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
G
GavriKos, 2018-11-05
@GavriKos

The simplest - com or lpt port are physical - they literally support the closure of pairs. But these are antiquities. You can still seem to be through the GPIO, if you find it on the motherboard.
But - much more correctly - through a simple microcontroller plugged into USB. If you are afraid to "program a microcontroller" - take an arduino - yes, it is wildly redundant for this particular task, but it is easy to program.

A
Alexander, 2018-11-05
@NeiroNx

Or you can just solder the wires into the keyboard and assign the action to which thread the media button (so that the system tracks the clicks), or keep the program running all the time.

S
solalex, 2018-11-05
@solalex

You can use the contacts of a regular network network, and track the rise or fall of the link. If contacts 1 and 3 are closed, the link will go up. It is not necessary to use foil - there are a lot of reed switches and magnets for them on sale.

M
metajiji, 2018-11-18
@metajiji

Connect the wires to the keyboard, for example to the CapsLock button :)

D
Dmitry Alexandrov, 2018-11-05
@jamakasi666

The easiest and most pleasant option is to buy Digispark on Attiny85 which costs 100 rubles and is immediately usb compatible and even arduino compatible.
Another option can be confused through the audio inputs.

X
x67, 2018-11-05
@x67

If you don’t want to bother with usb, you can plug it into a 3.5 port and programmatically listen to the signal from it, like from a microphone. But it is highly desirable to have protection against static. At least a suppressor / zener diode connected in parallel to a computer + twisted pair. Ideally, of course, have galvanic isolation and a separate power supply for the "sensor", and transmit the signal directly to the jack input.
Well, don’t forget about the resistance, for microphones it seems to be more than 200-300 Ohms

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question