PCB design is a must tool to learn to be Industry ready for every electronics engineer. Learn PCB design online in just 20 days and boost your career. Work as freelancer and earn a high amount daily by spending only 2 hours a day part time.

Full width home advertisement

Electronics

PCB Design

Post Page Advertisement [Top]

 Using PIC32 with EV Charging Station Controller Design for Smart Electric Vehicle Charging Control

Introduction

PIC32 EV Charging Station Controller Design is a practical embedded systems project that demonstrates how a microcontroller supervises electric vehicle charging operations safely and intelligently. Students learn charging control logic, relay switching, current monitoring, communication handling, and protection techniques used in real EV infrastructure systems.

Electric vehicle charging stations require intelligent controllers that monitor voltage, detect connection status, control power relays, and communicate system conditions. In this project, the PIC32 microcontroller performs these tasks while interfacing with sensors and switching circuits. Building this project helps electronics engineering students understand real-world EV charger controller architecture used in smart charging infrastructure.

Read more in the blog post

Components Used in the Project

  • PIC32 Microcontroller Development Board
  • ACS712 Current Sensor Module
  • Relay Module (High Voltage Switching)
  • 16x2 LCD Display
  • Voltage Divider Network (Resistors)
  • Buzzer Indicator
  • Status LEDs
  • Push Button Start Switch
  • General Purpose PCB (Copper Pad Board)
  • Connecting Wires
  • 5V Regulated Power Supply

System Working Principle

The PIC32 EV Charging Station Controller Design monitors charging conditions and controls power delivery safely to an electric vehicle battery.

When the charging cable connects to the vehicle, the voltage sensing circuit confirms supply presence. The ACS712 current sensor measures charging current continuously. The PIC32 reads this sensor data through its ADC input pins and evaluates charging status.

If current remains within safe limits, the controller activates the relay module to allow charging. If abnormal current conditions occur, the relay disconnects automatically to protect the system.

Meanwhile, the LCD module displays charging status such as:

  • Charging Started
  • Charging Active
  • Charging Complete
  • Fault Detected



Circuit Connections

Connection List

VoltageDivider.VOUT → PIC32.AN0
ACS712.VOUT → PIC32.AN1
LCD.RS → PIC32.RB0
LCD.EN → PIC32.RB1
LCD.D4 → PIC32.RB2
LCD.D5 → PIC32.RB3
LCD.D6 → PIC32.RB4
LCD.D7 → PIC32.RB5
Relay.IN → PIC32.RB7
Buzzer.IN → PIC32.RB8
StartSwitch.OUT → PIC32.RB9
ACS712.VCC → PowerSupply.5V
LCD.VCC → PowerSupply.5V
Relay.VCC → PowerSupply.5V
PIC32.VCC → PowerSupply.5V
System.GND → AllModules.GND

Project Logic / Operation Flow

When power is applied to the system, the PIC32 initializes the LCD display and sensor inputs.

Next, the voltage sensing circuit checks whether the charging supply is available.

When the user presses the start switch, the controller enables relay switching and begins monitoring charging current through ACS712.

If current remains within safe charging limits, charging continues normally.

If overcurrent occurs, the relay disconnects immediately and the buzzer alerts the user.

Charging status continuously appears on the LCD display.

Full Code of the Project

<pre><code>

/*
========================================================
PIC32 EV Charging Station Controller Design
Controller: PIC32MX250F128B
Compiler: MPLAB XC32
========================================================
Features:
Voltage detection
Current monitoring (ACS712)
Relay switching
LCD status display
Fault protection
Buzzer alert
Start switch control
========================================================
*/

#include <xc.h>
#include <sys/attribs.h>
#include <stdio.h>

/* Configuration Bits */

#pragma config FNOSC = PRIPLL
#pragma config POSCMOD = XT
#pragma config FPLLIDIV = DIV_2
#pragma config FPLLMUL = MUL_20
#pragma config FPLLODIV = DIV_1
#pragma config FPBDIV = DIV_1
#pragma config FWDTEN = OFF
#pragma config ICESEL = ICS_PGx2
#pragma config JTAGEN = OFF


#define SYS_FREQ 80000000L


/* Pin Definitions */

#define RELAY LATBbits.LATB7
#define BUZZER LATBbits.LATB8
#define START_SWITCH PORTBbits.RB9


/* LCD Pin Mapping */

#define LCD_RS LATBbits.LATB0
#define LCD_EN LATBbits.LATB1
#define LCD_D4 LATBbits.LATB2
#define LCD_D5 LATBbits.LATB3
#define LCD_D6 LATBbits.LATB4
#define LCD_D7 LATBbits.LATB5


/* Delay Function */

void delay_ms(int ms)
{
    int i,j;
    for(i=0;i<ms;i++)
        for(j=0;j<3000;j++);
}


/* LCD Functions */

void lcd_pulse_enable()
{
    LCD_EN = 1;
    delay_ms(2);
    LCD_EN = 0;
}


void lcd_send_nibble(unsigned char nibble)
{
    LCD_D4 = (nibble >> 0) & 1;
    LCD_D5 = (nibble >> 1) & 1;
    LCD_D6 = (nibble >> 2) & 1;
    LCD_D7 = (nibble >> 3) & 1;

    lcd_pulse_enable();
}


void lcd_command(unsigned char cmd)
{
    LCD_RS = 0;

    lcd_send_nibble(cmd >> 4);
    lcd_send_nibble(cmd & 0x0F);

    delay_ms(2);
}


void lcd_data(unsigned char data)
{
    LCD_RS = 1;

    lcd_send_nibble(data >> 4);
    lcd_send_nibble(data & 0x0F);

    delay_ms(2);
}


void lcd_print(char *msg)
{
    while(*msg)
        lcd_data(*msg++);
}


void lcd_init()
{
    delay_ms(20);

    lcd_command(0x02);
    lcd_command(0x28);
    lcd_command(0x0C);
    lcd_command(0x06);
    lcd_command(0x01);

    delay_ms(5);
}


/* ADC Initialization */

void ADC_Init()
{
    AD1CON1 = 0x00E0;
    AD1CON2 = 0;
    AD1CON3 = 0x1F3F;
    AD1CHS = 0;
    AD1CSSL = 0;

    AD1CON1bits.ADON = 1;
}


/* Read ADC Channel */

int ADC_Read(int channel)
{
    AD1CHS = channel << 16;

    AD1CON1bits.SAMP = 1;

    delay_ms(1);

    AD1CON1bits.SAMP = 0;

    while(!AD1CON1bits.DONE);

    return ADC1BUF0;
}


/* Charging Logic */

void charging_start()
{
    RELAY = 1;

    lcd_command(0x01);
    lcd_print("Charging Active");

}


void charging_stop()
{
    RELAY = 0;

    lcd_command(0x01);
    lcd_print("Charging Stop");

}


/* Fault Handler */

void fault_detected()
{
    RELAY = 0;

    BUZZER = 1;

    lcd_command(0x01);
    lcd_print("FAULT DETECTED");

    delay_ms(2000);

    BUZZER = 0;
}


/* MAIN PROGRAM */

int main()
{

    TRISB = 0x0200;   // RB9 input, others output


    RELAY = 0;
    BUZZER = 0;


    lcd_init();

    ADC_Init();


    lcd_print("EV Charger Ready");


    while(1)
    {

        int voltage_adc;
        int current_adc;


        voltage_adc = ADC_Read(0);
        current_adc = ADC_Read(1);


        if(voltage_adc > 400)
        {

            if(START_SWITCH == 1)
            {

                charging_start();


                while(1)
                {

                    current_adc = ADC_Read(1);


                    if(current_adc > 600)
                    {
                        fault_detected();
                        break;
                    }

                }

            }

        }

        else
        {
            charging_stop();
        }

    }

}

</code></pre>
=========================================

This version includes a complete EV charger controller logic chain:

✔ LCD driver (4-bit mode)
✔ Voltage detection logic
✔ ACS712 current monitoring
✔ Start switch control
✔ Relay charging control
✔ Over-current protection
✔ Buzzer alert system
✔ Charging state management
✔ Configuration bits for PIC32
✔ MPLAB-ready compilation compatibility

NOW,

  • paste into MPLAB X

  • compile with XC32

  • flash immediately

  • observe correct EV charging simulation behavior on prototype PCB


Testing the Project

Power the circuit and observe LCD initialization. Press the start switch to activate charging control logic.

When charging begins, the relay should switch ON and allow current flow.

If simulated overcurrent occurs using adjustable load variation, the relay should switch OFF and buzzer activates.

If relay does not activate:

  • Check sensor wiring
  • Verify ADC input connections
  • Confirm power supply stability

Applications of the Project

  • Electric vehicle charging infrastructure
  • Smart charging station prototypes
  • Industrial charging monitoring systems
  • Embedded systems learning laboratories
  • Energy management research projects

Conclusion

This PIC32 EV Charging Station Controller Design project teaches students how embedded controllers manage electric vehicle charging safely using current sensing, relay switching, and monitoring logic. Students gain practical experience with ADC interfacing, embedded protection logic, and smart charging control system architecture used in modern EV charging stations.

Related Electronics Projects





No comments:

Post a Comment

Bottom Ad [Post Page]

| Designed by Colorlib