Ks0147 keyestudio Touch Key USB shield: Difference between revisions
Keyestudio (talk | contribs) |
Keyestudio (talk | contribs) |
||
(22 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[image:ks0147.png|thumb|400px|right|Keyestudio Touch Key USB shield]] | |||
<br> | |||
==Introduction== | ==Introduction== | ||
Have you seen the Makey touch keyboard simulation? MaKey MaKey is a very simple circuit board that can make any objects as a computing input device.<br> | |||
That’s to say, it can make stairway into a piano, bananas into a keyboard, plasticine into a joystick or even your families into a musical synthesizer.<br> | |||
The principle is simple. It uses ARDUINO microcontroller to simulate a keyboard, and lead out several keys, replacing the switch with touch key.<br> | |||
This Touch Key USB Shield is developed by KEYESTUDIO. <br> | |||
The shield uses touch input, namely, a double-contact switch, leading out touch port and ground connected to two touch electrodes. Because of body-resistance, when you touch the two electrodes, there is certain current flowing through between them, so can detect the touch event through the current detection. <br> | |||
More reference see the [http://wiki.keyestudio.com/index.php/Ks0188_keyestudio_Maker_Touch_Starter_Kit keyestudio Maker Touch Starter Kit].<br> | |||
<br> | |||
==Features== | |||
* Compatible with [http://wiki.keyestudio.com/index.php/Ks0001_keyestudio_UNO_R3_BOARD UNO R3] and [http://wiki.keyestudio.com/index.php/Ks0002_keyestudio_Mega_2560_R3_Development_Board MEGA 2560 control board]. | |||
* XP and win7 system Drive-free auto-identification | |||
* Identify six buttons at most | |||
* Operating voltage: DC 5V | |||
* Can set the 6 buttons output in the code | |||
* Onboard comes with 2 anti-reversed interfaces, used to connect other devices. | |||
<br>[[File:KS0147 (9).jpg|500px|frameless|thumb]]<br> | <br>[[File:KS0147 (9).jpg|500px|frameless|thumb]]<br> | ||
== | <br> | ||
==Technical Details== | |||
* Dimensions: 70mm x 53mm x 26mm | |||
* Weight: 19.8g | |||
<br>[[File:KS0147 Detail.png|600px|frameless|thumb]]<br> | |||
<br> | |||
==PINOUT== | |||
<br>[[File:KS0147 pinout.jpg|800px|frameless|thumb]]<br> | |||
<br> | |||
==Test Code== | |||
Below is an example code.<br> | |||
[https://drive.google.com/open?id=1WfwYEaAQSRz_q6QHv8qjIF8BfGwH0UNa Click here] to download the libraries.<br> | |||
[https://drive.google.com/open?id=1IJCN4apPYGFBX7bNXJccrP9y6GJ3rkwo Click here] to download the code <br> | |||
Or you can directly copy and paste the code below to [http://wiki.keyestudio.com/index.php/How_to_Download_Arduino_IDE Arduino IDE].<br> | |||
<pre> | |||
#include "UsbKeyboard.h" | |||
int InData1 = 0, InData2 = 0, InData3 = 0, InData4 = 0, InData5 = 0, InData0 = 0; //touch input value | |||
//temporary storage | |||
int TouchSensitivity = 20; //touch sensitivity. 0~1023,the larger the value, the lower the sensitivity. | |||
void setup() | |||
{ | |||
for(int i = A0; i <= A5; i++) | |||
{ | |||
pinMode(i, INPUT); //A0~A5 port as input port | |||
} | |||
for(int i = 6; i <= 12; i++) | |||
{ | |||
pinMode(i, OUTPUT); //A0~A5 port as input port | |||
} | |||
TIMSK0 &= !(1 << TOIE0); | |||
} | |||
void loop() | |||
{ | |||
UsbKeyboard.update(); | |||
//read out the voltage value of all pins, and because of pull-up resistor, | |||
//the default of all pins of maximum level is 1023,decrease the level of pins though touch. | |||
//so the value is by 1024-analogRead(A0); | |||
InData0 = 1024 - analogRead(A0); | |||
InData1 = 1024 - analogRead(A1); | |||
InData2 = 1024 - analogRead(A2); | |||
InData3 = 1024 - analogRead(A3); | |||
InData4 = 1024 - analogRead(A4); | |||
InData5 = 1024 - analogRead(A5); | |||
//trigger keyboard events with various possibility | |||
if(InData0 >= TouchSensitivity) | |||
{ | |||
digitalWrite (11, HIGH); | |||
UsbKeyboard.sendKeyStroke(4); //A | |||
} | |||
else digitalWrite(11, LOW); | |||
if(InData1 >= TouchSensitivity) | |||
{ | |||
digitalWrite(10, HIGH); | |||
UsbKeyboard.sendKeyStroke(5); //B | |||
} | |||
else digitalWrite(10, LOW); | |||
if(InData2 >= TouchSensitivity) | |||
{ | |||
digitalWrite(9, HIGH); | |||
UsbKeyboard.sendKeyStroke(6); //C | |||
} | |||
else digitalWrite(9, LOW); | |||
if(InData3 >= TouchSensitivity) | |||
{ | |||
digitalWrite(8, HIGH); | |||
UsbKeyboard.sendKeyStroke(7); //D | |||
} | |||
else digitalWrite(8, LOW); | |||
if(InData4 >= TouchSensitivity) | |||
{ | |||
digitalWrite(7, HIGH); | |||
UsbKeyboard.sendKeyStroke(8);//E | |||
} | |||
else digitalWrite(7, LOW); | |||
if(InData5 >= TouchSensitivity) | |||
{ | |||
digitalWrite(6, HIGH); | |||
UsbKeyboard.sendKeyStroke(9);//F | |||
} | |||
else digitalWrite(6, LOW); | |||
delay(100); | |||
} | |||
</pre> | |||
<br> | |||
<span style="color: red">'''Code to Note:'''</span> <br> | |||
'''1.''' Before compile the code, do remember to add the necessary libraries inside the libraries directory of Arduino IDE.<br> | |||
Download the libraries from below link:<br> | |||
https://drive.google.com/open?id=1WfwYEaAQSRz_q6QHv8qjIF8BfGwH0UNa<br> | |||
'''2.''' In the code '''UsbKeyboard.sendKeyStroke(9)''', here you can change the value to make 6 buttons output different value. The detailed value you can find in the '''UsbKeyboard.h''' file, as the figure shown below. | |||
<br>[[File:KS0147 Code.png|700px|frameless|thumb]]<br> | |||
<br> | |||
==Example Use== | |||
Upload well the code to UNO R3, then stack the shield onto UNO R3. Connect the alligator clip line to both GND and A0-A5 interfaces, and clip the coin to GND and A0 connected to alligator clip line. | |||
<br>[[File:KS0147 Result.png|700px|frameless|thumb]]<br> | |||
<br> | |||
Then connect the shield to computer (WIN7) using a USB cable, the computer will automatically identify the shield. <br> | |||
Open a Notepad, when your fingers touch the two coins, the letter A will continue to display on the text.<br> | |||
<br>[[File:KS0147 Result 1.png|500px|frameless|thumb]]<br> | |||
<br> | |||
If use your fingers to separately touch the coin connected to GND and one end of A1-A5 alligator clip line, the letter BCDEF will display on the text. | |||
<br> | |||
<br> | |||
==Resources == | ==Resources == | ||
''' | '''Download the code and libraries:'''<br> | ||
https://fs.keyestudio.com/KS0147 | |||
'''Video:'''<br> | |||
http://video.keyestudio.com/ks0147/ | |||
<br> | |||
==Get One Now == | ==Get One Now == | ||
'''Official Website''' | *[https://www.keyestudio.com/free-shipping-new-keyestudio-touch-key-usb-shield-for-arduino-p0337.html '''Official Website''' ] | ||
*[https://www.aliexpress.com/store/product/Free-shipping-New-Makey-Makey-touch-key-USB-shield-analog-touch-keyboard-for-arduino/1452162_2043499238.html?spm=2114.12010612.8148356.64.31c5276frwiMC3 '''Shop on Aliexpress'''] | |||
[[Category: Shield]] | [[Category: Shield]] |
Latest revision as of 15:08, 6 January 2021
Introduction
Have you seen the Makey touch keyboard simulation? MaKey MaKey is a very simple circuit board that can make any objects as a computing input device.
That’s to say, it can make stairway into a piano, bananas into a keyboard, plasticine into a joystick or even your families into a musical synthesizer.
The principle is simple. It uses ARDUINO microcontroller to simulate a keyboard, and lead out several keys, replacing the switch with touch key.
This Touch Key USB Shield is developed by KEYESTUDIO.
The shield uses touch input, namely, a double-contact switch, leading out touch port and ground connected to two touch electrodes. Because of body-resistance, when you touch the two electrodes, there is certain current flowing through between them, so can detect the touch event through the current detection.
More reference see the keyestudio Maker Touch Starter Kit.
Features
- Compatible with UNO R3 and MEGA 2560 control board.
- XP and win7 system Drive-free auto-identification
- Identify six buttons at most
- Operating voltage: DC 5V
- Can set the 6 buttons output in the code
- Onboard comes with 2 anti-reversed interfaces, used to connect other devices.
Technical Details
- Dimensions: 70mm x 53mm x 26mm
- Weight: 19.8g
PINOUT
Test Code
Below is an example code.
Click here to download the libraries.
Click here to download the code
Or you can directly copy and paste the code below to Arduino IDE.
#include "UsbKeyboard.h" int InData1 = 0, InData2 = 0, InData3 = 0, InData4 = 0, InData5 = 0, InData0 = 0; //touch input value //temporary storage int TouchSensitivity = 20; //touch sensitivity. 0~1023,the larger the value, the lower the sensitivity. void setup() { for(int i = A0; i <= A5; i++) { pinMode(i, INPUT); //A0~A5 port as input port } for(int i = 6; i <= 12; i++) { pinMode(i, OUTPUT); //A0~A5 port as input port } TIMSK0 &= !(1 << TOIE0); } void loop() { UsbKeyboard.update(); //read out the voltage value of all pins, and because of pull-up resistor, //the default of all pins of maximum level is 1023,decrease the level of pins though touch. //so the value is by 1024-analogRead(A0); InData0 = 1024 - analogRead(A0); InData1 = 1024 - analogRead(A1); InData2 = 1024 - analogRead(A2); InData3 = 1024 - analogRead(A3); InData4 = 1024 - analogRead(A4); InData5 = 1024 - analogRead(A5); //trigger keyboard events with various possibility if(InData0 >= TouchSensitivity) { digitalWrite (11, HIGH); UsbKeyboard.sendKeyStroke(4); //A } else digitalWrite(11, LOW); if(InData1 >= TouchSensitivity) { digitalWrite(10, HIGH); UsbKeyboard.sendKeyStroke(5); //B } else digitalWrite(10, LOW); if(InData2 >= TouchSensitivity) { digitalWrite(9, HIGH); UsbKeyboard.sendKeyStroke(6); //C } else digitalWrite(9, LOW); if(InData3 >= TouchSensitivity) { digitalWrite(8, HIGH); UsbKeyboard.sendKeyStroke(7); //D } else digitalWrite(8, LOW); if(InData4 >= TouchSensitivity) { digitalWrite(7, HIGH); UsbKeyboard.sendKeyStroke(8);//E } else digitalWrite(7, LOW); if(InData5 >= TouchSensitivity) { digitalWrite(6, HIGH); UsbKeyboard.sendKeyStroke(9);//F } else digitalWrite(6, LOW); delay(100); }
Code to Note:
1. Before compile the code, do remember to add the necessary libraries inside the libraries directory of Arduino IDE.
Download the libraries from below link:
https://drive.google.com/open?id=1WfwYEaAQSRz_q6QHv8qjIF8BfGwH0UNa
2. In the code UsbKeyboard.sendKeyStroke(9), here you can change the value to make 6 buttons output different value. The detailed value you can find in the UsbKeyboard.h file, as the figure shown below.
Example Use
Upload well the code to UNO R3, then stack the shield onto UNO R3. Connect the alligator clip line to both GND and A0-A5 interfaces, and clip the coin to GND and A0 connected to alligator clip line.
Then connect the shield to computer (WIN7) using a USB cable, the computer will automatically identify the shield.
Open a Notepad, when your fingers touch the two coins, the letter A will continue to display on the text.
If use your fingers to separately touch the coin connected to GND and one end of A1-A5 alligator clip line, the letter BCDEF will display on the text.
Resources
Download the code and libraries:
https://fs.keyestudio.com/KS0147
Video:
http://video.keyestudio.com/ks0147/