[ Log In ]

#### Part 1: Microcontroller and LED Breadboard Circuit

Part 1: Making a circuit for the Atmel AVR Atmega32 microcontroller to light up an LED (Light Emitting Diode). The circuit consists of an LED, a resistor of the appropriate value to limit current to the LED and a microcontroller.

#### Breadboard a Simple LED Circuit

Making the simple circuit to connect an LED (Light Emitting Diode) with a resistor to an Atmel AVR Atmega32 microcontroller connected to PORTB Pin 0.

#### Resistor and Schematic Symbol (short)

Very brief description of a resistor and the resistor's schematic symbol.

#### Determining Resistance Value for LED

How to find the resistance (resistor value) needed for a particular LED (Light Emitting Diode) usig Ohm's Law R = V/I: Resistance = voltage / current. In this case, it's a voltage difference (delta voltage) R = (SourceVoltage - LEDVoltageRating)/I. In the video, the 2 volts is the voltage of the LED and the .01 amps, or 1 miliamp is the amp rating of the LED.

#### Breadboard the LED to Microcontroller with Resistor

Physically wiring the circuit for an LED (Light Emitting Diode) to a microcontroller and a resistor so we can turn the LED on and off.

#### Part 2: Making a Microcontroller Program to Turn on an LED

Part 2: Making a program for the Atmel AVR Atmega32 microcontroller to light up an LED (Light Emitting Diode). The circuit consists of an LED, a resistor of the appropriate value to limit current to the LED and a microcontroller.

#### Schematic: Two LEDs and Push Button to Microcontroller with Hardware Debouncing

Schematic on paper of one button with hardware debouncing and two LEDs (Light Emitting Diodes) connected to an AVR microcontroller. The push button switch is connected to pin 1 on PORT B and the LEDs are connected to pin 0 and pin 2 on the same port. These are green LEDs so a 330ohm resistor is used to limit the current through the LED.

#### Breadboard: Push Button and Two LEDs connected to Microcontroller with Hardware Debouncing

Breadboard circuit of one button with hardware debouncing and two LEDs (Light Emitting Diodes) connected to an AVR microcontroller. The push button switch is connected to pin 1 on PORT B and the LEDs are connected to pin 0 and pin 2 on the same port. These are green LEDs so a 330ohm resistor is used to limit the current through the LED.

#### Software vs. Hardware Debouncing for Push Button and Switches

The rationalle of using one method over the other and the tradeoffs. In software debouncing, the trade off is the microcontroller requires a few more cycles which can slow the execution of the program slightly and the variables needed for software debouncing requires a bit of memory. The trade-off with hardware debouncing is that the extra hardware (capacitor or capacitor/resistor pair) will introduce a cost to the circuit where if the circuit will be used in a product that will have thousands, or many thousands of units made, a hardware solution may be too expensive.

#### Breadboarding: Connecting 14 LEDs and To Push Buttons to the Microcontroller

7 LEDs are connected to PORTB on pins 0 to 6 and a push button is connected to pin 7 on that port. On PORTD, 7 LEDS are connected to pins 0 to 6 and one push button is connected to pin 7. Resistors are connected in series with the LEDs to limit the current so the LEDs don't burn out.

#### Introduction to Potentiometers (variable resistors, or trimmers)

Potentiometers are variable resistors. The resistance changes when the wiper is adjusted. The variable resistance is measured from one of the outside leads to the center (wiper) lead. The small variable resistors are generally called trimmers.

#### On Paper and Breadboarding: Maxim MAX603 5V Low Dropout Voltage Regulator

The MAX603 is a Voltage Regulator that will provide 5v output and can accept a voltage very close to this output voltage featuring its low dropout.

The input voltage is connected to pin 1 and the output of 5v is from pin 8. the two middle pins on each side is connected to ground. Pin 4 is the off pin and to have the regulator enabled, this pin must be connected to the input voltage or pin.

The set pin at pin 5 is a pin that if it is connected to gnd, that pin will tell the chip to use the set voltage output of 5v. If a resistor is connected to this pin, the output voltage can be modified.

A capacitor is connected between the output pin and gnd and another capacitor is connected to input and gnd. Both capacitor values are 10uF (microfarad)

#### Potentiometers (variable resistors, trimmers or trimpots) Explained and Schematic Symbol

The potentiometer is a device that increases or decreases resistance as a variable resistor. Potentiometers can also be used as a voltage divider. If the potentiometer is to be used as a variable resistor, the potentiometer is only wired using two of the leads, the wiper (usually the middle lead) and one of the other leads (depending on which direction you would like the resistance to increase or decrease).

As a voltage divider, the two outer leads are aired to each pole and the center lead would be the output of the new divided voltage.

#### On Paper: Understanding Voltage Dividing using Resistors or a Potentiometer

A voltage divider is a way to decrease a voltage to a proportion of the circuit voltage using two resistors or a potentiometer. The proportion of two resistors will create that proportion output of voltage between the resistors (or the wiper in the case of a potentiometer).

#### On Paper: Voltage Dividing Formula using the Two Resistor Voltage Divider

The formula for the voltage divider.

#### On Paper: Voltage Divider Schematic

A voltage divider is just two resistors of a specified value to create a proportion for a voltage output that exists between the two resistors.

#### Breadboarding: Potentiometer (Voltage Divider) to ADC (Analog to Digital Conversion)

The center lead (Vout) of the potentiometer is connected to the ADC pin 0. The potentiometer's outer leads are connected to ground (GND) and 5V (VCC). These connections create the voltage divider. Optionally you can used resistors rather than wires for the two outer lead connections to minimize the possibility of a short where the resistance goes very low across the center lead to one of the outer leads.

The ADC needs to be powered. The ADC has its own power pins for AVCC and GND. the AVCC is connected directly to VCC (the 5V rail) and the GND is simply connected to GND on the - rail. Across these two power pins should reside a 100nf (nanofarad) or .1uf (microfarad) capacitor just like on the main power pins.

Another important pin for ADC is the voltage reference pin. This pin will receive the top voltage in our range of voltages we need to consider in the ADC input. Say, for instance, you don't want the 5v to be your voltage reference, because your device only has a range of 0v to 3.3v that will be delivered to the ADC. The top voltage in this range, 3.3v, should be connected to the ADC voltage reference Vref pin. If you had 5v connected to this Vref pin, but the device only gave you 0v to 3.3v, then your precision will be reduced.

The Vref pin can be set in programming, which is the case in this video clip.

#### Controlling LED Dimming with a Potentiometer

Using a potentiometer, the dimming of an LED can be controlled. The potentiometer is connected in a way that it functions as a voltage divider. The LED and a resistor in series with the LED to limit the current to the LED is connected to the potentiometer's middle lead and GND and the potentiometer is connected to the battery using its outer leads.

#### Breadboarding: Connecting an LED and Resistor to PORTD Pin 0

An LED is connected to PORD Pin 0 of an AVR microcontroller. In this case, the LED is used to represent a motor that will turn on and off according to an ADC value.

#### Understanding the Support Components That Need to be Used with the Relay

The Relay requires a few other components to provide enough power to trip the relay coil (transistor) and a diode across the relay coil to protect the transistor from any back EMF that could be caused by the relay coil.

The relay will be controlled by a pin on the microcontroller. Since the microcontroller will not allow a draw of current that the relay coil will need, a transistor will be needed to switch on a higher current supply. The higher current supply is just the 5v that is powering the circuit. On of the pins of the transistor is connected to the pin of the microcontroller. This pin will have a resistor between the pin and the transistor (base). When the pin is high, the transistor will allow current to pass through the other two pins (collector and emitter).

The relay coil is connected to this part of the transistor so when the pin is high, the relay coil will fire. Since the coil can create back EMF, the coil will have a signal diode across the coil to keep any current from hitting the transistor.

#### Determine the Resistance that must be Connected to the base Lead of a Transistor

A resistor will most likely be needed at the base lead of a transistor if the transistor will be used as a switch. The formla below is a special formula that is used only if the supply voltage is the same as the voltage being applied to the base lead of the transistor

Resistance = LoadCurrent x LoadResistance x Hfe(transistor rated)

#### Breadboarding: Connecting a Relay to the Microcontroller (with Transistor, Resistor and Diode)

The pin of the microcontroller is connected to a transistor that will switch on the current that will fire the coil of the relay so the relay can switch on. The pin of the microcontroller has a resistor to the base lead of the transistor.

A protection diode is connected to the two leads of the relay coil to protect the transistor from a current spike from the relay coil. The diode is a signal diode 1N4001.

#### Result: Connecting a Relay to the Microcontroller (with Transistor, Resistor and Diode)

This is a test of the pressure switch circuit with the relay connected to the microcontroller via the transistor.

The pin of the microcontroller is connected to a transistor that will switch on the current that will fire the coil of the relay so the relay can switch on. The pin of the microcontroller has a resistor to the base lead of the transistor.

A protection diode is connected to the two leads of the relay coil to protect the transistor from a current spike from the relay coil. The diode is a signal diode 1N4001.

#### Breadboarding: Connecting an LED and Resistor to the Microcontroller (PORTB Pin1)

The LED is connected to the microcontroller on the second pin (PORTB Pin 1) in series with the 330 ohm resistor the limit the current through the LED

#### Breadboarding: Connecting an LED and Resistor to the Microcontroller (PORTB Pin0)

The LED is connected to the microcontroller on the first pin (PORTB Pin 0) in series with the 330 ohm resistor the limit the current through the LED

#### Getting an LED to blink on an Arduino. Basics of Arduino Programming (Parts: Arduino UNO, Red LED, 330 ohm Resistor, Breadboard)

How to get an LED to blink on the Arduino board as well as on the breadboard by using the Arduino IDE.

Using the Arduino Sketch, a program is developed to make the onboard LED blink (see code below). Alternatively, an led can be wired from the Arduino (Arduino UNO in this example) to a breadboard that contains an LED and a 330 ohm resistor and the Sketch can refer to the pins on the Arduino, in this case, 12 and GND. Any GPIO (General Purpose Input/Output) pin can be used.

#### Operational Amplifier (Op Amp) - Nearly all opamp circuits use "Negative Feedback"

Negative feedback keeps the input voltage approximately zero (0).

In a circuit that has the non-inverting input to ground and there is a resistor from the voltage going into the inverting input, the output voltage will try to force the input voltages (inverting and non-inverting) to be zero.

#### Operational Amplifier (Op Amp) - Simple Opamp Circuit - Negative Feedback using 20k resistors and 10k resistors and an opamp

In this circuit, the non-inverting input has 5 volts coming in, represented by 10 volts being voltage divided with two 2.2k resistors at either side of the input. No current is being drawn into the input.

The negative feedback from the output will make the input voltages equal, so the inverting input will also equal 5 volts.

In the circuit, there is 4 volts coming in and in series with a 10k resistor, and on the other side of the inverting input, a 20k resistor is present. With the negative feedback, 100 microamps will be flowing out across the 20k resistor causing a 2 volt drop and across the 10k resistor causing a 1 volt drop. So, from 4 volts, adding 1 volt across the 10k resistor is 5 volts (at the inverting input) and across the 20k resistor will be a 2 volt jump making the output voltage 4v + 1v + 2v = 7 volts.

#### Operational Amplifier (Op Amp) - Simple Opamp Circuit - Negative Feedback using 20k resistors and 10k resistors and an opamp

This is the prototype of the circuit for Negative feedback where 4 volts with a 10k resistor is at the inverting input with a 20k resistor also connected to the output, and 5 volts (using 10 volts with a voltage divider) at the non-inverting input.

The whole point of this circuit is to force the inputs to be equal and the output will change to make this happen.

#### Operational Amplifier (Op Amp) - More Complex Opamp Circuit - Classic Integrator Circuit using a ,01 capacitor, 20k resistor and an opamp

At the feedback from the output to the inverting input resides a .01 uF capacitor. The inverting input will have a square wave that is rise above and fall below 5 volts where 5 volts is at the midpoint of the square wave.

When the square wave is abov ethe 5 volts, there will be current from the 5 volts, but not into the inverting input. The current goes to the capacitor. There will be a linear voltage change at the capacitor when current is applied to the capacitor. The voltage ramps down.

When the voltage is below the 5 volts, the current will be going in the other direction and the voltage will ramp up.

The end result is creating a triangle wave from a square wave.