Lab 1 - Microcontrollers Complete the program template below being sure to select the correct parameters to meet the requirements (see the Microcontroller.

Slides:



Advertisements
Similar presentations
Button Input: On/off state change Living with the Lab Gerald Recktenwald Portland State University
Advertisements

10 Ways to Ruin Your Mini-Max microcontroller (and lose $69)
Encoders, Motors, Power, Mini Project #1 10/24/2014.
Basic DC Motor Circuits
PHY 235 Robotics Workshop Day 6 DC Motors, H-Bridge Board, Simple Lego/Boe Bot.
Programming Microcontrollers B. Furman 19MAR2011.
ELECTRICAL. Circuits Outline Power Hub Microcontroller Sensor Inputs Motor Driver.
Motor Control Lab Using Altera Nano FPGA
1 Lab2: A/D Converter. 2 This circuit connects a variable voltage to an A/D port on the AVR mcu. Your software running on the AVR mcu will read the digital.
Coordinate Based Tracking System
AVR Programming CS-212 Dick Steflik. ATmega328P I/O for our labs To get data into and out of our Arduino its a little trickier than using printf and.
Arduino. Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source.
Using Your Arduino, Breadboard and Multimeter Work in teams of two! living with the lab 1 © 2012 David Hall.
 Main Components:  Sensors  Micro controller  Motor drivers  Chasis.
The Use of Microcontrollers
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Arduino John Marcoux Christopher Lesch Thomas Dodge Unless otherwise noted, all information and pictures came from:
Embedded Programming and Robotics Lesson 5 Motor Control 1.
16-Bit Timer/Counter 1 and 3 Counter/Timer 1,3 (TCNT1, TCNT3) are identical in function. Three separate comparison registers exist. Thus, three separate.
Embedded Systems Programming 1 ETEE 3285 Topic HW3: Coding, Compiling, Simulating.
Objectives How Microcontroller works
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009.
1 Applied Control Systems Technology. 2 Pin configuration Applied Control Systems.
Segway Controller Notes. = connection on top layer of circuit board = connection on bottom layer of circuit board Ground Plane: Areas enclosed by the.
Intro to Arduino Programming. Draw your circuits before you build them From Arduino 330 Ohm From Arduino 330 Ohm From Arduino 330 Ohm.
The SFA Rover Team Project. The SFA Rover  Must be demonstrated at the beginning of the last lab of the semester, Dec 11 th.  Teams can work on this.
INTERFACING WEB SERVER WITH A ROBOT
Robotics Research Laboratory Louisiana State University.
Advanced uC Session Speaker : Chiraag Juvekar Jan 13, 2011 Speaker : Chiraag Juvekar Jan 13, 2011.
Default_Routine(); - PWM Mapping /******************************************************************** * FUNCTION NAME: Default_Routine * PURPOSE: Performs.
Counter/Timer/PWM. incoming Lab. Counter counter is a device which stores the number of times a particular event or process has occurred synchronous/asynchronous.
Motors & Motor Drivers ECE 450.
AVR Programming: Digital I/O September 10, What is Digital I/O? Digital – A 1 or 0 Input – Data (a voltage) that the microcontroller is reading.
PRIYADARSHINI SHRAVYA KAVYAA MOBILE CONTROLLED ROBOT USING DTMF ALLPPT.com _ Free PowerPoint Templates, Diagrams and Charts.
How an NPN Transistor Works
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
Warmup – 16FEB2012 This one is for practice. I have paper if you need it. Suppose there are eight, single-pole, single-throw (SPST) switches connected.
Robotics Research Laboratory Louisiana State University.
Low Power FM Receiver Andrew Young November 17, 2008.
Timers and Scheduled Interrupts
Handling multiple input signals Version #2 – co-operative scheduler Version #3 – pre-emptive scheduler.
Arduino Mega Arduino Mega 2560 Arduino Mega 2560.
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Motor TYWu.
Microcontroller basics Embedded systems for mortals.
Casne.ncl.ac.uk Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the.
Microcontroller basics Embedded systems for mortals.
Arduino DC Motor Motion Control Instructor: Dr Matthew Khin Yi Kyaw.
Atmega328p Introduction for Digital and PWM Output Brion L Fuller II Robotics Club.
ISA CLICK CONTROL #38 – FALL 2014 ERIC BRUNNGRABER DRAKE ISABIRYE.
Pulse-Width Modulation: Simulating variable DC output
Microcontroller basics Embedded systems for mortals.
Motors & Motor Controllers
Application Case Study Christmas Lights Controller
Timers and Scheduled Interrupts
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION
Outline Introduction to Arduino UNO Programming environment setup GPIO
If you want to swing an robot arm or …
Microcontroller basics
UCD ElecSoc Robotics Club 2017/2018
Programming Boe-Bots (Part 1)
How to avoid catching things on fire.
Electronic Education Kits
Introduction to H-Bridge
CS-4540 Robotics - Lab 05 Switch inputs to the Arduino Uno
Wave Generation and Input Capturing
Interrupts.
Buttons.
2019 Investing Now Summer Program
Presentation transcript:

Lab 1 - Microcontrollers Complete the program template below being sure to select the correct parameters to meet the requirements (see the Microcontroller slides). Show either to TA or myself your completed code when entering the lab. Test the code using the simulation capability of AVR Studio. Demonstrate this simulation to either the TA or myself and be ready to explain what is happening when the blocks change color. Construct the circuit shown below being careful to separate the 9V and 5V lines. Build your circuit with the idea of limiting noise. (i.e., be careful where you place your components, use short leads, and avoid ground loops). Your layout should be easy to compare to the schematic. When you push and release the button switch, the motor will toggle between full speed forward and full speed reverse in half steps. Demonstrate your robot to either the TA or myself. Lab Report –Show using the schematic on the page titled “ATmega168 & SN754410” how you would connect a second motor being sure to show the connections between the motor, H-bridge and microcontroller. –This lab uses a single chip to operate the motors. This is also one of the most expensive chip in your packet! Look on-line and determine the highest current available to a motor that can be drawn from a single-chip H-Bridge. Provide its manufacturer, part number, cost, Voltage range, max current, and URL of the datasheet. –Explain what a ground loop is and how you can limit its effect.

Voltage Regulator 5V for microcontroller circuit Note: The capacitor values in your kits may be different. Place your capacitors in the optimum positions Unregulated input Ground Regulated Output To Robot Circuits +5 VDC C1 100  F C2 0.1  F + D1 1N5817 (Schottky) From 9V battery Or battery pack +7 VDC to +20 VDC

ATmega168 & SN Microcontroller Connections for H-Bridge Driver

Suggested Breadboard Layout VR H-Bridge LCD HBeat Button

Code for Microcontroller Lab Add motor routine #define LEFT_MOTOR 1 void motor( int mtr, int speed) { static int fwd; static int rev; if (speed > 0) { fwd = speed; rev = 0; } else if (speed<0) { fwd = 0; rev = -speed; } else {fwd = 0; rev = 0; } if (mtr == LEFT_MOTOR) {OCR?A = fwd; OCR?B = rev; }

Add interrupt routine ISR( External Interrupt Vector ?) {static int dutycycle = 0; unsigned char x; x = PINB & 0b ; //Note the use of the mask. What values can x have? if (x==0) // What position is the button in to get x = 0? { dutycycle += 1; if (dutycycle > 7) dutycycle = 0; switch (dutycycle) { case 0: motor(LEFT_MOTOR, ? );//Off break; case 1: motor(LEFT_MOTOR, ? );//50% Forward break; case 2: motor(LEFT_MOTOR, ? );//100% Forward break; case 3: motor(LEFT_MOTOR, ? );//50% Forward break; case 4: motor(LEFT_MOTOR, ? );//Off break; case 5: motor(LEFT_MOTOR, ? );//50% Reverse break; case 6: motor(LEFT_MOTOR, ? );//100% Reverse break; case 7: motor(LEFT_MOTOR, ? );//50% Reverse break; } printf(“DC: %d \n”, dutycycle); // Note the use of \n }

Code for Microcontroller Lab Add to main routine int main (void) { … /* Left Motor */ //Setup the PWM on pin 17 (PB3) TCCR?A = ? ; // Setup for 0 Volts when counter is low; Phase Correct PWM TCCR?B = ? ; // Use an 8-bit prescaler OCR?A = ?; // Initialize motor so that it is off DDRB = ? ; // Don’t forget to set this pin as an output //Setup the PWM on pin 5 (PD3) TCCR?A = ? ; // Setup for 0 Volts when counter is low; Phase Correct PWM OCR?B = ? ; // Initialize motor so that it is off DDRD |=? ; // Don’t forget to set this pin as an output … }