Outils pour utilisateurs

Outils du site


start:arduino:mains

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
start:arduino:mains [2022/10/30 18:37] – [Programme HackBerry.ino version V1.0 MK2] gerardadminstart:arduino:mains [2023/04/13 07:23] (Version actuelle) – [Programme HackBerry_Test_tinkercad.ino version V1.0] gerardadmin
Ligne 18: Ligne 18:
  
 [[https://github.com/mission-arm/HACKberry/tree/master/HACKberry_program|Programme main robotisée HackBerry GitHub]] [[https://github.com/mission-arm/HACKberry/tree/master/HACKberry_program|Programme main robotisée HackBerry GitHub]]
 +
 +[[https://wikifab.org/wiki/Proth%C3%A8se_de_main_command%C3%A9e_par_des_capteurs_musculaires#%C3%89tape_32_-_T%C3%A9l%C3%A9verser_le_code_Arduino_dans_la_main|Prothese main robot Arduino]]
 +
 +[[https://wikilab.myhumankit.org/index.php?title=Projets:Bionicohand#R.C3.A9f.C3.A9rences.2F_Sources|Bionicohan FR]]
 +
 +
 +==== Capteurs EMG ====
 +
 +[[http://fr.mfgrobots.com/mfg/it/1002029866.html| Capteurs EMG c'est Quoi ? FR ]]
 +
 +[[https://fr.aliexpress.com/w/wholesale-capteur-emg-arduino.html|EMG sur Alliexpress]]
 +
 +[[https://wikilab.myhumankit.org/images/a/a6/DIY_-_Faites_le_vous-m%C2%88me-_Capteur_EMG.pdf|DIY_-_Faites_le_vous-même-_Capteur_EMG.pdf]]
 +
 +[[https://youtu.be/J7_LEoYuqww|video  capteur EMG EN]]
 +
 +
 +[[start:arduino:emg|test capteurs EMG]]
  
  
Ligne 469: Ligne 487:
 } }
 </code> </code>
 +
 +==== Simulation main sur Tinkercad ====
 +
 +=== Cablage Arduino Uno et servoMoteurs ===
 +[[https://www.tinkercad.com/things/aOcPVfLshTv-mainrobot001/editel?sharecode=5w0XKvIfN_HbnWhJSuMrUpc_JwIGZ0DbrTIVq2bElGQ|{{ :start:arduino:capture_du_2022-10-31_10-43-01.jpg?direct&800 |}}]]
 +
 +=== Schema ===
 +
 +{{ :start:arduino:capture_du_2022-10-31_10-50-53.jpg?direct&600 |}}
 +
 +=== Programme HackBerry_Test_tinkercad.ino version V1.0 ===
 +<code c Main_robot_0011.ino>
 +#include <Servo.h>
 +
 +//Pin
 +int pinButtonCalib; //start calibration
 +int pinButtonTBD; // No function implemented yet.
 +int pinButtonThumb; // open/close thumb
 +int pinButtonOther; //lock/unlock other three fingers
 +int pinServoIndex;
 +int pinServoOther;
 +int pinServoThumb;
 +int pinSensor; //sensor input
 +
 +//Software
 +int sensorValue = 0;
 +int memPouce = 0;
 +int memIndex = 0;
 +int mem3Dgts = 0;
 +
 +//Hardware
 +Servo servoIndex; //index 
 +Servo servoOther; //3doigts
 +Servo servoThumb; //pouce
 +
 +//Valeurs mini/max servos
 +const int outThumbMax = 170;//valeur max servo pouce
 +const int outIndexMax = 142;//valeur max servo index
 +const int outOtherMax = 96;//valeur max servo 3doigts
 + 
 +const int outThumbMin = 170-86;//valeur min servo pouce 170-86=84
 +const int outIndexMin = 140-117; //valeur min servo index 140-117= 23
 +const int outOtherMin = 95-55;//valeur min servo 3doigts 95-55 = 40
 +
 +void setup() {
 +    Serial.begin(9600);
 + 
 +    // Pin Configuration
 +    pinButtonCalib = A4;// A6 sur Hackberry pour test Calibration -- validation index 
 +    pinButtonTBD   = A5;// A7 sur Hackberry pour test
 +    pinButtonThumb = A0;// Verrouillage pouce -- validation pouce
 +    pinButtonOther = 10;// Verouillage 3 doigts -- validation  3doigts
 +    pinServoIndex  = 5;// Servo pour l'index 
 +    pinServoOther  = 6;// Servo pour 3 doigts
 +    pinServoThumb  = 9;// Servo pour le pouce
 +    pinSensor      = A1; // Capteur de pression
 +  
 +    servoIndex.attach(pinServoIndex);//index
 +    servoOther.attach(pinServoOther);// 3 doigts
 +    servoThumb.attach(pinServoThumb);//Pouce
 +    pinMode(pinButtonCalib, INPUT_PULLUP);
 +    pinMode(pinButtonTBD,   INPUT_PULLUP);
 +    pinMode(pinButtonThumb, INPUT_PULLUP);
 +    pinMode(pinButtonOther, INPUT_PULLUP);
 +}
 +
 +void loop() {
 +  sensorValue = 0; 
 +  
 +  if ( digitalRead(pinButtonThumb) == HIGH ){
 +    memPouce = 1;
 +    memIndex = 0;
 +    mem3Dgts = 0;
 +  }
 +   if ( digitalRead(pinButtonCalib) == HIGH ){
 +    memPouce = 0;
 +    mem3Dgts = 0;
 +    memIndex = 1;
 +  }
 +  if ( digitalRead(pinButtonOther) == HIGH ){
 +    memPouce = 0;
 +    mem3Dgts = 1;
 +    memIndex = 0;
 +  }
 + 
 +  
 +  if (memPouce == 1){
 +    sensorValue = analogRead(pinSensor);
 +    delay(25);
 +    sensorValue = map(sensorValue, 0, 1023, outThumbMin, outThumbMax);
 +    Serial.print("sensor pouce= "); Serial.println(sensorValue);
 +    servoThumb.write(sensorValue);
 +    delay(15); 
 +  }
 +  if (memIndex == 1){
 +    sensorValue = analogRead(pinSensor);
 +    delay(25);
 +    sensorValue = map(sensorValue, 0, 1023,outIndexMin, outIndexMax);
 +    Serial.print("sensor index= "); Serial.println(sensorValue);
 +    servoIndex.write(sensorValue);
 +    delay(15); 
 +  }
 +  if (mem3Dgts == 1){
 +    sensorValue = analogRead(pinSensor);
 +    delay(25);
 +    sensorValue = map(sensorValue, 0, 1023,outOtherMin, outOtherMax);
 +    Serial.print("sensor doigts= "); Serial.println(sensorValue);
 +    servoOther.write(sensorValue);
 +    delay(15); 
 +  }
 +    
 +}
 +</code>
 +
 +==== Test main.ino====
 +<code c testmain.ino>
 +//EMG sensor robotic hand controller 
 +//This code is for controlling a robotic hand with
 +//an EMG sensor. 
 +//
 +//© Au Robots 8.4.2017
 +
 +
 +//Necessary for controlling the servos
 +#include <Servo.h> 
 +
 +const int x = ///// This is the reference value and it
 +//will depend on your setup. You have to find it out 
 +//yourself by looking at the serial monitor and finding
 +//a value between the maximum and minimum value.
 +
 +//Naming the servos
 +Servo servo1;
 +Servo servo2;
 +Servo servo3;
 +Servo servo4;
 +Servo servo5;
 +Servo servo6;
 +
 +void setup() 
 +
 +//Starting the serial monitor
 +Serial.begin(9600); 
 +
 +//Configuring servo pins
 +servo2.attach(10); // pinky
 +servo3.attach(11); //ring
 +servo4.attach(3); // middle
 +servo5.attach(6); //index
 +servo6.attach(5); //thumb
 +
 +
 +
 +void loop() 
 +
 +//Printing the EMG data
 +Serial.println(analogRead(5)); 
 +
 +//If the EMG data is greater than x the hand closes
 +  if(analogRead(5) > x) {
 +    servo2.write(180);
 +    servo3.write(148);
 +    servo4.write(89);
 +    servo5.write(180);
 +    servo6.write(180);
 +  }
 +
 +//If the EMG data is lower than x the hand opens
 +  else if (analogRead(5) < x) {
 +    servo2.write(38);
 +    servo3.write(10);
 +    servo4.write(0);
 +    servo5.write(16);
 +    servo6.write(16);
 +  }
 +
 +//A delay to slow down the process
 +  delay(100);
 +
 +</code>
 +
/home/chanteri/www/fablab37110/data/attic/start/arduino/mains.1667151473.txt.gz · Dernière modification : 2023/01/27 16:08 (modification externe)