Sommaire |
Si vous aussi vous avez toujours eu envie de partir à la conquête du monde à la tête de votre propre armée de robots, il faut commencer par les bases. Voici comment fabriquer un bras robotisé simple à l'aide d'un Arduino !
Mettre le code suivant dans l'Arduino :
// Contrôler la position de servo-moteurs avec des potentiomètres (résistance variable) #include <Servo.h> Servo myservo1; // create servo object to control a servo Servo myservo2; // create servo object to control a servo Servo myservo3; // create servo object to control a servo int potpin1 = 0; // analog pin used to connect the potentiometer int potpin2 = 1; // analog pin used to connect the potentiometer int potpin3 = 2; // analog pin used to connect the potentiometer int val1; // variable to read the value from the analog pin int val2; // variable to read the value from the analog pin int val3; // variable to read the value from the analog pin void setup() { myservo1.attach(9); // attaches the servo on pin 9 to the servo object myservo2.attach(10); // attaches the servo on pin 9 to the servo object myservo3.attach(11); // attaches the servo on pin 9 to the servo object } void loop() { //servo 1 val1 = analogRead(potpin1); // reads the value of the potentiometer (value between 0 and 1023) val1 = map(val1, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) val2 = analogRead(potpin2); // reads the value of the potentiometer (value between 0 and 1023) val2 = map(val2, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) val3 = analogRead(potpin3); // reads the value of the potentiometer (value between 0 and 1023) val3 = map(val3, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180) myservo1.write(val1); // sets the servo position according to the scaled value myservo2.write(val2); // sets the servo position according to the scaled value myservo3.write(val3); // sets the servo position according to the scaled value delay(5); // waits for the servo to get there }
1) tourner un des potentiomètre dans un sens, le servo-moteur correspondant fait bouger le bras ! 2) tourner le même potentiomètr dans l'autre sens, le servo-moteur correspondant fait bouger le bras dans l'autre sens !
Il est possible de rajouter autant de servo-moteurs que l'on veut en ajustant le code à mettre dans l'arduino. Il est également possible de piloter autre chose que des servo-moteurs, comme un moteur continu par exemple.
On obtient un petit bras robotisé où chaque articulation est pilotée par un potentiomètre.
Quand on tourne un potentiomètre, on envoie une information à l'Arduino. Ce dernier utilise le code que l'on lui a envoyé via le câble USB pour traduire cette information en commande pour le servo-moteur. Le signal envoyé par le potentiomètre est un signal analogique (continu, c'est à dire constitué d'une infinité de valeurs). Le signal envoyé au servo-moteur est un signal numérique (discret, c'est à dire constitué d'un nombre limité de valeurs).
Ici je mets les questions soulevées par l'expérience, qui n'ont pas trouvé de réponses !!
Développons les concepts scientifiques associés. Ne pas hésiter à faire des liens avec Wikipédia.
Indiquer ici les expériences de Wikidébrouillard.
Autres expériences avec le même concept, recherche sur internet (indiquer les liens).
Robotique industrielle, exploration spatiale
Indiquer ici des lieux où tout le matériel nécessaire pour réaliser cette expérience est disponible.
© Graphisme : Les Petits Débrouillards Grand Ouest (Patrice Guinche - Jessica Romero) | Développement web : Libre Informatique