Research on the basic principles and applications of AtmelAVR Flash microcontrollers in automobiles

Publisher:剑戟辉煌Latest update time:2020-09-15 Source: dzscKeywords:Atmel Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  Automatically closing power windows or doors on vehicles 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.


  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 or mid-size cars will be 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 designed 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; 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 a safe 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 expensive and limit the style of window/door design), or non-directional measurement through physical monitoring (this is a cost-effective solution overall).


  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; 100 N of applied force; 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

  It must be possible to calculate the force applied to the glass from the motor current and to provide continuous information on the position of the moving part in terms of speed. These parameters can be used to determine whether 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: Perform an initial learning sequence and store the torque values ​​in memory. This technique is memory intensive and requires a defined calibration sequence.


  – 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 end 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, detection and storage of blocking points 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, known position, etc. If a default value is given 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 (the 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, derives the speed and motor current reference by counting consecutive direction changes, and 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...)

  The average of the eight sampling points is calculated and 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:Atmel Reference address:Research on the basic principles and applications of AtmelAVR Flash microcontrollers in automobiles

Previous article:Atmel Studio 7.0 Quick Start Guide (Based on ASF)
Next article:Example of ATmega16 driving spi interface 128x64 screen written by MikroC

Latest Microcontroller Articles
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号