Logo

dev-resources.site

for different kinds of informations.

How Developers Enable EV Chargers to Communicate with Mobile Apps

Published at
1/16/2025
Categories
webdev
javascript
python
programming
Author
lovestaco
Author
9 person written this
lovestaco
open
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": [ ... ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

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

await client.call(
  'RemoteStartTransaction',
  remoteStartTransactionBody
);
Enter fullscreen mode Exit fullscreen mode

Step 2: Charger Responds

The charger acknowledges the command with a response:

{"status": "Accepted"}
Enter fullscreen mode Exit fullscreen mode

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"
}
Enter fullscreen mode Exit fullscreen mode

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" }
      ]
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

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 }
);
Enter fullscreen mode Exit fullscreen mode

Step 2: Charger Responds

The charger acknowledges with:

{"status": "Accepted"}
Enter fullscreen mode Exit fullscreen mode

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" }
      ]
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

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.

javascript Article's
30 articles in total
JavaScript is a versatile language for web development, enabling interactive and dynamic user experiences across all major browsers.
Favicon
7 Developer Tools That Will Boost Your Workflow in 2025
Favicon
LeetCode Challenge: 242. Valid Anagram - JavaScript Solution 🚀
Favicon
How Developers Enable EV Chargers to Communicate with Mobile Apps
Favicon
Learn how to create an accordion with Tailwind CSS and JavaScript
Favicon
🚀 Boost your JavaScript expertise! Master dynamic apps with observers – from event listeners to RxJS and beyond. Explore how JavaScript's observables transform your code into a powerhouse of interactivity and efficiency!
Favicon
Optimizing Mobile Performance and Media Loading for a Dynamic Website
Favicon
Understanding Statement Coverage in Software Testing
Favicon
Diff JSON: Simplifying JSON Comparisons
Favicon
API Rate Limiting in Node.js: Strategies and Best Practices
Favicon
Sharing Runes in Svelte 5 with the Rune Class
Favicon
Introduction to TypeScript for JavaScript Developers
Favicon
11 real-life PWA examples you can learn from in 2025
Favicon
[React]Props tip: the relationship between function parameter and attribute
Favicon
Buy verified cash app account
Favicon
JavaScript Security Best Practices: Prevent Vulnerabilities | Mbloging
Favicon
Understanding Observers in JavaScript: A Comprehensive Guide
Favicon
Test Case Generator: Revolutionizing Software Testing
Favicon
AI TRISM: Transforming Artificial Intelligence Governance
Favicon
Understanding Code Coverage in Software Testing
Favicon
[Boost]
Favicon
Cómo Iniciar y Crecer como Desarrollador Frontend en 2025
Favicon
Building bun-tastic: A Fast, High-Performance Static Site Server (OSS)
Favicon
My React Journey: Project
Favicon
Is JavaScript Still Relevant?
Favicon
From Challenge to Creation: Building a Blog Post Generator with AWS and React
Favicon
How to Use JavaScript to Reduce HTML Code: A Simple Example
Favicon
Poemio
Favicon
NPM vs Yarn vs PNPM: Choosing the Right Package Manager
Favicon
Easy Discount Calculation: Tax, Fees & Discount Percentage Explained
Favicon
LogLayer: A Modern Logging Library for TypeScript / JavaScript

Featured ones: