Embedded systems and programming (including my work at Eyantra (IIT Bombay))

28
A Seminar on Embedded Systems in Robotics (An initiative of Electronics Hobby Club) by Akash Deep Singh B.E 7 th Semester (Power Electronics & Instrumentation) Jorhat Institute of Science & Technology Forward biased

Transcript of Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Page 1: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

A Seminar

onEmbedded Systems

inRobotics

(An initiative of Electronics Hobby Club)

byAkash Deep Singh

B.E 7th Semester (Power Electronics & Instrumentation)Jorhat Institute of Science & Technology

Forward biased

Page 2: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

What is a System?

“A system is an arrangement in which all its units assemble and work together according to the plan or program.”

Page 3: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Examples…

It is a time display SYSTEMParts: Hardware, Needles, Battery, Dial, Chassis and Strap

Rules1.All needles move clockwise only2.A thin needle rotates every second3.A long needle rotates every minute 4.A short needle rotates every hour5.All needles return to the original position after 12 hours

WATCH

Page 4: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

It is an automatic clothes washing SYSTEMParts: Status display panel, Switches & Dials, Motor, Power supply & control unit, Inner water level sensor and solenoid valve.

Rules1.Wash by spinning 2.Rinse3.Drying 4.Wash over by blinking 5.Each step display the process stage6.In case interruption, execute only the remaining

Washing Machine

Page 5: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Embedded System

It is a computing based system.Or

“A computer inside a product”

Parts: Input Unit, Microcontroller(or Microprocessors), Application Software, Additional Mechanical Parts, Output Unit

Rule:1. Runs on the specified application software2.Has specific requirements and perform predefined task.

Page 6: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

An Embedded System is one that has computer hardware with software embedded in it as one of its important components.

SOFTWARE PROGRAM#include <16f876a.h>#use delay (clock=20000000)#byte PORTB=6main(){set_tris_b(0);portb=255; //decimaldelay_ms(1000);portb=0x55; //hexadecimaldelay_ms(1000);portb=0b10101010; //binarydelay_ms(500);}

Page 7: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Where do we find such systems???

And many more………….

Page 8: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Why do we require such systems???

Real-time operationsizecosttimereliabilitysafetyenergysecurity

Page 9: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

CENTRE OF STUDY???

Robotics

Definition of Embedded SystemsComputer inside a Robot

Page 10: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

PRODUCT : ROBOT

1. Sensors: In order to sense the environment

2. Actuators : For movement of robots and its parts

3. Control: Controller/Processor as a brain of the robot

4. Intelligence: User written command to perform desired set of action

5. Power: A necessity for making a system work

6. Communication: Robot can talk to another robot/PC

Page 11: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

SensorsIn human analogy: “SENSE ORGANS”

What is a sensor?In common parlance,

“Anything that can sense a change”

In electronics,

A sensor is a device that measures a physical quantity and converts it into a signal which can be read by an observer or by an instrument.

Page 12: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Sensors Employed in Robotics:1. IR Sensors

2. Position encoders

3. Ultrasonic Sensors

4. Accelerometers

5. Gyroscope

6. Infrared TSOP Receiver

7. Motion Sensor

8. GPS

IR sensor works on the principle of emitting IR rays and receiving the reflected ray by a receiver (Photo Diode).IR source (LED) is used in forward bias.IR Receiver (Photodiode) is used in reverse bias.

Sharp IR SensorIR Proximity Sensor White Line Sensor

Page 13: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

ActuatorsIn human analogy: “Response”

Actuators are the final control elements (F.C.E) used in all kinds of control systems.

D.C MotorD.C Geared MotorServo MotorStepper Motor

Page 14: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Control of a Robot The actual manifestation of an embedded

system…

Microprocessor Vs Micro Controller

Page 15: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Microcontrollers manufacturers:

INTEL 8031,8032,8051,8052,8751,8752

PIC 8-bit PIC16, PIC18, 16-bit DSPIC33 / PIC24, PIC16C7x

MotorolaMC68HC11

AtmelAtMEGA 8,16,32,64,128,256 etcAT90S2333

American based industry est.. In the year 1984

Focus on embedded systems build around microcontrollers

ATMEL stands for “Advanced Technology for Memory & Logic

AVR Architecture

Architecture developed by Brogen & Wollan AVR stands for Alf & Vegard’s RISC processor Later developed by ATMEL in the year 1996

Page 16: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Intelligence of the Robot

Embedded C: user code

For the robot:Convert the user code to machine

language called hex file

Page 17: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

PROGRAMMING THE MICROCONTROLLER FOR SPECIFIED TASK

1. What is AVR Atmega 8 microcontroller

2. Basic idea of C programming

3. Use of embedded C to create a small program

4. Run the program on the bot.

1. What are ports?

Junctions where peripherals are connected.This peripherals can be

a. Input unitsb. Output units

2. Ports in Atmega8

Atmega8 is a 28 pin micro.

23 pins can be used as both input and output pins.

PINS are grouped together as PORTS

Page 18: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Atmega8 has Two 8-bit Input/Output Ports

PORTx; ‘x’ is subscript and could be either of B,D Atmega8 has One 6-bit Input/Output port

PORTC All ports can be configured individually as input/ouput

How to access the port?

Each port has three registers associated with it1. DDRx2. PORTx3. PINx

Page 19: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

DDRx Register

1. DDR stands for “Data Direction Register”2. Purpose: To set PORT Pins as input or output

DDRx=0; // PORTx is defined as INPUTDDRx=1; // PORTx is defined as OUTPUT

Example: Let us make PORTB upper nibble as output and lower nibble as input

Hex conversion of first nibble: FHex conversion of second nibble: 0

Page 20: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

PINx Register:

The purpose of this register is to read the value from the input device connected to the PORT.

Or To read data present on PORTx

Example: Read data from PortC (PLEASE NOTE: PORTC HAS BEEN DEFINED AS INPUT PORT)

PINC=0xF0;

Or we can also create a variable such that x=PINCx=0xF0

Page 21: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

PORTx Register This register works in two different ways depending on the way in which the port is defined

Case1: When portx is defined OutputThe purpose will be to output data present on the Portx pin to the output device

Example: Here we define PortB as output by assigning

DDRB=0xFF

Let the data present on the PortB be 0xFF

Therefore we write

Case2: When portx is defined as input , it is used to activate or deactivate the pull-up resistor

Page 22: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

PLEASE NOTE THAT THERE IS NO PORT CALLED A IN ATMEGA8 MICROCONTROLLER

Page 23: Embedded systems and programming (including my work at Eyantra (IIT Bombay))
Page 24: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

AVR Programming Tools Software Required

ATMEL STUDIO 61. Integrated Development Environment (IDE)2. Supports Developing and Debugging of AVR and ARM based

microcontroller applicationWE WILL WRITE THE C PROGRAM AND COMPILE IT IN ATMEL STUDIO TO GENERATE HEX FILE (MACHINE LANGUAGE UNDERSTANDABLE BY THE MICROCONTROLLER)

Hardware Required

HEX FILE CAN BE LOADED INTO THE MICROCONTROLLER USING BOOTLOADER or AVR PROGRAMMERS

Page 25: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Buzzer Beep

Page 26: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

A Glimpse of Eyantra 2012-13

Page 27: Embedded systems and programming (including my work at Eyantra (IIT Bombay))
Page 28: Embedded systems and programming (including my work at Eyantra (IIT Bombay))

Thank you