RZ/G2L - EV Charging Station

RZ/G2L - EV Charging Station

Introduction

The user guide details the steps and instructions necessary for the implementation of the OCPP compliant EV charging station use case application on the RZ/G2L EVK using AWS Greengrass.

In the scenario of the EV charging station, the application on the RZ/G2L EVK functions as a charging station, while the infrastructure set up on the AWS cloud serves as the Central Management System (CMS). The application for the EV charging station complies with OCPP 2.0.1 standards. This application is capable of start charging, stop charging and get the meter reading during the charging.

Assumption:
Before going through the following steps, please make sure that RZ Gateway Linux environment preparation was completed.

Note:

The EV Charging Station is also compatible with Ubuntu / Debian environment tation is also compatible with Ubuntu / Debian environment and guided by EV Charging Station on Ubuntu / Debian

Architecture Description

The architecture diagram presented below illustrates the AWS services utilized in the cloud and the RZ/G2L EVK. This diagram features two environments: the AWS cloud and the RZ/G2L EVK. Both environments are interconnected through internet communication protocols, such as WebSocket.

image-20250806-011321.png

 

Step 1 - Infrastructure Setup

Important Note: About re-setting up the infrastructure
To successfully establish the infrastructure, it is essential for the user to verify that the instances created on the device and in the AWS cloud are deleted before initiating the installation process.

When resetting up the infrastructure, please follow the steps descrided in Remove the instances from both device and AWS Cloud.

Step 1.1 - AWS Credentials Preparation

AWS Credentials are necessary to establish the EV charging station use case environment on the cloud and the RZ/G2L EVK. The user must create an AWS account and log into the AWS Management Console using either the root account or an existing IAM user with administrative rights. If the user does not have an IAM user, follow the steps outlined below to create one
• Navigate to the IAM service.
• Create a new IAM user (if not have) and ensure Programmatic access is enabled during creation. This will provide an AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
• Attach appropriate policies to this IAM user to grant the necessary permissions.

image-20250806-011003.png
  1. Install AWS CLI on Host machine from AWS Documentation.

  2. Export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as environment variables on Host Machine.

  3. Run following AWS cli command to generate AWS_SESSION_TOKEN for 36 hours duration
    On Host Machine:

$ aws sts get-session-token --duration-seconds 129600

Command result:

{ "Credentials": { "AccessKeyId": "123...", "SecretAccessKey": "...", "SessionToken": "...", "Expiration": "2025-07-30T23:47:00Z" } }
  1. Copy and save the temporary AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_SESSION_TOKEN for further use.

Step 1.2 - Setup EV charging station use case infrastructure

The EVSE application requires the establishment of infrastructure on the AWS cloud and the RZ/G2L Device. On the RZ/G2L device, the application will transmit boot notifications and heartbeat signals utilizing Greengrass v2 components. On the AWS Cloud, deploy the web UI interface to facilitate interaction with the application via an EC2 instance. The web UI interface enables users to view all active stations listed. The entire infrastructure is configured using the Ansible tool, which necessitates AWS credentials for access and setup on the AWS cloud.
The EVSE package includes the evse.zip file, which contains scripts and source code for setting up the infrastructure. The evse.sh script configures the RZ/G2L EVK by using setup_ocpp_client_env.sh and subsequently executes Ansible to establish the cloud infrastructure through setup_ocpp_server_env.sh. Ansible processes the playbook.yaml to configure the AWS cloud. Follow the steps below to set up the EV charging station infrastructure on the RZ/G2L device and the AWS cloud.

On the RZ/G2L EVK:

  1. Download from GitHub page, the evse-g2l-vlp-v1.0.zip file

  2. Copy evse-g2l-vlp-v1.0.zip file to RZ/G2L /home/root

  3. Extract the zip file and remove the zip file

# unzip evse-g2l-vlp-v1.0.zip # rm evse-g2l-vlp-v1.0.zip
  1. Change directory to scripts

# cd ~/evse/scripts/
  1. Run evse.sh script by providing AWS credentials and AWS region as arguments.

# ./evse.sh <AWS_ACCESS_KEY_ID> <AWS_SECRET_ACCESS_KEY> <AWS_SESSION_TOKEN> <AWS_REGION>
  1. The script will execute approximately 30 to 40 minutes to setup the infrastructure on RZ/G2L Device and AWS cloud.

  2. During the execution of the script, it generates logs for each step. The user can review the logs sequentially as outlined below and validate the installation.

Setup on RZ/G2L EVK:

• Verifying and installing dependencies packages required for setup

image-20250806-002514.png

• Create IoT policy, IAM role, IAM policies and attach policies to IAM role.

image-20250806-002606.png

• Install Greengrass v2 on RZ/G2L EVK

image-20250806-002642.png

• Below log shows the summary of EVSE client installation

image-20250806-002720.png

Setup on AWS cloud:

• Starts executing step-2, Setting up EVSE server using Ansible

image-20250806-002801.png
  • Create EC2 instance key pair

image-20250806-002839.png
  • Create and Launch EC2 instance

image-20250806-003006.png

• Connect EC2 instance with ssh

image-20250806-003035.png

• Deploy FastAPI server into EC2

image-20250806-003124.png

• Deploy React app to EC2

image-20250806-003207.png

• Create S3 bucket policies to access S3 bucket

image-20250806-003233.png

• Create Greengrass component

image-20250806-003304.png

• On Successful completion of Step-2, the below output is shown

image-20250806-003340.png

If the installation is successful, the above message will be shown on RZG2L EVK UART console

Step 2 - Execute EV Charging Station use case

This section describes the method of interacting with the EVSE use case application. Follow the below steps to start EV charge station application on the RZ/G2L EVK.

  1. In order to interact with EV charge station application, we must access the web UI interface through a browser. To launch the web UI application, a public IP address is required. Once the infrastructure has been established, the Ansible tool records the public IP in ~/evse/scripts/ansible_start/instance_ip.txt.

On RZ/G2L EVK:

cat ~/evse/scripts/ansible_start/instance_ip.txt

54.173.73.82 (for e.g.)

  1. Open the browser and type the URL: http://<instance_ip>

For e.g. http:// 54.173.73.82

image-20250806-003747.png

Login as User

  1. The application opens log-in page. Enter username as “user” and Password as “1234” and click on log-in.

  2. From the dashboard itself we can see that CP_1 charging station is available to use for the user.

image-20250806-003827.png
  1. Now the user can select charge point CP_1 and initiate charging

image-20250806-003856.png
  1. Once clicking on the start charging button, this initiates the charging request which is sent through web socket. And the user will be notified that charging has started.

image-20250806-003924.png
  1. Whenever the user decides to stop the charging process, they can click on 'stop charging.' Upon clicking 'stop charging,' the charging will be stopped. Simultaneously, the meter reading data will be presented to the user, indicating the total energy consumption during the charging period.

    NOTE:
    It is important to note that the meter reading data consists of random values generated for the purpose of demonstrating that the meter reading functionality was achieved using the OCPP protocol.

image-20250806-004022.png

Login as Admin

  1. The application opens log-in page. Enter username as “Admin” and Password as “1234” and click on log-in.

image-20250917-225736.png
  1. Click on control center tab.

image-20250917-225808.png
  1. Select the Charge point from list.

image-20250917-225844.png
  1. Click on SET UNAVAILABLE option to disable the charge point and click on SET AVAILABLE option to enable the charge point. For example, below picture shows the disabling charge point.

image-20250917-225917.png
  1. To set the charge point charge rate, select charge point and select charge rate from the drop-down list.

image-20250917-230004.png
  1. Select SET CHARGE RATE option.

image-20250917-230034.png
  1. In the EV user application, the charge point shows modified charge rate.

Note: To know the behavior of the greengrass component (OcppChargingClient) in edge device, we can see the logs on the below location.

tail -f /greengrass/v2/logs/OcppChargingClientComponent.log
image-20250806-004230.png

Remove the instances from both device and AWS Cloud

To successfully establish the infrastructure, it is essential for the user to verify that the instances created on the device and in the AWS cloud are deleted before initiating the installation process. Follow the steps below to ensure the instances are removed.

Step 1 - Remove Greengrass core device

This section details the process of cleaning Greengrass instances on the RZ/G2L EVK and in the AWS cloud to set up the EV charging station use case on the device again. Following the steps to remove the Greengrass core device and its components.

On RZ/G2L EVK:

  • Stop the Greengrass service and remove Greengrass v2 data from the device.

systemctl stop greengrass.service rm -rf /greengrass/v2

On AWS Cloud:

  • Open AWS Greengrass console and click on Core devices

image-20250805-064033.png
  • Click on g2l_core_ocpp and click on Delete button

image-20250805-064316.png
  • Select Delete option on the popup box. The core device instance will be deleted.   

  • In Manage -> All Devices -> Things, select g2l_core_ocpp thing and click on Delete. Click on Delete thing in next page. The g2l_core_ocpp thing will be deleted.

image-20250805-071538.png

Step 2 - Remove Greengrass components

  • In Greengrass Devices -> Components, click on OcppChargingClientComponent

image-20250805-071750.png
  • Click on Delete version and select Delete on popup box

image-20250805-071825.png

Step 3 - Remove EC2 Instance and Key pair

Open EC2 instance console

Click on Instances -> Instances, Select ota-server instance

image-20250806-000843.png

• Select Stop Instance in the Instance State list. And click Stop button on popup box. The instance state will be changed from Running to Stopped

image-20250806-000930.png

• Select Terminate (delete) Instance in the Instance State list. And click on Terminate (delete) button on the popup box. The instance state will be changed from Stopped to Terminated.

image-20250806-001010.png

• In EC2 -> Network & Security -> Key Pairs, Select ota-server-key and select Delete in the Actions list. Type Delete in popup box. The EC2 instance ota-server-key will be deleted.

image-20250806-001251.png

Now, the device and cloud are ready to setup the infrastructure for EV charging station use case.