oke yang perlu di siapkan sebagai berikut
Untuk mekanik mobile robot
- omni wheel 3 buah
- motor dc flying 3 buah
- bracket motor akrilik 3 buah
- shaft motor dengan roda omni 3 buah
- mekanik robot bisa di bikin dari cutting akrilik
untuk elektronik
- Arduino Uno
- Driver 3 channel (untuk kali ini kita bikin sendiri driver ic l293 sebanyak 2 buah, atau sobat bisa pake motor shield driver yang banyak di jual type Adafruit motor shield)
Pada gambar diatas, ada tulisan 1, 2 dan 3. 1 untuk motor 1, 2 untuk motor 2 dan 3 untuk motor 3. Logika sederhana menggerakkan roda omniwheel seperti gambar diatas.
Robot bergerak kedepan (maju).
motor 1 bergerak CCW, motor 2 bergerak CW dan motor 3 Diam
Robot bergerak kebelakang (mundur).
motor 1 bergerak CW, motor 2 bergerak CCW dan motor 3 Diam
Robot bergerak Kekanan.
motor 1 bergerak CW dengan kecepatan lebih kecil daripada motor 2, motor 2bergerak CCW kecepatan lebih kecil daripada motor 3 dan motor 3 CW
Robot bergerak Kekiri.
motor 1 bergerak CCW dengan kecepatan lebih kecil daripada motor 3, motor 2bergerak CW kecepatan lebih kecil daripada motor 2 dan motor 3 CCW
untuk pergerakan ke kanan dan kekiri, kecepatan motor 1 dan 2 bisa diatur ulang untuk mendapatkan pergerakan robot yang pas sesuai dengan yang di inginkan.
Robot Belok kiri
motor 1 bergerak CW, motor 2 bergerak CW dan motor 3 CW
Robot Belok kanan
motor 1 bergerak CCW, motor 2 bergerak CCW dan motor 3 CCW
program Arduino untuk mobile robot dengan omni wheel bisa di lihat sebagai berikut
/*omni wheel program*/
/*www.sekolahrobot.com*/
/*cw
motor 1. 1A->HIGH - 1B->LOW
motor 2. 2A->HIGH - 2B->LOW
motor 4. 4A->LOW - 4B->HIGH
*/
#define dir1a 2
#define dir1b 4
#define pwm1 3
#define dir2a 7
#define dir2b 6
#define pwm2 5
#define dir3a 8
#define dir3b 10
#define pwm3 9
#define dir4a 12
#define dir4b 13
#define pwm4 11
void setup()
{
pinMode(dir1a,OUTPUT);
pinMode(dir1b,OUTPUT);
pinMode(pwm1,OUTPUT);
pinMode(dir2a,OUTPUT);
pinMode(dir2b,OUTPUT);
pinMode(pwm2,OUTPUT);
}
void loop()
{
maju(255);
delay(2000);
stopped();
delay(2000);
mundur(255);
delay(2000);
stopped();
delay(2000);
kanan(255);
delay(2000);
stopped();
delay(2000);
kiri(255);
delay(2000);
stopped();
delay(2000);
belokkanan(255);
delay(2000);
stopped();
delay(2000);
belokkiri(255);
delay(2000);
stopped();
delay(2000);
}
void maju(int pwm)
{
digitalWrite(dir1a,LOW);
digitalWrite(dir1b,HIGH);
analogWrite(pwm1,pwm);
digitalWrite(dir2a,HIGH);
digitalWrite(dir2b,LOW);
analogWrite(pwm2,pwm);
digitalWrite(dir4a,LOW);
digitalWrite(dir4b,LOW);
analogWrite(pwm4,0);
}
void mundur(int pwm)
{
digitalWrite(dir1a,HIGH);
digitalWrite(dir1b,LOW);
analogWrite(pwm1,pwm);
digitalWrite(dir2a,LOW);
digitalWrite(dir2b,HIGH);
analogWrite(pwm2,pwm);
digitalWrite(dir4a,LOW);
digitalWrite(dir4b,LOW);
analogWrite(pwm4,0);
}
void kanan(int pwm)
{
digitalWrite(dir1a,LOW);
digitalWrite(dir1b,HIGH);
analogWrite(pwm1,pwm/3.5);
digitalWrite(dir2a,LOW);
digitalWrite(dir2b,HIGH);
analogWrite(pwm2,(pwm*6)/10);
digitalWrite(dir4a,LOW);
digitalWrite(dir4b,HIGH);
analogWrite(pwm4,pwm);
}
void kiri(int pwm)
{
digitalWrite(dir1a,HIGH);
digitalWrite(dir1b,LOW);
analogWrite(pwm1,(pwm*6)/10);
digitalWrite(dir2a,HIGH);
digitalWrite(dir2b,LOW);
analogWrite(pwm2,pwm/3.5);
digitalWrite(dir4a,HIGH);
digitalWrite(dir4b,LOW);
analogWrite(pwm4,pwm);
}
void belokkiri(int pwm)
{
digitalWrite(dir1a,HIGH);
digitalWrite(dir1b,LOW);
analogWrite(pwm1,pwm);
digitalWrite(dir2a,HIGH);
digitalWrite(dir2b,LOW);
analogWrite(pwm2,pwm);
digitalWrite(dir4a,LOW);
digitalWrite(dir4b,HIGH);
analogWrite(pwm4,pwm);
}
void belokkanan(int pwm)
{
digitalWrite(dir1a,LOW);
digitalWrite(dir1b,HIGH);
analogWrite(pwm1,pwm);
digitalWrite(dir2a,LOW);
digitalWrite(dir2b,HIGH);
analogWrite(pwm2,pwm);
digitalWrite(dir4a,HIGH);
digitalWrite(dir4b,LOW);
analogWrite(pwm4,pwm);
}
void stopped()
{
digitalWrite(dir3a,LOW);
digitalWrite(dir3b,LOW);
analogWrite(pwm3,0);
digitalWrite(dir4a,LOW);
digitalWrite(dir4b,LOW);
analogWrite(pwm4,0);
digitalWrite(dir1a,LOW);
digitalWrite(dir1b,LOW);
analogWrite(pwm1,0);
digitalWrite(dir2a,LOW);
digitalWrite(dir2b,LOW);
analogWrite(pwm2,0);
}
/*www.sekolahrobot.com*/
/*cw
motor 1. 1A->HIGH - 1B->LOW
motor 2. 2A->HIGH - 2B->LOW
motor 4. 4A->LOW - 4B->HIGH
*/
#define dir1a 2
#define dir1b 4
#define pwm1 3
#define dir2a 7
#define dir2b 6
#define pwm2 5
#define dir3a 8
#define dir3b 10
#define pwm3 9
#define dir4a 12
#define dir4b 13
#define pwm4 11
void setup()
{
pinMode(dir1a,OUTPUT);
pinMode(dir1b,OUTPUT);
pinMode(pwm1,OUTPUT);
pinMode(dir2a,OUTPUT);
pinMode(dir2b,OUTPUT);
pinMode(pwm2,OUTPUT);
}
void loop()
{
maju(255);
delay(2000);
stopped();
delay(2000);
mundur(255);
delay(2000);
stopped();
delay(2000);
kanan(255);
delay(2000);
stopped();
delay(2000);
kiri(255);
delay(2000);
stopped();
delay(2000);
belokkanan(255);
delay(2000);
stopped();
delay(2000);
belokkiri(255);
delay(2000);
stopped();
delay(2000);
}
void maju(int pwm)
{
digitalWrite(dir1a,LOW);
digitalWrite(dir1b,HIGH);
analogWrite(pwm1,pwm);
digitalWrite(dir2a,HIGH);
digitalWrite(dir2b,LOW);
analogWrite(pwm2,pwm);
digitalWrite(dir4a,LOW);
digitalWrite(dir4b,LOW);
analogWrite(pwm4,0);
}
void mundur(int pwm)
{
digitalWrite(dir1a,HIGH);
digitalWrite(dir1b,LOW);
analogWrite(pwm1,pwm);
digitalWrite(dir2a,LOW);
digitalWrite(dir2b,HIGH);
analogWrite(pwm2,pwm);
digitalWrite(dir4a,LOW);
digitalWrite(dir4b,LOW);
analogWrite(pwm4,0);
}
void kanan(int pwm)
{
digitalWrite(dir1a,LOW);
digitalWrite(dir1b,HIGH);
analogWrite(pwm1,pwm/3.5);
digitalWrite(dir2a,LOW);
digitalWrite(dir2b,HIGH);
analogWrite(pwm2,(pwm*6)/10);
digitalWrite(dir4a,LOW);
digitalWrite(dir4b,HIGH);
analogWrite(pwm4,pwm);
}
void kiri(int pwm)
{
digitalWrite(dir1a,HIGH);
digitalWrite(dir1b,LOW);
analogWrite(pwm1,(pwm*6)/10);
digitalWrite(dir2a,HIGH);
digitalWrite(dir2b,LOW);
analogWrite(pwm2,pwm/3.5);
digitalWrite(dir4a,HIGH);
digitalWrite(dir4b,LOW);
analogWrite(pwm4,pwm);
}
void belokkiri(int pwm)
{
digitalWrite(dir1a,HIGH);
digitalWrite(dir1b,LOW);
analogWrite(pwm1,pwm);
digitalWrite(dir2a,HIGH);
digitalWrite(dir2b,LOW);
analogWrite(pwm2,pwm);
digitalWrite(dir4a,LOW);
digitalWrite(dir4b,HIGH);
analogWrite(pwm4,pwm);
}
void belokkanan(int pwm)
{
digitalWrite(dir1a,LOW);
digitalWrite(dir1b,HIGH);
analogWrite(pwm1,pwm);
digitalWrite(dir2a,LOW);
digitalWrite(dir2b,HIGH);
analogWrite(pwm2,pwm);
digitalWrite(dir4a,HIGH);
digitalWrite(dir4b,LOW);
analogWrite(pwm4,pwm);
}
void stopped()
{
digitalWrite(dir3a,LOW);
digitalWrite(dir3b,LOW);
analogWrite(pwm3,0);
digitalWrite(dir4a,LOW);
digitalWrite(dir4b,LOW);
analogWrite(pwm4,0);
digitalWrite(dir1a,LOW);
digitalWrite(dir1b,LOW);
analogWrite(pwm1,0);
digitalWrite(dir2a,LOW);
digitalWrite(dir2b,LOW);
analogWrite(pwm2,0);
}
Oke selamat Mencoba,
kesulitan mendapatkan bahan-bahan diatas, bisa kontak ke kita melalui comment berikut
Salam