#### 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.

#### LED Schematic Symbol

The schematic symbol of an LED (Light Emitting Diode).

#### Polarity of an LED

How to determine the polarity of an LED (Light Emitting Diode) and determine which lead is the anode and cathode.

#### Determining Resistance Value for LED and Their Color

LED (Light Emitting Diode) colors, their voltages and how to select a resistance value for an LED so the LED will not have more current than it needs (will not burn out).

#### 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.

#### Starting WINAVR Programmers Notepad for LED Program

Starting the WINAVR Programmers Notepad to begin programming for the Atmel AVR microcontroller.

#### Creating a Folder to Store the C Program (main.c)

Creating a folder to store the program and project files and saving files into for the C or AVR-GCC project using programmers notepad for WINAVR. The main program should be called main.c since that is what the makefile already contains.

#### Modifying the Makefile for AVR

Modifying the make file to make sure the C or AVR-GCC program can be compiled and trasfered into the AVR microcontroller under WINAVR and using the program called mfile. This consists of changing the programmer to USBTiny or the programmer of choice and changing the microcontroller and setting the correct port that the programmer is plugged into.

#### WINAVR Compiling and Transferring the Code to the AVR

Compiling the program and transferring the compiled program into the microcontroller using the USBTIny AVR pocket programmer and WINAVR programmers notepad. The process under programmers notepad is Tools -> Make All to compile the program and Tools -> Program to invoke avrdude.exe to transfer the compiled program into the microcontroller.

#### Results: Single LED Turn On with the AVR

The results of the single LED circuit and program of turning on the LED using PORTB and Pin 0 after the program was transfered into the AVR microcontroller.

#### Blink an LED Program and Circuit for AVR

Developing a program to blink an LED on the Atmel AVR microcontroller under WINAVR using programmers notepad (AVR-GCC programming in C).

#### Introduction to Delays (Blinking LED)

Adding the delay functions to the LED blink program using the #include util/delay.h statement and the _delay_ms(delayAmount) function.

#### Playing with the _delay_ms function

Playing with the delay '_delay_ms()' function by changing the delay and seeing what happens to a blinking LED.

#### Push Button and Switch Bounce (Intro to Debouncing)

General explanation of push button and switch bounce. Removeing the push button or switch bounce is called debouncing the swith or push button. Debouncing can be addressed in two ways, software debouncing and hardware debouncing.

#### Programming: Push Button Switch to Change LED Blink Delay

How to make a program for the Atmel AVR microcontroller using a push button to change the delay that an LED is blinking. The program uses the util/delay.h library and _delay_ms(delayAmount) function. Two delays are used: a 10 millisecond delay and a 100 millisecond delay.

#### Circuit and Programming: Push Button Switch to Change LED Blink Delay

How connect a push button to a microcontroller (make a circucit) and make a program for the Atmel AVR microcontroller using a push button to change the delay that an LED is blinking. The program uses the util/delay.h library and _delay_ms(delayAmount) function. Two delays are used: a 10 millisecond delay and a 100 millisecond delay.

#### 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.

#### Programming: Toggle Two LEDs when Push Button is Pressed for AVR

Making a program for the Atmel AVR microcontroller to toggle two LEDs when a push button switch is pressed. When the push button is pressed and released, one LED is on, and when the push button is pressed and released again, the on LED is turned off and the other LED is turned on.

#### Result: Push Button with No Debouncing (Toggling two LEDs)

A test of the actual circuit with the Atmel AVR microcontroller programmed showing the push button without any debouncing and two LEDs toggled when the push button is pressed and released. Results show that without debouncing the LEDs sometimes toggle twice or three times with one button pressed and release.

#### Result: Push Button with Hardware Debouncing (Toggling Two LEDs)

A test of the actual circuit with the Atmel AVR microcontroller programmed showing the push button with debouncing using a capacitor across the two leads of the push button switch. Two LEDs (Light Emitting Diodes) are toggled when the push button is pressed and released. Results show that without debouncing the LEDs sometimes toggle twice or three times with one button pressed and release.

#### Program and Circuit: Push button Software Debouncing

A program is developed and circuit is breadboarded to investigate debouncing through software. A few variables are created to measure the confidence level of the press and release. Two LEDs are added to the circuit to determine is the debouncing is operating successfully. If the LEDs toggled twice or more, then the debouncing would be unsuccessful. There is a threshold that only allows the button to create an action if the confidence level is above this threshold.

#### Breadboarding: connecting Two LEDs and One Push Button to a Microcontroller

Two LEDs and one push button is connected to an AVR microcontroller on PORTB. The LEDs are connected to pin 0 and pin 1. The push button is connected to pin 2.

#### Programming: Software Debouncing for a Push Button Switch

A program is developed to investigate the elimination of button bounce (software push button debouncing). The circuit consists of two LEDs and a push button. The LEDs will toggle when the push button is pressed and then released. Two main variables are used in understanding the actual button press and button release. These are confidence levels of pressed and released. A threshold controls the button action.

#### Result: Software Debouncing of a Push Button Switch

A push button is tested to determine if software debouncing is successful. Microcontroller used is an Atmel AVR Atmega32. Two LEDs are used to check if the button exhibited a bounce.

#### Schematic On Paper: 14 LED and Two Button on Microcontroller

7 LEDs are connected to PORTB pins 0 to 6. The 7th pin has a push button. On PORTD 7 LED are connected to pins 0 to 6 and on the 7th pin a push button is connected to the AVR microcontroller.

#### 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.

#### Programming: Create a Quick Press Button Game

An AVR microcontroller program that uses two push Buttons and 14 LEDs where each player has one push button and 7 LEDs. The object of the game is to press the push button faster than the opponent. The 7 LEDs will light up in sequence as the push button is pressed until the last LED lights up. The first player that lights the last LED on their side wins.

#### Programming: Creating a Global Variable

Positioning a variable or array outside of the main function allows this variable to be used within all functions. All variable positioned outside of the main function are called global variables and the scope of these variables are global, or able to be used anywhere in the program.

#### Programming: Initializing 7 LEDs and a Button on PORTB and the Same for PORTD

A Push Button and 7 LEDs are Initialized on PORTD and PORTB. The Push Button is located on the 8th pin (pin 7) on each port and the 7 LEDs are located on the remaining pins of each port.

#### Programming: Part 1: A Method of Creating Reusable Code

Similar code is put into a single function to be called by two uses. In this example, two push buttons are needed to be read (evaluated) and a set code needs to be executed when each of these push buttons are pressed and released. Since these two push buttons will perform similar actions, the code is taken into a single function to be called by each of these push button conditions. Array is used in this code.

#### Programming: Part 2: A Method of Creating Reusable Code - Functions

Similar code is put into a single function to be called by two uses. In this example, two push buttons are needed to be read (evaluated) and a set code needs to be executed when each of these push buttons are pressed and released. Since these two push buttons will perform similar actions, the code is taken into a single function to be called by each of these push button conditions. Array is used in this code.

#### Configuring: How to Change Syntax Color and Font in Programmers Notepad

In this case, the brackets {} or [] and Parenthesis () are changed to highlight their positions which allows better visual of the containing code or condition. To changes these attributes, go to Tools -> Options -> Schemes (Styles or advanced) to open the configuration screen for these options. The item that was changed is called "Brace Match".

#### Programming: Making Sure Library is Compiled only Once (#ifndef...#endif)

All libraries (header files .h) that are created for c or c++ programs must have code in them to make sure they are not compiled more than once. The use of #ifndef #define and #endif is used for this. The #ifndef means if not defined. If a define is in the top portion of the library file to demarkate the file by a special name, then an ifndef can be used to make sure the code in that library is omitted if the define was alreay seen by the compiler.

#### Programming: Initializing Two Buttons and Two LEDs on PORTB

Initializing two push button and two LEDs using binary notation. The push buttons will be connected to pins 0 and 1 and the LEDs are connected to pins 2 and 3.

#### Programming: ButtonPress Library Usage

Using the buttonPress library for the Atmel AVR microcontroller. The function is called ButtonPressed and it returns a char for testing if the push button is actually pressed. The parameters are the button number, port where the button is connected, pin of the port where the button is connected, and the confidence level threshold.

#### Programming and Result: Using the Timer/Counter to Toggle an LED 100 Times/Second

The Timer/Counter is used to count against a known clock frequency, the internal clock source for the AVR microcontroller. In the first part of the experiment, an LED, connected to PORTB and Pin 0 is toggled every time the TCNT1 exceeds 10000. That makes the LED toggle 100 times per second, which is too fast for the eye to discern the blink.

The TCCR1B Timer/Counter Control 16-bit Register B is used to turn on the CS10 (Clock Select) option of the control register to enable the timer for no prescaling.

#### Programming and Result: Using the Timer/Counter to Toggle an LED every second

The Timer/Counter is used to count against a known clock frequency, the internal clock source for the AVR microcontroller. In the first part of the experiment, an LED, connected to PORTB and Pin 0 is toggled every time TCNT1 is counted to 10000 * 100 using another loop. This makes the LED toggle every second

The TCCR1B Timer/Counter Control 16-bit Register B is used to turn on the CS10 (Clock Select) option of the control register to enable the timer for no prescaling.

#### Programming and Result: Using the Timer/Counter to Create Chasing LEDs

The Timer/Counter is used to count against a known clock frequency, the internal clock source for the AVR microcontroller. In the first part of the experiment, a set of LEDs (14 in all) is connected to PORTB and PORTD and will produce a chasing effect every second and every 7th of a second using the TCNT1 timer/counter.

#### On Paper: Using Interrupts with the Timer/Counter

The interrupt can be used to create an event when the timer/counter TCNT1 or TCNT0 achieves a specific value. The OCR1A is used to hold this value.

The TCCR1B is set to a prescaler of 64 using the Clock Select bits (CS10, CS11 and CS 12) and another control bit called WGM12 (Waveform Generation Mode) CTC Mode (Clear Timer on Compare). This will cause the TCNT1 to go back to 0 when the OCR1A value is hit.

sei() is used to enable global interrupts along with the timer interrupts enable control TIMSK.

#### Programming: Using Interrupts with the Timer/Counter

The interrupt can be used to create an event when the timer/counter TCNT1 or TCNT0 achieves a specific value. The OCR1A is used to hold this value.

The TCCR1B is set to a prescaler of 64 using the Clock Select bits (CS10, CS11 and CS 12) and another control bit called WGM12 (Waveform Generation Mode) CTC Mode (Clear Timer on Compare). This will cause the TCNT1 to go back to 0 when the OCR1A value is hit.

sei() is used to enable global interrupts along with the timer interrupts enable control TIMSK.

#### Result: Using Interrupts with the Timer/Counter

The interrupt can be used to create an event when the timer/counter TCNT1 or TCNT0 achieves a specific value. The OCR1A is used to hold this value.

The TCCR1B is set to a prescaler of 64 using the Clock Select bits (CS10, CS11 and CS 12) and another control bit called WGM12 (Waveform Generation Mode) CTC Mode (Clear Timer on Compare). This will cause the TCNT1 to go back to 0 when the OCR1A value is hit.

sei() is used to enable global interrupts along with the timer interrupts enable control TIMSK.

To test the output, an LED is connected to PORTB pin 0 and toggled on the interrupt.

#### On Paper: Understanding the Pins of the LCD (pinout) and Their Functions

Each of the pins on the LCD have their own functions.

#1 pin: VSS - Ground
#2 pin: VDD - 5v Supply
#3 pin: V0 - contract Adjustment
#4 pin: RS - Register Select Signal
#6 pin: Enable
#7, #8, #9, #10 pins: Low Data Lines
#11, #12, #13, #14 pin: High Data Lines
#15 pin: Anode or + LED backlight
#16 pin: Cathode or - LED backlight

#### Breadboarding: Conecting the LCD to the Microcontroller

When using all 8 data lines for the LCD, you will need a full port and three more pins on the mictocontroller. Careful consideration should be made when selecting this port.

In this case, the data lines are connected to all the pins of PORTB.

The data pins of the LCD is labeled D0, D1, D2, D3, D4, D5, D6 and D7, and these are connected to PORTB pin 0 to pin 7 respectively. (i.e. D0 to pin 0, D1 to pin 1 and so on). The remaining control pins RS, RW and enable are connected to three pins of PORTD.

#### 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.

#### Programming: Part 1: Send a String of Characters to the LCD Function

The prototype and function is added called void Send_A_String(unsigned char *stringOfCharacters)

#### Programming: Part 1: Understanding Pointers

The asterisk * denotes the pointer and in this example, the pointer '*' is pointing to a variable called StringOfCharacters. the pointer will start at the first memory location of the variable and can inform what is stored in that memory location. If * StringOfCharacters = "NewbieHack.com", then the pointer would see 'N' as the first character. If 1 is added to the * StringOfCharacters (i.e. pointer = * StringOfCharacters + 1), then the 'e' would be seen by the pointer.

#### On Paper: Setting a Cursor Location

a 20x4 LCD is described. the command 0b10000000 to the LCD allows you to set the curcor at a specific location. The trailing 0000000 is the position on the display. There are 128 possible locations, but for the 20x4, there are 80 possible locations.

1st line: 0 - 19
2nd line: 64 - 83
3rd line: 20 - 39
4th line: 84 - 103

Notice that the first line and the 3rd line continue like its on one line and the 4th line continues from the 2nd line. This is like it was meant to be a 2 line LCD with very long lines which is how the LCD processor treats all LCDs.

In the LCD program, a new function is created called GotoLocation(x, y).

#### On Paper: Wall Adapters for Power

Wall Adapters have an input voltage generally between 110v or 220v. This voltage may read 115v, 120v, 230v or 240v. the output voltage will vary widely. This usually depends on the application of the wall adapter. If the wall adapter was used for another device, the wall adapter was designed and manufactured to power that device safely.

The output will be shown in DC or AC voltage and amperage. Voltage is the rating that the wall adapter will provide the circuit, and the amperage is the maximum value that the wall adapter allow. That is to say, if a device normally draws (pulls as having a load) 5 amps, but the wall adapter can only allow a 2 amp draw, then the device will only get a load of 2 amps.

Examples of common values for voltage and amps: 9v, 12v, 1000ma (1A), 250ma. Amp is 'A' and milliamp is 'ma'.

If the output is AC (Alternating Current) voltage, the wall adapter is just a step up or step down voltage converter. If the output voltage is DC (Direct Current), then this would be called an AC to DC converter.

#### 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)

#### Programming: ADC (Analog to Digital Converter) Setting the Left or Right Shift for the Result

Setting either a left shift or right shift for the result will make it easier to grab the data for 8-bit or 10-bit. It is how the number will be placed within the register that will hold the data. The number will be placed in the register as left justified or right justified using terminology from word processors. This is important because the data will reside in two registers, because a 10-bit number will not fit in just one 8-bit register.

The bit that needs to be set is ADLAR if you want the data to be shifted to the left. This will put the 8-bit information in one register called the ADCH (ADC High) and make it very easy to get the number without having to do any bitwise manipulations.

#### On Paper: PWM (Pulse width Modulation) Brief Description

PWM is a digital way of outputting a specific voltage between the top and bottom voltages (i.e. 5v to 0v). The output would be a pulse within a period of time. The percentage of the width of the pulse relates to the output voltage. This pulse width percentage is called duty cycle. For instance, within this period of time, if the pulse is at 5v for half of the period of time, then the output voltage is 2.5v.

#### Programming: ADC (Analog to Digital Converter) Setting the Internal Voltage of 2.56v as the Voltage Reference

The AVR microcontroller offers an internal voltage reference of 2.56v to be used if so desired. If the device that is being measured by the ADC has a top value of 2.56v then this option would be a good one. The accelerometer that I am connecting to the ADC actually has a higher top voltage, but not that much more, so I selected this option.

The register that this option can be controlled is the ADMUX register. The REFS1 and REFS0 control the source of the reference voltage. In this case, to select the internal 2.56 volts as the reference, both REFS1 and REFS0 must be set.

#### Programming and Result: ADC (Analog to Digital Conversion) Understanding Noise and Using Noise Cancelling and Sleep Mode

The ADC has a noise cancelling features described below:

Circuit Specific: Analog Noise Cancelling Techniques: The ground plane specifications, using an inductor or 10 mH and 100 nf (nano farad) .1 uf (micro farad) capacitor.

Programming: ADC Noise Canceler - ADC noise reduction and idle mode. Entering the ADC noise reduction mode will cause the CPU to stop when the ADC is starting a conversion. This will only work in ADC single conversion mode.

the ADC noise reduction mode is invoked by setting the SM0 bit in the MCUCR register, make sure the SM1 and SM2 is not set. The SE (Sleep Enable) bit must also be enabled in the same register.

#### Introduction to Servos and Servomechanisms

Servos are motors that use feedback to control the motor's position. This type of control is called closed loop control. Servos use a special electromechanical device to provide this feedback. This electromechanical device can be a potentiometer or encoder. Encoders come in various shapes, sizes and resolutions.

Encoders provide a pulse (usually caused by an LED and sensor) that determines the position of the shaft of the motor. When the controller counts to the commanded number of pulses, the motor is stopped, or put into reverse if the motor over ran the position. The motor and controller will constantly provide torque in the direction that is needed to keep the position and is always correcting.

If a potentiometer is used, the motor shaft is connected to the potentiometer in some way (hobby servos connect the potentiometer with gears).

#### Introduction to Encoders

Encoders are devices that are used in the closed loop control of motors. Encoders provide the control system the feedback on where the motor is positioned. Encoders can be linear, or radial. If the encoder is physically connected to the motor shaft in some way, then the encoder is generally circular containing some type of transparency that would provide a pulse if turned. The pulse is generated by a light on one side of the encoder and a sensor on the other side of the encoder.

If the encoder is not physically connected to the motor shaft, then the encoder may be a linear strip (commonly called a code strip). The light and sensor would be connected near the motor and the code strip would be tied the extremes of where the motor will travel.

#### Introduction to PWM (Pulse Width Modulation)

PWM or Pulse Width Modulation is the microcontroller's way of creating variable voltages. Since the microcontroller can only create voltages of 0v and the voltage of VCC which could be 5v, 3.3v, 1.8v, etc. there is a need to be able to create voltages between this 0v and VCC to control devices that required these variable voltages.

Some of the uses are:
- Sound output
- Motor control
- LED Dimming

The components to PWM is the Pulse, the Period and the Duty Cycle.

The pulse is where the voltage reaches 5v and maintains this 5v within the set period.

The period is the time frame that there is an idle voltage 0v, and a pulse. The period is set to the specifications of the desired resolution.

The duty cycle is the percentage of the width of the pulse in relation to the period.

There is standard PWM where the pulse falls at one side of the period, and there is phase correct PWM where the pulse falls at the midpoint of the period.

#### Controlling Motor Speed with a Potentiometer

Using a potentiometer, the speed of a motor can be controlled. The potentiometer is connected in a way that it functions as a voltage divider. The motor is connected to the potentiometer's middle lead and GND and the potentiometer is connected to the battery using its outer leads.

#### 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.

#### On Paper: How to Output a PWM (Pulse Width Modulation) Signal on Any Pin of the Microcontroller

In this case, a Hitec hobby servo is controlled using the PWM signal, but any device could be controlled using this method with a change to the ICR value to conform to the device's PWM frequency requirement. The 19,999 (20,000 indexed from 0) is used because this translates to a 50 Hz frequency, or 20 ms period that the Hitec servo requires.

The TCNT1 will be used to bring the pin low within the period for the specific pin. The TCNT1 is a timer/counter that holds the value of the clock.

#### Programming: Fast PWM (Pulse Width Modulation) with Interrupts and No Prescaling

The interrupts library must be included. The OCIE1A (Output Compare Interrupt Enable) is set in the TIMSK1 (Timer mask) register to enable the interrupts for the timer/counter when the ICR (Input Capture Register) is reached. The Global Interrupt is used sei();. When the ICR value is reached, the ISR (Interrupt Service Routine) for the TIMER1_COMPA_vect is called.

#### Programming: Setting Up the LCD and Interrupts for the ADC and Sending a String to the LCD

The LCD library and initialization is established. The interrupts for the ADC is started and a string is sent to the LCD. This is to get ready for the pressure sensor program. A string is sent to the LCD to create a label called Pressure.

#### Programming: ADC (Analog to Digital Conversion) Setting up the Prescaler so the ADC Falls Between 50 and 200 KHz

The ADC clock must be between 50 KHz and 200 KHz to do the conversions. The ADC clock ticks with the microcontroller clock and a prescaler can be applied to the ADC clock so that the frequency is slower and in the range of 50 KHz and 200 KHz.

A prescaler of 16 will do the job for this microcontroller running at 1 MHzsince:

1,000,000 Hz / 16 = 62,500 Hz = 62.5 KHz.

The ADPS2 (ADC Pre Scaler) bit must be enabled in the ADCSRA (ADC Status and Control Register) to do this. There are three of these bits ADPS0 and ADPS1, but these are left at 0.

#### 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.

#### Programming: Controlling a Pin Using an ADC Value

The LED is connected to pin 0 on PORTD which is controlled by values from the ADC. The LED is actually representing a vacuum pump, so when the pressure sensor that is connected to the ADC passes a high threshold that will turn off the motor (pin to low) and if the ADC passes a low threshold, the motor will turn on (pin high). This will keep a vacuum in the tank between these two thresholds.

#### Result: Controlling a Pin Using an ADC Value

The LED is connected to pin 0 on PORTD which is controlled by values from the ADC. The LED is actually representing a vacuum pump, so when the pressure sensor that is connected to the ADC passes a high threshold that will turn off the motor (pin to low) and if the ADC passes a low threshold, the motor will turn on (pin high). This will keep a vacuum in the tank between these two thresholds.

#### 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.

#### Description of a Transistor and Schematic Symbol

A transistor is a device that can allow a high current to pass with a small current signal. A transistor can work two ways, either as an amplifier, or a switch. In this case, it will be used as a switch to apply current to a relay.

The transistor has three leads. The lead that serves as an input of a small current is called the base lead. When the base lead gets a small current, current can pass through the collector and emitter leads.

#### Understanding UART Serial Communication

With UART (Universal Asynchronous Receiver/Transmitter) and USART (Universal Synchronous Asynchronous Receiver/Transmitter), microcontroller communicate using two data lines called RX and TX. Rx is used for listening (receiving) to other sources like other chips or computers, and TX is used for talking (transmitting).

The speed that the two devices are communicating must be the same in asynchronous mode since there is no clock line connected between them. If each device has a different speed (baud rate), then the two would not be able to communicate.

In synchronous mode, the two devices are connected together by a wire that has a clock tick on it. One of the devices produces this clock on the clock line and the other device conforms to this clock frequency.

Two way communication can actually happen one wire and this mode is called half duplex. The transmission takes turns with the receiving. Full duplex is where the communication happens on two lines and the communication can happen simultaneously.

The communication that is sent from one device to another is sent as a data frame. The data frame consists of a start bit, data bits (i.e. 8-bit number), and one or two stop bits. The data frame may or may not include a parity bit.

The parity bit is a way for the microcontroller to determine if the data is valid or not. If something happened to the data on the way to the receiving end, the parity bit will give a clue to this error.

#### Description of the Dynamixel Servo Communication (AX-12, AX-18, etc.)

The Dynamixel line of servos are digital servos that use the UART form of communication. The mode of communication is Half Duplex and Asynchronous sinc ethe full communication happens only on one line.

There can be as many as 256 servos on the communication line. Each servo has a unique ID, so when there is a transmission, the data that is sent must contain the ID of the servo that is to be controlled.

#### On Paper: Discusson on UART One Way Communication

The transmitting microcontroller will output the communication from its TX transmitter pin to the RX pin of the receiving microcontroller. A wire will be connected from the TX of the transmitting microcontroller to the RX of the receiving microcontroller.

A button on the transmitting microcontroller will initiate the transmission through the TX pin. The LED on the transmitting microcontroller will serve as an indicator that the push button is working. An LED on the receiver microcontroller will serve as an indication of a successful communication.

#### 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

#### Programming: Setting up an LED for PORTB Pin 1

First the data direction register for port b (DDRB) and pin 0 must be set for output since the LED is be controlled.

The high or low state of that pin is already at a low state (by default) and that is how it need to be at the initialization.

#### Programming: Enabling the Receive and Transmit for UART/USART

The the TX and RX pins will be used for communication and not for the general purpose I/O that exists at those pins, then the TX and RX need to be enabled.

#### Result: Using UART/USART One Way Communication

This is the result of the one way communication of one microcontroller transmitting through its TX pin and another microcontroller receiving through the RX pin. A push button switch is connected to the transmitting microcontroller to initiate the transmit. Both microcontrollers have an LED to show the successful push button switch press and the show a successful transmission on the other microcontroller.

The horn mount is removed by a center screw and the mount is pryed off of the servo. The case is disassembled with 4 long screws at each corner. The top cover is removed exposing the gears. The bottom cover is removed.

The gears are removed and the bushings are removed from the larger gear.

#### Dissassembling the AX-12A Digital Servo by Dynamixel

The horn mount is removed by a center screw and the mount is pried off of the servo. The case is disassembled with 4 long screws at each corner. The top cover is removed exposing the gears. The bottom cover is removed.

The gears are removed and the bushings are removed from the larger gear.

#### Assembling the gears for the AX-12A Digital Servo by Dynamixel

Bushing are slid onto each side of the large gear. The large gear is installed on the servo. Grease is applied to the medium compound gear and installed on the pin as shown where the smaller pinion is mated with the large gear. The metallic gear can be used in place of this gear. The remaining gears are installed to complete the gear assembly using grease. The gears are spun to insure correct assembly.

The top cover and bottom cover is installed using 4 long screws. Finally, the horn mount is installed using a single screw that is fastened to the center of the mount.

#### Only one interrupt can be handled at a time

There is only enough memory to handle a single interrupts. If there is a desire to handle two interrupts, only one of them will fire is the current interrupt is not completed.

#### Machine Learning Defined

Authors definition: Machine learning is a sub field of statistics and artificial intelligence.

Designing algorithms for inferring what is unknowns from known. with regard to the sub field of statistics, machine learning focuses more on algorithms rather than the theory and obtaining analytical forms that can be applied.

You are given some data or examples and machine learning tries to infer an answer with the knowledge of the data present.

#### 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.

#### Unreal Engine 4 (UE4) How to make proximity switch (Overlap in a volume) Toggle a light on

An attribute can be toggled or affected using the begin overlap event.

This example: toggle or turn a light on when in proximity to the light.

#### Unreal Engine 4 (UE4) How to create an input (keyboard, mouse, finger touch) event on the level blueprint

Click the icon at the top of the level editor called blueprints and click on open level blueprints.

Right click on the event graph and click on inputs and then on whatever input you would like to use. For example, click on key event and find the keyboard key to use for the input.

#### Unreal Engine 4 (UE4) How to create a custom event in a class blueprint (An event to be used or fired by the level blueprint)

Open or create a class blueprint. In the event graph of the blueprint, right click on the graph and type event. Click on custom event...

This will be the entry into the blueprint when it gets called.

In this case, the instructor is creating a moveby event and the input is added by clicking on new in the details tab and inputs section. The input can be specified as any type.

#### Unreal Engine 4 (UE4) How to call a class blueprint from a level blueprint

The class blueprint that will be called should be put into the level and selected. Open the level blueprint.

Right click on the events graph of the level blueprint and select the custom event that was created in the class blueprint. the nodes will appear automatically and all that is left to do is populate properties that are required by the class blueprint.