Translate

Membuat Alat Kendali Suhu LM35 dengan PID Control ARDUINO

Membuat Alat Kendali Suhu LM35 dengan PID Control ARDUINO


           Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang digunakan untuk mengendalikan suhu suatu benda dengan output yang dipakai adalah fan PC atau motor brushless, jadi alat ini seperti kendali fan saja yang mana menggunakan PID sebagai metodenya, semakin mendekati set point maka kipas akan semakin pelan dan jika sudah sampai set point maka kipas akan berhenti, alat ini memiliki beberapa buah parameter yaitu PV yang artinya suhu realtime sekarang, SV (Set Value) artinya batas set point yang diinginkan agar mencapai steady state, HYS (histerisis) artinya batas toleransi set point, akan ada batas atas dan ada batas bawah untuk toleransi, kemudian ada ONR yaitu nilai untuk menghidupkan relay atau mematikan relay. PWM artinya nilai PID atau duty cycle yang telah dikeluarkan oleh mikrokontroller untuk mengatur kecepatan fan. untuk lebih jelasnya berikut adalah skema dan programnya.




a. Arduino Uno






b. LCD Display 16x2





c. Sensor Suhu LM35





d. Transistor Driver Fan Brushless





e. Relay + Driver






f. Program Arduino IDE

#include "Wire.h"
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

int relay = 10;
int kipas = 9;

const int btset = A2;
const int btup = A3;
const int btdown = A2;
const int btok = A5;

int btsetx = 0;
int btupx = 0;
int btdownx = 0;
int btokx = 0;
float sv = 35;
float hys = 1;
float onrelay = 37;

int adcdat;

float simpansv = 35;
float simpanhys = 1;
float simpanonrelay = 37;

float kp = 1.85;
float ki = 1.67;
float kd = 1.15;

float batasatas;
float batasbawah;

float p,i,d,suhu,pid;
float error,errorx,sumerr;

void setup() {
  lcd.begin(16, 2);
  lcd.clear();
  lcd.noCursor();
  pinMode(relay,OUTPUT);
  pinMode(A1,OUTPUT);
  pinMode(kipas,OUTPUT);
  pinMode(btset,INPUT);
  pinMode(btup,INPUT);
  pinMode(btdown,INPUT);
  pinMode(btok,INPUT);
  digitalWrite(btset,HIGH);
  digitalWrite(btup,HIGH);
  digitalWrite(btdown,HIGH);
  digitalWrite(btok,HIGH);
  digitalWrite(A1,LOW);
}

void loop() {

  btsetx = digitalRead(btset);
 
  if(btsetx == 0){
  delay(200);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("LOADING...");
  delay(3000);
  lcd.clear();
  setting();
  lcd.setCursor(0, 0);
  lcd.print("LOADING...");
  delay(3000);
  lcd.clear();
  settinghy();
  lcd.setCursor(0, 0);
  lcd.print("LOADING...");
  delay(3000);
  lcd.clear();
  settingrelay();
  lcd.clear();
  }
 
  error = batasatas - suhu;
  p = error * kp;
  sumerr = error + errorx; 
  i = ki * sumerr; 
  d = error - errorx;
  pid = p + i + d;
 
  if(pid < 1){
  pid = 0;
  }
 
 
   adcdat = analogRead(0);
   suhu = (adcdat * (5.0 / 1023.0)) * 100;
 
  analogWrite(kipas,pid);
   
  lcd.setCursor(0, 0);
  lcd.print("PV=");
  lcd.print(suhu,1);
  lcd.setCursor(0, 1);
  lcd.print("SV=");
  lcd.print(simpansv,1);
  lcd.setCursor(8, 0);
  lcd.print("HYS=");
  lcd.print(simpanhys,1);
  lcd.setCursor(8, 1);
  lcd.print("PWM=");
  //lcd.print(simpanonrelay,1);
  lcd.print(pid,1); 
  delay(200);
 
  batasatas = simpansv + simpanhys;
  batasbawah = simpansv - simpanhys;
 
  if(suhu >= simpanonrelay){
  digitalWrite(relay,HIGH);
  }
  if(suhu < simpanonrelay){
  digitalWrite(relay,LOW);
  }
 
  errorx = error;
 
}


//======================================
void setting(){

  lcd.setCursor(0, 0);
  lcd.print("SETTING SV");
  lcd.setCursor(0, 1);
  lcd.print(sv);

  btupx = digitalRead(btup);
  btdownx = digitalRead(btdown);
  btokx = digitalRead(btok);
 
  if(btupx == 0){
    delay(200);
    sv = sv + 0.5; 
  }

  if(btdownx == 0){
    delay(200);
    sv = sv - 0.5;   
  }
 
  if(btokx == 0){
    delay(200);
    lcd.clear();
    simpansv = sv;
    return;   
  }

setting();
}



void settinghy(){

  lcd.setCursor(0, 0);
  lcd.print("SETTING HYS");
  lcd.setCursor(0, 1);
  lcd.print(hys);

  btupx = digitalRead(btup);
  btdownx = digitalRead(btdown);
  btokx = digitalRead(btok);
 
  if(btupx == 0){
    delay(200);
    hys = hys + 0.5; 
  }

  if(btdownx == 0){
    delay(200);
    hys = hys - 0.5;   
  }
 
  if(btokx == 0){
    delay(200);
    lcd.clear();
    simpanhys = hys;
    return;   
  }

settinghy();
}




void settingrelay(){

  lcd.setCursor(0, 0);
  lcd.print("SETTING ON RELAY");
  lcd.setCursor(0, 1);
  lcd.print(onrelay);

  btupx = digitalRead(btup);
  btdownx = digitalRead(btdown);
  btokx = digitalRead(btok);
 
  if(btupx == 0){
    delay(200);
    onrelay = onrelay + 0.5; 
  }

  if(btdownx == 0){
    delay(200);
    onrelay = onrelay - 0.5;   
  }
 
  if(btokx == 0){
    delay(200);
    lcd.clear();
    simpanonrelay = onrelay;
    return;   
  }

settingrelay();

}






g. VIDEO HASILNYA











Membuat Alat Kendali Lampu Menggunakan Remote TV SONY dan ARDUINO

Membuat Alat Kendali Lampu Menggunakan Remote TV SONY dan ARDUINO


       Pada kesempatan kali ini saya akan membahas mengenai bagaimana cara membuat sebuah alat yang dapat berfungsi sebagai kendali peralatan rumah tangga atau elektronik lainnya dengan menggunakan remote tv SONY, jadi prinsip kerjanya yaitu led atau lampu akan dikendalikan menggunakan remote tv SONY sesuai dengan tombol yang ditekan, misal tombol 1 akan menghidupkan led 1, tombol 2 akan menghidupkan led 2 dan tombol 3 akan menghidupkan led 3 dan seterusnya. sensor yang digunakan yaitu TSOP atau Receiver IR Remote. untuk lebih jelasnya berikut adalah skema dan programnya. 




a. Arduino Uno





b. Sensor TSOP / IR Remote TV





c. Remote TV SONY






d. Program Arduino IDE

#include <IRremote.h>

int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
decode_results results;

int power = 13;
int mute = 3;
int next = 4;
int play = 5;
int uref = 6;
int volup = 7;
int voldown = 8;
int upampli = 9;
int downampli = 10;
int mark = 0;



void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(power,OUTPUT);
  pinMode(mute,OUTPUT);
  pinMode(next,OUTPUT);
  pinMode(play,OUTPUT);
  pinMode(uref,OUTPUT);
  pinMode(volup,OUTPUT);
  pinMode(voldown,OUTPUT);
  pinMode(upampli,OUTPUT);
  pinMode(downampli,OUTPUT);
}

void loop() {
  if (irrecv.decode(&results)) {
   // Serial.println(results.value, DEC);
    irrecv.resume(); // Receive the next value
   
    if(results.value == 656 ){
      digitalWrite(mute,HIGH);
      delay(1000);
      digitalWrite(mute,LOW);
     
    }
   
    if((results.value == 1488 )&&(mark == 0)){
      digitalWrite(power,HIGH);
      delay(1000);
      mark = 1;
 
    }
     else if((results.value == 1488 )&&(mark == 1)){
      digitalWrite(power,LOW);
      delay(1000);
      mark = 0;
 
    }
      if(results.value == 16 ){
      digitalWrite(next,HIGH);
      delay(1000);
      digitalWrite(next,LOW);
 
    }
      if(results.value == 2064 ){
      digitalWrite(play,HIGH);
      delay(1000);
      digitalWrite(play,LOW);
 
    }
      if(results.value == 1040 ){
      digitalWrite(uref,HIGH);
      delay(1000);
      digitalWrite(uref,LOW);
 
    }
      if(results.value == 1168 ){
      digitalWrite(volup,HIGH);
      delay(1000);
      digitalWrite(volup,LOW);
 
    }
      if(results.value == 3216 ){
      digitalWrite(voldown,HIGH);
      delay(1000);
      digitalWrite(voldown,LOW);
 
    }
      if(results.value == 144 ){
      digitalWrite(upampli,HIGH);
      delay(1000);
      digitalWrite(upampli,LOW);
 
    }
      if(results.value == 2192 ){
      digitalWrite(downampli,HIGH);
      delay(1000);
      digitalWrite(downampli,LOW);
 
    }
   
  }
}






e. VIDEO HASILNYA









Membuat Alat Pengukur Heart Beat (BPM) dan Suhu Tubuh DS18B20 dengan RTC DS1302 dan PRINTER THERMAL

Membuat Alat Pengukur Heart Beat (BPM) dan Suhu Tubuh DS18B20 dengan RTC DS1302 dan PRINTER THERMAL


       Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang bisa berfungsi sebagai pasien monitor, jadi alat ini bisa mendeteksi heart beat atau detak jantung dan suhu tubuh dengan output yaitu bisa diprint dengan printer thermal sehingga ada data recordnya. alat ini menggunakan pulse sensor dan sensor DS18B20. kemudian agar pada kertas printer terdapat jam dan tanggal maka ditambahi RTC DS1302. untuk lebih jelasnya berikut adalah program dan skemanya.




a. Arduino Uno






b. Sensor Suhu DS18B20





c. Sensor Pulse






d. RTC DS1302





e. LCD 16x2





f. Printer Thermal






g. Program Arduino IDE

#include "Wire.h"
#include <LiquidCrystal.h>
#include <DS1302.h>
#include <OneWire.h>
#include <SoftwareSerial.h>
SoftwareSerial Thermal(0, 1);

LiquidCrystal lcd(11, 9, 8, 7, 6, 5);

// Init the DS1302
DS1302 rtc(2, 3, 4);

OneWire  ds(10);  // on pin 10 (a 4.7K resistor is necessary)

int zero=0;
int heatTime = 80;
int heatInterval = 255;
char printDensity = 15;
char printBreakTime = 15;

int buzzer = 13;
int tombol = 12;
int tombolx;
int n = 0;
int x;
int dataadc;
int bpmx;
int bpms;


void initPrinter()
{
 //Modify the print speed and heat
 Thermal.write(27);
 Thermal.write(55);
 Thermal.write(7); //Default 64 dots = 8*('7'+1)
 Thermal.write(heatTime); //Default 80 or 800us
 Thermal.write(heatInterval); //Default 2 or 20us
 //Modify the print density and timeout
 Thermal.write(18);
 Thermal.write(35);
 int printSetting = (printDensity<<4) | printBreakTime;
 Thermal.write(printSetting); //Combination of printDensity and printBreakTime

}


void setup(){
  Thermal.begin(19200); // to write to our new printer
  initPrinter();
  Wire.begin();
 
  pinMode(buzzer,OUTPUT);
  digitalWrite(buzzer,HIGH);
 
  pinMode(tombol,INPUT);
  digitalWrite(tombol,HIGH);
 
  lcd.begin(16, 2);
  lcd.clear();
  lcd.noCursor();
  // Set the clock to run-mode, and disable the write protection
  rtc.halt(false);
  rtc.writeProtect(false);
 
  // The following lines can be commented out to use the values already stored in the DS1302
  //rtc.setDOW(TUESDAY);      
  //rtc.setTime(12, 43, 0);    
  //rtc.setDate(21, 3, 2017);  
}


void loop(){
  byte i;
  byte present = 0;
  byte type_s;
  byte data[12];
  byte addr[8];
  float celsius, fahrenheit;
 
  if ( !ds.search(addr)) {
    ds.reset_search();
    delay(250);
    return;
  }
 

  ds.reset();
  ds.select(addr);
  ds.write(0x44, 1);        // start conversion, with parasite power on at the end
 
  delay(1000);     // maybe 750ms is enough, maybe not
  // we might do a ds.depower() here, but the reset will take care of it.
 
  present = ds.reset();
  ds.select(addr);   
  ds.write(0xBE);         // Read Scratchpad

  for ( i = 0; i < 9; i++) {           // we need 9 bytes
    data[i] = ds.read();
  }

  int16_t raw = (data[1] << 8) | data[0];
  if (type_s) {
    raw = raw << 3; // 9 bit resolution default
    if (data[7] == 0x10) {
      // "count remain" gives full 12 bit resolution
      raw = (raw & 0xFFF0) + 12 - data[6];
    }
  } else {
    byte cfg = (data[4] & 0x60);
    // at lower res, the low bits are undefined, so let's zero them
    if (cfg == 0x00) raw = raw & ~7;  // 9 bit resolution, 93.75 ms
    else if (cfg == 0x20) raw = raw & ~3; // 10 bit res, 187.5 ms
    else if (cfg == 0x40) raw = raw & ~1; // 11 bit res, 375 ms
    //// default is 12 bit resolution, 750 ms conversion time
  }
 
  celsius = (float)raw / 16.0;

 tombolx = digitalRead(tombol);

 if(tombolx == 0){
  lcd.clear();
  lcd.print("Printing...");
 
//TURN OFF UNDERLINE MODE
  Thermal.write(27);
  Thermal.write(45);
  Thermal.write(zero);
  delay(3000);

  //NORMAL MODE
  Thermal.println("HASIL PEMERIKSAAN");
  Thermal.print(rtc.getTimeStr());
  Thermal.print(" ");
  Thermal.println(rtc.getDateStr());
  Thermal.write(10);

  //print suhu
  Thermal.print("Suhu = ");
  Thermal.print(celsius);
  Thermal.println(" c");
  Thermal.print("BPM = ");
  Thermal.print(bpmx);
  Thermal.write(10);

  lcd.clear();
 }



 dataadc = analogRead(0);
 if(dataadc > 600){
 delay(200);
 n = 0;
 bpmx = 0;
 bpms = 0;
 lcd.clear();
 bpm();
 }

  // Display time centered on the upper line
  lcd.setCursor(0, 0);
  lcd.print(rtc.getTimeStr());
 
  lcd.setCursor(0, 1);
  lcd.print("T= ");
  lcd.print(celsius);
 
  lcd.setCursor(9, 1);
  lcd.print("B= ");
  lcd.print(bpmx);
 
  if((bpmx < 50)&&(bpmx > 0)){
  digitalWrite(buzzer,LOW);
  }
  else if(bpmx > 130){
  digitalWrite(buzzer,LOW);
  }
  else if(celsius > 37){
  digitalWrite(buzzer,LOW);
  }
  else
  {
  digitalWrite(buzzer,HIGH);
  }
 
  /* Display abbreviated Day-of-Week in the lower left corner
  lcd.setCursor(0, 1);
  lcd.print(rtc.getDOWStr(FORMAT_SHORT));
 
  // Display date in the lower right corner
  lcd.setCursor(6, 1);
  lcd.print(rtc.getDateStr());
  */
 
  delay(1000);     // maybe 750ms is enough, maybe not
 

}



void bpm(){
 n++;
 dataadc = analogRead(0);

 if ((dataadc > 600) && (x == 1)) {  
  x = 0;
  bpms = bpms + 1;
 }
 else if ((dataadc < 600) && (x == 0)) {
 x = 1;
 }

 lcd.setCursor(0, 0);
 lcd.print("BPM= ");
 lcd.print(bpms);
 
delay(200);

if(n > 50){
bpmx = bpms * 6;
 lcd.clear();
return;
}
else{
bpm();
}


}





h. Gambar Hasil Print-nya






i. VIDEO HASILNYA









Membuat Alat Pengukur Tegangan AC Sinus 220v Menggunakan Arduino UNO dan Sensor ZMPT101B

Membuat Alat Pengukur Tegangan AC Sinus 220v Menggunakan Arduino UNO dan Sensor ZMPT101B


          Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat yang digunakan untuk mengukur tegangan AC dengan mengunakan Arduino UNO dan sensor ZMPT101B, jadi prinsip kerjanya alat ini seperti multimeter atau avometer yaitu mengukur tegangan ac dari 0 sampai 220 VAC. yang paling penting dari alat ini yaitu bagaimana cara kalibrasi dari sensor AC karena output sensor adalah sinyal sinus dan bagaimana mendapatkan Vrms-nya. untuk lebih jelasnya berikut adalah skema dan programnya.



a. Arduino Uno





b. Sensor ZMPT101B
 





c. LCD 16x2





d. Program Arduino IDE

#include "Wire.h"
#include <LiquidCrystal.h>
LiquidCrystal lcd(11, 9, 8, 7, 6, 5);

int vin = 0;
int iin = 0;
int vout;
float kal;

unsigned long start_times[100];
unsigned long stop_times[100];
unsigned long values[100];

// Define various ADC prescaler
const unsigned char PS_16 = (1 << ADPS2);
const unsigned char PS_32 = (1 << ADPS2) | (1 << ADPS0);
const unsigned char PS_64 = (1 << ADPS2) | (1 << ADPS1);
const unsigned char PS_128 = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);

int a = 0;
int zero = 1;


void setup() {

  lcd.begin(16, 2);
  lcd.clear();
  lcd.noCursor();

  // set up the ADC
  ADCSRA &= ~PS_128;  // remove bits set by Arduino library

  // you can choose a prescaler from above.
  // PS_16, PS_32, PS_64 or PS_128
  ADCSRA |= PS_128;    // set our own prescaler to 64



}


void loop() {

  unsigned int i1;
  unsigned int z1;
  z1 = 0;
 
  unsigned int i2;
  unsigned int z2;
  z2 = 0;
 
  unsigned int i3;
  unsigned int z3;
  z3 = 0;
 
  unsigned int i4;
  unsigned int z4;
  z4 = 0;
  
  for(i1=0;i1<100;i1++) {
    start_times[i1] = micros();
    values[i1] = analogRead(A0);            

  if (values[i1] >= z1) {
  z1 = values[i1];
  }
 
    stop_times[i1] = micros();
  }
 
    for(i2=0;i2<100;i2++) {
    start_times[i2] = micros();
    values[i2] = analogRead(A0);            

  if (values[i2] >= z2) {
  z2 = values[i2];
  }
 
    stop_times[i2] = micros();
  }
 
 
    for(i3=0;i3<100;i3++) {
    start_times[i3] = micros();
    values[i3] = analogRead(A0);            

  if (values[i3] >= z3) {
  z3 = values[i3];
  }
 
    stop_times[i3] = micros();
  }
 
 
    for(i4=0;i4<100;i4++) {
    start_times[i4] = micros();
    values[i4] = analogRead(A0);            

  if (values[i4] >= z4) {
  z4 = values[i4];
  }
 
    stop_times[i4] = micros();
  }
 

   int vin1 = z1 ;
   int vin2 = z2 ;
   int vin3 = z3 ;
   int vin4 = z4 ;

  z1 = 0;
  z2 = 0;
  z3 = 0;
  z4 = 0;

if((vin1 > vin2)&&(vin1 > vin3)&&(vin1 > vin4)){
  vout = vin1;
  kal = (vout - 515.9) / 0.413 ;
}
else if((vin2 > vin1)&&(vin2 > vin3)&&(vin2 > vin4)){
  vout = vin2;
  kal = (vout - 515.9) / 0.413 ;
}
else if((vin3 > vin1)&&(vin3 > vin2)&&(vin3 > vin4)){
  vout = vin3;
  kal = (vout - 515.9) / 0.413 ;
}
else if((vin4 > vin1)&&(vin4 > vin2)&&(vin4 > vin3)){
  vout = vin4;
  kal = (vout - 515.9) / 0.413 ;
}

if(kal < 0){
kal = 0;
}

/*
  lcd.setCursor(0, 0);
  lcd.print("v1= ");
  lcd.print(vin1);

  lcd.setCursor(0, 1);
  lcd.print("v2= ");
  lcd.print(vin2);
 
  lcd.setCursor(8, 0);
  lcd.print("v3= ");
  lcd.print(vin3);
 
  lcd.setCursor(8, 1);
  lcd.print("v4= ");
  lcd.print(vin4);
*/

  lcd.setCursor(0, 0);
  lcd.print("adc= ");
  lcd.print(vout);
 
  lcd.setCursor(0, 1);
  lcd.print("Vrms= ");
  lcd.print(kal);
 
delay(200);

}





e. VIDEO HASILNYA









  

Kendali Palang Pintu Otomatis Berbasis Fingerprint Sensor Arduino + Bascom avr

Kendali Palang Pintu Otomatis Berbasis Fingerprint Sensor Arduino + Bascom avr


        Pada Penjelasan kali ini akan dibahas mengenai bagaimana cara membuat sebuah alat yang digunakan untuk mengendalikan palang pintu secara otomatis menggunakan sensor fingerprint atau sensor sidik jari, pada alat ini terdapat 2 buah palang pintu yaitu untuk masuk dan keluar jadi programnya juga ada dua. buka-tutup palang pintu menggunakan mikro servo dan untuk processornya menggunakan ATMega8. programnya menggunakan auto-reset atau watchdog timer. untuk lebih jelasnya berikut adalah program dan skemanya.




a. Skema Minimum System





b. Sensor Fingerprint





b. Mini Servo





c. Laser dan Sensor Photodioda






d. LCD 16x4






e. Program Bascom AVR

$regfile = "m8def.dat"
$crystal = 16000000
$baud = 9600

Config Lcdpin = Pin , Rs = Portd.4 , E = Portd.5 , Db4 = Portd.6
Config Lcdpin = Pin , Db5 = Portd.7 , Db6 = Portb.0 , Db7 = Portb.1
Config Lcd = 16 * 4
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Config Watchdog = 2048


Dim Data_masuk As String * 100
Dim Cmti_pos As Byte , Cmgr_pos As Byte , Index_pos As Byte , Cmd_pos As Byte
Dim Pjg_sms_index As Byte , Pjg_data As Byte
Dim Sms_index As String * 3
Dim Cmd As String * 5
Dim Cmdbin As Byte
Dim Dataadc As Word
Dim Mark As Integer
Dim Count As Integer

Mark = 0
Cls

Ddrb.2 = 1
Ddrd.3 = 1
Portd.3 = 1

Cls
Cursor Off



Mulai:
Enable Interrupts
'
Start Adc


Data_masuk = " "

Cls


Do

If Mark = 1 Then
Config Servos = 1 , Servo1 = Portb.2 , Reload = 10
Config Portb.2 = Output

Servo(1) = 65
Wait 5

Servo(1) = 135


Do

'Locate 1 , 1
'Lcd "TEKAN RESET"

'auto reset tiap 2 detik
Start Watchdog

Loop
End If


If Mark = 0 Then

On Urxc Getchar

Enable Urxc


Do
Dataadc = Getadc(0)

Locate 1 , 1
Lcd "Kendaraan Keluar"
Locate 2 , 1
Lcd "Silahkan Letakan"
Locate 3 , 1
Lcd "Jari Anda"
'Lcd Dataadc

Waitms 200

If Dataadc >= 1020 Then
Count = 10
Do


Decr Count

If Count < 1 Then
Count = 0
End If

Locate 4 , 1
Lcd "Sisa Waktu= " ; Count

If Count = 0 Then
Portd.3 = 0
End If


Wait 1

Loop
End If

Loop
End If

Loop


Getchar:

Cls

   Input Data_masuk

   Upperline
   Lcd "DATA MASUK"

   Pjg_data = Len(data_masuk)

   Cmti_pos = Instr(data_masuk , "ID")

   Cmd_pos = Instr(data_masuk , "#")

   If Cmd_pos <> 0 Then
      Incr Cmd_pos
      Cmd = Mid(data_masuk , Cmd_pos , 1)

      Portd.3 = 1

      Locate 2 , 1
      Lcd "ID = " ; Cmd

      Select Case Cmd
      Case "0" :
      Locate 3 , 1
      Lcd "Eko Prawiro"
      Mark = 1
      Wait 3

      Disable Urxc
      Goto Mulai

      Case "1" :
      Locate 3 , 1
      Lcd "Marta Cihuy"
      Mark = 1
      Wait 3

      Disable Urxc
      Goto Mulai

      End Select

   End If

Return





f. Program Arduino IDE

#include <Adafruit_Fingerprint.h>
#include <SoftwareSerial.h>

int getFingerprintIDez();

// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino  (WHITE wire)
SoftwareSerial mySerial(2, 3);


Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup() 
{
  Serial.begin(9600);
  Serial.println("fingertest");

  // set the data rate for the sensor serial port
  finger.begin(57600);
 
  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor!");
  } else {
    Serial.println("Did not find fingerprint sensor :(");
    while (1);
  }
  Serial.println("Waiting for valid finger...");
}

void loop()                     // run over and over again
{
  getFingerprintIDez();
  delay(50);            //don't ned to run this at full speed.
}

uint8_t getFingerprintID() {
  uint8_t p = finger.getImage();
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image taken");
      break;
    case FINGERPRINT_NOFINGER:
      Serial.println("No finger detected");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_IMAGEFAIL:
      Serial.println("Imaging error");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }

  // OK success!

  p = finger.image2Tz();
  switch (p) {
    case FINGERPRINT_OK:
      Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      Serial.println("Image too messy");
      return p;
    case FINGERPRINT_PACKETRECIEVEERR:
      Serial.println("Communication error");
      return p;
    case FINGERPRINT_FEATUREFAIL:
      Serial.println("Could not find fingerprint features");
      return p;
    case FINGERPRINT_INVALIDIMAGE:
      Serial.println("Could not find fingerprint features");
      return p;
    default:
      Serial.println("Unknown error");
      return p;
  }
 
  // OK converted!
  p = finger.fingerFastSearch();
  if (p == FINGERPRINT_OK) {
    Serial.println("Found a print match!");
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_NOTFOUND) {
    Serial.println("Did not find a match");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }  
 
  // found a match!
  Serial.print("Found ID #"); Serial.print(finger.fingerID);
  Serial.print(" with confidence of "); Serial.println(finger.confidence);
}

// returns -1 if failed, otherwise returns ID #
int getFingerprintIDez() {
  uint8_t p = finger.getImage();
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.image2Tz();
  if (p != FINGERPRINT_OK)  return -1;

  p = finger.fingerFastSearch();
  if (p != FINGERPRINT_OK)  return -1;
 
  // found a match!
  Serial.print("Found ID #"); Serial.print(finger.fingerID);
  Serial.print(" with confidence of "); Serial.println(finger.confidence);
  return finger.fingerID;
 
 }






g. Video Hasilnya














Membuat Jam Digital Menggunakan RTC DS1302 dan OLED LCD DISPLAY

Membuat Jam Digital Menggunakan RTC DS1302 dan OLED LCD DISPLAY

 

        Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara mengakses OLED LCD dan RTC DS1302 secara bersamaan, aplikasi dari alat ini yaitu untuk menampilkan jam dan tanggal pada lcd oled display dan juga bisa setting alarm sesuai yang diinginkan, jadi jika jam telah masuk pada zona alarm maka led atau buzzer akan menyala sehingga akan menandakan bahwa ada peringatan. untuk lebih jelasnya berikut adalah skema dan programnya.




a. Arduino Mega






b. LCD OLED 





c. RTC DS1302






d. Program Arduino IDE ( Menampilkan Jam dan Tanggal )

// DS1302:  RST pin    -> Arduino Digital 2
//          DAT pin   -> Arduino Digital 3
//          CLK pin  -> Arduino Digital 4

#include <Wire.h>
#include <DS1302.h>
#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); 

int x;
char tmp_string1[8];
char tmp_string2[8];
int dataadc;
int z;
int setting = 0;

const int bt1 = 8;
const int bt2 = 9;
const int bt3 = 10;
const int bt4 = 11;

int bt1x;
int bt2x;
int bt3x;
int bt4x;

int led1 = 46;
int led2 = 44;
int led3 = 48;
int led4 = 50;
int waktu = 0;
int waktusimpan = 0;

DS1302 rtc(2, 3, 4);
Time t;


void draw(void) {

if(setting == 1){ 
  bt2x = digitalRead(bt2);
  bt3x = digitalRead(bt3);
  bt4x = digitalRead(bt4);

  itoa(waktu, tmp_string1, 8);
   
  u8g.setFont(u8g_font_unifont);
  u8g.drawStr(0, 22, "SET JAM");
  u8g.drawStr(0, 40, tmp_string1);

if(bt2x == 0){
delay(200);
waktu++;
}

if(bt3x == 0){
delay(200);
waktu--;
}

if(bt4x == 0){
delay(200);
waktusimpan = waktu;
setting = 0;
}



if(setting == 0){ 

//float dua angka dibelakang koma
//  itoa(z, tmp_string1, 8);
//  itoa(dataadc, tmp_string2, 8);

  u8g.setFont(u8g_font_unifont);
  u8g.drawStr(0, 22, rtc.getDateStr(FORMAT_LONG,FORMAT_LITTLEENDIAN, '/'));
  u8g.drawStr(0, 40, rtc.getTimeStr());
  //Serial.println(t.hour);

if(t.hour == 7){
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led4,HIGH);
}

else if(t.hour == 13){
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
digitalWrite(led4,HIGH);
}

else if(t.hour == 20){
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
digitalWrite(led4,HIGH);
}

else if(t.hour == waktusimpan){
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led4,LOW);
}

else{
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led4,HIGH);
}

}
}


void setup(void) {

  pinMode(led1,OUTPUT);
  pinMode(led2,OUTPUT);
  pinMode(led3,OUTPUT);
  pinMode(led4,OUTPUT);
 
  pinMode(bt1,INPUT);
  pinMode(bt2,INPUT);
  pinMode(bt3,INPUT);
  pinMode(bt4,INPUT);
 
  digitalWrite(bt1,HIGH);
  digitalWrite(bt2,HIGH);
  digitalWrite(bt3,HIGH);
  digitalWrite(bt4,HIGH);
   
  Serial.begin(9600);
  rtc.halt(false);
  rtc.writeProtect(false);
//  rtc.setDOW(MONDAY);        
//  rtc.setTime(03, 06,00);     
//  rtc.setDate(13, 3, 2017);   
  rtc.writeProtect(true);


  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
}


void loop(void) {
 
  bt1x = digitalRead(bt1);
  if(bt1x == 0){
  delay(200);
  setting = 1;
  }

  t = rtc.getTime();
 
  u8g.firstPage();
  do {
    draw();

  } while( u8g.nextPage() );

  delay(1000);
}






e. Program Arduino IDE ( Menampilkan Jam dan Tanggal + Fitur Setting Alarm )

// DS1302:  RST pin    -> Arduino Digital 2
//          DAT pin   -> Arduino Digital 3
//          CLK pin  -> Arduino Digital 4

#include <Wire.h>
#include <DS1302.h>
#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);

int x;
char tmp_string1[8];
char tmp_string2[8];
int dataadc;
int z;
int setting = 0;

int key1 = 14;
int key2 = 15;
int key3 = 16;
int key4 = 17;

const int bt1 = 8;
const int bt2 = 9;
const int bt3 = 10;
const int bt4 = 11;

int bt1x;
int bt2x;
int bt3x;
int bt4x;

int mark1 = 0;
int mark2 = 0;
int mark3 = 0;
int mark4 = 0;

int led1 = 46;
int led2 = 44;
int led3 = 48;
int led4 = 50;

int waktu = 0;
int waktusimpan = 0;

int waktu2 = 0;
int waktusimpan2 = 0;

int waktu3 = 0;
int waktusimpan3 = 0;

int waktu4 = 0;
int waktusimpan4 = 0;


DS1302 rtc(2, 3, 4);
Time t;


void draw(void) {

if(setting == 1){
  bt2x = digitalRead(bt2);
  bt3x = digitalRead(bt3);
  bt4x = digitalRead(bt4);

  itoa(waktu, tmp_string1, 8);
  
  u8g.setFont(u8g_font_unifont);
  u8g.drawStr(0, 22, "SET JAM KLM4");
  u8g.drawStr(0, 40, tmp_string1);

if(bt2x == 0){
delay(200);
waktu = waktu + 1;
}

if(bt3x == 0){
delay(200);
waktu = waktu - 1;
}

if(bt4x == 0){
delay(1000);
waktusimpan = waktu;
setting = 2;
}

}



if(setting == 2){
  bt2x = digitalRead(bt2);
  bt3x = digitalRead(bt3);
  bt4x = digitalRead(bt4);

  itoa(waktu2, tmp_string1, 8);
  
  u8g.setFont(u8g_font_unifont);
  u8g.drawStr(0, 22, "SET JAM KLM1");
  u8g.drawStr(0, 40, tmp_string1);

if(bt2x == 0){
delay(200);
waktu2 = waktu2 + 1;
}

if(bt3x == 0){
delay(200);
waktu2 = waktu2 - 1;
}

if(bt4x == 0){
delay(1000);
waktusimpan2 = waktu2;
setting = 3;
}

}




if(setting == 3){
  bt2x = digitalRead(bt2);
  bt3x = digitalRead(bt3);
  bt4x = digitalRead(bt4);

  itoa(waktu3, tmp_string1, 8);
  
  u8g.setFont(u8g_font_unifont);
  u8g.drawStr(0, 22, "SET JAM KLM2");
  u8g.drawStr(0, 40, tmp_string1);

if(bt2x == 0){
delay(200);
waktu3 = waktu3 + 1;
}

if(bt3x == 0){
delay(200);
waktu3 = waktu3 - 1;
}

if(bt4x == 0){
delay(1000);
waktusimpan3 = waktu3;
setting = 4;
}

}



if(setting == 4){
  bt2x = digitalRead(bt2);
  bt3x = digitalRead(bt3);
  bt4x = digitalRead(bt4);

  itoa(waktu3, tmp_string1, 8);
  
  u8g.setFont(u8g_font_unifont);
  u8g.drawStr(0, 22, "SET JAM KLM3");
  u8g.drawStr(0, 40, tmp_string1);

if(bt2x == 0){
delay(200);
waktu3 = waktu3 + 1;
}

if(bt3x == 0){
delay(200);
waktu3 = waktu3 - 1;
}

if(bt4x == 0){
delay(1000);
waktusimpan3 = waktu3;
setting = 0;
}

}



if(setting == 0){

//float dua angka dibelakang koma
//  itoa(z, tmp_string1, 8);
int adc1 = analogRead(A0);
int adc2 = analogRead(A1);
int adc3 = analogRead(A2);

 // itoa(adc4, tmp_string2, 8);

  u8g.setFont(u8g_font_unifont);
  u8g.drawStr(0, 22, rtc.getDateStr(FORMAT_LONG,FORMAT_LITTLEENDIAN, '/'));
  u8g.drawStr(0, 40, rtc.getTimeStr());
  //u8g.drawStr(0, 50, tmp_string2);
  //Serial.println(adc1);
  //Serial.println(adc2);
  //Serial.println(adc3);
  //Serial.println(adc4);
 

if((t.hour == waktusimpan2)&&(mark1 == 0)){
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led4,HIGH);

digitalWrite(key1,LOW);
digitalWrite(key2,HIGH);
digitalWrite(key3,HIGH);
digitalWrite(key4,HIGH);

 int adc1 = analogRead(A0);
 if(adc1 < 1010){
  mark1 = 1;
 }

}

if((t.hour == waktusimpan2)&&(mark1 == 1)){
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led4,HIGH);

digitalWrite(key1,HIGH);
digitalWrite(key2,HIGH);
digitalWrite(key3,HIGH);
digitalWrite(key4,HIGH);

}

else if((t.hour == waktusimpan3)&&(mark2 == 0)){
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
digitalWrite(led4,HIGH);


digitalWrite(key1,HIGH);
digitalWrite(key2,LOW);
digitalWrite(key3,HIGH);
digitalWrite(key4,HIGH);

 int adc2 = analogRead(A1);
 if(adc2 < 1010){
  mark2 = 1;
 }

}


else if((t.hour == waktusimpan3)&&(mark2 == 1)){
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led4,HIGH);


digitalWrite(key1,HIGH);
digitalWrite(key2,HIGH);
digitalWrite(key3,HIGH);
digitalWrite(key4,HIGH);

}



else if((t.hour == waktusimpan4)&&(mark3 == 0)){
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
digitalWrite(led4,HIGH);

digitalWrite(key1,HIGH);
digitalWrite(key2,HIGH);
digitalWrite(key3,LOW);
digitalWrite(key4,HIGH);

 int adc3 = analogRead(A2);
 if(adc3 < 1010){
  mark3 = 1;
 }

}

else if((t.hour == waktusimpan4)&&(mark3 == 1)){
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led4,HIGH);


digitalWrite(key1,HIGH);
digitalWrite(key2,HIGH);
digitalWrite(key3,HIGH);
digitalWrite(key4,HIGH);


}

else if((t.hour == waktusimpan)&&(mark4 == 0)){
 digitalWrite(led1,HIGH);
 digitalWrite(led2,HIGH);
 digitalWrite(led3,HIGH);
 digitalWrite(led4,LOW);


  digitalWrite(key1,HIGH);
  digitalWrite(key2,HIGH);
  digitalWrite(key3,HIGH);
  digitalWrite(key4,LOW);

 int adc4 = analogRead(A3);
 if(adc4 < 1010){
  mark4 = 1;
 }
 
}

else if((t.hour == waktusimpan)&&(mark4 == 1)){
 digitalWrite(led1,HIGH);
 digitalWrite(led2,HIGH);
 digitalWrite(led3,HIGH);
 digitalWrite(led4,HIGH);


  digitalWrite(key1,HIGH);
  digitalWrite(key2,HIGH);
  digitalWrite(key3,HIGH);
  digitalWrite(key4,HIGH);

}

else{
digitalWrite(led1,HIGH);
digitalWrite(led2,HIGH);
digitalWrite(led3,HIGH);
digitalWrite(led4,HIGH);

digitalWrite(key1,HIGH);
digitalWrite(key2,HIGH);
digitalWrite(key3,HIGH);
digitalWrite(key4,HIGH);

}




}
}





void setup(void) {

  pinMode(key1,OUTPUT);
  pinMode(key2,OUTPUT);
  pinMode(key3,OUTPUT);
  pinMode(key4,OUTPUT);

  pinMode(led1,OUTPUT);
  pinMode(led2,OUTPUT);
  pinMode(led3,OUTPUT);
  pinMode(led4,OUTPUT);
 
  pinMode(bt1,INPUT);
  pinMode(bt2,INPUT);
  pinMode(bt3,INPUT);
  pinMode(bt4,INPUT);
 
  digitalWrite(bt1,HIGH);
  digitalWrite(bt2,HIGH);
  digitalWrite(bt3,HIGH);
  digitalWrite(bt4,HIGH);
  
  Serial.begin(9600);
  rtc.halt(false);
  rtc.writeProtect(false);
  //rtc.setDOW(WEDNESDAY);       
  //rtc.setTime(19, 55, 00);    
  //rtc.setDate(15, 3, 2017);  
  rtc.writeProtect(true);


  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
}



void loop(void) {
 
  bt1x = digitalRead(bt1);
  if(bt1x == 0){
  delay(200);
  setting = 1;
  }

  t = rtc.getTime();
 
  u8g.firstPage();
  do {
    draw();

  } while( u8g.nextPage() );

  delay(1000);
}






f. Video Hasilnya











Membuat Robot Quadruped ( Robot Berkaki 4 ) Menggunakan Arduino dan Kendali Android

Membuat Robot Quadruped ( Robot Berkaki 4 ) Menggunakan Arduino dan Kendali Android


         Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah robot yang sedikit rumit bagi pemula dikarenakan banyaknya servo yang harus diakses yaitu sekitar 10 buah servo, robot ini terdapat 2 buah servo yang digunakan untuk kakinya, jadi 1 servo untuk angle kaki dan satu servo lagi untu sikunya. robot ini menggunakan arduino sebagai mikrokontrollernya dan kendali menggunakan handphone android, media pengiriman data menggunakan bluetooth HC-05. untuk batre yang digunakan adalah batre Li-Po 2200mAh. untuk lebih jelasnya berikut adalah program dan skemanya.




a. Arduino mega

  



b. Arduino Mega Sensor Shield





c. Motor Servo 





d. UBEC 15A





d. Batre Lipo 2200 mAh





e. Bluetooth HC-05






d. Program Android







e. Program Arduino IDE

#include <Servo.h>

Servo myservo1;
Servo myservo2;
Servo myservo3;
Servo myservo4;
Servo myservo5;
Servo myservo6;
Servo myservo7;
Servo myservo8;
Servo myservo9;
Servo myservo10;
int datain;
int x;

void setup(){
myservo1.write(70);
myservo2.write(70);

Serial.begin(9600);
Serial.setTimeout(5);

//perekat 
myservo1.attach(36);
myservo2.attach(37);

//kaki1 angle
myservo3.attach(26);
//kakl1 siku
myservo4.attach(27);

//kaki2 angle
myservo5.attach(30);
//kakl2 siku
myservo6.attach(31);

//kaki3 angle
myservo7.attach(32);
//kakl3 siku
myservo8.attach(33);

//kaki4 angle
myservo9.attach(34);
//kakl4 siku
myservo10.attach(35);


rebah();
delay(3000);
bangun();
delay(5000);
myservo1.write(150);
myservo2.write(150);
delay(3000);



}


void loop(){

if(x == 1){
maju();


if(x == 2){
kiri();
}

if(x == 3){
kanan();
}

if(x == 4){
bangun();
}

if(x == 5){
mundur();
}

 
if(Serial.available()>0){

datain = Serial.parseInt();

if(datain == 111){
//maju();
x = 1;
}

if(datain == 222){
//kiri();
x = 2;
}

if(datain == 333){
//kanan();
x = 3;
}

if(datain == 444){
//stop();
x = 4;
}

if(datain == 555){
//mundur();
x = 5;
}




}




void rebah(){
//angle
myservo3.write(140);
myservo5.write(50);
myservo7.write(100);
myservo9.write(100);

//siku
myservo4.write(100);
myservo6.write(100);
myservo8.write(100);
myservo10.write(100);

}


void bangun(){
//angle
myservo3.write(140);
myservo5.write(50);
myservo7.write(100);
myservo9.write(100);

//siku
myservo4.write(160);
myservo6.write(20);
myservo8.write(20);
myservo10.write(160);

}



void maju(){

myservo1.write(70);
delay(500);

//kaki1 angle+siku
myservo3.write(140);
myservo4.write(130);
delay(500);

//kaki1 angle+siku
myservo3.write(100);
delay(500);
myservo4.write(160);
delay(500);

//kaki3 angle+siku
myservo7.write(100);
myservo8.write(50);
delay(500);

//kaki3 angle+siku
myservo7.write(130);
delay(500);
myservo8.write(20);
delay(500);

myservo1.write(175);
delay(500);

//============================

myservo2.write(70);
delay(500);

//kaki2 angle+siku
myservo5.write(50);
myservo6.write(50);
delay(500);

//angle kaki1+kaki3
myservo3.write(140);
myservo7.write(100);
delay(500);

//kaki2 angle+siku
myservo5.write(100);
delay(500);
myservo6.write(20);
delay(500);

//kaki4 angle+siku
myservo9.write(100);
myservo10.write(130);
delay(500);

//kaki4 angle+siku
myservo9.write(60);
delay(500);
myservo10.write(160);
delay(500);

myservo2.write(190);
delay(500);

//=======================

myservo5.write(50);
myservo9.write(100);
delay(500);

}






void mundur(){

myservo1.write(70);
delay(200);

//kaki1 angle+siku
myservo3.write(100);
myservo4.write(130);
delay(200);

//kaki1 angle+siku
myservo3.write(140);
delay(100);
myservo4.write(160);
delay(200);

//kaki3 angle+siku
myservo7.write(130);
myservo8.write(50);
delay(200);

//kaki3 angle+siku
myservo7.write(100);
delay(200);
myservo8.write(20);
delay(200);

myservo1.write(175);
delay(200);

//============================

myservo2.write(70);
delay(200);

//kaki2 angle+siku
myservo5.write(100);
myservo6.write(50);
delay(200);

//angle kaki1+kaki3
myservo3.write(100);
myservo7.write(130);
delay(200);

//kaki2 angle+siku
myservo5.write(50);
delay(200);
myservo6.write(20);
delay(200);

//kaki4 angle+siku
myservo9.write(60);
myservo10.write(130);
delay(200);

//kaki4 angle+siku
myservo9.write(100);
delay(100);
myservo10.write(160);
delay(200);

myservo2.write(190);
delay(200);

//=======================

myservo5.write(100);
myservo9.write(60);
delay(200);


}




void kanan(){

myservo1.write(70);
delay(200);
//kaki1 angle+siku
myservo3.write(140);
myservo4.write(130);
delay(200);

//kaki1 angle+siku
myservo3.write(100);
delay(100);
myservo4.write(160);
delay(200);


//kaki3 angle+siku
myservo7.write(130);
myservo8.write(50);
delay(200);

//kaki3 angle+siku
myservo7.write(100);
delay(200);
myservo8.write(20);
delay(200);

myservo1.write(175);
delay(200);

//============================

myservo2.write(70);
delay(200);

//kaki2 angle+siku
myservo5.write(100);
myservo6.write(50);
delay(200);

//angle kaki1+kaki3
myservo3.write(140);
myservo7.write(130);
delay(200);

//kaki2 angle+siku
myservo5.write(50);
delay(200);
myservo6.write(20);
delay(200);

//kaki4 angle+siku
myservo9.write(100);
myservo10.write(130);
delay(200);

//kaki4 angle+siku
myservo9.write(60);
delay(100);
myservo10.write(160);
delay(200);

myservo2.write(190);
delay(200);

//=======================

myservo5.write(100);
myservo9.write(100);
delay(200);

}





void kiri(){

myservo1.write(70);
delay(200);

//kaki1 angle+siku
myservo3.write(100);
myservo4.write(130);
delay(200);

//kaki1 angle+siku
myservo3.write(140);
delay(100);
myservo4.write(160);
delay(200);

//kaki3 angle+siku
myservo7.write(100);
myservo8.write(50);
delay(200);

//kaki3 angle+siku
myservo7.write(130);
delay(200);
myservo8.write(20);
delay(200);

myservo1.write(175);
delay(200);

//============================

myservo2.write(70);
delay(200);

//kaki2 angle+siku
myservo5.write(50);
myservo6.write(50);
delay(200);

//angle kaki1+kaki3
myservo3.write(100);
myservo7.write(100);
delay(200);

//kaki2 angle+siku
myservo5.write(100);
delay(200);
myservo6.write(20);
delay(200);

//kaki4 angle+siku
myservo9.write(60);
myservo10.write(130);
delay(200);

//kaki4 angle+siku
myservo9.write(100);
delay(100);
myservo10.write(160);
delay(200);

myservo2.write(190);
delay(200);

//=======================

myservo5.write(50);
myservo9.write(60);
delay(200);


}





f. VIDEO HASILNYA