Manufaktur industri
Industri Internet of Things | bahan industri | Pemeliharaan dan Perbaikan Peralatan | Pemrograman industri |
home  MfgRobots >> Manufaktur industri >  >> Manufacturing Technology >> Proses manufaktur

Pengontrol Joystick untuk Robot MeArm - Koordinat Perekaman

Komponen dan persediaan

Arduino UNO
× 1
Joystick analog (Generik)
× 2
Resistor 10k ohm
× 2
Resistor 680 ohm
× 1
LED 5 mm:Merah
× 1
Servo mikro SG90
× 4

Aplikasi dan layanan online

Arduino IDE

Tentang proyek ini

Pengontrol joystick Arduino Uno untuk lengan robot (MeArm®) dengan perekaman koordinat. Memungkinkan untuk mengulang koordinat yang direkam sekali pada klik tombol atau berulang kali. Menggunakan papan dasar Arduino Uno tanpa papan tambahan. Membutuhkan koneksi USB (2A) atau catu daya 6V / 2A. Diuji dengan menggunakan empat servos SG90.

Tekan tombol pada joystick1 untuk mulai merekam koordinat. Tekan tombol pada joystick1 untuk mengakhiri perekaman koordinat.

Tekan tombol pada joystick2 untuk mulai memutar ulang koordinat yang direkam. Tekan tombol pada joystick2 untuk menghentikan pemutaran ulang koordinat yang direkam. Tahan tombol pada joystick2 untuk memulai pemutaran ulang koordinat yang direkam secara otomatis dalam siklus.

Memo:Kami juga telah membuat versi yang lebih sederhana dari perangkat lunak ini yang tidak memerlukan resistor tambahan dan dioda LED:Robot MeArm - Perekaman Koordinat (Versi Minimal)

Jika Anda memiliki papan joystick MeArm, berikut adalah versi untuk Anda:MeArm 1.6.1 Gerakan Perekaman Papan Joystick Robot (IR)

Kode

  • Pengontrol Joystick Arduino untuk robot MeArm ® dengan perekaman koordinat. (versi 1.3.1)
Pengontrol Joystick Arduino untuk robot MeArm ® dengan perekaman koordinat. (versi 1.3.1)Arduino
Gunakan Arduino IDE untuk memprogram papan dasar Arduiono UNO melalui port USB.
/* joystick analog meArm versi 1.3.1 - UtilStudio.com Des 2018 Menggunakan dua joystick analog dan empat servo. Dalam versi 1.3 ditingkatkan perekaman koordinat. Beberapa bug telah dihapus. Joystick pertama menggerakkan gripper ke depan, belakang, kiri dan kanan, tombol start/stop merekam posisi. Joystick kedua menggerakkan gripper ke atas, ke bawah, dan menutup dan membuka, tombol start/stop memainkan posisi rekaman. Tekan tombol selama 2 detik untuk memutar otomatis. Pin:Arduino Stick1 Stick2 Base Shoulder Elbow Gripper Record/ GND GND GND Coklat Coklat Coklat Coklat Auto play 5V VCC VCC Merah Merah Merah Merah LED A0 HOR A1 VER PD2 BUTT A2 HOR A3 VER PD3 BUTT 11 Kuning 10 Kuning 9 Kuning 6 Kuning PD4 X */#include bool repeatePlaying =false; /* Berulang kali menjalankan siklus yang direkam */int delayBetweenCycles =2000; /* Delay antar siklus */int basePin =11; /* Basis servo */int shoulderPin =10; /* Servo bahu */int elbowPin =9; /* Servo siku */int gripperPin =6; /* Servo Gripper */int xdirPin =0; /* Basis - joystick1*/int ydirPin =1; /* Bahu - joystick1 */int zdirPin =3; /* Siku - joystick2 */int gdirPin =2; /* Gripper - joystick2 *///int pinRecord =A4; /* Catatan tombol - kompatibilitas mundur *///int pinPlay =A5; /* Tombol putar - kompatibilitas mundur */int pinRecord =PD2; /* Tombol record - direkomendasikan (A4 tidak digunakan lagi, akan digunakan untuk joystick tambahan) */int pinPlay =PD3; /* Tombol putar - direkomendasikan (A5 tidak digunakan lagi, akan digunakan untuk joystick tambahan) */int pinLedRecord =PD4; /* LED - menunjukkan mode perekaman (ringan) atau putar otomatis (berkedip satu) */bool useInternalPullUpResistors =false;const int buffSize =512; /* Ukuran buffer perekaman */int startBase =90;int startShoulder =90;int startElbow =90;int startGripper =0;int posBase =90;int posShoulder =90;int posElbow =90;int posGripper =0;int lastBase =90;int lastShoulder =90;int lastElbow =90;int lastGripper =90;int minBase =0;int maxBase =150;int minShoulder =0;int maxShoulder =150;int minElbow =0;int maxElbow =150;int minGripper =0;int maxGripper =150;const int countServo =4;int buff[buffSize];int buffAdd[countServo];int recPos =0;int playPos =0;int buttonRecord =HIGH;int buttonPlay =HIGH;int buttonRecordLast =LOW;int buttonPlayLast =RENDAH;bool record =false;bool play =false;bool debug =false;String command ="Manual";int printPos =0;int buttonPlayDelay =20;int buttonPlayCount =0;bool ledLight =false;Servo servoBase;Servo servoBahu;Servo servoSiku;Servo servoGripper;pengaturan batal() { Serial.begin(9600); if (gunakanInternalPullUpResistors) { pinMode(pinRecord, INPUT_PULLUP); pinMode(pinPlay, INPUT_PULLUP); } else { pinMode(pinRecord, INPUT); pinMode(pinPlay, INPUT); } pinMode(xdirPin, INPUT); pinMode(ydirPin, INPUT); pinMode(zdirPin, INPUT); pinMode(gdirPin, INPUT); pinMode(pinLedRecord, OUTPUT); servoBase.attach(basePin); servoShoulder.attach(pin bahu); servoElbow.attach(elbowPin); servoGripper.attach(gripperPin); Posisi awal(); digitalWrite(pinLedRecord, TINGGI); penundaan (1000); digitalWrite(pinLedRecord, LOW);}void loop() { buttonRecord =digitalRead(pinRecord); buttonPlay =digitalRead(pinPlay); // Serial.print(buttonRecord); // Serial.print("\t"); // Serial.println(buttonPlay); // untuk tujuan pengujian if (buttonPlay ==LOW) { buttonPlayCount++; if (buttonPlayCount>=buttonPlayDelay) { repeatePlaying =true; } } else buttonPlayCount =0; if (buttonPlay !=buttonPlayLast) { if (record) { record =false; } if (buttonPlay ==RENDAH) { play =!play; repeatePlaying =salah; if (mainkan) { StartPosition(); } } } if (buttonRecord !=buttonRecordLast) { if (buttonRecord ==LOW) { record =!record; if (rekam) { play =false; repeatePlaying =salah; recPos =0; } else { if (debug) PrintBuffer(); } } } buttonPlayLast =buttonPlay; buttonRecordLast =buttonRecord; float dx =peta(analogRead(xdirPin), 0, 1023, -5.0, 5.0); float dy =peta(analogRead(ydirPin), 0, 1023, 5.0, -5.0); float dz =peta(analogRead(zdirPin), 0, 1023, 5.0, -5.0); float dg =peta(analogRead(gdirPin), 0, 1023, 5.0, -5.0); jika (abs(dx) <1,5) dx =0; jika (abs(dy) <1,5) dy =0; jika (abs(dz) <1,5) dz =0; jika (abs(dg) <1,5) dg =0; posBase +=dx; posBahu +=dy; posSiku +=dz; posGripper +=dg; if (play) { if (playPos>=recPos) { playPos =0; if (repeatePlaying) { delay(delayBetweenCycles); Posisi awal(); } else { mainkan =salah; } } bool endOfData =salah; while (!endOfData) { if (playPos>=buffSize - 1) break; if (playPos>=recPos) rusak; int data =buff[playPos]; int sudut =data &0xFFF; int servoNumber =data &0x3000; endOfData =data &0x4000; switch (servoNumber) { kasus 0x0000:posBase =sudut; merusak; kasus 0x1000:posBahu =sudut; merusak; kasus 0x2000:posElbow =sudut; merusak; kasus 0x3000:posGripper =sudut; dg =posGripper - lastGripper; merusak; } playPos++; } } if (posBase> maxBase) posBase =maxBase; if (posShoulder> maxShoulder) posShoulder =maxShoulder; if (posElbow> maxElbow) posElbow =maxElbow; if (posGripper> maxGripper) posGripper =maxGripper; if (posBase  0) { posGripper =maxGripper; waitGripper =benar; } servoGripper.write(posGripper); if (mainkan &&waitGripper) { delay(1000); } if ((lastBase !=posBase) | (lastShoulder !=posShoulder) | (lastElbow !=posElbow) | (lastGripper !=posGripper)) { if (record) { if (recPos   

Skema

Pengontrol joystick untuk robot MeArm ® dengan perekaman koordinat - diagram shematic Papan pengujian dengan hanya dua servo yang terhubung. Lihat diagram skema untuk menghubungkan 4 motor servo.

Proses manufaktur

  1. Pengontrol Game Arduino
  2. MeArm Robot Arm - Robot Anda - V1.0
  3. Mobil RC Terkendali Joystick
  4. Robot Pengikut Baris
  5. Kalkulator UNO sederhana
  6. Robot yang Dikendalikan Bicara
  7. Kegigihan Visi
  8. Arduino Joystick
  9. Pengontrol Penguji Arduino DMX-512
  10. Robot untuk navigasi dalam ruangan yang sangat keren