Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
7d1d298
add plain ESP32 Devkit v1 build Target
May 24, 2021
5966b50
add plain ESP32 Devkit v1 build Target, add phase switching, add API …
May 24, 2021
f759744
add embedded storage for web content
May 24, 2021
72ed7c9
make oled.h depend on OLED define
May 24, 2021
fbd77b8
fix numPhases display
May 24, 2021
c13b555
use better partition layout for small ESP32
May 24, 2021
c4a8dbc
properly remove rfid and oled code from build
May 24, 2021
bc61b12
remove 4-20ma/ModbusMaster from deps
May 24, 2021
6d57543
Update README.md
baycom May 24, 2021
28e4c8c
switchNumPhases: increase pre switch delay
May 26, 2021
3926042
updated README.md
May 26, 2021
856c034
reworked switchNumPhases to deactivate and reactivate EVSE properly, …
May 26, 2021
8d279b2
Update README.md
baycom May 26, 2021
e545c05
Update README.md
baycom May 26, 2021
a54db4c
Update README.md
baycom May 26, 2021
7594a64
reset CPIntPin on reboot
May 27, 2021
c4d08ea
Merge branch 'master' of https://github.com/baycom/SimpleEVSE-WiFi
May 27, 2021
010630b
add numPhases to parameters
May 27, 2021
4a401b5
fix api requests (double request->send)
May 27, 2021
78df541
simplify phase status
May 28, 2021
0790e31
add numPhases and meteringFactor to modbus regs
May 31, 2021
b418409
add numPhases and meteringFactor to modbus regs
May 31, 2021
98869d2
add phase switching to current modal
Jun 1, 2021
742670d
change API call 'meteringFactor' to 'meterFactor'
Jun 1, 2021
12af450
change API call 'meteringFactor' to 'meterFactor', add websocket call…
Jun 1, 2021
aa0f945
Add numPhases to getParameters description
baycom Jun 1, 2021
2de83ba
added schematic
Jun 2, 2021
f4ab0c2
Merge branch 'master' of https://github.com/baycom/SimpleEVSE-WiFi
Jun 2, 2021
b1a90c0
prefix ESP32 Pins with GPIO
Jun 2, 2021
26eb1c9
fixed minor flaw in schematic
Jun 4, 2021
1df3676
fixed minor flaw in schematic
Jun 4, 2021
8f9ac12
make MODBUSIP optional by define
Jun 7, 2021
624da52
make MODBUSIP optional by define, add esp_task_wdt_reset to prevent a…
Jun 7, 2021
f92d6cd
updated to latest official version
simplest-circuits Dec 19, 2022
59f566d
merged official 2.3.0
simplest-circuits Dec 29, 2022
708c6db
a lot of small changes to get everything together
simplest-circuits Dec 30, 2022
a4d89c4
minor changes to present HTML content correctly
simplest-circuits Dec 31, 2022
b5ea06c
fixed html-content for PhaseSwitchHandling
simplest-circuits Jan 1, 2023
22d8fe8
added wdt-resets on main.cpp
simplest-circuits Jan 2, 2023
94476ff
Merge pull request #1 from simplest-circuits/master
baycom Jan 2, 2023
00468f5
successfully implemented OLED SSD1306
simplest-circuits Jan 5, 2023
aefd13d
added pcb-layout
simplest-circuits Jan 5, 2023
9f47703
Update README.md
simplest-circuits Jan 5, 2023
7c3989b
Update README.md
simplest-circuits Jan 5, 2023
e3025f4
Merge pull request #2 from simplest-circuits/master
baycom Jan 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
134 changes: 105 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
# This fork...
... contains the latest official release on github (v2.3.0) of the original source code + the phase switching feature from the baycom fork.
There are various slight modifications in many parts of the code, to get everything working.
The code can be compiled for an ESP32 or NodeMCU-32s and runs without issues. I also added the support for a cheap OLED SSD1306 and also a breakout PCB to simplify the connections.

Tested with:
- SimpleEVSE WB
- OLED SSD1303 (1.3")
- SDM 630 Modbus v2
- NodeMCU-32S Kit with external antenna (AZDelivery)
- 3.3V Relaisboard (important ***3.3V*** otheriwse it will not switch!!)


# SimpleEVSE-WiFi

💬 [German version](https://www.evse-wifi.de/dokumentation/)
Expand All @@ -13,7 +26,7 @@ EVSE-WiFi brings WiFi functionality to your EVSE WB/DIN to control your Charging

If you want to support this project, I would be very happy about a donation.

[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/pools/c/85c7xRbeay)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/evsewifi)

## Main Features

Expand Down Expand Up @@ -72,35 +85,35 @@ SimpleEVSE-WiFi supports not only the control of the EVSE WB but also the use of
##### Mandatory
This wiring is mandatory and absolutely needed to run SimpleEVSE-WiFi

ESP8266-Pin | ESP8266-GPIO | EVSE WB
----------- | ----------- | -----------
D1 | GPIO5 | TX
D2 | GPIO4 | RX
GND | | GND
ESP8266-Pin | ESP8266-GPIO | EVSE WB | ESP32 DEVKIT V1
----------- | ----------- | ----------- | -----------
D1 | GPIO5 | TX | GPIO21
D2 | GPIO4 | RX | GPIO22
GND | | GND | GND

##### Button (optional)
ESP8266-Pin | ESP8266-GPIO | Button
----------- | ----------- | -----------
D4 | GPIO2 | Pin 1
GND | | Pin 2
ESP8266-Pin | ESP8266-GPIO | Button | ESP32 DEVKIT V1
----------- | ----------- | ----------- | -----------
D4 | GPIO2 | Pin 1 | 16
GND | | Pin 2| GND

##### S0 Electicity Meter (optional)*
ESP8266-Pin | ESP8266-GPIO | electricity meter
----------- | ----------- | -----------
D3 | GPIO0 | S0+
GND | | S0-
ESP8266-Pin | ESP8266-GPIO | electricity meter | ESP32 DEVKIT V1
----------- | ----------- | ----------- | -----------
D3 | GPIO0 | S0+ | GPIO17
GND | | S0- | GND

##### LED (optional)
ESP8266-Pin | ESP8266-GPIO | LED
----------- | ----------- | -----------
D0 | GPIO16 | Anode (+)
GND | | Kathode (-)
ESP8266-Pin | ESP8266-GPIO | LED | ESP32 DEVKIT V1
----------- | ----------- | ----------- | -----------
D0 | GPIO16 | Anode (+) | GPIO2
GND | | Kathode (-) | GND

##### Modbus Electicity Meter (optional)**
TTL->RS485 | ESP8266-Pin
TTL->RS485 | ESP32-Pin
----------- | -----------
RX | RX
TX | TX
RX | 14
TX | 34
VCC | 5V
GND | GND

Expand All @@ -109,17 +122,30 @@ TTL->RS485 | Modbus Meter
A+ | A
B- | B

##### OLED SSD1306 **
OLED | ESP32-Pin
----------- | -----------
CS | 25
DC | 26
VCC | 5V
GND | GND


##### Phase switching (optional)**
ESP32 DEVKIT V1
----------- |
GPIO32 |
GND |

##### RC522 RFID-Reader (optional)
ESP8266-Pin | ESP8266-GPIO | RC522
----------- | ----------- | -----------
D5 | GPIO14 | SCK
D6 | GPIO12 | MISO
D7 | GPIO13 | MOSI
D8 | GPIO15 | SDA
GND | | GND
3.3V | | 3.3V
ESP8266-Pin | ESP8266-GPIO | RC522 | ESP32 DEVKIT V1
----------- | ----------- | ----------- | -----------
D5 | GPIO14 | SCK | GPIO18
D6 | GPIO12 | MISO | GPIO19
D7 | GPIO13 | MOSI | GPIO23
D8 | GPIO15 | SDA | GPIO5
GND | | GND | GND
3.3V | | 3.3V | 3.3V

Be sure to use a suitable power supply for ESP. At least 500mA is recommended!

Expand Down Expand Up @@ -194,6 +220,7 @@ currentP1 | actual current in A (phase 1)
currentP2 | actual current in A (phase 2)
currentP3 | actual current in A (phase 3)
useMeter | energy meter is configured in EVSE-WiFi (true/false)
numPhases | number of phases in use


#### Example
Expand Down Expand Up @@ -287,6 +314,55 @@ E0_could not set current - internal error | Internal error occured (unspecified)
E1_could not set current - give a value between *x* and *y* | Wrong value was given
E2_could not set current - wrong parameter | Wrong parameter was given

### setNumPhases()
using setNumPhases() will switch between one and three phase operation

Parameter | Description
--------- | -----------
numPhases | Number of phases to be used (1 or 3).

#### Example

`GET http://192.168.4.1/setNumPhases?numPhases=3`

> Enables three phase operation.

```text
Number of phases set to given value
```
In cases of Error, the answer would be

Answer | Description
--------- | -----------
S0_switchNumPhases set to given value | Operation succeeded
E1_switchNumPhases failed - wrong state | Wrong value or already set
E2_switchNumPhases failed - always active mode | Function is not available in always active ode
E3_switchNumPhases failed - wrong parameter name | Parameter `numPhases` is missing

### setMeterFactor()
using setMeterFactor() will the metering factor.

Parameter | Description
--------- | -----------
meterFactor | When using a single phase meter it might make sense to switch between factor 1 and 3 when switching the number of phases.

#### Example

`GET http://192.168.4.1/setMeterFactor?meterFactor=3`

> Sets factor 3 (for e.g. in three phase operation with a single phase meter).

```text
Metering factor set to given value
```
In cases of Error, the answer would be

Answer | Description
--------- | -----------
S0_setMeterFactor set to given value | Operation succeeded
E1_setMeterFactor failed - invalid factor value | Factor has to be 1 2 or 3
E2_setMeterFactor - wrong parameter name | Parameter `meterFactor` is missing

### setStatus()
will activate/deactivate EVSE WB

Expand Down
41 changes: 41 additions & 0 deletions data/timer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"command": "timer",
"list": [
{
"active": false,
"from": 0,
"to": 0,
"days": "",
"current": null
},
{
"active": false,
"from": 0,
"to": 0,
"days": "",
"current": null
},
{
"active": false,
"from": 0,
"to": 0,
"days": "",
"current": null
},
{
"active": false,
"from": 0,
"to": 0,
"days": "",
"current": null
},
{
"active": false,
"from": 0,
"to": 0,
"days": "",
"current": null
}
],
"active": false
}
14 changes: 13 additions & 1 deletion include/config.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#ifndef CONFIG_H_
#define CONFIG_H_

#include <Arduino.h>
#include <ArduinoJson.h>

Expand Down Expand Up @@ -62,6 +65,7 @@ struct s_systemConfig {
uint8_t evsecount;
bool logging;
bool api;
uint16_t oledontime;
};

struct s_evseConfig {
Expand All @@ -79,6 +83,7 @@ struct s_evseConfig {
bool reg2000;
unsigned long updateInterval;
uint8_t currentAfterBoot; // Not in config.json - just for runtime
uint8_t numPhases;
};

class EvseWiFiConfig {
Expand Down Expand Up @@ -113,6 +118,7 @@ class EvseWiFiConfig {
uint16_t ICACHE_RAM_ATTR getMeterImpLen(uint8_t meterId);
uint8_t ICACHE_FLASH_ATTR getMeterPhaseCount(uint8_t meterId);
uint8_t ICACHE_FLASH_ATTR getMeterFactor(uint8_t meterId);
bool ICACHE_FLASH_ATTR setMeterFactor(uint8_t meterId, uint8_t factor);
bool useSMeter;
bool useMMeter;
bool mMeterTypeSDM120;
Expand Down Expand Up @@ -145,6 +151,7 @@ class EvseWiFiConfig {
uint8_t ICACHE_FLASH_ATTR getSystemEvseCount();
bool ICACHE_FLASH_ATTR getSystemLogging();
bool ICACHE_FLASH_ATTR getSystemApi();
uint16_t ICACHE_FLASH_ATTR getSystemOledOnTime();

// evrialConfig
uint8_t ICACHE_FLASH_ATTR getEvseMbid(uint8_t evseId);
Expand All @@ -169,6 +176,10 @@ class EvseWiFiConfig {
uint16_t ICACHE_FLASH_ATTR getEvseCurrentAfterBoot(uint8_t evseId);
bool ICACHE_FLASH_ATTR setEvseCurrentAfterBoot(uint8_t evseId, uint16_t current);

uint8_t ICACHE_FLASH_ATTR getEvseNumPhasesPin(uint8_t evseId);
bool ICACHE_FLASH_ATTR setEvseNumPhases(uint8_t evseId, uint8_t numphases);
uint8_t ICACHE_FLASH_ATTR getEvseNumPhases(uint8_t evseId);

private:
s_wifiConfig wifiConfig;
s_meterConfig meterConfig[1];
Expand All @@ -183,4 +194,5 @@ class EvseWiFiConfig {

protected:

};
};
#endif //CONFIG_H
5 changes: 3 additions & 2 deletions include/config_template.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"rfidgain": 32
},
"ntp": {
"ntpip": "pool.ntp.org",
"ntpip": "de.pool.ntp.org",
"timezone": 1,
"dst": false
},
Expand Down Expand Up @@ -57,7 +57,8 @@
"evseinstall": 16,
"avgconsumption": 15,
"rseactive": false,
"rsevalue": 80
"rsevalue": 80,
"numPhases": 3
}
]
}
14 changes: 9 additions & 5 deletions include/oled.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,32 @@
#include <U8g2lib.h>
#include "oled_templates.h"
#include "ntp.h"
#include "config.h"

class EvseWiFiOled {

public:
bool displayOn;

void begin(U8G2_SSD1327_WS_128X128_F_4W_HW_SPI*, uint8_t rotation);
//U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE, /* clock=*/ 16, /* data=*/ 17);
void begin(U8G2_SSD1306_128X64_NONAME_F_SW_I2C*, uint8_t rotation);
void setLanguage(EvseWiFiConfig*);
void clearBuffer();
void sendBuffer();
void oledLoop();
void turnOff();
void turnOn();
void showDemo(uint8_t evseStatus, unsigned long chargingTime, uint16_t current, uint8_t maxcurrent, float power, float energy, time_t time, String* version, bool active, bool timerActive);
void showDemo(uint8_t evseStatus, unsigned long chargingTime, uint16_t current, uint8_t maxcurrent, uint8_t phases, float power, float energy, time_t time, String* version, bool active, bool timerActive);
void showCheck(bool, uint8_t);
void showSplash(String text = "Loading...");
void showSplash(String text = "", String head = "Loading...");

private:
U8G2_SSD1327_WS_128X128_F_4W_HW_SPI* u8g2;
U8G2_SSD1306_128X64_NONAME_F_SW_I2C* u8g2;
void drawCheck(uint8_t);
void drawUncheck();
uint8_t offsetX = 0;
uint8_t offsetY = 0;
unsigned long millisRandOffset = 0;
uint8_t language;
String getTranslation(uint8_t, uint8_t);
};
#endif
1 change: 0 additions & 1 deletion include/oled_templates.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ static const unsigned char xbm_unlocked[] PROGMEM = { /*
0x80,0xf3,0x40,0xf4,0x20,0xf8,0x20,0xf8,0x00,0xf8,0xff,0xf0,
0xff,0xf0,0xff,0xf0,0xff,0xf0,0xff,0xf0,0xff,0xf0,0x7e,0xf0};


static const uint8_t xbm_checked_width = 73;
static const uint8_t xbm_checked_height = 60;
static const unsigned char xbm_checked[] PROGMEM = {
Expand Down
2 changes: 2 additions & 0 deletions include/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ bool ICACHE_FLASH_ATTR activateEVSE();
bool ICACHE_FLASH_ATTR deactivateEVSE(bool);
bool ICACHE_FLASH_ATTR setEVSEcurrent();
bool ICACHE_FLASH_ATTR setEVSERegister(uint16_t, uint16_t);
bool ICACHE_FLASH_ATTR setSDMID();
void ICACHE_FLASH_ATTR pushSessionTimeOut();
void ICACHE_FLASH_ATTR sendEVSEdata();
void ICACHE_FLASH_ATTR sendTime();
Expand All @@ -46,3 +47,4 @@ void ICACHE_FLASH_ATTR startWebserver();
bool ICACHE_FLASH_ATTR resetUserData();
void ICACHE_FLASH_ATTR timerActivateMatch(uint16_t);
void ICACHE_FLASH_ATTR timerDeactivateMatch();
void ICACHE_FLASH_ATTR sendSyslogToWs();
Loading