### GTranslate       In this lesson you will use Ohm’s law to calculate the values of the resistors you will need to protect the microprocessor as you power eight LEDs, instead of one and two LEDs, as in Chapter 7.

You will then build the circuit using a new part called a bar resistor and program the output pins to create sequences of on and off states for the eight LEDs. You will be using binary to write high and low commands directly to the pins. After this, you will add a micro switch to the circuit and program the circuit to allow different sequences to be manifested in relation to pressing or not pressing your input switch.

In this lesson, you will also learn about the PBASIC phrase DIRS, which is to set the direction of your microprocessor pins to be set as inputs and/or outputs.

You will also be using the PBASIC phrase OUTS, which will allow you to use binary to switch the individual pins to a high or low, which will allow you turn the LEDs on and off in the sequences you program.

While each individual pin of the Arduino can source 40 mA by exceeding either the source you can damage the tiny wires on the interior of the microcontroller. There are also limits to how much current multiple pins can source and sink at the same time. Source is the amount of current available to drive a device from the Arduino UNO. Sink is the amount of current the pin can absorb before damage is done.

Pins 13-10 should not exceed 100 mA source total. So, a series of pins have specific source capabilities, which must be acknowledged in your design.

1. Using Ohm’s law, calculate what size resistor you would need to limit the Arduino to source only 100 mA total for all eight output pins.
2. Remember, Ohm’s law states V =X R, or voltage = current times resistance. We already know that we have 5 volts DC available on the Arduino

Solving for resistance:

We first need to convert mA into amps by moving the decimal place three spaces to the left. So, 100 mA = .1 A.

Now, divide .1 A by 4 this gives us .025 A per pin available from the Arduino device, when driving all 4 pins simultaneously.

Plug these values into Ohm’s law to get the resistor value needed at each. Solving for resistance, the Ohm’s law equation now becomes gives you a value of 200 Ohms per LED.

3. Now that you have figured out your resistor values you are ready to build the circuit. You will be using a new part called the bar resistor with 9 resistors inside one single unit. You can use a 200 Ohm bar resistor of a resistor with a larger Ohm rating such as a 1000 Ohm resistor to know that we will not damage our Arduino.

4. Introducing a New Part

Single In-Line Package (SIP) resistor networks are packs of 8 or 9 resistors or more in a single unit with 10 pins. One of the pins is the common pin that is shared by all the resistors. As with other resistors, SIP resistor networks also have maximum ratings for how much mA they can absorb as heat. The one provided in the kit is a 1/4 W resistor pack. This is a valuable part because it can reduce the chance of accidental short circuits on your board by reducing the number of parts and wires exposed to other parts.  Bar resistor Bar resistor schematic symbol

Parts Required

Arduino Uno
4 220 Ohm resistors or bar resistor
or bar resistor

Building the Circuit