We need Switch to control electronics or electrical appliances or some thing, Some time electrical switches will give a shock when we use electrical switches with wet hand and then touch to control electrical or electronic load is much interactive than ordinary switches, may be some projects needs touch switch.
In this lesson, we will show what is Digital Touch Sensor Module and how to use it with the Arduino board.
Arduino IDE (version 1.6.4+)
-Control Interface : A total of three pins (GND, VCC, SIG), GND to ground , VCC is the power supply , SIG digital signal output pin ;
-Power Indicator : Green LED, power on the right that is shiny ;
-Touch area : Similar to a fingerprint icon inside the area , you can touch the trigger finger .
-Positioning holes : 4 M2 screws positioning hole diameter is 2.2mm, the positioning of the module is easy to install , to achieve inter- module combination ;
TTP223 is 1 Key Touch pad detector IC, and it is suitable to detect capacitive element variations. It consumes very low power and the operating voltage is only between 2.0V~5.5V. The response time max about 60mS at fast mode, 220mS at low power mode @VDD=3V. Sensitivity can adjust by the capacitance(0~50pF) outside.
Connect Vcc pin of Sensor breakout board to Arduino’s +5V pin and GND to GND. Connect Signal (SIG) pin to Arduino Digital pin D2.
The sketch below provides an output to your serial monitor indicating whether or not the sensor is pressed.
After the uploader , if use finger or metal object touch the metal surface of the transducer , the red LED lights on the UNO will light. Open the Serial Monitor at baudrate 9600, and you will see something as below:
前面测试通过了车体安装,电机能够正常运转。在这一课中将告诉大家如何让小车循迹。
step1:下载软件源码
cd osoyoo-robot/ wget --no-check-certificate http://osoyoo.com/driver/lf-tank.tar.gz
step2:解压源码包 lf.tar.gz里面包含了循迹模块测试程序和循迹程序
tar -zxvf lf-tank.tar.gz cd lf
step3:测试循迹模块 循迹模块上有5个黑白循迹探头,每个探头对应一个红色信号灯,没有检测到黑线时候灯亮起;当检测到黑线时候信号灯熄灭,输出端输出一个低电平,5个探头从左往右分别编号为1-5.将循迹模块探头放置在白色背景黑色线上,当对应探头在黑线上时候,终端会输出提示信息:”No.x
is OK!”,同时,信号灯熄灭。例如,3号探头位于黑线上,会打印出”No.3 is OK!”。如果探头位于黑线上,但是终端输出:”No
black line detected!”,说明循迹模块不正常,请检查接线是否正确;探头是否距离黑线太高或太近。
sudo python test.py
如果测试没有问题,就可以运行下面的循迹程序了。如果测试不通过,请检查循迹模块接线是否正确。
将小车放置在事先铺设好的轨道上,轨道要求白色背景黑色线,线宽在10 cm-30 cm之间,轨道尽量平滑,避免铺设转弯处是直角的轨道。运行下面shell命令后,小车将沿着轨道前进。
sudo python line_follow.py