Embedded Systems Programming Custom sensors for the use with Atmel ATmega8535 microcontrollers

30
1 Embedded Systems Programming Custom sensors for the use with Atmel ATmega8535 microcontrollers and the Kanda STK200 board Designed by Richard Anthony University of Greenwich

description

Embedded Systems Programming Custom sensors for the use with Atmel ATmega8535 microcontrollers and the Kanda STK200 board Designed by Richard Anthony University of Greenwich. 1. New sensors for the ATmega8535. Light Sensor Connects to Analogue input ADC7 (pin 7 of Port A) - PowerPoint PPT Presentation

Transcript of Embedded Systems Programming Custom sensors for the use with Atmel ATmega8535 microcontrollers

Page 1: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

11

Embedded Systems Programming

Custom sensors for the use with Atmel ATmega8535 microcontrollers

and the Kanda STK200 board

Designed by Richard AnthonyUniversity of Greenwich

Page 2: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

2

New sensors for the ATmega8535

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Light Sensor

Connects to Analogue input ADC7 (pin 7 of Port A)

Reading increases as light intensity increases

Page 3: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

3

New sensors for the ATmega8535

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Floor-Switch Sensor

Connects to Digital input (bit 0 of any port)

When the mat is stepped on, the switch operates

Page 4: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

4

New sensors for the ATmega8535

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Passive Infra-Red (PIR) Sensor

Connects to Digital input (bit 2 of any port)

When a person moves, in detector range, the internal switch operates

Page 5: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

5

New sensors for the ATmega8535

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Magnetic-Switch Sensor

Connects to Digital input (bit 1 of any port)

When the magnet is moved in / out of range, the switch operates

Page 6: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

66

New sensors for the ATmega8535

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Twin Variable Resistor Sensor

Connects to Analogue inputs ADC2 and ADC3(bits 2 and 3 of port A)

Rotating the dials changes the analogue resistance values

Page 7: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

77Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Peripherals – Thermistor (2)

Our custom temperature sensor can be connected to bit 6 of port A.

(Must be used on port A because it is an analogue device and needs to be sampled using the ADC).

Page 8: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

88Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Peripherals – Thermistor (2)

Digital value (reading most significant 8-bits from 10-bit ADC)

708090

100110120130140150160170180190200210220230240

0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100

Temperature (degrees Celcius)

AD

C o

utpu

t val

ue

Thermistor temperature sensor probe calibration (8-bit values read as ADCH, i.e. most significant 8 bits)

Page 9: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

9

Peripherals – Humidity Sensor

Our custom Humidity sensor can be connected to bits 3, 4, 5 of port A (uses all three bits).

(Must be used on port A because it is an analogue device and needs to be sampled using the ADC).

Page 10: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

1010Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Peripherals – Sounder

Used in PCs, Christmas cards, alarm clocks ….

Low output current needed - can be driven directly from a parallel port pin.

Our custom sounder device is connected to bit 3 of the port.

You need to configure the pin for output and provide a pulse on the port bit 3.

See the Loudspeaker demonstration project provided.

Page 11: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

1111Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Peripherals – Motor with shaft encoder and H/W Interrupt generation

MotorCan be driven via bit 3 of any port (‘1’ provides power to the motor).

Primarily designed for PWM using Timer/Counter0. Timer 0 Output Compare Match Output OC0 is the alternate function of Port B bit 3.

Motor can reach speeds exceeding 100 Revolutions per Second (6,000 RPM).

Motor stalls if driven with a duty cycle less than 29% (approximately 8 RPS).

Shaft EncoderComprises a ‘Slotted-Opto Switch’ (which detects when its light beam is broken) and a rotor with four cut-outs, enabling detection accuracy of ¼ rotation (i.e. 90 degrees).

If measuring rotational speed, four pulses represent 1 revolution.

The output of the Slotted-Opto Switch is connected to bit 2 of any port.

Primarily designed to generate a Hardware Interrupt INT0, which is the alternate function of Port D bit 2.

Page 12: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

Peripherals – Motor with shaft encoder and H/W Interrupt generation

1212Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Connections to Port B and Port D

Motor

Rotor

Slotted Opto

Switch

Page 13: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

1313Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Peripherals – Motor with shaft encoder and H/W Interrupt generation

Motor

Rotor

Slotted Opto

Switch

Transistor driver

circuit for motor

Page 14: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

14Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Peripherals – Shaft encoder

Infrared light beam

IRLED

IRsensitive transistor

(under rotor)

Page 15: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

15

There is also a simpler motor rig that does not have the optical feedback system

Details will be added soon

Page 16: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

1616Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Digital Signal Processing – D-to-A conversion with a resistor ladder

A simple 8-bit R-2R resistor ladder(connects to any port, uses all 8-bits configured as outputs)

Converts a Digital value in the numerical range 0 – 255 into an Analogue value in the range 0 Volts to 5 Volts

Resistors

8 Analogue outputs, one per stage to

allow experiments

Bit 0

8 bit Digital data input

Bit 7

Page 17: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

1717Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Digital Signal Processing – D-to-A conversion with a resistor ladder

Oscilloscope Earth connection

Page 18: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

1818Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Digital Signal Processing – D-to-A conversion with a resistor ladder

Oscilloscope Earth connection

Page 19: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

19Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Peripherals – Accelerometer and X-Y axis Bar LEDs

Page 20: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

20

Peripherals – Accelerometer and X-Y axis Bar LEDs

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Page 21: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

21Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Output device - SERVO

Converts a control signal from a single digital output port pin into a precise rotational position (angle).

PWM is used to generate the control pulse width in the range 0.5ms – 2.5ms (1.5ms pulse indicates the ”neutral“ / central position).

Rotation: 180 degrees.

Page 22: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

22

Peripherals – Servo adapter board

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

To Microcontroller

port

To Servos

Power (from supply) 5Volt to 6Volt

Ground from supply (0Volt)

Page 23: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

23

Peripherals – Servo adapter board

To Servo

Signal (PWM pulse)

Power 5Volt to 6Volt

Ground (0Volt)

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Page 24: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

24

Peripherals – Servo adapter board

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Two servos connected, using both Timer1 PWM

channels

Page 25: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

25

Peripherals – Servos in use (simple 2-servo robot)

Page 26: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

26

Peripherals – InfraRed receiver (RC5 command receiver, as in TV remote controls)

InfraRed receiver

Page 27: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

27

RFID reader

Peripherals – Radio Frequency Identification (RFID) reader

“Tag read”Indicator LED

RFID tag

Page 28: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

28Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Peripherals – KeypadProvides a simple means of numerical data or control input. The Keypad has 12 buttons arranged in a 4 Row * 3 Column Matrix:

Page 29: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

2929

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

The LCD provides a versatile means of displaying alphanumeric data and messages (such as error codes, status messages, and user instructions).

The LCD can display 2 rows of 16 characters.

LCD display panel

Peripherals – Liquid Crystal Display (LCD)

Page 30: Embedded Systems Programming Custom sensors for the use with  Atmel ATmega8535 microcontrollers

Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Peripherals - Seven Segment display

30