## Arduino: Lesson 3 - Blinking an LED with delay() function

 Fig. 1 - Arduino: Lesson 3 - Blinking an LED with delay()

## Welcome to Lesson 3 - Basic Arduino Course

Today we are going to learn how to make our first algorithm, let's learn how to use the blink() function, this function makes your Arduino blink an LED, every time determined in the programming.

### Hardware Required

• Arduino Board
• LED - optional "You can use the onboard LED"
• 220 ohm resistor - optional "You can use the onboard resistor"

## The Circuit

You can use as an example the built-in LED that most Arduino boards have. This LED is connected to a digital pin 13, however, this number may vary from board type to board type.

This constant is LED_BUILTIN and allows you to control the built-in LED easily, and the correspondence of this constant is digital pin 13.

However, you can to lit an external LED with this sketch, you  only need to build the circuit showing in Figure 2 below, you can connect one external LED in serie with the resistor to the digital PIN 6

Connect the positive leg of the LED (the positive leg, is the anode) to the other end of the resistor. Connect the negative leg of the LED (the negative leg,  is the cathode) to the GND

## Resistor calculation

We need to use a resistor in series with the LED to limit the current in the LED. The value of this resistor depends on the LED we will use.

Considering that we will use an external green LED, let us analyze this situation by following the steps below:

• The power supply comes from a digital pin on the Arduino (Vdc = 5v).
• The LED needs a current of 20mA to be powered.
• And a supply voltage of 2.5V.

You can see the voltage requirements of LED in the table in Figure 3 below, which contains the average voltage of most standard color LEDs.

 Fig. 3 - Typical Led Voltage Range

Knowing that the LED power supply is 2.5V and 20mA (0.02A), following the table in Figure 3, let's put the data already obtained in the formula in Figure 4 below, and calculate:

 Fig. 4 - Formula to calculate the resistance for the power supply of LED

### Formula:

R = (Vps - Vled) / Iled

R = (5 - 2,5)/(0.02)

R = 125

As we can see, the result of the calculation made resulted in a resistance of 125Ω. As 20mA is on average the threshold value of the LED, R = 125Ω will also be its threshold resistance so as not to damage the LED.

The resistor value in series with the LED can be a different value, it can be one of 150 ohms, or more, such as 220 ohms, 330 ohms; the LED will also light up with higher values but with less intensity.

## The Code

After building the circuit, connect your Arduino board to your computer, launch the Arduino Software (IDE), copy the code below and paste it into your Arduino IDE. But first, let's understand the code line by line.

• First, in void setup() structure, digital pin 6 is initialized as output pin, as shown in line 4 below
 12345 // Arduino: Lesson 3 - Blinking an LED with delay()void setup() {                      // This function is called once when the program starts pinMode(6, OUTPUT); // initialize digital pin 6 as an output.}
• In the void loop() structure, in line 8, the digitalWrite function, command activates port 6 to HIGH level, it means that it goes from 0V to 5V, which makes the LED receive the voltage and lit up.
• In the line 9, the delay() instruction indicates that we will have 1000 milliseconds or 1 second to wait, and then enters the next step which is to turn the LED off.
 1...78910 // Arduino: Lesson 3 - Blinking an LED with delay()void loop() { // The loop structure runs over and over again forever digitalWrite(6, HIGH); // initialize digital pin 6 as an output. delay(1000);           // Wait for 1 second...

• In the line 12, the digitalWrite function, command activates port 6 to LOW level, it means that it goes from 5V to 0V, Then turn the LED off.
• In the line 13, the delay() instruction indicates that we will have 1000 milliseconds or 1 second to wait, and then enters the next step which is to turn the LED off.
 1...7...1213 // Arduino: Lesson 3 - Blinking an LED with delay()void loop() { // The loop structure runs over and over again forever digitalWrite(6, LOW); // initialize digital pin 6 as an output. delay(1000);           // Wait for 1 second...

This brings the LED pin back to 0 volts, and turns the LED off. Enough time should pass between powering on and powering off, that's long enough to see the LED blink.

Therefore, the delay() function tell the Arduino board to do nothing for 1000 milliseconds or 1 second. When you use the delay() function, nothing else happens for that amount of time.

The complete code is showed in the sketch below.

 1 2 3 4 5 6 7 8 9 10 11 12 // Arduino: Lesson 3 - Blinking an LED with delay() void setup() {                     // This function is called once when the program starts pinMode(6, OUTPUT); // initialize digital pin 6 as an output.}void loop() { // The loop function runs over and over again forever digitalWrite(6, HIGH); // Turn the LED ON (HIGH voltage level)delay(1000);           // Wait for 1 seconddigitalWrite(6, LOW); // Turn the LED OFF (LOW voltage level)delay(1000);                 // Wait for 1 second} //------------------------------------- www.elcircuits.com --------------------------------------------

We can also use the same code, adding a name to pin 6 of the code above, simply assigning an integer to pin 6.

 1234 // Arduino: Lesson 3 - Blinking an LED with delay()int ledPin =  6;      // the number of the LED pin

In this way, you will use pin 6 identification as ledPin, as we can see in the complete code below.

 123456789101112131415 // Arduino: Lesson 3 - Blinking an LED with delay()int ledPin =  6;      // The number of the LED pinvoid setup() {                              // This function is called once when the program starts pinMode(ledPin, OUTPUT); // initialize digital pin 6 "ledPin" as an output.}void loop() { // The loop function runs over and over again forever digitalWrite(ledPin, HIGH); // Turn the LED ON (HIGH voltage level)delay(1000);           // Wait for 1 seconddigitalWrite(ledPin, LOW); // Turn the LED OFF (LOW voltage level)delay(1000);                           // Wait for 1 second}//------------------------------------- www.elcircuits.com --------------------------------------------

This second code will work the same way, however when we have many "Pins" ports in a larger project, and we need to change the pin to another port, in this second code, you simply change line 3 of the code, which assigns port 6, the integer ledPin to another port you need.

## Arduino: Lesson 2 - How to Install Arduino Software (IDE) on Windows - Step by Step!

 Fig. 1 - Arduino: Lesson 2 - How to Install Arduino Software (IDE) on Windows - Step by Step!

## Welcome to Lesson 2 - Basic Arduino Course

Today we are going to explain how to install Arduino Software (IDE) on Windows machines step by step. Let's get started!

You can choose between the Installer (.exe) and the Zip packages how showing in Figure 2. We suggest you use the first one that installs directly everything you need to use the Arduino Software (IDE), including the drivers.
Note: With the Zip package you need to install the drivers manually. The Zip file is also useful if you want to create a portable installation.

STEP 2: When the download has been completed, open the installer file and proceed with the installation, allow the driver installation process when you get a warning from the operating system and accept the License Agreement, how to showing in Figure 3 below.

 Fig. 3 - How to Install Arduino IDE - Agreement Page

STEP 3: Select the folder where you want to install Arduino IDE, how to showing in Figure 4 below.

 Fig. 4 - How to Install Arduino IDE - Folder location Select Page

STEP 4Choose the components to install and select all the components including the board drivers, how showing in Figure 5.

 Fig. 5 - How to Install Arduino IDE - Check components Page

STEP 5: In some cases, we may get a “Windows Security” windows, how to showing in Figure 6 below, to install devices software, simply click on button “Install“, and wait until the installation completes.

 Fig. 6 - How to Install Arduino IDE - Security Device Page
STEP 6: The process will extract and install all the required files to execute properly the Arduino Software (IDE). When finished, click in "Close" button, and the installation is finished.

 Fig. 7 - How to Install Arduino IDE - Installation Page

That's it, you've just successfully installed the Arduino IDE Software on your computer!

### Previous Lesson

If you have any questions, suggestions or corrections, please leave them in the comments and we will answer them soon.

My Best Regards!!!

## PinOut - ARDUINO Mega Rev3 Board - ATMega328PU

 Fig. 1- Arduino Mega Rev3 Board - arduino.cc

The Arduino Mega 2560 is a microcontroller board based on the ATmega2560. It has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button.

Source: arduino.cc

If you have any questions, suggestions or corrections, please leave them in the comments and we will answer them soon.

My Best Regards!!!

## How to Make Cable; Guitar, Keyboard, Bass, Audio Mix, PA, among others, Step by Step!

 How To Make Cable of, Guitar, Bass, Audio Mix, PA, and some others Quality!

Today we bring you a quick guide on how to build your own audio cable for: Musical Instruments, Home Studio, Soundboard, Amplifiers, Automotive Sound, Recording Studio, Professional Sound, Microphone Cable, Balanced Cables, CD Player, among so many others.

### You might also be interested in:

There is a huge variety of cables, but we will show the most common ones, which, as they are the most common, are the most used.

### 1° It's a Cable: A mono P10 Male connector to a mono P10 Male connector

This type of cable is one of the most eclectic, and most of it is used between musical instruments, such as keyboards, bass guitars, guitars, and so on. and the audio mix, to carry a signal to the PA "Public Audition", among others. This is shown in Figure 1 below.

 Fig. 1- Diagram Mono P10 Male to P10 Male Connector

### 2° It's a Cable: One male P10 stereo connector to two male P10 mono connectors

This type of cable is generally used between the mixer and the effect module, using the insert channels to send and receive effects, among many others. This is shown in Figure 2 below.

 Fig. 2- Diagram P10 Male Stereo Connector for Two Mono P10 Male Connector

### 3° It's a Cable: One Balanced Female XLR Connector for Two Mono P10 Male Connectors

These types of cables are generally used in audio mix connections to balanced amplifiers among other myriad uses. This is shown in Figure 3 below.

 Fig. 3- Female XLR Connector Diagram for 2 Mono P10 Male Connectors

### 4° It's a Cable: A Balanced Female XLR Connector to a Male P10 Stereo Connector

This cable is generally used to connect a Power Play "Headphone Amplifier Distributor" to the Soundboard auxiliary, we can also connect to a balanced microphone "When available on the audio mix with Plug P10" with Microphone powered with Phantom Power, between so many others. This is shown in Figure 4 below.

 Fig. 4 - Female XLR Connector Diagram to a Male P10 Stereo Connector

### 5° Is a Cable: One XLR Female connector to one P10 mono Male connector

This cable is generally used to connect a microphone to the mixer, and or to connect the output of the XLR console to the amplifiers, among many others. This is shown in Figure 5 below.

 Fig. 5 - Diagrama  Conector XLR Fêmea para P10 Macho Mono

### 6° It's a Cable: One Male Balanced XLR connector to two P10 mono Male connectors

This type of cable is generally used to connect the output of the mix to P10, L and R, for active box, amplifiers, which has a stereo XLR input, among others. This is shown in Figure 6 below.

 Fig. 6 - XLR Male Connector Diagram for 2 P10 Mono Male

### 7° It's a Cable: One Balanced Male XLR Connector to One Male P10 Stereo Connector

This type of cable is generally used to connect a balanced signal from equipment, to a mix, such as instruments with low sensitivities, such as; "depending on the model" Guitar, ukulele, among others. This is shown in Figure 7 below.

 Fig. 7 - XLR Male Connector Diagram for P10 Stereo Male

### 8° It's a Cable: One XLR Male connector to one P10 mono Male connector

This type of cable is similar to the previous one, except that it is used for unbalanced signals, for a mix, such as instruments with low sensitivities, such as; "depending on the model" Violão, Cavaquinho, among others. This is shown in Figure 8 below.
 Fig. 8 - Male Unbalanced XLR Connector Diagram for P10 Mono Male

### 9° It's a Cable: A Balanced Female XLR connector to a Balanced Male XLR connector

This cable is well known and standard for use in balanced Microphones, but it is also widely used to connect peripherals such as; equalizers, processors, effects equipment to the Mix, as well as to connect the output of the XLR console to the Active Box, Amplifiers, among many others. This is shown in Figure 9 below.

 Fig. 9 - Balanced XLR Connector Diagram Male Balanced XLR

### 10° It's a Cable: Two RCA Male connectors to one P10 Stereo Male Connector

This type of cable is generally used for connecting P10 stereo output signals to loudspeakers that have RCA inputs, among many others. This is shown in Figure 10 below.

 Fig. 10 - Diagram Male RCA Connector to Male P10 Stereo Connector

### 11° It's a Cable: Two male RCA connectors to two P10 mono Male connectors

This type of cable is generally used to connect output signals from the Mix, usually the older ones, with P10 connectors for amplifiers that have signal inputs with RCA connectors, also used to connect CD, DVD, Disc and other peripheral devices to the line input on the soundboard, among others. This is shown in Figure 11 below.

 Fig. 11 - Diagrama Conector RCA Macho para Conector P10 mono Macho

### 12° It's a Cable: Two RCA Male Connectors to Two RCA Male Connectors

This type of cable is generally used to connect the Mix's auxiliary output signals, usually the older ones, with RCA connectors for amplifiers that have the signal inputs with RCA connectors, also used to connect CD, DVD, Disc and other devices. peripherals to the auxiliary RCA input on the mixer, among others. This is shown in Figure 12 below.

 Fig. 12 - RCA Male Connector to Male RCA Connector Diagram

If you have any questions, suggestions or corrections, please leave them in the comments and we will answer them soon.

My Best Regards!!!

## Symmetrical Adjustable Power Supply 1.25V to 47V 10 Amps with Short Circuit Protection + PCB

 Fig. 1 - Symmetrical Adjustable Power Supply 1.25V to 47V 10 Amps with Short Circuit Protection
This is a Symmetrical Adjustable Power Supply can vary its output voltage from 1.25V to 47V, based on the LM317HV Linear Voltage Regulator Integrated Circuit for positive voltage and the LM337HV for negative voltage, which together with the NPN transistors TIP 35C and the PNP transistor TIP36C provide a current of 10 amps.

This schematic was taken from our partner fvml.com.br, what we did was a small change in the supported current capacitance, you can check the original circuit here Click Here!

The LM317HV and LM337HV voltage regulators are adjustable 3-terminal voltage regulators capable of delivering currents of 1.5A or more over an output voltage range of 1.25V to 50V

The LM317HV and LM337HV offer overload protection such as current limiting, thermal overload protection, and safe-area protection, that make the device breakdown-proof. The overload protection circuit remains fully functional even if the setting terminal is disconnected.

Remember, we limit the maximum output voltage of the power supply to 47V, because the LM337HV negative voltage regulator supports a maximum of 50V, unlike the LM317HV which supports up to 60V.

## How the Circuit Works

After rectification and filtering, which are the first basic operations of the circuit, the total voltage coming from the transformer and rectified enters the first output block, the voltage regulator, which is controlled by the LMs Integrated Circuit and mirror image "Same function, just in a negative way".

R1 and R2 are 10 ohm resistors that have the function of Load Sensor, they receive the current flowing through the circuit, and while this current does not reach the current calculated across the resistors R1 and R2, the circuit behaves like a normal voltage regulator, because for small "calculated" currents there is no voltage drop across the Load Sensing resistor, so the Boosters Transistors TIP36C and TIP35C are not activated.

When the current in the circuit increases, the voltage across resistor R1 increases, when this voltage reaches about 0.6V "transistor turn-off voltage", the power stage is activated and current flows through it.

## The Protection Circuit

The output short circuit protection circuit is formed by transistors; Q1 BD140 PNP and Q2 BD139 NPN, each for an output bias voltage.

They regulate the maximum current "Calculated", which is fixed at 10 amps, and work together with 0.06ohm resistors R3 and R4 as a current sensing resistor, which is used to polarize transistors Q1 and Q2, so that, depending on the determined value, they limit the output current of the entire circuit according to a simple formula from Ohms Law, which is used to set this limiting current.

## Formula 1st Ohm's Law

The First Ohm's Law states that the potential difference between two points of a resistor is proportional to the electrical current established in it, and the ratio of electrical potential to electrical current is always constant for ohmic resistors. The formula is given by: V = R * I

V - Voltage or Electrical Potential
R - Electrical Resistance
I - Electrical Current

Armed with the knowledge of the ohms law, we can now calculate the values ​​of the Load Sense resistors, which activates the power step, and the bias resistors of the protection transistors, which is the Short Circuit protection circuit.

First, we have to know the current of the LM317hv Voltage Regulator, which according to the datasheet is 1.5 amps.

LM317HV & LM337HV = 1.5A
Let's calculate R1, knowing that the same calculation is done for R2. We know that Ohm's Law gives us the following expression:

V = R * I
V = The cutoff voltage of transistors Q3, Q4 & Q5, which follows the same principle for set Q6, Q7 & Q8, is 0.6V "Which is the Transistor cutoff region". Let's call Q3, Q4 & Q5 as a Qeq.

I = It is the current of the regulator CI1, let's put the working current of the CI1 at 300mA, which is equal to 0.3A, with this current we won't need to put a heatsink on it.

Then:

R1 = Vbe_Qeq / I_CI1
R1 = 0.6V / 0.3A
R1 = 2 ohms

### Protection Circuit Resistor Calculation

Likewise, we have to know the total current of the chosen source so that there is a cut in this region. Our source is for 10 Amps.

Power Supply = 10A
Let's calculate R3, knowing that the same calculation is done for R4. We know that Ohm's Law gives us the following expression:

V = R * I
V = The cutoff voltage of transistor Q1, which follows the same principle as for transistor Q2, is 0.6V "Which is the Transistor cutoff region".

I = It is the total current of PS, which is 10A.

Then:

R1 = Vbe_Q1 / I_ps
R1 = 0.6V / 10A
R1 = 0.06 ohms

### Power Transistors Current

Q3 + Q4 + Q5 = 25A + 25A + 25 = 75A

NOTE: Remembering that the power of TIP36C transistors is 125W, this means that it works with current from 25A to 5V, remember the formula above, P=V*I;

P = 5V * 25A = 125W.

For this circuit with a maximum voltage of 47V, and transistors with a maximum power of 125W, we look like this:

Pmax = V * I:
Imax = P / V => Imax = 125W / 47V => Imax = 2.66A
How are three transistors together Imax = 7.98A

And that's why our circuit uses three TIP36C transistors to achieve 10 amps at the output.

In Figure 2 we have the schematic diagram of the adjustable power supply circuit with short circuit protection, so those who accompany us already know this circuit very well, the difference is exactly the implantation of the symmetry of the circuit and the protection circuit, as we can see below.
 Fig. 2 - Symmetrical Adjustable Power Supply 1.25V to 47V 10 Amps with Short Circuit Protection

## The Power Transformer

The transformer must be symmetrical, i.e.: "3 wires". The transformer must be able to supply at least 10A at the output. The primary, "input voltage", must match the voltage in your area; 110V or 220Vac. The secondary, "output voltage" should be 36 - 0V - 36Vac.

## Component List

• Semiconductors
• U1 ....................... LM317HV Voltage Regulator
• U2 ....................... LM337HV Voltage Regulator
• Q1 ....................... PNP BD140 Transistor
• Q2 ....................... NPN BD139 Transistor
• Q3, Q4, Q5 ......... PNP TIP36C Power Transistor
• Q6, Q7, Q8 ......... NPN TIP35C Power Transistor
• D1 ...................... KBPC5010 - 50A Rectifier Bridge
• D2, D3 ............... 1N4007 Diode Rectifier

• Resistors
• R1, R2 ................ 2Ω / 2W  Resistor
• R3, R4 ................  0.06Ω / 5W Resistor
• R5, R6 ................ 5KΩ  / 1/8W Resistor
• R7, R8 ................ 120Ω / 1/8W Resistor
• R9, R10, R11 ...... 0.1Ω / 5W Resistor
• R12, R13, R14 .... 0.1Ω / 5W Resistor
• RV1 .................... 5KΩ Potentiometer

• Capacitors
• C1, C2 ................ 5600uF - 63V Electrolytic capacitor
• C3, C4 ................ 10uF - 63V Electrolytic capacitor
• C5, C6 ................ 1000uF - 63V Electrolytic Capacitor

• Others
• P1, P2 ................. Connector 3 screw terminal 5mm 3 Pins
• Others ................. Wires, Solders, pcb, etc.

We offer for download the necessary materials for those who want to assemble with PCI - Printed Circuit Board, the files in PNG, PDF and GERBER files for those who want to send for printing.