README.rst
1.. zephyr:code-sample:: ocpp
2 :name: OCPP charge point
3 :relevant-api: ocpp_api
4
5 Implement an OCPP charge point that connects to a Central System server and
6 simulates the meter readings.
7
8Overview
9********
10
11Open Charge Point Protocol (OCPP) is an application protocol for communication
12between Charge Points (Electric vehicle (EV) charging stations) and a central
13management system, also known as a charging station network.
14
15This ocpp sample application for Zephyr implements the OCPP library
16and establishes a connection to an Central System server using the web socket
17
18The source code for this sample application can be found at:
19:zephyr_file:`samples/net/ocpp`.
20
21Requirements
22************
23
24- Linux machine
25- STM32 Discovery kit (32F769IDISCOVERY) or any network interface device
26- SteVe Demo Server (<https://github.com/steve-community/steve/blob/master/README.md>)
27- LAN for testing purposes (Ethernet)
28
29Configuration
30*************
31
32The sample application supports several configuration options that can be set
33via Kconfig:
34
35- ``CONFIG_NET_SAMPLE_OCPP_SERVER``: OCPP central system server IP address
36
37- ``CONFIG_NET_SAMPLE_OCPP_PORT``: OCPP central system server port number
38
39- ``CONFIG_NET_SAMPLE_OCPP_WS_PATH``: WebSocket URL path.
40
41- ``CONFIG_NET_SAMPLE_SNTP_SERVER``: SNTP server IP address to get the time
42 from network
43
44Building and Running
45********************
46
47Build the ocpp sample application like this:
48
49.. zephyr-app-commands::
50 :zephyr-app: samples/net/ocpp
51 :board: <board to use>
52 :goals: build
53 :compact:
54
55The sample application is to built and tested on
56
57.. code-block:: console
58
59 west build -b stm32f769i_disco
60 west flash
61
62The output of sample is:
63
64.. code-block:: console
65
66 *** Booting Zephyr OS build v3.6.0-rc1-37-g8c035d8f24cf ***
67 OCPP sample stm32f769i_disco
68 [00:00:02.642,000] <inf> net_dhcpv4: Received: 192.168.1.101
69 [00:00:02.642,000] <inf> main: net mgr cb
70 [00:00:02.642,000] <inf> main: Your address: 192.168.1.101
71 [00:00:02.642,000] <inf> main: Lease time: 86400 seconds
72 [00:00:02.642,000] <inf> main: Subnet: 255.255.255.0
73 [00:00:02.643,000] <inf> main: Router: 192.168.1.1
74 [00:00:07.011,000] <inf> main: cs server 122.165.245.213 8180
75 [00:00:07.011,000] <inf> main: IPv4 Address 122.165.245.213
76 [00:00:07.024,000] <inf> main: sntp succ since Epoch: 1707890823
77 [00:00:07.024,000] <inf> ocpp: upstream init
78 [00:00:07.025,000] <inf> ocpp: ocpp init success
79 [00:00:17.066,000] <inf> main: ocpp auth 0> idcon 1 status 1
80 [00:00:17.101,000] <inf> main: ocpp auth 0> idcon 2 status 1
81 [00:00:17.197,000] <inf> main: ocpp start charging connector id 1
82 [00:00:17.255,000] <inf> main: ocpp start charging connector id 2
83 [00:01:07.064,000] <inf> main: ocpp stop charging connector id 1
84 [00:01:08.063,000] <inf> main: ocpp stop charging connector id 2
85