Robotics Research Laboratory Louisiana State University.

Slides:



Advertisements
Similar presentations
Jordan Barry Victor Brzeski
Advertisements

Review: Interrupts & Timers
Mark Neil - Microprocessor Course 1 Device Drivers – Digital Voltmeter.
Data Acquisition ET 228 Chapter
ECE 265 – LECTURE 14 Analog Signal Acquisition The A/D converters 5/14/ ECE265.
Analog/Digital Subsystem
Analog Comparator Positive input chooses bet. PB2 and Bandgap Reference. Negative input chooses bet. PB3 and the 8 inputs of the A/D. ACME= Analog Comparator.
Robotics Research Laboratory Louisiana State University.
Spring EE 316 Computer Engineering Junior Lab Serial Ports.
Technion-Israel Institute of Technology Electrical Engineering Department High Speed Digital Systems Laboratory Project subject: wireless biofeedback system.
Railway Foundation Electronic, Electrical and Processor Engineering.
Railway Foundation Electronic, Electrical and Processor Engineering.
Digital I/O Connecting to the Outside World
ECE 371- Unit 11 Introduction to Serial I/O. TWO MAJOR CLASSES OF SERIAL DATA INTERFACES ASYNCHRONOUS SERIAL I/O - USES “FRAMING BITS” (START BIT AND.
Robotics Research Laboratory Louisiana State University.
Arduino Josh Villbrandt February 4, Digital Circuits Analog versus digital – What’s the difference? – How to represent an analog signal in a computer?
Digilent System Board Capabilities Serial Port (RS-232) Parallel Port 1 Pushbutton Hint: Good for a reset button Connected to a clock input. See Digilent.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering 1 Hsu/Youssefi.
Architectures and Applications for Wireless Sensor Networks ( ) Sensor Node Programming II (UART and Radio) Chaiporn Jaikaeo
Embedded System Design Laboratory October 11, 2002Stanford University - EE281 Lecture #4#1 Lecture #4 Outline Announcements Project Proposal AVR Processor.
ELE2MIC Lecture 21 The AVR Sleep Modes ATMEGA128’s Analog to Digital Converter –Features –Block Diagram –Clock Source –Input Sources –Interrupts –BandGap.
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.
RS232 #use rs232(baud=9600,xmit=PIN_C6,rcv=PIN_C7
INTERFACING WEB SERVER WITH A ROBOT
Robotics Research Laboratory Louisiana State University.
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
Robotics Research Laboratory Louisiana State University.
Universal Asynchronous Receiver/Transmitter (UART)
Suleyman Demirel University CSS340 Microprocessor Systems – Lecture 2 ATMEGA328P ARCHITECTURE ANALOG INPUTS.
Getting Started With the Arduino Uno
ARDUINO 1. Basics  Comments  /* * Blink * * The basic Arduino example. Turns on an LED on for one second, * then off for one second, and so on... We.
Analog to Digital Converter (ADC). Analog to Digital Converters  Microcontroller understands only digital language.  To convert the analog output from.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Computer Science Summer term 2012 Final Project Team 2.
Analog to Digital Converter (ADC)
Rebecca Bruce and Susan Reiser, May 2015 Analog Input and Output.
Analog to Digital Conversion - ADC Mark Neil - Microprocessor Course 1 Device Drivers – Measuring Voltages.
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.
CE-2810 Dr. Mark L. Hornick 1 Serial Communications Sending and receiving data between devices.
Mechatronics Hydrophobe Josh Pritts – Vice President / EE Team Leader.
Microcontroller basics Embedded systems for mortals.
Microcontroller basics Embedded systems for mortals.
Sensing Algorithm using IR Sensor and ADC Soong-sil University. Robotics 기 정 두 원.
1 Lab 4: D/A Converter Lab 4: D/A Converter This is a simple resistive network for a D/A converter Port 1, Port 0 are digital inputs ==> 00 (minimum),
WEATHER MONITORING SYSTEM. User Requirements  Design a weather monitoring system that detects the following parameters  Temperature  Pressure  Relative.
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
Arduino.
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Assist. Prof. Rassim Suliyev - SDU 2017
Application Case Study Security Camera Controller
Environment Temperature Monitor
Analog Comparator An analog comparator is available on pins PE2(AIN0), PE3(AIN1) The comparator operates like any other comparator. -when (+) exceeds (-)
For further information
ADC,DAC and sensor interface
SERIAL PORT PROGRAMMING
Arduino - Introduction
Serial Communication: RS-232 (IEEE Standard)
Atmega32 Serial Programming Basics
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
How to avoid catching things on fire.
The Arduino Microcontroller: Atmel AVR Atmega 328
Asynchronous Serial Communications
PIC18F458 Analog-to-Digital
ADC and DAC Programming in AVR
ADC and DAC Data Converter
Device Drivers – Digital Voltmeter
Introduction to Arduino
ADC and DAC Data Converter
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Presentation transcript:

Robotics Research Laboratory Louisiana State University

 Analog to Digital (ADC, A/D or A to D) ◦ Converting an analog voltage to a digital value that can be used by a microcontroller. ◦ There are many sources of analog signals to be measured such as light intensity, temperature, distance, position, etc.  ATMega128 ADC has 10 bits resolution (0~1024) ◦ Has 8 channels through a multiplexer ◦ 8 pins on PORTF ◦ Need to set PORTF as input without pull-up ◦ Has own power supply (labeled AVCC) ◦ Allows measuring voltages from 0 to 5 volts with a resolution of 5/1024 volts, or 4.88 mV

S1 = 0 ~ Ω R2 = 1000 Ω V X V drop = Xi mA x S1 Ω X v+ restV drop = Xi mA x 1000Ω 0V drop = Xi mA x 0 Ω 5 V Connect to ADC 0 V Resistance value of S1(IR sensor) can be changed by sensing

uint16_t a2d_10( uint8_t Channel ){ // Select the channel in a manner which leaves REFS0 and REFS1 un touched. ADMUX = ( ADMUX & (( 1 << REFS1 ) | ( 1 << REFS0 ))) | Channel; // Start the conversion ADCSR = ADCSR | ( 1 << ADSC ); // Wait for it to complete while ( ADCSR & ( 1 << ADSC )); return ADC; // ADC defined at avr/iom128.h ( special function register: SFR_IO16) } // a2d_10 /home/csc2700/csc2700/40-ADC-01

 Translates data between parallel and serial forms  UARTs are commonly used in conjunction with communication standards ◦ ex) EIA RS-232, RS-422 or RS-485  Character framing ◦ Start bit: logic low ◦ Stop bit : logic high ( 1 or 2 bits) ◦ Parity bit : optional (even or odd)  Important Setting for Serial UART : ◦ Baud Speed, Flow control, Port

 Minimum required connection ◦ RX(yellow),TX(green), and Ground(black)  Our programmer has 2 serial port ◦ ttyACM0 : ISP programming port ◦ ttyACM1 : UART serial port  Wire connection ◦ PE0  Yellow wire ◦ PE1  Green wire ◦ GND  Black wire  Open Gtk-term ◦ Set port : /dev/ttyACM1 ◦ Speed: for ttyACM for Bluetooth connection

 Config.h ◦ Set : #define CFG_USE_UART0 1  Hardware.h ◦ Set : #define UART0_BAUD_RATE57600  ADC_test.c ◦ Add : #include "UART.h” ◦ Create file pointer : FILE *u0;// for UART0 ◦ Open u0  if defined( __AVR_LIBC_VERSION__ )  u0 = fdevopen( UART0_PutCharStdio, UART0_GetCharStdio );  #else  u0 = fdevopen( UART0_PutCharStdio, UART0_GetCharStdio, 0 );  #endif ◦ Send values using fprintf(u0,”your message %d”, variable) ; /home/csc2700/csc2700/40-ADC-02

 Check the UART buffer first ◦ int UART0_IsCharAvailable()  Read a character from UART buffer ◦ int UART0_GetChar() int counter; char tmpChar; While(1){ if ( UART0_IsCharAvailable() ) { tmpChar = UART0_GetChar(); if ( tmpChar == ‘s'){ // start moving }else if ( tmpChar == ‘c'){ // clear counter }else if ( tmpChar == ‘r’){// report counter number }

 Make a led0 on when ‘0’ message is received from UART  Make a led0 off when button0 is pressed  Make a led1 on when ‘1’ message is received from UART  Make a led1 off when button1 is pressed  Send “!!!good bye!!!” message to UART tx when “bye” message is received from UART rx

 Make a led0 ON and a motor clockwise spin when ‘4’ message is received from UART  Make a led1 ON and a motor anti-clockwise spin when ‘6’ message is received from UART  Make a led2 ON and speed of the motor increase when ‘8’ message is received from UART  Make a led3 ON and speed of the motor decrease when ‘2’ message is received from UART