Application Case Study Security Camera Controller

Slides:



Advertisements
Similar presentations
Jordan Barry Victor Brzeski
Advertisements

Digital Thermostat and Data Logger Brandon Wagner and David Southwick.
Sistemi Elettronici Programmabili13-1 MULTI OSC + CLOCK FILTER LVD POWER SUPPLY CONTROL 8 BIT CORE ALU PROGRAM MEMORY RAM I2CI2C PORT A SPI PORT B 16-BIT.
Robotics Club, Snt Council2 The 3 Schools of Robotics: Mechanical Design – Types of motors – Material selection –
Module 4: Analog programming blocks. Module Objectives Analyze a control task that uses analog inputs. Connect a potentiometer to LOGO! controller and.
Introduction of Holtek HT-46 series MCU
OutLine Overview about Project Wii Robot Escaper Robot Problems and Solutions Demo.
Synchronized Strobe for Video Camera
Timers and Interrupts Shivendu Bhushan Summer Camp ‘13.
1 ECE 263 Embedded System Design Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System.
Digital I/O Connecting to the Outside World
Introduction.
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
Module 4: Analog programming blocks. Module Objectives Analyze a control task that uses analog inputs. Connect a potentiometer to LOGO! controller and.
ARM Timers.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
AT91 Embedded Peripherals
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
CS 478: Microcontroller Systems University of Wisconsin-Eau Claire Dan Ernst Hybrid I/O – Pulses.
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
1 Lab 5: Controls and feedback. 2 Lab 5: Control and Feedback This embedded system uses the Photo sensor to detect the light intensity of the environment.
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
IN 1900 ICT Project Final Presentation. Group name : Code Squad.
BLDC Motor Speed Control with RPM Display. Introduction BLDC Motor Speed Control with RPM Display  The main objective of this.
MICROCONTROLLER INTERFACING WITH STEPPER MOTOR MADE BY: Pruthvirajsinh Jadeja ( ) COLLEGE:DIET BRANCH:EC.
GROUP MEMBERS: SUMEET HOODA. RAJDEEP PATRE. DHIRAJ GAONKAR. LIVE HUMAN DETECTION USING WIRELESS REMOTE CONTROLLED ROBOT.
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 Microcontrollers. 2 Programmers work in the virtual world Machinery works in the physical world Microcontrollers connect the virtual and physical world.
Components of Mechatronic Systems AUE 425 Week 2 Kerem ALTUN October 3, 2016.
Case Study #1 Microcontroller System. What is a microcontroller? A microcontroller can be considered a self-contained system with a processor, memory.
Application Case Study Christmas Lights Controller
Arduino.
Introduction to Motors, servos and steppers
Embedded Systems Programming Interrupts and Handlers
Why are Timer Functions Important?
Chip Config & Drivers – Required Drivers:
Servos Elementary Robotics with Servos
Embedded Systems Programming
Timers and Event Counters
Environment Temperature Monitor
ABSTRACT The controller continuously polls the temperature with certain regular time intervals and displays over the 7_segment display The temperature.
68HC11 Interrupts & Resets.
SCADA for Remote Industrial Plant
Microcontroller Applications
SUBMITTED BY EDGEFX TEAM
Chapter 11: Inter-Integrated Circuit (I2C) Interface
UNIT – Microcontroller.
BITS EDU. CAMPUS , VARNAMA
4-Integrating Peripherals in Embedded Systems
COMP2121: Microprocessors and Interfacing
AVR Addressing Modes Subject: Microcontoller & Interfacing
Pulse Width Modulation (PWM) Motor Feedback - Shaft Encoder
RX 8-Bit Timer (TMR) 4/20/2011 Rev. 1.00
Communication Protocol
The Arduino Microcontroller: Atmel AVR Atmega 328
Timer/Counter Modified from Dr. Lam Phung’s Slides.
ECE 3430 – Intro to Microcomputer Systems
Internet-of-Things (IoT)
8255.
Asynchronous Serial Communications
ECE 354 Computer Systems Lab II
CSCI1600: Embedded and Real Time Software
Introducing the PIC Mid-Range Family and the 16F84A
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
ECE 3430 – Intro to Microcomputer Systems
ECE Computer Engineering Design Project
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Application Case Study Security Camera Controller Embedded Systems Programming Application Case Study Security Camera Controller (with automatic pan to pre-set zones of interest triggered by movement sensors) Requirements analysis Selecting sensors, inputs and outputs I/O ports and interfacing Timing diagrams Configuration of internal modules (timer, ADC)

The automatic pan concept Zone #1 Zone #3 Camera pivot and servo for rotation Camera Zone #2 Field of view The automatic pan concept (zones are equipped with localised movement sensors) Initial situation (camera facing zone #2) Movement detected in zone #1, camera is rotated to pre-set angle facing zone #1 Zone #2 Rotation Richard Anthony

Case study - Requirements analysis Functional requirements of the Security Camera Controller: Detect movement in a number of specific zones. Sense light level and differentiate between day and night-time. Turn camera power on when movement detected. Turn camera servo power on when movement detected. Turn security light on when movement detected at night-time. Automatically pan camera to point at zone where movement detected. Turn camera servo power off when camera pan rotation completed. Turn camera power off when no movement detected for 5 minutes. Turn security light off when no movement detected for 5 minutes. Communicate with other components of a security system via a ZigBee network (this aspect only described in outline). Provide simple power and operational status indication via single LED. Non-functional requirements: Use low levels of power. Casing must be adequate for harsh environment (full weather exposure to some parts, large variation in temperatures and humidity). Mechanical robustness and smooth rotational movement of camera. 3 Richard Anthony

Case study - Selecting sensors, inputs and outputs Sensors, and I/O devices for the Security Camera Controller : PIR sensors to detect movement in zones. Requires single digital input pin with interrupt capability per PIR sensor (up to 5 sensors to be supported). A light sensitive device such as a Photodiode or Light Dependent Resistor (LDR) is needed to sense the light level. Requires single analogue input pin (and the Analogue-to-Digital converter). The camera pan movement requires a servo, which is controlled by a single PWM output (and a programmable timer). The servo power, camera power and spotlight power require transistors driven each by a single digital IO pin (3 of). In addition, because the spotlight is mains-powered, it requires that the transistor drives a relay. The alarm sounder requires a single digital IO pin. A low-intensity LED is adequate for the signal LED. It requires a single digital output pin. The ZigBee network module requires a serial port USART (Rx and Tx pins). It also requires three handshaking signals; 2 digital outputs and 1 digital input. The camera is a separate component which sends signals via a separate wireless link (not part of the controller’s logic or function). 4 Richard Anthony

Case study - I/O ports and interfacing (1) Interfacing sensors and I/O devices to specific ports (for ATmega328), ordered in terms of most specific requirements first. The ZigBee module’s serial interface is connected to Port D bits 0 and 1 which provide the USART Rx and Tx functions respectively. The Light Dependent Resistor must be connected to the Analogue-to-Digital converter, Port C bit 0 (ADC0) is used. The servo is connected to Port B bit 3 which provides the OC2A output from Timer2. The PIR sensors are connected to separate digital input bits on Port D bits 2-6 inclusive, sharing the PCINT2 pin-change interrupt. The servo power, camera power and spotlight power control outputs are connected to Port C digital output bits 1, 2, 3 respectively. The alarm sounder is connected to digital output Port D bit 7. The ZigBee module’s handshaking signals are connected to Port B digital IO bits 0, 1 and 2. The signal LED is connected to digital output Port B bit 7. The camera data stream has its own wireless link and is not interfaced to the microcontroller. 5 Richard Anthony

Case study - I/O ports and interfacing (2) – ATmega328p ZigBee Comms Spotlight power PIR 1 Camera pwr PIR 2 Servo pwr PIR 3 Light sensor Signal LED PIR 4 PIR 5 Camera servo (PWM) Alarm sounder ZigBee module handshaking Richard Anthony

Case study - I/O ports and interfacing – ATmega1281 Equivalent Richard Anthony ATmega1281 Case study - I/O ports and interfacing – ATmega1281 Equivalent Light sensor ZigBee Comms Camera servo (PWM) Alarm sounder Spotlight power PIR 1 PIR 2 PIR 3 Camera pwr PIR 4 PIR 5 Servo power Signal LED ZigBee module handshaking Richard Anthony

Case study - I/O ports and interfacing – ATmega2560 Equivalent Light sensor ATmega2560 ZigBee comms Camera servo (PWM) Alarm sounder PIR 1 PIR 5 … Spotlight power Camera power Servo power Signal LED ZigBee module handshaking Richard Anthony Richard Anthony

Flow chart (1) Main Start Wait Configure Timer1 (1 second clock) Turn sounder Off Configure Timer2 (PWM for servo) Configure PCINT interrupt (movement sensors) Turn camera Off Turn servo power Off Turn spotlight Off Configure ADC (Sample light level) Stop SpotlightOn Off period completed ? Yes No LightLevel == Light Turn Spotlight on On period completed ? Yes No Turn Spotlight off SpotlightOff Stop ActivateSounder Set sounder On duration Turn sounder On Stop 9 Richard Anthony

Signal LED pulse interval reached Flow chart (2) Timer1 ISR Start (1-second clock interval) Yes No Pulse signal LED Signal LED pulse interval reached ? LED_FlashIntervalRemaining -- Sounder OffTime > 0 OnTime > 0 SounderOffTime -- SounderOnTime -- Turn sounder Off Camera CameraOnTime -- Turn camera Off Call SpotlightOff Spotlight SpotlightOffTime -- SpotlightOnTime -- Start ADC conversion Stop 10 Richard Anthony

Flow chart (3) PCINT ISR Sensor #1 pin high ? Yes No (Motion sensors) Sensor #1 pin high ? Yes No Set PWM value to point camera to zone #1 Start (an input pin changed value) Set PWM value to point camera to zone #2 Sensor #3 Set PWM value to point camera to zone #3 Stop Turn camera On Sensor #2 Call SpotlightOn Call ActivateSounder Turn servo power On LightLevel = Dark Start (conversion complete) ADC ISR LightLevel > threshold ? Yes No = Light Stop 11 Richard Anthony

Timing diagram 1 1-second clock and light-level sampling ADC conversion complete (momentary state) Ambient light level (as detected) ADC interrupt handler Timer1 (1-second clock) Start ADC conversion ADC conversion time Light Dark 1 second 12 Richard Anthony

Timing diagram 2 Movement sensors and camera positioning PCINT ISR Zone #1 Zone #2 Zone #3 Camera target position Richard Anthony

Timing diagram 3 Actuator control logic Camera Rotating (worst case) Timing diagram 3 Actuator control logic Camera power Sounder Servo power Zone #1 Zone #2 Zone #3 Camera target position Ambient light level Light Dark Spotlight Richard Anthony

Case study - Configuration of internal module – Timer1 Timer1 is used to provide a 1-second clock pulse which is used to count-down a number of application-level time-periods (i.e. one hardware clock is used to govern multiple separate software-managed time intervals). The application-level time periods include the Signal LED pulse interval and the timing periods for {camera on-time, spotlight on-time, spotlight off-time, sounder on-time}. Mode of operation – to achieve a timeout after 1 second, channel A is used in CTC mode. Timer1 is ideal for the 1-second clock because it is a 16-bit timer. The largest prescaler is used, i.e. 1024. This allows the timer to measure an interval of up to 67 seconds approximately with a 1MHz clock. The timer is configured to use interrupts (Compare Match interrupt). 15 Richard Anthony

Case study - Configuration of internal module – Timer2 Timer2 generates a PWM pulse to control the rotational position of the camera. Interrupts are not needed for Timer2; the PWM pulse is generated directly on the OC2A pin (Port B bit 3 of the ATmega328). The pulse width is from 500 to 2500 microseconds (the equivalent servo rotational angle is approximately 180 degrees). A 500µS pulse width indicates fully anticlockwise, 1500µS indicates the centre position, and 2500µS indicates fully clockwise. The pulse is repeated at a typical rate of 18mS, as shown in the PWM timing diagram: Interval (I) = 18 mS typical 500µS 2500µS Pulse (P) Equivalent servo position However, Timer2 is an 8-bit timer (16-bit Timer1 is used for the 1-second clock), so the precision of the actual timing signal produced is limited: For a clock speed of 1MHz, and by using the 64 prescaler, the pulse interval (given by the counter overflow) is actually 16.384mS (works correctly with the servos tested). The specific prescaler and clock speed combination limits the PWM pulse granularity to 64µS increments (where 2500µS – 500µS = 2000µS pulse width range for 180° movement range, ≡ 11µS per degree). Therefore 64µS ≡ 5.76° movement granularity (which is adequate in this application). Richard Anthony

Case study - Configuration of internal module - ADC Only a single analogue sensor is used; the light-level sensor. Therefore only a single channel of the ADC is used; channel 0. The application design requires that the light level is sampled frequently; once a second is ideal, therefore the ADC conversion is started from within the Timer1 ISR. The ADC unit has a 10-bit precision, but in this application it is only necessary to detect the light-level difference between night-time and daytime, and thus an 8-bit result is adequate. The configuration registers are programmed to provide the most-significant 8-bits in a single data register. The ADC is configured to use interrupts (Conversion Complete interrupt). Richard Anthony

Case study - Configuration of internal module – PCINT2 Interrupt Up to five movement sensors are supported, and it is necessary to detect signals from these via an interrupt mechanism. The ATmega328 only has two dedicated interrupt pins (INT0 and INT1), but pin-change interrupts are supported for every I/O pin, managed separately for each of the three ports (B, C, D). PCINT2 can be used to detect any pin-change on any of the input pins of Port D. The movement sensors are each connected to one of the Port D bits (bits 2-6 inclusive). The PCINT2 interrupt is enabled. When triggered, the PCINT2 ISR code must first determine which sensor has detected movement, by examining all the input bits. The sensors work in active-high mode (and external pull-down resistors are used in the circuit), meaning that all bits are low when no movement is detected. Determining which sensor was activated requires finding which pin has gone high. The ISR must then set the camera servo PWM value appropriately so that the camera rotates to point at the zone where movement was detected. 18 Richard Anthony