Membuat Alat Pendeteksi Jari Tangan Menggunakan Arduino dan Leap Motion
Kali ini akan dibahas mengenai bagaimana cara membuat alat yang digunakan untuk mendeteksi jari-jari tangan kemudian jari-jari tangan tersebut dapat mengendalikan hidup dan matinya LED yang terpasang di Arduino, alat ini bisa dikembangkan untuk mengendalikan robot atau device lain seperti servo atau motor dc dll. Alat ini menggunakan sensor Leap Motion sebagai media pendeteksinya, yang akan ditransferkan ke Arduino. berikut penjelasan skema dan programnya.
a. Arduino Uno
b. Leap Motion
c. Program Processing IDE
import com.onformative.leap.LeapMotionP5;
import com.leapmotion.leap.Finger;
LeapMotionP5 leap;
import processing.serial.*;
Serial port;
public void setup() {
// set window, P3D = 3D rendering
size(600, 600, P3D);
noFill();
stroke(255);
// set LEAP object
leap = new LeapMotionP5(this);
// set com port. Currently: "/dev/tty.usbmodemfd121"
//println("Available serial ports:");
//println(Serial.list());
//port = new Serial(this, "/dev/tty.usbmodemfd121", 9600);
port = new Serial(this, Serial.list()[0], 9600);
}
public void draw() {
background(0);
fill(255);
int numFingers = leap.getFingerList().size();
print("Number of Fingers: ");
println(numFingers);
port.write(numFingers);
for (Finger f : leap.getFingerList()) {
PVector position = leap.getTip(f);
PVector velocity = leap.getVelocity(f);
ellipse(position.x, position.y, 10, 10);
}
}
public void stop() {
leap.stop();
}
d. Program Arduino IDE
void setup(){
// initialize serial communication:
Serial.begin(9600);
// set LED pins 3-7 as outputs
for(int x = 3; x<8; x++){
pinMode(x, OUTPUT);
}
}
void loop(){
byte numFingers;
// check if data has been sent from the computer:
if (Serial.available()) {
// read the most recent byte (which will be from 0 to 255):
numFingers = Serial.read();
if (numFingers == 0){
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
} else if (numFingers == 1){
digitalWrite(3, HIGH);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
} else if (numFingers == 2){
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
} else if (numFingers == 3){
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
} else if (numFingers == 4){
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
} else if (numFingers == 5){
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
digitalWrite(6, HIGH);
digitalWrite(7, HIGH);
}
}
}
d. Cara Install Library
- Download library di link berikut https://github.com/mrzl/LeapMotionP5
- Ekstrak file tersebut lalu letakan di Document -> Processing -> Libraries
- Ubah namanya menjadi "LeapMotionP5"
- Lalu buka software Processing dan Arduinonya
e. VIDEO HASILNYA
- Download library di link berikut https://github.com/mrzl/LeapMotionP5
- Ekstrak file tersebut lalu letakan di Document -> Processing -> Libraries
- Ubah namanya menjadi "LeapMotionP5"
- Lalu buka software Processing dan Arduinonya
e. VIDEO HASILNYA
Update Contact :
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email : Fajarudinsidik@gmail.com
No Wa/Telepon (puat) : 085267792168
No Wa/Telepon (fajar) : 085369237896
Email: Fajarudinsidik@gmail.com
atau Kirimkan Private messanger melalui email dengan klik tombol order dibawah ini :