23
1 Warm Greetings to you Shri Nivas, No. 26, Kasthuri Nagar Ondipudur, Trichy Road, Coimbatore – 641 016 Web: www.stepsknowledge.com email: [email protected] Phone: 0422-2271011 STEPS Knowledge Services Pvt Ltd Business Presence Electronics Design, SPMs, EOL, Test Automation & Product development Training in Electronics ; In-house, Corporates & Academia Process consultancy & Deployment for SMEs Setting up labs for Electronics in Academia STEPS What do we do? Design & development, IPR & Patents, Training in Electronics Core: Embedded systems (H/W & S/W) Authorised training partner for : 3 decades (from 1987) of association with Who are we? 140+ man years Experience Year 1986 onwards – keeping pace with technologies Patents, IPR, Copyrights – International EI International working experience

Warm Greetings to you Business Presence

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Warm Greetings to you Business Presence

1

Warm Greetings to you

Shri Nivas, No. 26,

Kasthuri Nagar

Ondipudur, Trichy Road,

Coimbatore – 641 016

Web: www.stepsknowledge.com

email: [email protected]

Phone: 0422-2271011

STEPS Knowledge Services Pvt Ltd

Business Presence

Electronics Design, SPMs, EOL,

Test Automation &

Product development

Training in Electronics ; In-house,

Corporates &

Academia

Process consultancy

& Deployment

for SMEs

Setting up labs for

Electronics in Academia

STEPS

What do we do?

Design & development, IPR & Patents, Training in Electronics

Core: Embedded systems

(H/W & S/W)

Authorised training

partner for :

3 decades (from 1987) of association with

Who are we?

140+ man years Experience

Year 1986 onwards

– keeping pace with technologies

Patents, IPR,

Copyrights –

International

EI International working experience

Page 2: Warm Greetings to you Business Presence

2

1950s We officially become Texas Instruments Incorporated, entering the semiconductor industry by inventing the silicon transistor in1954. In 1958, TIer Jack Kilby invents the integrated circuit, revolutionizing the semi- conductor industry and paving the way for allmodern electronics. 1960s We develop the first electronic hand-held calculator (Cal Tech) in 1967 while also focusing our efforts ondeveloping faster, smaller and more powerful TI chips. The Apollo Lunar Exploration Module containing TI components lands on the moonduring this decade.

Experiential learning is the process of learning through

experience, and is more specifically defined as

"learning through reflection on doing".

Hands-on learning is a form of experiential learning.

Our Objective - Experiential learning

Page 3: Warm Greetings to you Business Presence

3

https://innovate.mygov.in/iicdc2019/ Texas Instruments Online Contestwww.drishti.online

• TI Certificate

• Prize reward

• E-Learning

• Application based quiz

• Internship

• Free registration

For Students

ROBOTICS

System Design Approach

Page 4: Warm Greetings to you Business Presence

4

Agenda Overview of Robotics

Types of Robots

Modules to built Robot

Microcontroller – MSP432

Working with MSP432

Introduction to Energia

Working with Digital Input /Output

Analog Read and Write

Serial Communication

Working with Bump Switches

Interfacing of bump switches and writing codes todetect bump switch activation

Working with QTR 8 SensorsInterfacing QTR 8 Reflectance sensors to detect white

and black colour.

Working with DC motorsIntroduction to H Bridge to operate a DC motor. Running

the DC motor in various directions like forward , reverse

, left and right. Controlling the speed of motors.

Line Follower ApplicationMaking a robot to follow black line on the surface.

Cloud control Robot

Swarm Robots

Phototrophic / Photophobic Robot

Robot ?

• An electromechanical device which is capable of reacting in some way to its environment, and take autonomous decisions or actions in order to achieve a specific task.

what your robot should do ?

• Land wheeled, tracked, and legged robots

• Aerial planes, helicopters, and blimp

• Aquatic boats, submarines, and swimming robots

• Misc. and mixed robots

• Stationary robot arms, and manipulators

Types of Robots

Wheeled Robots Tracked Robots Legs

Air

Land

Water Hybrid Stationary robot arms

Page 5: Warm Greetings to you Business Presence

5

Modules

• Actuators

• Microcontroller

• Motor Controller

• Interface

• Sensors

• Programming

• Energy

Actuators

• Rotational Actuators– AC Motor

– DC Motors

– Geared DC Motors

– Servo Motors

– Stepper Motors

• Linear Actuators– DC Linear Actuator

– Solenoids

– Pneumatic and hydraulic actuators

Actuators - Purpose

• Used to move a wheeled robot?

• Motor being used to lift or turn a heavy weight?

• Range of motion limited to 180 degrees?

• Angle need to be very precise?

• Motion in a straight line?

Microcontroller

Page 6: Warm Greetings to you Business Presence

6

MSP FamilyDifferentiation

MSP432Temperature 85°C

Up to 256 KB Flash

Up to 64 KB SRAM

Bootstrap Loader

4× I2C or SPI

Real-time JTAG

4× UART or SPI

4× 16-bit Timer/PWM/CCP

2× 32-bit GP Timers

Watchdog Timer

24ch, 14-bit 1 MSPS SAR ADC

Voltage Reference

2× Analog Comparators

Capacitive Touch I/O

Real-Time Clock

DMA (8 ch)

AES-256

CRC32

Temperature Sensor

AnalogComms PeripheralsSecurity

Systick Timer

Driver Libraries

Debug

System Modules

Memory

Programmable DCO

Low-Power OSC

NVIC SWD

ARM®

Cortex™-M4F48 MHz

WIC ITM

FPU MPU

Power & Clocking

• Ultra-low standby and active power, and fast wakeup ─ 95uA/MHz active, 850nA Standby; Deep sleep to Active: <10us typ

• Wide supply range ─ 1.62-3.7V, including flash operation, enabling multiple battery technologies and eliminating external regulation

• Integrated high-performance and low-power analog ─ Including 1MSPS 14-bit ADC

• Secure MCU environment – Flash IP protection & integrated AES-256 encryption

• Simplified portability from MSP430 - Leverage software & know-how from existing MSP430 designs

Using 430 Peripherals, Analog & Low Power Modes

32KB ROM

1.62V – 3.7V Operation

Same as MSP430

MSP Platform Portability

MSP

430

MSP

432

MSP430 Modules

MSP 16-bit core

430

MSPWare

Register-Level

DriverLibrary

430

MSP Debugger

LaunchPad

BoosterPacks

Target Board

BSL

ULP Tools: ULP Advisor & EnergyTrace

IAR IDE

Energia

CCS IDE

GCC

CMSIS

ARM Modules

New MSP432 Modules

ARM M4F 32-bit core

432

ARM

432

ARM Keil

ULP Tools: ULP Advisor & EnergyTrace+

Intrinsics & InterruptsNew for MSP432

Same as MSP430

Slight modifications from MSP430

430 430

MSPWare

Register-Level

DriverLibrary

Libraries

Libraries

Intrinsics & Interrupts

RTOSs

Hardware Software Development Tools Development Kits Introducing the MSP432 LaunchPad

Develop high performance applications that benefit

from low power operation

Features• Low-power, high performance MSP432P401R

MCU• 40 pin BoosterPack Connector, and support

for 20 pin BoosterPacks• Onboard XDS-110ET emulator featuring

EnergyTrace+ Technology • 2 buttons and 2 LEDs for User Interaction• Back-channel UART via USB to PC

Kit Includes• Development board with demo application• USB cable• Quick start guide

Page 7: Warm Greetings to you Business Presence

7

Low power operationLower power consumption

MSP432 LaunchPad

What is LaunchPad?

• LaunchPad is an easy-to-use development tool intended forbeginners and experienced users alike for creatingmicrocontroller-based applications

Why MSP432 LaunchPad?• Easy to Use• Great general purpose LaunchPad• Low power operation is great for

battery-operated applications

MSP432 ARCHITECTURE

Hands-On with MSP432 Launchpad

Page 8: Warm Greetings to you Business Presence

8

MSP432 Architecture MSP432 | 32-bit Cortex-M4F

• 32-bit pipeline architecture

• Cortex-M4 with DSP extension

instruction set

• Floating Point Unit

• Standard Cortex-M Debugger

Module, Serial Wire Debug,

ITM Trace support

• Core modules including DMA,

SysTick, & Interrupt (NVIC)

Cortex-M | Core Comparison

Cortex-M Thumb Thumb-2 HW MPYHWDIV

Saturatedmath

DSP-extensions

FPUARM

architecture

Cortex-M0 Most Subset1 or 32 cycle

No No No NoARMv6-M

Von Neumann

Cortex-M0+ Most Subset1 or 32 cycle

No No No NoARMv6-M

Von Neumann

Cortex-M1 Most Subset3 or 33 cycle

No No No NoARMv6-M

Von Neumann

Cortex-M3 Entire Entire 1 cycle2-12

cyclesYes No No

ARMv7-MHarvard

Cortex-M4 Entire Entire 1 cycle2-12

cyclesYes Yes

OptionalYes for

MSP432

ARMv7E-MHarvard

MSP 432 CLOCK MODULE

Hands-On with MSP 432 Launchpad

Page 9: Warm Greetings to you Business Presence

9

• Flexible clock sources & distribution:

– 5 clocks from 7 sources (2 external, 5 internal)

– Selections suitable for high-speed & low-power operations

• Wide range of operating frequency

– 10kHz to 48 MHz

– Fine intermediate steps with dividers & tuning

• Configurable & robust system:

– Run-time lockable configuration

– Failsafe mechanism with interrupts for external sources

Clock system HF & LF Oscillators

Frequency Oscillators MCLK SMCLK HSMCLK ACLK BCLK Comments

HF

1-48 MHz

DCO✔ ✔ ✔

Internal integrated digitally controlled oscillator.

1-48 MHz

HFXT

✔ ✔ ✔

High frequency crystal. Frequency range is SW configurable.

24MHz MODOSC✔ ✔ ✔

Internal osc. option for peripherals such as ADC

5MHz SYSOSC Internal, direct clock for ADC failsafe for HFXT

LF

32kHz LFXT✔ ✔ ✔ ✔ ✔

Low-frequency oscillator

32kHz128kHz

REFO

✔ ✔ ✔ ✔ ✔

Internal low-frequency oscillator.Failsafe* (32kHz) for LFXT

10kHz VLO✔ ✔ ✔ ✔

Internal ULP LF oscillatorClock selection for WDT

High-accuracy tune-able DCO• 6 tune-able frequency ranges

– Each range has calibrated center frequency

– Example: [8-16MHz] range has a calibrated 12MHz center frequency

• Tune-able within each frequency range

– Center Frequency +/- 212 steps DCOTUNE register

• DCO accuracy:

– Internal resistor: + 2.65 % [Calibrated]

– External resistor : + 0.4 % [91kΩ + 0.1% ]

• Failsafe for internal resistor mode

3MHz 48MHz24MHz12MHz6MHz1.5

Calibrated Center Frequency

Frequency Range

8MHz 16MHz4MHz

MSP 432 Memory Mapping

Hands-On with MSP 432 Launchpad

Page 10: Warm Greetings to you Business Presence

10

Memory | Overview

Memory Size Speed Features

Flash 256kB + 4kBSector: 4kB

16MHz Speed boost with 128-bit buffer & pre-fetch

Powerful security features

SRAM 64kBBank: 8kB

48MHz Dynamic bank power-down & retention options for low power

ROM 32kB 48MHz Robust DriverLib APIs integrated to save application space

Lower power execution

BSL 8kB 16MHz UART/I2C/SPI Boot-Strap Loader provided

• Independent banks simultaneous read/execute and program/erase operations

• 128-bit buffer Power savings & higher effective speed with ARM’s pre-fetch

• Hardware assisted operations

– Burst data comparison for fixed patterns (data fill check)

– Flash program modes with auto-computed parity & auto-verify:

– Write immediate, 128-bit full word write, or 4*128-bit burst mode

}128kB

Bank 1

Bank 2

4kB 4kB

4kB

25

6kB

Individually [un-]protectedfrom write/erase

INFO 4kB

Memory | Flash

> 105 erase cycles

Memory | RAM• Up to 64KB of banked SRAM architecture

• 8 dynamically configurable banks:

– Enable/disable banks to optimize active mode power consumption

– Retain/not retain content in LPM3 to minimize SRAM leakage power consumption

SRAM banks Memory size

Bank 0 enable/retention (always enabled) 8KB

Bank 1 enable/retention 16KB

Bank 2 enable/retention 24KB

. . . …

Bank 6 enable/retention 56KB

Bank 7 enable/retention 64KB

0x00000000 Flash

0x01000000 ROM

0x20000000 SRAM

0x22000000 Bit-banded SRAM

0x40000000 Peripherals (Registers)

0x42000000 Bit-banded Peripherals

0xE0000000 Instrumentation, ETM, etc.

256kB + 4kB- Interrupt Vector Table- Application Code

Peripheral Driver Library

Ultra-low-leakage SRAM- 64kB = 8 x 8kB banks- Bit-banded

Bit-Band

Bit-Band

Peripheral Space - Register directly

accessible- Bit-banded

Memory mapping

Page 11: Warm Greetings to you Business Presence

11

Motor Controller• Brushed DC motor controllers:

– used with brushed DC, DC gear motors, and many linear actuators.

• Brushless DC motor controllers:

– used with brushless DC motors.

• Servo Motor Controllers:

– used for hobby servo motors

• Stepper Motor Controllers:

– used with unipolar or bipolar stepper motors depending on their kind.

Interface to Robot

• Wired Control

• Wired Computer Control

• Ethernet

• Wireless - Infrared

• Wireless - Radio Frequency (RF)

• Wireless - Bluetooth

• Wireless - WiFi

• Wireless - GPRS / Cellular

• Autonomous

Sensors• Contact

– Push button / Contact switch

– Pressure sensor

• Distance– Ultrasonic Range Finders

– Infrared

– Laser

– Encoders

– Linear Potentiometer

• Positioning

– Indoor Localization

– GPS

• Rotation

• Environmental Conditions

Programming - MSP432 IDEs

• Texas Instruments

– Code Composer Studio(CCS)

– Energia: Open source

• Third party software

– MSPGCC (open-source comunity)

– IAR Embedded WorkBench Edition (IAR Systems)

Page 12: Warm Greetings to you Business Presence

12

Let us build our Robot

MSP432 Type ASelection of Board

Select Launchpad w/ msp432 EMT (48 MHz)

Page 13: Warm Greetings to you Business Presence

13

Selection of COM Ports Basic Digital Operation

• To set a pin as Output/INPUT use the following API

• For setting a pin as OUTPUT

pinMode(PinNumber, OUTPUT);

• For setting a pin as INPUT with PULLUP Resistor

pinMode(PinNumber,INPUT_PULLUP);

• For setting a pin as INPUT otherwise

pinMode(PinNumber,INPUT);

Basic Digital Operation

• To Write a data HIGH or LOW to an Energia Pin Number , use the below API

• To write HIGH

digitalWrite(PinNumber, HIGH);

• To Write LOW

digitalWrite(PinNumber,LOW);

Basic Digital Output

• Write a code to Turn ON and OFF the REDLED onboard MSP432 board every onesecond. RED LED is connected to Pin 2.0 i.eEnergia pin Number 75 .

Page 14: Warm Greetings to you Business Presence

14

Basic Digital OutputSolution codevoid setup()

{

pinMode(75,OUTPUT);

}

void loop()

{

digitalWrite(75,HIGH);

delay(1000);

digitalWrite(75,LOW);

delay(1000);

}

Practice Exercise

• Write a code to Turn ON RED, GREEN and BLUE LED Simultaneously for one second and Turn OFF the three mentioned LED for one second.

• Refer the energia pin map for Energia Pin number of RED, GREEN and BLUE LED

Digital Input Operation

• To declare a pin as Input in Pull UP direction

pinMode(PinNumber,INPUT_PULLUP);

• To read a pin status i.e HIGH or LOW use the API

digitalRead(PinNumber);

will return 0 for HIGH status at a Pin

will return 1 for LOW status at a Pin

Digital Input Operation

• Write a code in Energia to turn ON Red LED when the onboard Push Button 1 switch is pressed and to turn OFF the Red LED when the Push Button 1 is released.

• Push Button 1 is connected to Pin Number 73

• RED LED is connected to Pin Number 75

Page 15: Warm Greetings to you Business Presence

15

Digital Input Operation • Solution

void setup()

{

pinMode(73,INPUT_PULLUP);

pinMode(75,OUTPUT);

}

void loop()

{

int x=digitalRead(73);

if(x==0)

{

digitalWrite(75,HIGH);

}

else

{

digitalWrite(75,LOW);

}

}

Working with Serial Communication

• API to start a Serial module at a baud rate

Serial.begin(baud rate);

• API to send a data through Serial module

Serial.println(“ Your message ”);

Serial.println(variable);

Example of available Baud rates

300, 1200, 2400, 4800, 9600, 14400, 19200,28800, 38400, 57600, or 115200

Working with Serial Communication

• Modify previous exercise to print a messageon the serial monitor “ Button Pressed “ whenthe Push Button 1 is pressed and to print amessage “Button Released” when the buttonis released.

Working with Serial Communication• Solution

void setup()

{

pinMode(73,INPUT_PULLUP);

pinMode(75,OUTPUT);

Serial.begin(9600);

}

void loop()

{

int x=digitalRead(73);

if(x==0)

{

digitalWrite(75,HIGH);

Serial.println(“Pressed”);

}

else

{

digitalWrite(75,LOW);

Serial.println(“Released”);

}

}

Page 16: Warm Greetings to you Business Presence

16

Working With Analog Peripherals:Analog IN

• To read Analog Input use the following input

analogRead(PinNumber);

• Returns the Digital value of the Analog Input given Pin

Working With Analog Peripherals:Analog IN

• Write a code to read the analog signal on pin 2 of the MSP432 board and print it on the Serial monitor

Working With Analog Peripherals:Analog IN

void setup()

{

pinMode(2,INPUT);

Serial.begin(9600);

}

void loop()

{

int x=analogRead(2);

Serial.println(x);

delay(500);

}

Working with Analog Peripherals-Analog Out

3ms

2.5ms

2ms

4ms

F =1/4ms=250HzDC=(1/4)*100 =25%25%(3.3V) = 0.8V

F =1/4ms=250HzDC=(1.5/4)*100 =37.5%37.5%(3.3V) = 1.2V

F =1/4ms=250HzDC=(2/4)*100 =50%50%(3.3V) = 1.6V

4ms

4ms

Page 17: Warm Greetings to you Business Presence

17

Working with Analog Peripherals-Analog Out

analogWrite()

Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds.

Syntax:

analogWrite(pin,dutyCycle)

Parameters:

pin: Pin number to which PWM signal must be generated

dutyCycle: range of values between 0 – 255 determines PWM dutycycle range 0% to 100%

Working with Analog Peripherals-Analog Out

Write a code to slowly brighten the RED LED connected to pin number 75.

Working with Analog Peripherals-Analog Out

void setup(){pinMode(75,OUTPUT);

}

void loop(){

for(int duty=0;duty<=255;duty++){analogWrite(75,duty);delay(20);

}}

Working With Bump Switches

KW 11-2 Bump Switches

Page 18: Warm Greetings to you Business Presence

18

Working With Bump Switches Working with bump switches

Connection of First Bump Switch to Pin 9.0 (Energia Pin 42) using a Pullup resistor

Working with single a bump switch

Write a code to detect the bump switch press (connected to Pin 9.0, Energia Pin Number 42) to print a message “ Bump Switch Pressed” on the serial monitor.Hints : Configure pin 42 in Pullup mode, Use digitalRead() API to read the status of the switch

Working with 6 bump switches

Pin Number 9.0 9.1 9.2 9.3 9.4 9.5

Energia Pin Number

42 59 45 62 49 66

bs1==0 || bs2==0

Page 19: Warm Greetings to you Business Presence

19

Working with 6 bump switches

• Write a code to print a message on the Serial monitor when any of the bump switches arepressed

• Hint : Configure all the Bump switches pin outs as Pullup and read them one by one.

Working with QTR-8Reflectance Sensor

Working with QTR-8Reflectance Sensor

Configuration of single QTR-8 Reflectance Sensor

Colour Digital Value

Black 1

White 0

Truth Table

QTR 8 Connections

QTR Pin Number /Name MSP432 Pin Number MSP432 Energia Pin Number

GND GND GND

VCC VCC VCC

LED ON 5.3 61

1 7.0 65

2 7.1 48

3 7.2 64

4 7.3 47

5 7.4 52

6 7.5 68

7 7.6 53

8 7.7 69

Pin Connections

Page 20: Warm Greetings to you Business Presence

20

Pseudo Code for Reading one QTR 8 Pin connected to Pin 7.0

main program Initialization while(1){1) Set P5.3 high (turn on IR LED)2) Make P7.0 an output, and set it high (charging the capacitor)3) Wait 10 us, delayMicroseconds(10);4) Make P7.0 an input5) Run this loop 10,000 times

a) Digital Read P7.0 6) Set P5.3 low (turn off IR LED, saving power)7) Wait 10 ms, delay(10);}Print the digitally read value in step 5

Colour Digital Value

Black 1

White 0

Truth Table

Run the code and check if you are getting Ones and Zeros when the sensor crosses a black tape and White tape

Reading all QTR 8 Pins and converting into sensor value

• Extend the previous code to Read all the 8 pins and convert it into a single sensor value using the following formulaWeights 128 64 32 16 8 4 2 1

Pin

Number

7.7 7.6 7.5 7.4 7.3 7.2 7.1 7.0

Variable

Name

h g f e d c b a

Converting digital array into a number

sensorvalue=(h*128)+(g*64)+(f*32)+(e*16)+(d*8)+(c*4)+(b*2)+(a*1)

Print the sensor value on the serial monitor and test the values by moving the QTR

sensors on a black tape.

Working With DC Motors

Principle of H bridge

Page 21: Warm Greetings to you Business Presence

21

DRV8833 Connections to MDPDB Running the DC motors nSleep DIR PWM Direction

of Motor

1 0 1 Forward

1 1 1 Reverse

Launchpad Pin Number Energia Pin Number Motor Driver and Power

Distribution Board Pin Name

10.0 54 DIR Right (violet)

10.1 70 DIR Left(violet)

3.5 32 PWM Right (yellow)

3.7 31 PWM Left (yellow)

10.2 55 nSLP Right (sleep pin)(grey)

10.3 71 nSLP Left (sleep Pin)(grey)

3V3 1 VCCMD

Solution function to run the motors

void Reverse(int i,int j)

{

digitalWrite(55,HIGH);//SLP R

digitalWrite(54,HIGH); // DIR R

digitalWrite(71,HIGH);//SLP L

digitalWrite(70,HIGH); //DIR L

analogWrite(31,j); // PWM L

analogWrite(32,i); //PWM R

}

void Forward(int i,int j)

{

digitalWrite(55,HIGH);//SLP R

digitalWrite(54,LOW); // DIR R

digitalWrite(71,HIGH);//SLP L

digitalWrite(70,LOW); //DIR L

analogWrite(31,j); // PWM L

analogWrite(32,i); //PWM R

}

First argument is the PWM for right motor and second is for PWM for left motor

Task 1

• Write a code using bump switches as selectable control for robot movement direction.

– Forward Movement

– Reverse Movement

– Turn left and move

– Turn Right and move

Page 22: Warm Greetings to you Business Presence

22

Challenge 1: Line Follower

• Write a code to make the robot follow the Black tape

• Hint: Read the QTR Sensors and accordingly turn the motor to follow the line

Challenge 2: Cloud Control Robot

• Write a code to control the Robot from the cloud using MQTT protocol. You should able to control the robot moment in all 4 direction including STOP function.

• Hint: Use MQTT app as client interface, CC3200 with CC110L as Gateway and control the Robots over Sub1GHz network.

Challenge 3: SWARM Robots

• Write a code to implement swarm robots function.

• Hint: You can use the WSN using sub 1GHz and group other batches to perform swarm function.

Challenge 4: COBOTS

• Write a code to implement collaborative robots function.

• Hint: You can use the WSN using sub 1GHz and group other batches to perform sequential tasks.

Page 23: Warm Greetings to you Business Presence

23

Challenge 5: Phototrophic / Photophobic Robot

• Write a code to implement Phototrophic / Photophobic Robots function.

• Hint: You can use the Light sensor and interface with the Robot.

“ShriNivas” , No. 26, 2nd street, Kasthuri Nagar,

Ondipudur, Coimbatore – 641 016

E-mail: [email protected]

Mobile: 9843011587

Website: www.stepsknowledge.com