Raspberry Pi – Arduino Uno – Starts with a LED

In my long road of electronic learning, today I start far, from very far away. But with patience and Google, We arrive at any ! 🙂

arduino-duemilanove-usb-led

After a first test on a weather station, I wanted to try my hand at something more electronic : make a LED flash.

Preparation

For those who join me on this article, the used kit is announced here. Everything is included in to try their hand.

Then you have the tool that will allow to send the program to the Arduino board. Nothing simpler than that, It is on the official site with a download here. At the time of the writing of this article, I chose the version 1.5.2 still in beta.

Finally it should be tutorials and help. To calculate the codes of resistors received in the package and which are not noted, I used This link. You click on the colours and the resistance value is displayed.

Regarding installation, I was inspired a set of blogs that seem very well done on the site of the zero.

Once everything installed, It's gone !

Assembly

I used the famous Breadboard (or breadboard) to connect the different components with the Arduino.

Equipment used :

  • The breadboard
  • A red LED
  • 1000Ω resistance (1KΩ)
  • Wires

The Arduino is connected to the USB port and the delivered voltage is 5V.

Concerning the necessary resistance, an LED in general needs a voltage (U) 1, 2V with intensity (I) 20mA (0,02A). The residual voltage at the terminals of the LED will be 5 (What provided the Arduino) – 1,2 = 3.8. With the formula U = R * I, We arrive at R =. 3,8 / 0,02 = 190Ω ! Like me you can put a stronger resistance. Not vice versa at the risk of your LED Grill.

Here is the schema of the montage made under Fritzing (Note the direction of the LED) :

ArduinoLED_bb

Programming

You run the downloaded software, Select your Arduino board from the Tools menu and you are ready.

The program is simple : define pine 2 like the one who will enable our diode, initialize this pin 2 as output and then fasten by turning on / turning off the LED every seconds. It looks like this :

const int led_rouge = 2;
void setup() {
 pinMode(led_rouge, OUTPUT);
}
void loop() {
 digitalWrite(led_rouge, LOW); 
 delay(1000);
 digitalWrite(led_rouge, HIGH); 
 delay(1000);
}

Result

By sending your program to the Arduino you should now have a LED which happily flashes every second !

WP_20130808_001

Nothing extraordinary so but this is the beginning. The following steps should be a little more complicated.

Like this article ? Bear with me on patreon!

You may also like...