Basic principles of designing an anti-pinch system for electric windows based on an AVR Flash microcontroller

Publisher:pengbinyyyLatest update time:2013-12-07 Source: eefocusKeywords:AVR Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  Automatically closing power windows or doors on cars present a potential risk of jamming, crushing and possible injury. They must be able to reverse movement to prevent the force applied by the motor from exceeding normal limits. This feature means that speed, current and glass position must be constantly monitored.

  For reasons of cost and simplicity, the system described in this article uses a common brushed motor with Hall effect sensors. The detection algorithm based on speed and torque derivatives has been verified to be robust and fault tolerant. The algorithm can be used on all Atmel AVR Flash microcontrollers with A/D converters and I/O ports that trigger interrupts on changes. This article describes the basic principles, and the application note on the Atmel website has a detailed description of the implementation.

Electric devices in modern cars

  Electronic components and systems now account for more than 20% of the cost of high-end passenger cars. Increasing the number of electronic devices allows for better control of sensors and actuators, thereby enhancing the comfort and safety of the car. It is expected that most mid-range and high-end cars will be systematically equipped with power window or door systems. The vast majority of these devices are fully automatic, which means that they must be accompanied by safety systems to prevent injury or mechanical failure. Regulations have established rules that power systems must follow. This is especially true for the raising of windows and sliding of doors. This application note describes how to implement an anti-pinch algorithm that was originally developed for power window systems but can be easily ported to other mobile devices.

standard

  Car power windows are subject to international standards, such as MVSS118 in the United States or 74/60/EEC in Europe. In terms of how to reduce the risk to children, these documents put forward the following requirements: detection area: 4mm to 200mm; maximum clamping force is 100N; can be reversed when clamped; determine the deflection angle test: 5N/mm to 20N/mm.

 

About Hardware

  There are different detection strategies for determining whether there is an obstacle entering the critical clamping area:

  (1) No mechanical contact. The reaction occurs before the clamping force is applied to the object. Because no external force is applied to the object, this is the best protection method. It also does not rely on vibration, aerodynamic changes or deformation. However, this method requires integrated sensors (infrared, ultrasonic, etc.) and related circuit modules and lines, which leads to additional costs.

  (2) With mechanical contact. The measured pressure is transmitted to the system to indicate that an object is trapped. In this regard, designers have two basic technologies available: directional measurement (mechanical sensors or contacts integrated into the door seal, these solutions have always been costly and limit the style of window/door design), or non-directional measurement through physical monitoring (this is the best solution in terms of overall cost).

Anti-pinch algorithm details

  The object detection algorithm was designed from the outset to meet the requirements of the standards (FMVSS118 & 74/60/EEC): detection area of ​​4 to 200 mm; maximum applied force of 100 N; reversal of direction when an object is clamped; standard confirmation test.

  The reasons for having to be adaptive include: – The mechanical parts of the lifting system will change over time (aging, local deformation, wear, etc.); – The electronic characteristics will change greatly; – The environment affects the friction (temperature, humidity, icing, etc.); The system should not react to disturbances and incorrect detection of objects. It must be robust to air friction, road vibrations, power failures, etc.

Physical parameters of the solution using the motor

  The force applied to the glass must be calculated from the motor current. The position of the moving part is continuously available in terms of velocity. These parameters can be used to determine if an object has been encountered and: whether the object is in the detection zone; whether the applied force exceeds the limit.

  This article describes an anti-pinch algorithm that works by measuring motor current and a Hall-effect speed indicator. With very little modification, the algorithm can be used in systems such as sliding doors or convertible tops.

Pinch Detection Algorithm

  Typically, the object detection algorithm operates by indirectly measuring the window lift system, including current (torque) and position (speed). The application notes associated with the algorithm use two techniques, which are based on:

  – Calibrated torque stored in conflict-free memory: A preliminary learning sequence is performed to store the torque values ​​in memory. This technique is memory intensive and requires a defined calibration sequence. [page]

  – Speed-derived calculation: A technique that makes sense because it requires less memory but more calculation, having the advantages of both approaches.

Implementation on AVR

  The algorithm described in detail in the previous paragraphs has been implemented and tested on an AVR ATmega88 development board. Figure 2 describes the hardware used to implement the algorithm. It uses a standard ATmega88 and analog chain to measure the motor current. The hardware has two Hall effect sensors. The direction of the motor is controlled by a bipolar delay and a field effect transistor to activate the motor switch.

 

In-system Flash programming

  In-system programming allows any AVR microcontroller located in the end system to be programmed and reprogrammed. Through a simple three-wire SPI interface, the in-system programmer communicates serially with the AVR microcontroller to reprogram all non-volatile memory on the chip. In-system programming does not require the chip to be physically removed from the system. This saves time and money both in the development phase in the laboratory and in the field for software or parameter upgrades. When uploading code into Flash memory at the final product stage, using the same standard AVR Flash microcontroller in multiple applications and customized versions can simplify total management.

Software Description

  All codes are implemented in C language using IAR EWAVR 4.1. The implementation of basic functions (position management, initialization, current management, window operation, anti-pinch monitoring) requires 2KB Flash. Adding extended functions such as calibration, choke point detection and storage can expand the code size to 4KB. The software code is available on Atmel's website and its structure is as follows:

  The initialization pin changes the interrupt to be used through a Hall effect sensor (sensitive to the rising and falling edges of the signal). It also initializes the clock and ACD used to measure speed and motor current.

  This function loads the window lift parameters from EEPROM or with initial values ​​to initialize the window lift. These parameters include window size, sensor value, entrapment threshold, entrapment zone, last known position, etc. If a default value is set on the position parameter, it can request a down command to initialize the window lift at the bottom limit.

  This function stores the window lifting parameters into EEPROM.

  This function contains the window lift state machine. It controls the operation of the window through the given event parameters. It monitors the window position, the upper and lower limits, and the state of the anti-pinch system. It returns the state of the window lift (same value as the get_window_state function).

  This interrupt subroutine is executed on the Hall effect sensor pin. It calculates the rolling direction, position, derived speed and motor current reference. By counting consecutive direction changes, it is also able to detect the default value of the Hall effect sensor (the sensor is not connected to an interrupt pin).

  This function forces the window to stop after a defined step. This function returns the state of the window raising state machine (this return value is used in the window_ctrl function).

  Establish window lift status: used in mandatory operations (such as stop request...)

  Calculate the average of the last 8 sampling points. Used to filter the motor current.

  This function monitors the start button, generates an operation command event and passes it to the window_ctrl function.

Keywords:AVR Reference address:Basic principles of designing an anti-pinch system for electric windows based on an AVR Flash microcontroller

Previous article:Design of digital phase-shift signal generator based on AVR and FPGA
Next article:The establishment of communication protocol between AVR microcontroller and host computer

Recommended ReadingLatest update time:2024-11-16 22:38

AVR internal EEPROM read and write example
This program simply demonstrates how to use the EERPOM of ATMEGA16. Introduction to EEPROM Write operation of EEPROM Read operation of EEPROM In order to simplify the program, various data are not output to the outside. It is recommended to use JTAG ICE hardware emulator when learning. After opening the debug file t
[Microcontroller]
The function of feeding the timer in AVR
In a microcomputer system composed of a single-chip microcomputer, the operation of the single-chip microcomputer is often interfered by the external electromagnetic field, causing the program to run away and fall into an infinite loop. The normal operation of the program is interrupted, and the system controlled by t
[Microcontroller]
AVR simple ADC program
I recently looked at the ADC of ATmega16 and wrote this simple program to understand the simple control of ADC. The program is simulated with Proteus, using the ICCAVR7 compiler (the header files are different, so you should consider it yourself) The program content is: read the external voltage through PA1 and dynami
[Microcontroller]
Design of CAN bus system for a certain vehicle based on AVR microcontroller
introduction Fieldbus technology is a rapidly developing technology in the field of automation control. Among them, CAN (Controller Area Network) bus is one of the most widely used fieldbuses in the world. With the development of the automotive electronics industry in recent years, CAN b
[Microcontroller]
Design of CAN bus system for a certain vehicle based on AVR microcontroller
ATtiny13 Reset Source
Reset AVR  When resetting the ATtiny13, all I/O registers are reset to their initial values ​​and the program starts executing from the reset vector. The instruction at the reset vector must be an absolute jump JMP instruction so that the program jumps to the reset handling routine. If the program never uses interrup
[Microcontroller]
ATtiny13 Reset Source
Design of digital tube display clock for avr single chip microcomputer
//Digital tube data P0 port, digital tube control P2 port #include #include #includePACe.h》 #include #include   #definecodePROGMEM #defineucharunsignedchar #defineuintunsignedint codeconstucharLED_7[16]={0x28,0x7E,0xA2,0x62,0x74,0x61,0x21,0x7A,0x20,0x60,0xff};//commonof+ codeconstucharposi ti on[8]={0x7f,0xbf,0xdf,0
[Microcontroller]
Design of digital tube display clock for avr single chip microcomputer
AVR 1602 LCD character movement
#include #include intrinsics.h #define uchar unsigned char #define uint unsigned int  uchar str1 ="This is a ASCII";  uchar str2 ="      Test     "; #include "1602.h" void port_init() {   PORTA=0xff;   DDRA=0xff;   PORTB=0xff;   DDRB=0xff;   PORTD=0xff;   DDRD=0xff; } void init() {   MCUCR=0x0a;
[Microcontroller]
Interface Design between Clock Chip SD2200ELP and AVR MCU
In the design of real-time online detection of the clearance of the brake shoe of the hoist, it is necessary to save the fault time and fault data. Clock chips are used in most instruments and meters, but many real-time clock chips (such as PCF8563) do not have power-off protection and require external crystal oscil
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号