issue48:tuto-arduino
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue48:tuto-arduino [2011/05/08 20:50] – créée fredphil91 | issue48: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' |
+ | |||
+ | 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' | ||
+ | |||
+ | 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' | ||
+ | |||
+ | **Part 1: Installing the Arduino IDE | ||
(for details see http:// | (for details see http:// | ||
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:// | ||
+ | |||
+ | 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' | ||
+ | |||
+ | 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 ' | + | **For those using the USB port to dialog, add yourself to the group ' |
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' |
+ | |||
+ | sudo usermod-aG dialout <votre nom d' | ||
+ | |||
+ | Ensuite, pour exécuter l' | ||
+ | |||
+ | Partie 2 : Câblage du circuit imprimé et connexion à l' | ||
+ | |||
+ | 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' | ||
+ | • 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 ' | 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 ' | ||
Ligne 47: | Ligne 87: | ||
After connecting a USB cable between the computer and the micro-controller, | After connecting a USB cable between the computer and the micro-controller, | ||
- | 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:// | ||
+ | |||
+ | Après avoir connecté un câble USB entre l' | ||
+ | |||
+ | Après avoir débranché le câble USB et branché la batterie de 9 volts, le projet a fonctionné indépendamment de l' |
issue48/tuto-arduino.1304880632.txt.gz · Dernière modification : 2011/05/08 20:50 de fredphil91