Outils pour utilisateurs

Outils du site


issue48:tuto-arduino

Différences

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

Lien vers cette vue comparative

Prochaine révision
Révision précédente
issue48:tuto-arduino [2011/05/08 20:50] – créée fredphil91issue48:tuto-arduino [2011/05/20 19:07] (Version actuelle) auntiee
Ligne 1: Ligne 1:
-With the Heathkit company gone, and with a modern computer using Ubuntu 10.04 LTS, I found a website detailing a micro-controller named Arduino at www.arduino.cc (not .com). It used a USB cable for power and its computer connection. Arduino Uno was affordable at $30. A simple traffic light simulation on a breadboard seemed just the fun experiment to try. +**With the Heathkit company gone, and with a modern computer using Ubuntu 10.04 LTS, I found a website detailing a micro-controller named Arduino at www.arduino.cc (not .com). It used a USB cable for power and its computer connection. Arduino Uno was affordable at $30. A simple traffic light simulation on a breadboard seemed just the fun experiment to try. 
  
 Getting things to work involved just three main tasks: Getting things to work involved just three main tasks:
Ligne 6: Ligne 6:
 • Writing a simple C program followed by an upload of the compiled code to the Arduino micro-controller. • Writing a simple C program followed by an upload of the compiled code to the Arduino micro-controller.
  
-Task 1 was simple, 2 was routine with some refresher study, and 3 required a small learning curve about C procedures - along with some new commands specific to the Arduino ports. Uploading the compiled code to the micro-controller was easy. Within a few days of fussing with things, my system finally worked as designed. Later, I updated my code to include a buzzer in the circuit. +Task 1 was simple, 2 was routine with some refresher study, and 3 required a small learning curve about C procedures - along with some new commands specific to the Arduino ports. Uploading the compiled code to the micro-controller was easy. Within a few days of fussing with things, my system finally worked as designed. Later, I updated my code to include a buzzer in the circuit.**
  
-Part 1: Installing the Arduino IDE+Avec le départ de la compagnie Heathkit et avec un ordinateur moderne utilisant Ubuntu 10.04 LTS, j'ai trouvé un site détaillant un micro-contrôleur nommé Arduino sur www.arduino.cc (pas .com). Il utilisait un câble USB pour l'alimentation et sa connexion à l'ordinateur. Arduino Uno était abordable à 30 $. Une simulation de feu de circulation simple sur un circuit imprimé semblait être la bonne expérience amusante à essayer. 
 + 
 +Faire fonctionner ça consistait seulement en trois tâches principales : 
 +• Installer et configurer l'IDE Arduino (Integrated Development Environment ou Environnement de Développement Intégré). 
 +• Déterminer le câblage pour le circuit imprimé et les ports Arduino nécessaires. 
 +• Écrire un programme C simple suivi de l'envoi du code compilé sur le micro-contrôleur Arduino. 
 + 
 +La première tâche était simple, la deuxième a été de la routine avec quelques cours de recyclage, et la troisième nécessitait une petite courbe d'apprentissage sur les procédures C - avec quelques nouvelles commandes spécifiques aux ports Arduino. Télécharger le code compilé sur le micro-contrôleur a été facile. Après quelques jours de tâtonnements, mon système a finalement fonctionné comme prévu. Plus tard, j'ai mis à jour mon code pour inclure une sonnerie dans le circuit. 
 + 
 +**Part 1: Installing the Arduino IDE
 (for details see http://arduino.cc/playground/Linux/Ubuntu) (for details see http://arduino.cc/playground/Linux/Ubuntu)
  
Ligne 16: Ligne 25:
  
 Install the compiler and the libraries packages: Install the compiler and the libraries packages:
 +
 +sudo apt-get install gcc-avr avr-libc**
 +
 +Partie 1 : Installation de l'IDE Arduino
 +(pour plus de détails voir http://arduino.cc/playground/Linux/Ubuntu).
 +
 +J'ai utilisé la section « Ubuntu sans le paquet Arduino » de la page pour mon installation (ça peut être différent pour vous).
 +
 +Téléchargez le fichier .gtz et installez-le avec le gestionnaire d'archives : aduino-0022.gtz (pris sur http://arduino.cc/en/Main/Software en utilisant le paquet Linux 32-bit).
 +
 +Installez le compilateur et les paquets de bibliothèques :
  
 sudo apt-get install gcc-avr avr-libc sudo apt-get install gcc-avr avr-libc
  
-For those using the USB port to dialog, add yourself to the group 'dialout' to have write permissions at that port with:+**For those using the USB port to dialog, add yourself to the group 'dialout' to have write permissions at that port with:
  
 sudo usermod -aG dialout <your username>  sudo usermod -aG dialout <your username> 
Ligne 27: Ligne 47:
 Part 2: Wiring the breadboard and connecting it to the Arduino Part 2: Wiring the breadboard and connecting it to the Arduino
  
-Here are the parts I used to complete the wiring (mostly from Radio Shack):+Here are the parts I used to complete the wiring (mostly from Radio Shack):**
  
-• breadboard and a few spools of 22-gauge, insulated, solid-core wire+Pour ceux qui utilisent le port USB pour dialoguer, ajoutez-vous au groupe « dialout »  pour avoir les permissions d'écriture sur ce port avec : 
 + 
 +sudo usermod-aG dialout <votre nom d'utilisateur> 
 + 
 +Ensuite, pour exécuter l'application, ouvrez le dossier « arduino-0022 », faites un clic droit sur « arduino » et choisissez « Exécuter ». Une fois que l'IDE est en cours d'exécution, sélectionnez votre carte (la mienne était l'Arduino Uno) à partir de Outils > Carte. 
 + 
 +Partie 2 : Câblage du circuit imprimé et connexion à l'Arduino. 
 + 
 +Voici les pièces j'ai utilisées pour effectuer le câblage (achetées surtout chez Radio Shack) : 
 + 
 +**• breadboard and a few spools of 22-gauge, insulated, solid-core wire
 • 2.1mm power plug, and 9-volt battery cap (solder red lead to the center tap, black lead to the outside tap) • 2.1mm power plug, and 9-volt battery cap (solder red lead to the center tap, black lead to the outside tap)
 • 9-volt battery • 9-volt battery
Ligne 37: Ligne 67:
 • resistors 5-220 Ohm, 2-150 Ohm, 1-10K Ohm (all 1/8 Watt okay) • resistors 5-220 Ohm, 2-150 Ohm, 1-10K Ohm (all 1/8 Watt okay)
  
-Shown below is the wiring schematic, and a view of my Arduino mounted on a wood frame with the breadboard and the wires. (The Lego board was used to hold things loosely together.) +Shown below is the wiring schematic, and a view of my Arduino mounted on a wood frame with the breadboard and the wires. (The Lego board was used to hold things loosely together.)**
  
-Part 3: Writing the code using C, and uploading the compiled code to the Arduino Uno+• un circuit imprimé et du câble électrique isolé de calibre 22 à âme pleine ; 
 +• une prise de courant de 2,1 mm et capuchon de pile de 9 volts (fil rouge soudé à la prise centrale, fil noir soudé à la prise extérieure) ; 
 +• une pile de 9 volts ; 
 +• des LED : 2 rouges, 2 vertes, 1 jaune (environ 2,1 mA chaque. Notez l'orientation !) ; 
 +• un interrupteur à bouton poussoir pour circuit imprimé ; 
 +• 3 VDC Mini Buzzer (Radio Shack 273-0053) ; 
 +• des résistances : 5 de 220 Ohms, 2 de 150 Ohms, 1 de 10 KOhms (toutes prévues pour 1/8 Watt). 
 + 
 +Ci-dessous le schéma de câblage et une vue de mon Arduino monté sur une armature en bois avec la carte et les fils. (Les briques Lego ont été utilisées pour maintenir les choses ensemble.) 
 + 
 +**Part 3: Writing the code using C, and uploading the compiled code to the Arduino Uno
    
 After some reading at the Arduino website, and with some borrowed code, the project code was one page in length using gedit. The file was then renamed 'trafficlightsound.pde' inside a folder named 'trafficlightsound' -- the name extension and corresponding folder name that the Arduino IDE seemed to require. Clicking in the IDE's start arrow at the left made the application verify and compile the code of 1468 bytes. After some reading at the Arduino website, and with some borrowed code, the project code was one page in length using gedit. The file was then renamed 'trafficlightsound.pde' inside a folder named 'trafficlightsound' -- the name extension and corresponding folder name that the Arduino IDE seemed to require. Clicking in the IDE's start arrow at the left made the application verify and compile the code of 1468 bytes.
Ligne 47: Ligne 87:
 After connecting a USB cable between the computer and the micro-controller, one click on the right arrow on the second row square of the IDE started the upload of bytecode to the microcontroller. Once loaded, the Arduino Uno ran the various lights and buzzer as designed.  After connecting a USB cable between the computer and the micro-controller, one click on the right arrow on the second row square of the IDE started the upload of bytecode to the microcontroller. Once loaded, the Arduino Uno ran the various lights and buzzer as designed. 
  
-After disconnecting the USB cable and connecting the 9-volt battery, the project ran independently from the computer. The program will continue to run in a loop until the power is removed.+After disconnecting the USB cable and connecting the 9-volt battery, the project ran independently from the computer. The program will continue to run in a loop until the power is removed.** 
 + 
 +Partie 3 : Ecriture du code en C et téléchargement du code compilé sur le Arduino Uno. 
 + 
 +Après quelques lectures sur le site Arduino, et avec un peu de code emprunté, le code du projet tenait sur une page dans gedit. Le fichier a ensuite été rebaptisé « trafficlightsound.pde » dans un dossier nommé « trafficlightsound » -  l'IDE Arduino semblait exiger cette extension et le même nom pour le dossier et le fichier. En cliquant sur la flèche de démarrage sur la gauche de l'IDE, cela a vérifié et compilé le code de 1468 octets. 
 + 
 +Le code source pour les feux de circulation Arduino peut être trouvé ici : http://pastebin.com/ACk9u937. 
 + 
 +Après avoir connecté un câble USB entre l'ordinateur et le micro-contrôleur, un clic sur la flèche vers la droite sur la deuxième ligne de l'IDE a lancé le chargement du bytecode vers le microcontrôleur. Une fois chargé, le Arduino Uno a fait fonctionner les différents feux et l'avertisseur sonore comme prévu. 
 + 
 +Après avoir débranché le câble USB et branché la batterie de 9 volts, le projet a fonctionné indépendamment de l'ordinateur. Le programme continuera à fonctionner dans une boucle jusqu'à ce que l'alimentation soit coupée. 
issue48/tuto-arduino.1304880632.txt.gz · Dernière modification : 2011/05/08 20:50 de fredphil91