How Developers Enable EV Chargers to Communicate with Mobile Apps

In the world of electric vehicles (EVs), one of the most magical experiences for an EV driver is tapping "Start" on their mobile app and watching the charger come to life. But how does that magic happen? Let’s dive into the behind-the-scenes journey of how EV chargers and mobile apps communicate. The Players in the Game Mobile App: This is where the user initiates actions, like starting or stopping the charging session. Backend Server: The brains behind the operation, coordinating communication between the app and the charger. EV Charger: The hardware that delivers the juice to your EV. The communication between these players follows a standardized protocol called OCPP (Open Charge Point Protocol). Specifically, most systems use OCPP over WebSocket, which ensures real-time, reliable communication. Starting the Charging Process Step 1: User Hits “Start” in the App The process begins when a user taps the “Start” button. The backend server prepares a RemoteStartTransaction command with the following details: { "connectorId": 1, "idTag": "remote-11902", "chargingProfile": { "transactionId": 11902, "chargingProfileId": 1, "stackLevel": 1, "chargingProfilePurpose": "TxProfile", "chargingProfileKind": "Relative", "chargingSchedule": { "chargingRateUnit": "A", "chargingSchedulePeriod": [ ... ] } } } This command is sent to the charger via the backend using an RPC call: await client.call( 'RemoteStartTransaction', remoteStartTransactionBody ); Step 2: Charger Responds The charger acknowledges the command with a response: {"status": "Accepted"} This indicates the charger is ready to begin the transaction. Step 3: Charger Sends StartTransaction When the charger is fully prepared, it sends a StartTransaction message back to the backend: { "connectorId": 1, "idTag": "remote-11902", "meterStart": 0, "timestamp": "2025-01-15T02:09:54.000Z" } Monitoring the Charging Session Throughout the charging session, the charger periodically sends MeterValues updates, which include metrics like voltage, current, and energy delivered. These updates can be configured to occur every 30 seconds or at a different interval: { "connectorId": 1, "transactionId": 11902, "meterValue": [ { "timestamp": "2025-01-15T02:09:54.000Z", "sampledValue": [ { "value": "241.10", "measurand": "Voltage", "unit": "V" }, { "value": "0.00", "measurand": "Current.Import", "unit": "A" }, { "value": "0", "measurand": "Power.Active.Import", "unit": "W" }, { "value": "32", "measurand": "Current.Offered", "unit": "A" } ] } ] } Stopping the Charging Process Step 1: User Hits “Stop” in the App When the user taps “Stop,” the backend sends a RemoteStopTransaction command to the charger: await client.call( 'RemoteStopTransaction', { transactionId: 11902 } ); Step 2: Charger Responds The charger acknowledges with: {"status": "Accepted"} Step 3: Charger Sends StopTransaction After completing the shutdown, the charger sends a StopTransaction message with details like the total energy delivered: { "idTag": "remote-11902", "timestamp": "2025-01-15T02:40:49", "meterStop": 6379, "reason": "EVDisconnected", "transactionId": 11902, "transactionData": [ { "timestamp": "2025-01-15T02:40:49", "sampledValue": [ { "value": "6379.259277", "measurand": "Energy.Active.Import.Register", "unit": "Wh" } ] } ] } What’s a Connector? Just like a gas pump might have different nozzles for diesel or gasoline, EV chargers can have multiple connectors. Common types include: CCS2: Popular in Europe and North America. CHAdeMO: Common in Japan. Mennekes (Type 2): Widely used in Europe. Each connector operates independently, allowing one charger to serve multiple vehicles. OCPP OCPP (Open Charge Point Protocol) is an open communication standard designed for the interaction between electric vehicle (EV) charging stations (charge points) and central management systems (often referred to as backend systems or charge point management systems). It enables interoperability between charging infrastructure from different manufacturers and software providers. Versions of OCPP: OCPP 1.5: Early version, still in use in some older systems. OCPP 1.6: Widely adopted, supports both SOAP and WebSocket communication. OCPP 2.0 & 2.0.1: Enhanced versions with more features like improved security (TLS), support for smart charging, better diagnostics, and firmware management. Key Use Cases: Charging Station Management: Remote monitoring, troubleshooting, and firmware updates for charging stations. Smart Charging: Enables load balancing, scheduling/ pre-booking and integration with energy grids. Payment Integration:

Jan 16, 2025 - 06:39
How Developers Enable EV Chargers to Communicate with Mobile Apps

In the world of electric vehicles (EVs), one of the most magical experiences for an EV driver is tapping "Start" on their mobile app and watching the charger come to life.

But how does that magic happen?

Let’s dive into the behind-the-scenes journey of how EV chargers and mobile apps communicate.

The Players in the Game

  1. Mobile App: This is where the user initiates actions, like starting or stopping the charging session.
  2. Backend Server: The brains behind the operation, coordinating communication between the app and the charger.
  3. EV Charger: The hardware that delivers the juice to your EV.

The communication between these players follows a standardized protocol called OCPP (Open Charge Point Protocol). Specifically, most systems use OCPP over WebSocket, which ensures real-time, reliable communication.

Image description

Starting the Charging Process

Step 1: User Hits “Start” in the App

The process begins when a user taps the “Start” button. The backend server prepares a RemoteStartTransaction command with the following details:

{
  "connectorId": 1,
  "idTag": "remote-11902",
  "chargingProfile": {
    "transactionId": 11902,
    "chargingProfileId": 1,
    "stackLevel": 1,
    "chargingProfilePurpose": "TxProfile",
    "chargingProfileKind": "Relative",
    "chargingSchedule": {
      "chargingRateUnit": "A",
      "chargingSchedulePeriod": [ ... ]
    }
  }
}

This command is sent to the charger via the backend using an RPC call:

await client.call(
  'RemoteStartTransaction',
  remoteStartTransactionBody
);

Step 2: Charger Responds

The charger acknowledges the command with a response:

{"status": "Accepted"}

This indicates the charger is ready to begin the transaction.

Step 3: Charger Sends StartTransaction

When the charger is fully prepared, it sends a StartTransaction message back to the backend:

{
  "connectorId": 1,
  "idTag": "remote-11902",
  "meterStart": 0,
  "timestamp": "2025-01-15T02:09:54.000Z"
}

Monitoring the Charging Session

Throughout the charging session, the charger periodically sends MeterValues updates, which include metrics like voltage, current, and energy delivered. These updates can be configured to occur every 30 seconds or at a different interval:

{
  "connectorId": 1,
  "transactionId": 11902,
  "meterValue": [
    {
      "timestamp": "2025-01-15T02:09:54.000Z",
      "sampledValue": [
        { "value": "241.10", "measurand": "Voltage", "unit": "V" },
        { "value": "0.00", "measurand": "Current.Import", "unit": "A" },
        { "value": "0", "measurand": "Power.Active.Import", "unit": "W" },
        { "value": "32", "measurand": "Current.Offered", "unit": "A" }
      ]
    }
  ]
}

Stopping the Charging Process

Step 1: User Hits “Stop” in the App

When the user taps “Stop,” the backend sends a RemoteStopTransaction command to the charger:

await client.call(
  'RemoteStopTransaction',
  { transactionId: 11902 }
);

Step 2: Charger Responds

The charger acknowledges with:

{"status": "Accepted"}

Step 3: Charger Sends StopTransaction

After completing the shutdown, the charger sends a StopTransaction message with details like the total energy delivered:

{
  "idTag": "remote-11902",
  "timestamp": "2025-01-15T02:40:49",
  "meterStop": 6379,
  "reason": "EVDisconnected",
  "transactionId": 11902,
  "transactionData": [
    {
      "timestamp": "2025-01-15T02:40:49",
      "sampledValue": [
        { "value": "6379.259277", "measurand": "Energy.Active.Import.Register", "unit": "Wh" }
      ]
    }
  ]
}

What’s a Connector?

Just like a gas pump might have different nozzles for diesel or gasoline, EV chargers can have multiple connectors. Common types include:

  • CCS2: Popular in Europe and North America.
  • CHAdeMO: Common in Japan.
  • Mennekes (Type 2): Widely used in Europe.

Each connector operates independently, allowing one charger to serve multiple vehicles.

Image description

OCPP

OCPP (Open Charge Point Protocol) is an open communication standard designed for the interaction between electric vehicle (EV) charging stations (charge points) and central management systems (often referred to as backend systems or charge point management systems).

It enables interoperability between charging infrastructure from different manufacturers and software providers.

Versions of OCPP:

  • OCPP 1.5: Early version, still in use in some older systems.
  • OCPP 1.6: Widely adopted, supports both SOAP and WebSocket communication.
  • OCPP 2.0 & 2.0.1: Enhanced versions with more features like improved security (TLS), support for smart charging, better diagnostics, and firmware management.

Key Use Cases:

  1. Charging Station Management: Remote monitoring, troubleshooting, and firmware updates for charging stations.
  2. Smart Charging: Enables load balancing, scheduling/ pre-booking and integration with energy grids.
  3. Payment Integration: Allows charging stations to interact with payment gateways and manage user accounts.
  4. Analytics and Reporting: Helps operators analyze usage patterns and optimize operations.

How OCPP Works:

OCPP defines message structures and communication protocols between the charge point and the central system. For example:

  • A charge point sends messages about its status, energy consumption, or errors.
  • The central system can send commands to start/stop charging, update firmware, or perform diagnostics.

OCPP is managed by the Open Charge Alliance (OCA), which continues to develop and promote the protocol.

Packeges

  1. Python: mobilityhouse/ocpp
  2. Javascript: mikuso/ocpp-rpc

Wrapping It Up

Every time you start or stop charging from your app, a series of precise, real-time messages flow between your app, the backend, and the charger.

The OCPP protocol makes it all possible, ensuring that chargers and apps from different manufacturers can work together seamlessly.

So, next time you plug in your EV and tap “Start,” you’ll know a little more about the magic behind the scenes!

I’ve been working on a super-convenient tool called LiveAPI.

It’s designed to make API documentation effortless for developers.

With LiveAPI, you can quickly generate interactive API documentation that allows users to execute APIs directly from the browser.

Image description

If you’re tired of manually creating docs for your APIs, this tool might just make your life easier.