<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Arduino Playground - Medium]]></title>
        <description><![CDATA[My tips, tricks and experiences using Arduino for fun. - Medium]]></description>
        <link>https://medium.com/arduino-playground?source=rss----1c33042f604d---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Arduino Playground - Medium</title>
            <link>https://medium.com/arduino-playground?source=rss----1c33042f604d---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 20:18:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/arduino-playground" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Reading temperature with Arduino and an LM35 (or TMP36)]]></title>
            <link>https://medium.com/arduino-playground/reading-temperature-with-arduino-and-an-lm35-or-tmp36-69ae34ec728e?source=rss----1c33042f604d---4</link>
            <guid isPermaLink="false">https://medium.com/p/69ae34ec728e</guid>
            <category><![CDATA[temperature-monitoring]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[lm35]]></category>
            <category><![CDATA[tmp36]]></category>
            <dc:creator><![CDATA[Rodrigo Sousa Coutinho]]></dc:creator>
            <pubDate>Tue, 31 Dec 2024 16:37:20 GMT</pubDate>
            <atom:updated>2024-12-31T17:02:31.393Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FEVd8cfCaWot9qByYOMdlA.png" /></figure><p>The circuit to get the room temperature using the LM35 (or TMP36) is pretty basic, as you can see from the picture (the position of the flat part of the sensor is important!)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*q6sEY_gzimqw5-SZbzp39w.png" /><figcaption>Simple is best!</figcaption></figure><p>You can now run the following code in Arduino to get the 1st results.</p><pre>int tempPin = A0; //LM35 Vout<br><br>void setup()<br>{<br>  Serial.begin(9600);<br>  pinMode(tempPin,INPUT);<br>}<br><br>void loop()<br>{<br>  delay(1000);<br>  Serial.println(analogRead(tempPin));<br>}</pre><p>This will start outputting values without a lot of meaning. For instance, right now its showing 44 at my desk using the LM35.</p><p>The trick is that we’re using an analog port — A0. This gives us a 10 bit analog to digital converter, which means we have 2¹⁰ (1024) different values. These values range from 0 to the operating voltage you’re using, 5V if you’re powering your Arduino using USB.</p><p>So if you want to know how many volts are in A0, you need to multiply the value you get in analogRead(A0) by the operating voltage (5) and divide by 1024. Just change that last line by these two:</p><pre>// The .0 after the 1024 is required to convert to float<br>float A0volts = analogRead(tempPin)*5/1024.0;<br>Serial.println(A0volts);</pre><p>The output that I get is 0.21 (44*5/1024), so my A0 input is currently receiving 0.21V.</p><p>The way you can turn this into a temperature depends on the sensor you’re using.</p><h3>LM35</h3><p>According to the <a href="https://www.ti.com/lit/ds/symlink/lm35.pdf">spec</a>, the LM35 output formula is 0mV + 10.0mV/C, which is equivalent to 0.01V per each centigrade. That’s very convenient, because all you have to do is multiply volts by 100 and you get the temperature.</p><pre>Serial.println(A0volts*100);</pre><p>So now I know that the temperature at my desk is at a nice 21.5º (44*5*100/1024).</p><h3>TMP36</h3><p>The sensor I have at home is the LM35, but while playing with <a href="https://www.tinkercad.com/">tinkercad</a> I found they only have the TMP36. The <a href="https://www.analog.com/media/en/technical-documentation/data-sheets/TMP35_36_37.pdf">spec</a> tells us that the formula for this sensor is 50mV + 10.0mV/C so you need to offset A0Volts by 0.5:</p><pre>Serial.println((A0volts-0.5)*100);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69ae34ec728e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arduino-playground/reading-temperature-with-arduino-and-an-lm35-or-tmp36-69ae34ec728e">Reading temperature with Arduino and an LM35 (or TMP36)</a> was originally published in <a href="https://medium.com/arduino-playground">Arduino Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using a 74HC595 to control a LED Matrix]]></title>
            <link>https://medium.com/arduino-playground/using-a-74hc595-to-control-a-led-matrix-84559feee7cd?source=rss----1c33042f604d---4</link>
            <guid isPermaLink="false">https://medium.com/p/84559feee7cd</guid>
            <category><![CDATA[74hc595]]></category>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[led]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Rodrigo Sousa Coutinho]]></dc:creator>
            <pubDate>Sun, 05 Mar 2017 22:31:21 GMT</pubDate>
            <atom:updated>2017-03-05T22:41:12.410Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8li4RwAGu48hFlasbCf_jQ.jpeg" /></figure><p><a href="https://medium.com/arduino-playground/using-a-led-matrix-with-arduino-640537b46f37">Setting up a LED Matrix</a> can quickly get you out of pins to do other things with your Arduino. One way to overcome this is to use a <a href="http://www.ti.com/lit/ds/symlink/sn74hc595.pdf">74HC595</a> shift register.</p><p>This chip transforms bits that are inserted in series trough the data pin into 8 parallel bits. More on that later, but first, the circuit:</p><figure><img alt="The chip in the middle is the one doing the magic!" src="https://cdn-images-1.medium.com/proxy/1*6dWOSke5JNi4Ezmt_JJzsw.png" /><figcaption>The chip in the middle is the one doing the magic!</figcaption></figure><p>The connection between Arduino and the matrix columns is <a href="https://medium.com/arduino-playground/using-a-led-matrix-with-arduino-640537b46f37">the same as without the 595</a>. Just plug it to the right pins with a resistor in the middle (I used a 330Ω) and you’re done.</p><p>Pins <strong>QA</strong>-<strong>QH</strong> on the 595 are the outputs that we want, so they’re connected to the matrix rows. Don’t worry about QH*.</p><p>The other interesting pins are:</p><ul><li><strong>SER</strong> (SERial) where the data gets in;</li><li><strong>SRCLK</strong> (SeRial CLocK) the pin you set to high to store what’s in SER;</li><li><strong>RCLK</strong> (Register CLocK) the pin you set to high once you’re done setting all the pins.</li></ul><p>So here’s how it works. Let’s imagine you want to set the QA-QH to 10010010. You start with the least significant bit (0) so you set SER to LOW (D10 on the Arduino). Next, you set SCK (D11 on the Arduino) to HIGH and then to LOW, to “save” the value.</p><p>Time to go to the second bit, which has value 1. So you set SER to HIGH, and again you set SCK to HIGH and then to LOW.</p><p>You keep going, until you’ve sent the 8 bits. At this point, you set the RCLK to HIGH to sent your changes to pins QA through QH.</p><p>This may seem complex, but fortunately Arduino has a function that takes care of sending that bits out to the shift register:</p><pre>shiftOut(dataPin, clockPin, bitOrder, value)</pre><p>This means that, to set data on the 595, all you have to do is:</p><pre>digitalWrite(RCK_PIN, LOW); <br>// Write byte_to_write to SER, using SCK_PIN as the clock and <br>// send the least significant byte first (LSBFIRST)<br>shiftOut(SER_PIN, SCK_PIN, LSBFIRST, byte_to_write); <br>digitalWrite(RCK_PIN, HIGH); </pre><p>Cool, isn’t it?</p><p>So here’s the full code for the LED matrix, using a 595:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9b26f49b213a46cd7bd21e377bb6feb/href">https://medium.com/media/e9b26f49b213a46cd7bd21e377bb6feb/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*D6oLp685vcGx8GdRh-jswA.jpeg" /></figure><p>If you run this code you’ll get a nice smile! If you want to build a different character, head over to the <a href="https://rodrigosc.github.io/ArduinoLedMatrix/char_builder/builder.html">character builder</a> and create your own.</p><p>You can get the <a href="https://github.com/RodrigoSC/ArduinoLedMatrix">code and schematics for this project on github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84559feee7cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arduino-playground/using-a-74hc595-to-control-a-led-matrix-84559feee7cd">Using a 74HC595 to control a LED Matrix</a> was originally published in <a href="https://medium.com/arduino-playground">Arduino Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using a LED matrix with Arduino]]></title>
            <link>https://medium.com/arduino-playground/using-a-led-matrix-with-arduino-640537b46f37?source=rss----1c33042f604d---4</link>
            <guid isPermaLink="false">https://medium.com/p/640537b46f37</guid>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[matrix]]></category>
            <category><![CDATA[led]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Rodrigo Sousa Coutinho]]></dc:creator>
            <pubDate>Wed, 01 Mar 2017 15:29:37 GMT</pubDate>
            <atom:updated>2017-03-04T21:09:01.965Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_aQj73O-6_dO6-n--CGaIQ.jpeg" /><figcaption>A smile, and a lot of wires!</figcaption></figure><p>Got an 8x8 LED matrix such as the LBT2088AH that you want to connect to your Arduino? Here’s how it works:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*ySOKNevbZ0Cfz8NOal1S_w.png" /><figcaption>The LED matrix. The numbers represent the pins</figcaption></figure><p>The matrix has 8 rows and 8 columns of LEDs, each with a pin you can connect to your Arduino. This means you have 16 pins to connect. And notice that the pin numbers bare no relation with the actual row or column… go figure!</p><p>Anyway, the idea is that you go trough each row of the matrix in turn and turn its pin to HIGH. So, if you wanted to set the LEDs on row 5, you’d set pin 1 to HIGH, and all other row pins to LOW.</p><p>Next, you select which columns you want to light up. The columns you want to light up should be set to LOW, while the ones you want off should be set to HIGH. So, if you wanted to light up column 3, you’d need to set pin 4 to LOW, while keeping the other column pins in HIGH.</p><p>Confusing, isn’t it? Anyway, let’s assemble this thing.</p><h4>The circuit</h4><p>The schematic for the circuit looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eltEe7gJ3hmTxUVdhy9ffg.png" /><figcaption>The schematic looks deceptively simple…</figcaption></figure><p>Lots of wires to assemble… and because the pins don’t really match the rows or columns at all, here’s the breadboard view to help you out. Note that I used a smaller breadboard as auxiliary support, since the LED matrix is too big to use a single breadboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GctCm1lT6Icnpz7H9rgprw.png" /><figcaption>The breadboard is a mess… Hopefully the colored wires help a bit!</figcaption></figure><h4>The code</h4><p>The full code looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/746f0f1ebecbc4eb9238807a9b2d0488/href">https://medium.com/media/746f0f1ebecbc4eb9238807a9b2d0488/href</a></iframe><p>If you run this in your Arduino with the circuit described above, you should see a nice smile!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*j1X3Cln7hJO8w2KzKbOZ1w.jpeg" /><figcaption>Smile!</figcaption></figure><p>Let’s go trough what the code does:</p><p>The 1st line sets the character you want to show. Each number represents a row, and each number is a bit array with 1 for a connected LED and 0 for a disconnected LED. This means the 1st row (0x3c), which is binary 00111100, has two LEDs off, followed by 4 LEDs on, with 2 off LEDs to close the party. If you want to build your own character, head over to the <a href="https://rodrigosc.github.io/ArduinoLedMatrix/char_builder/builder.html">character builder</a>. With only a few clicks you&#39;ll build your own personal character.</p><p>The rest of the setup is all about defining the pins for rows and columns, and turning them into outputs — not very interesting, but needed.</p><p>The <em>loop</em> is where the fun begins. The first <em>for</em> iterates through each row. It’s immediately followed by another <em>for</em> loop to cleanup the columns. If you don’t do that, you’ll get some half glowing LEDs. Give it a go! Just comment that line and run the code again.</p><p>Next, we set the row to HIGH. From now on, each column we turn to LOW will turn on a LED on that row.</p><p>The following <em>for</em> loop iterates trough the columns. The idea behind the strange piece of code character[row] &amp; 1 &lt;&lt; col is to get a value that is true (anything other than zero) if the bit in the <em>col</em> position starting from the end is 1. If that&#39;s the case, that column is set to LOW, and therefore the LED lights up.</p><p>Next we delay for 1 millisecond to make sure the LEDs have enough time to light up. You can also play a bit with this: try to remove the delay, and you should see the 1st LEDs become dimer. If you set the delay to 300, you’ll be able to see rows being drawn one by one.</p><p>Finally we set the row pin to LOW, so we can start working on the next one.</p><p>You can <a href="https://github.com/RodrigoSC/ArduinoLedMatrix">download the full schematics and code from GitHub</a>. It includes a couple of other characters for you to try.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=640537b46f37" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arduino-playground/using-a-led-matrix-with-arduino-640537b46f37">Using a LED matrix with Arduino</a> was originally published in <a href="https://medium.com/arduino-playground">Arduino Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Checking for a button press in Arduino]]></title>
            <link>https://medium.com/arduino-playground/checking-for-a-button-press-in-arduino-7681cbb7bde7?source=rss----1c33042f604d---4</link>
            <guid isPermaLink="false">https://medium.com/p/7681cbb7bde7</guid>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[button]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Rodrigo Sousa Coutinho]]></dc:creator>
            <pubDate>Mon, 27 Feb 2017 20:23:58 GMT</pubDate>
            <atom:updated>2017-03-12T16:49:49.548Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3AYLJURSBBnosZKbS7VyOw.jpeg" /></figure><p>The idea is simple. Whenever someone presses a button in Arduino, you want to do something.</p><p>The circuit for a button looks something like this:</p><figure><img alt="A simple push button" src="https://cdn-images-1.medium.com/proxy/1*Dt0NJ2VNhRqC1lT3gZvh2Q.png" /><figcaption>A simple push button</figcaption></figure><p>That resistor between the button and the ground is called a <a href="https://en.wikipedia.org/wiki/Pull-up_resistor">pull-down resistor</a>. You need it so you don’t have a dangling wire connected to a digital input. When you have dangling wires, it is not possible to know if the input is on or off.</p><p>In terms of code, here’s what you need:</p><pre>#define BTN_PIN 2<br><br>void setup()   {                <br>  pinMode(BTN_PIN, INPUT); <br>  Serial.begin(9600);<br>}<br><br>void loop() {<br>  static uint8_t lastBtnState = LOW;<br>  uint8_t state = digitalRead(BTN_PIN);<br>  if (state != lastBtnState) {<br>    lastBtnState = state;<br>    if (state == HIGH) {<br>      Serial.println(&quot;Button pressed!&quot;);<br>    }<br>  }<br>  delay(100);<br>}</pre><p>The setup code prepares the pin for input. On the loop, we have a static variable that stores the last state of the button (think of a static variable as a variable that remembers state across different loops).</p><p>We then read the state of the button, and if it’s different from the previous state and it’s set to HIGH (i.e. pressed) we write “Button pressed!” to the serial port.</p><p>Quite a bit of work for a simple press of a button, isn’t it?…</p><h4>Making it generic</h4><p>In the code above you have a bunch of lines in your loop just to check if a button is pressed. If you want 2 or more buttons, it quickly becomes ridiculously complicated!</p><p>So here’s an alternative to the previous code, using a function to check if the button is pressed. In this example we’re checking for 2 buttons.</p><pre>#define BTN1_PIN 2<br>#define BTN2_PIN 3<br><br>void setup()   {                <br>  pinMode(BTN1_PIN, INPUT); <br>  Serial.begin(9600);<br>}<br><br>void loop() {<br>  if(buttonPressed(BTN1_PIN)) {<br>    Serial.println(&quot;Button 1 pressed!&quot;);<br>  }<br>  if(buttonPressed(BTN2_PIN)) {<br>    Serial.println(&quot;Button 2 pressed!&quot;);<br>  }<br>  delay(100);<br>}<br><br>// Generic function to check if a button is pressed<br>int buttonPressed(uint8_t button) {<br>  static uint16_t lastStates = 0;<br>  uint8_t state = digitalRead(button);<br>  if (state != ((lastStates &gt;&gt; button) &amp; 1)) {<br>    lastStates ^= 1 &lt;&lt; button;<br>    return state == HIGH;<br>  }<br>  return false;<br>}</pre><p>That makes the loop code much cleaner, doesn’t it? You can even hide that code in a library to make it neater. The function works for values of <em>button</em> between 0 and 15.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7681cbb7bde7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arduino-playground/checking-for-a-button-press-in-arduino-7681cbb7bde7">Checking for a button press in Arduino</a> was originally published in <a href="https://medium.com/arduino-playground">Arduino Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making a LED blink with Arduino]]></title>
            <link>https://medium.com/arduino-playground/making-a-led-blink-with-arduino-d9e7758e043c?source=rss----1c33042f604d---4</link>
            <guid isPermaLink="false">https://medium.com/p/d9e7758e043c</guid>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[led]]></category>
            <category><![CDATA[getting-started]]></category>
            <dc:creator><![CDATA[Rodrigo Sousa Coutinho]]></dc:creator>
            <pubDate>Sat, 18 Feb 2017 19:36:49 GMT</pubDate>
            <atom:updated>2017-03-01T15:33:33.285Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L1y47ZioMn_StOEyNveOiA.jpeg" /><figcaption>Why settle for 1 blinking LED, when you can have 2?</figcaption></figure><p>Now that you know <a href="https://medium.com/arduino-playground/getting-started-with-arduino-cad14a6486e6#.a3mfka4jm">how to connect a LED to Arduino</a>, let’s make it blink.</p><p>To do this, we’ll connect the LED to one of the digital outputs of Arduino, instead of connecting directly to the 5V pin. Let’s pick pin 7, for no particular reason. The circuit should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*wRcGCeOEq0GRhvTPAt1SqQ.png" /><figcaption>The blinking LED circuit. That’s a 330Ω resistor.</figcaption></figure><p>Now it’s time to code! A typical Arduino code has 2 parts: the <em>setup</em> and the <em>loop</em>.</p><p>On the <em>setup</em> part you initialize the circuit and put any instructions that you want to execute once, before the <em>loop</em> begins.</p><p>The <em>loop</em> part, as the name suggests, is executed in a loop as long as the Arduino is on.</p><p>Here’s the code you need to write to make the LED blink.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e5fd841b2bb1b8ee9400d23e3af3b58/href">https://medium.com/media/7e5fd841b2bb1b8ee9400d23e3af3b58/href</a></iframe><p>Let’s go trough it step by step:</p><p>On the first statement we’re telling the computer that each time we write LED_PIN we actually mean 7. This is a good idea, because if you want to change your LED to pin 6, you just need to change this line of code.</p><p>During setup, we need to tell Arduino that we’re using the 7th pin for output:</p><pre>pinMode(LED_PIN, OUTPUT);</pre><p>On the loop part, we will have 4 instructions. First:</p><pre>digitalWrite(LED_PIN, HIGH);</pre><p>What this does is tell pin 7 to turn on. This will put a 5V current on the pin, which will cause the LED to light up. Next we wait for 1 second, or 1000 milliseconds:</p><pre>delay(1000);</pre><p>Because we want the LED to blink, the next two instructions will turn off pin 7, putting a current of 0V through it, and will wait for 1 second:</p><pre>digitalWrite(LED_PIN, LOW);<br>delay(1000);</pre><p>Because all these instructions are inside a loop, the light will turn on for a second, then turn off for another second, and then repeat this behavior forever.</p><h4>Making 2 LEDs blink!</h4><p>Ok, let’s go wild! We’ll make 2 LEDs! When one is on, the other one will be off, an vice-versa.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*IHWFquAuMo8L0xx0XKwzRw.gif" /><figcaption>Blinking duo! The circuits always look messier in real life…</figcaption></figure><p>The circuit looks something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*jLn-uUU_vK01LvyXgXtmZg.png" /><figcaption>Double blinking power!</figcaption></figure><p>And the code will look something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8ac169192e207ba8e9dd38540b8c4636/href">https://medium.com/media/8ac169192e207ba8e9dd38540b8c4636/href</a></iframe><p>Can you guess what all the lines of code do?</p><p>And if two LEDs is too little for you, how about <a href="https://medium.com/arduino-playground/using-a-led-matrix-with-arduino-640537b46f37#.lh4xrluua">playing with 64 LEDs</a>?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9e7758e043c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arduino-playground/making-a-led-blink-with-arduino-d9e7758e043c">Making a LED blink with Arduino</a> was originally published in <a href="https://medium.com/arduino-playground">Arduino Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Finding the right resistor for your circuit]]></title>
            <link>https://medium.com/arduino-playground/finding-the-right-resistor-for-your-circuit-ecdf4b4c8f97?source=rss----1c33042f604d---4</link>
            <guid isPermaLink="false">https://medium.com/p/ecdf4b4c8f97</guid>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[led]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Rodrigo Sousa Coutinho]]></dc:creator>
            <pubDate>Thu, 16 Feb 2017 23:20:11 GMT</pubDate>
            <atom:updated>2017-02-16T23:20:10.866Z</atom:updated>
            <content:encoded><![CDATA[<p>If you connect a LED directly to the 5V power source of your Arduino, <a href="https://medium.com/arduino-playground/getting-started-with-arduino-cad14a6486e6">the LED will burn</a>… This is very well illustrated in this simulation using <a href="http://everycircuit.com/">EveryCircuit</a>.</p><figure><img alt="A somewhat unsuccessful circuit..." src="https://cdn-images-1.medium.com/proxy/1*q2ULjB1fLQDcB5M9m7e72g.png" /><figcaption>A somewhat unsuccessful circuit…</figcaption></figure><p>To avoid the LED from burning, we need to add a resistor. But which resistor?</p><p>The first thing we need to learn is the characteristics of the LED. A standard red LED has a voltage drop of about 2 volts and a current rating of 20 mili-amperes. Why is this important? Because of <strong>Ohm’s law</strong>!</p><pre>V = RxI</pre><p>Voltage (V) equals resistance (R) times current (I). So what? Well, we have a voltage of 5V (that’s the Arduino power source) and we need 2V (according to the LED specs). So we need to drop 5V-2V = 3V.</p><p>Also, because of the specs of the LED, we know we want 20mA. Following Ohm’s law, we get 3V = R x 20mA, so R = 3V / 20mA = <strong>150Ω</strong>. If we put in that resistor, we should have a successful circuit:</p><figure><img alt="A bright red light!" src="https://cdn-images-1.medium.com/proxy/1*3QijnoCL7LJCMXOd30rDxw.png" /><figcaption>A bright red light!</figcaption></figure><p>Look at that, all the values of voltage and current are right where they should be! You can increase a bit the resistance, that’s fine. The light will get dimmer, that’s all.</p><p>If you need to get the details for your LED, check <a href="https://farnsworthelectronics.com/blog-1/2016/8/1/another-helpful-led-referance-chart">this table</a>. For help doing the math, check this <a href="http://led.linear1.org/1led.wiz">LED calculator</a>.</p><h4>LEDs in series</h4><p>To have more than one LED on your circuit, you can connect them in two ways: In series or in parallel.</p><p>Components connected in series are connected along a single path, like this:</p><figure><img alt="A simple series circuit" src="https://cdn-images-1.medium.com/proxy/1*xZY8cO-jzyeR__qI9XLckQ.png" /><figcaption>A simple series circuit</figcaption></figure><p>To calculate the resistor you need, just add the voltage: we need 4V (2V + 2V), and we have 5V. So we need to drop 1V.</p><p>For the current, just use the 20mA. In a series circuit, the amperage is the same for the entire circuit.</p><p>Doing the math, we get 1V / 20mA = <strong>50Ω</strong>. Look how good the values are on the circuit!</p><figure><img alt="Getting ready for Xmas!" src="https://cdn-images-1.medium.com/proxy/1*q_RVrkDC_fF4Avj75LAiEA.png" /><figcaption>Getting ready for Xmas!</figcaption></figure><h4>LEDs in parallel</h4><p>Another way to connect the LEDs is using parallel circuits. Something like this:</p><figure><img alt="LEDs in parallel" src="https://cdn-images-1.medium.com/proxy/1*JE_hswImN4QiStJG0D-44w.png" /><figcaption>LEDs in parallel</figcaption></figure><p>Here the math is a bit different. The voltage is the same for the different paths, so we’ll need to drop 3V from our 5V power source. And the current is split, so we’ll need 40mA. Again, using Ohm’s Law: R = 3V / 40mA = 75Ω.</p><figure><img alt="A parallel wonder!" src="https://cdn-images-1.medium.com/proxy/1*M_ZbF95BJYtMKOmsXiLk9w.png" /><figcaption>A parallel wonder!</figcaption></figure><h4>Mixing it all together</h4><p>Now, this is all fine if you have the same number of LEDs and therefore can use the same voltage and current on both sides… But what if you have 3 LEDs?</p><p>The way to do it is to think of each path as a separate circuit. Using the same values for the resistors we calculated before, you can build this circuit:</p><figure><img alt="Not all circuits are created equal" src="https://cdn-images-1.medium.com/proxy/1*uN1LPiN2mpBg1l3btNKfeg.png" /><figcaption>Not all circuits are created equal</figcaption></figure><p>You can now have fun adding more LEDs to your circuit. Just be sure to check the specs for the LEDs and don’t go over 500mA for a single circuit — that’s as much as your Arduino can take.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ecdf4b4c8f97" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arduino-playground/finding-the-right-resistor-for-your-circuit-ecdf4b4c8f97">Finding the right resistor for your circuit</a> was originally published in <a href="https://medium.com/arduino-playground">Arduino Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Get started with Arduino, without an Arduino!]]></title>
            <link>https://medium.com/arduino-playground/getting-started-with-arduino-cad14a6486e6?source=rss----1c33042f604d---4</link>
            <guid isPermaLink="false">https://medium.com/p/cad14a6486e6</guid>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[led]]></category>
            <category><![CDATA[getting-started]]></category>
            <category><![CDATA[electronics]]></category>
            <dc:creator><![CDATA[Rodrigo Sousa Coutinho]]></dc:creator>
            <pubDate>Tue, 14 Feb 2017 23:43:31 GMT</pubDate>
            <atom:updated>2017-02-25T23:48:50.296Z</atom:updated>
            <content:encoded><![CDATA[<p>A couple of weeks ago I decided to get started with Arduino. I always wanted to play with electronics, but it seemed overwhelmingly complicated. Arduino promised to make it simple.</p><p>So, how to get started? Well, the good news is: You don’t even need an Arduino to get started! Instead of ordering your board, just head to <a href="https://circuits.io/">Autodesk Circuits</a> and create your account. That’s it. You’re ready to build your first circuit.</p><figure><img alt="Circuits.io has Arduino!" src="https://cdn-images-1.medium.com/proxy/1*PAXK92p89JieyPzvv07-Fw.png" /><figcaption>Circuits.io has Arduino!</figcaption></figure><p>Next, drag and drop a couple of wires on the <a href="http://wiring.org.co/learning/tutorials/breadboard/">breadboard</a>, add an LED, and that’s it. You just built your first circuit.</p><figure><img alt="Do not build this circuit for real!!! Keep reading!" src="https://cdn-images-1.medium.com/proxy/1*BNUY7y0Afz7zvOj_3DuYLg.png" /><figcaption>Do not build this circuit for real!!! Keep reading!</figcaption></figure><p>This circuit connects your LED directly to Arduino’s 5V power source. So once you click the “Start Simulation” button, the LED should light up, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*gvVgRANTnp_vIpH8ozjytg.png" /><figcaption>That LED seems a bit under the weather…</figcaption></figure><p>Well, the LED doesn’t really light up… it blows up! That’s the other cool thing about doing a simulation, you get to do mistakes without burning hardware.</p><p>So what’s missing? Well, since LEDs work between 2 and 3V and you’re connecting to a 5V power source, you need a resistor on your circuit.</p><p>If you have no idea what that means, don’t worry — more on that at the end of the post. Just build the following circuit and press “Start simulation”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*-f6oTXRSyQL06jcRwuJpMg.png" /><figcaption>If you have an Arduino, go ahead. Build this circuit.</figcaption></figure><p>And there you have it. Probably the simplest circuit you can build with an Arduino! A modest yet great start!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*tV7Z1Y0frVMab-m-LbkFFQ.jpeg" /><figcaption>The stronger the resistor, the less the LED will shine.</figcaption></figure><p>A couple of notes:</p><p>That’s a 330Ω resistor. You can use others, like for instance a 1kΩ resistor. Should be fine, but the LED will shine with less intensity. Check this to learn how <a href="https://medium.com/arduino-playground/finding-the-right-resistor-for-your-circuit-ecdf4b4c8f97#.7x3ahtv9a">find to the right resistor for your circuit</a>.</p><p>If the LED doesn’t shine at all, you might have plugged it the wrong way. It matters which end you connects to 5V and which end you connect to ground (GND). Try rotating the LED 180º.</p><p>Good luck assembling your first circuit! And once you get your LED shining, <a href="https://medium.com/arduino-playground/making-a-led-blink-with-arduino-d9e7758e043c#.8aesfgprl">head over here to make it blink</a>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cad14a6486e6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arduino-playground/getting-started-with-arduino-cad14a6486e6">Get started with Arduino, without an Arduino!</a> was originally published in <a href="https://medium.com/arduino-playground">Arduino Playground</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>