Touch Sensor for Arduino and creepy paranoid admin device
An interesting library for organizing touch control was discovered here for Arduino: www.arduino.cc/playground/Main/CapSense . The principle of operation is simple - we connect two any legs with a mega-ohm resistor for several, one leg will be the output, the second will be the input. We catch a wire sensor at the entrance, and even better, something flat and conductive - like a piece of copper foil. If the output is switched from 0 to 1 and vice versa, the input state will also switch, but due to various parasitic capacitances the process will take place with some delay, and the larger the capacity (say, the closer the human hand is), the greater this inertia. Here is an illustration from the author of the library:
--- AutoLock.py ---
# - * - coding: windows-1251 - * -
import serial
import os
ser = serial.Serial ('COM3', 9600) # Here you need to put your port
while 1:
s = ser.readline (). strip () # Read the line and remove the line breaks
# print (s) # uncomment for debugging
if s == 'Bye!': # if a person is gone, lock the system
os.system ('rundll32.exe user32.dll, LockWorkStation')
---
Under Ubuntu, it worked successfully with changes in 2 lines: the port opens like this:
ser = serial.Serial ('/ dev / ttyUSB0', 9600)
The machine closes like this:
os.system ('gnome-screensaver-command --lock')
A small video showing the work:
PS About my experiments with Arduino, I am still writing on the blog arduino-ru.blogspot.com , but there will be reports in the form of reports, and I plan to post more detailed descriptions on Habr with the analysis of source codes and schemes. In particular, I will be glad to do this if it is interesting to someone. Are there people in the audience who are close to software, but who want to understand a little bit of self-made hardware? Or vice versa, those born with a soldering iron in their hands, but never got close to the microcontrollers? In general, I want feedback - waiting for comments good and different :)