MartinFowler

Automotive Simulation Control System_ Lichuang & Renesas Training Camp

 
Overview
"Automotive Simulation Control System" Engineering Technology Report
 
1. Work Overview
1.1 Function Overview
  This project uses Renesas MCU as the main control to create a car simulation control system. Through the logic design of the circuit, it simulates car startup, front and rear gears, speed gears, throttle, Braking, speed light indication and screen display, speed warning, left and right steering, headlights, reversing lights, brake lights, whistle, emergency double flash and other functions.
 
1.2 Actual picture
 
 
2. Technical details
2.1 Function module
  The car simulation control system has start, front and rear gears, speed gears, accelerator, brake, speed display, overspeed warning, left and right steering, headlights, reversing lights, brake lights, and whistle. , double flash and more than ten functions. See Figure 2.1 for details
 
Figure 2.1 "Automotive Simulation Control System" functional module schematic
 
2.2 Schematic description
  The circuit schematic is shown in Figure 2.2, drawn according to the functional modules, including power module, main control module, debugging interface, accelerator and brake module, forward Reversing module, speed display module, whistle circuit, turn signal and emergency double flash module, reset circuit, reserved test interface, etc.
 
 
2.3 PCB design
  PCB design is shown in Figure 2.3.
 
   
  (a) (b) (c)
Figure 2.3 "Automobile Simulation Control System" PCB design drawing
(a) Wiring diagram (b) 2D diagram (c) 3D diagram
  The functional distribution of the PCB is mainly divided into four parts, namely the operating console , instrument panel, car display, and other components, as shown in Figure 2.4.
 
Figure 2.4 "Automotive Simulation Control System" PCB Function Distribution Figure
 
 
2.4 Software Description
   The main control chip is Renesas R7FA2E1A72DFL. The main control program is written using e2 studio. It mainly uses I2C external OLED screen, ADC analog signal acquisition and GPIO functions. The pin definition is shown in Figure 2.5.
 
Figure 2.5 Renesas R7FA2E1A72DFL pin diagram
 
  core code is as follows (see attachment for detailed code):
 void hal_entry(void)
{
    //ADC samples vehicle speed and displays
...
 while(1)
    {
...
        (void) R_ADC_ScanStart(&g_adc0_ctrl );
 ...
        err =R_ADC_Read(&g_adc0_ctrl, ADC_CHANNEL_7, &adc_data1);
        assert(FSP_SUCCESS == err);
        a0=(adc_data1/4095.0)*5;
        R_BSP_SoftwareDelay (20, BSP_DELAY_UNITS_MILLISECONDS);
        if(a0<=0.1)// zero
       {
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_00, BSP_IO_LEVEL_LOW);//speed low
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_01, BSP_IO_LEVEL_LOW);//speed middle R_IOPORT_PinWrite(&g_speedioport_ctrl, BSP_IO_PORT_01_PIN_02, BSP_IO_LEVEL_LOW)
            ;//speed high
       }
        if((a0>0.1) & (a0<1))//speed low
        {
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_00, BSP_IO_LEVEL_HIGH);//speed low
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_01, BSP_IO_LEVEL_LOW);//speed middle R_IOPORT_PinWrite (&g_ioport_ctrl, BSP_IO_PORT_01_PIN_02, BSP_IO_LEVEL_LOW)
            ;//speed high
    }
        if((a0>=1) & (a0<2))//speed middle
        {
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_00, BSP_IO_LEVEL_HIGH);//speed low
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_01, BSP_IO_LEVEL_HIGH);/ /speed middle
            R_IOPORT_PinWrite( &g_ioport_ctrl, BSP_IO_PORT_01_PIN_02, BSP_IO_LEVEL_LOW);//speed high
          }
        if((a0>=2) & (a0<3))//speed high
        {
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_00,BSP_IO_LEVEL_HIGH);//speed low
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_01, BSP_IO_LEVEL_HIGH);//speed middle
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_02, BSP_IO_LEVEL_HIGH);//speed high
         }
      if(a0>=3)//超速声光警告
        {             
      R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_00, BSP_IO_LEVEL_HIGH);
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_01, BSP_IO_LEVEL_HIGH);
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_02, BSP_IO_LEVEL_HIGH);
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_04, BSP_IO_LEVEL_LOW);//蜂鸣器响
            R_BSP_SoftwareDelay (100 , BSP_DELAY_UNITS_MILLISECONDS);
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_00, BSP_IO_LEVEL_LOW);//speed low
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_01, BSP_IO_LEVEL_LOW);//speed middle
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_02, BSP_IO_LEVEL_LOW);//speed high
            R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_04, BSP_IO_LEVEL_HIGH);//蜂鸣器不响
            R_BSP_SoftwareDelay (100 , BSP_DELAY_UNITS_MILLISECONDS);
            continue;
          }
    //twinkle转向灯
    R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_03, BSP_IO_LEVEL_HIGH);
    R_BSP_SoftwareDelay (500 , BSP_DELAY_UNITS_MILLISECONDS);
    R_IOPORT_PinWrite(&g_ioport_ctrl, BSP_IO_PORT_01_PIN_03, BSP_IO_LEVEL_LOW);
    R_BSP_SoftwareDelay ( 500 , BSP_DELAY_UNITS_MILLISECONDS);
    }
...
}
 
 
3. 实物展示说明
3.1 电源模块
  该作品供电接口有Type-C和接线柱2种,供电电压5V,并接有5.1V稳压管确保系统电压处于安全范围,接通后电源指示红灯亮,仪表盘车辆启动绿灯亮。同时设置了5秒开机动画灯功能,仪表盘速度等有规律闪亮(详见视频《升级功能1:汽车启动动画灯》)。如图3.1所示:
 
1111

MicrosoftInternetExplorer402DocumentNotSpecified7.8 磅Normal0
图3.1  电源模块
 
3.2 车前灯控制
   车前灯开启时,仪表盘前灯指示绿灯亮,车前白灯(×2)亮(详见主视频《汽车模拟控制系统》实物演示)。如图3.2所示:



































































































































































































































































 
1111

MicrosoftInternetExplorer402DocumentNotSpecified7.8 磅Normal0
图3.2  车前灯控制
 
 
3.3 前进和倒车模块
档位拨动至前进档时,仪表盘前进指示绿灯亮。如图3.3所示:
 


参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-05-15 00:35:59

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

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号