CurtRod / SimpleEVSE-WiFi

Brings EVSE WB/DIN into your WiFi
https://www.evse-wifi.de
78 stars 31 forks source link

Recompile 1.x version to work on ESP32 ? #66

Open Macrisu opened 3 years ago

Macrisu commented 3 years ago

Hello,

It is possible to modify/recompile version 1.x to run on an ESP32?

https://maker.pro/esp8266/tutorial/how-to-upgrade-from-esp8266-to-esp32

CurtRod commented 3 years ago

You can compile the existing code also for ESP32.

Macrisu commented 3 years ago

I will try... From what I see here, Arduino is not needed? https://github.com/CurtRod/SimpleEVSE-WiFi/pull/65

hoermto commented 3 years ago

@Macrisu I am currently working on a ESP32 version that uses pin compatibility of 8266. If you compile ESP32, there are implicit assumptions and changes that require Modbus EVSE connection, and others. I am looking for a replacement of the Wemos D1 mini by a ESP32 in my SimpleEVSE v1.

HA-TB303 commented 3 years ago

That sounds great, I need the same for my little DIY charger DIN Rail thingy ;) IMG_1838

Macrisu commented 3 years ago

@hoermto I used NoddeMCU and for some reason, they are crap and cannot connect to them after firmware upgrade. Also, WIFI is very bad. I've ordered two ESP32-WROOM-32U and WIFI antenna.

https://imgur.com/a/3woKYYl

If you can compile the 1.x firmware for ESP32 it would be great.

hoermto commented 3 years ago

I am using a NodeMCU 8266 currently. Wifi is bad, yes. Other is that it has no free Pins to extend with Oled or CPInt. It will need some time on my side to get it done, however, I have the same plan. Using a ESP32 with external antenna to use in my SimpleEVSE v1.

hoermto commented 3 years ago

That sounds great, I need the same for my little DIY charger DIN Rail thingy ;) IMG_1838

For this case, what is you requirement? You can compile the code for the Wemos D1 mini still ... if you migrate to ESP32, you pin layout will change, so I suspect you cannot use this hardware directly. In reverse, you wont be able to get all EVSE-WIFI v2 features into the 8266 because of limited pin count and 8266 memory shortage (e.g. OLED libraries won't fit into the firmware). There are ways, like if you dont have a RFID, you could use these pins for a CPInt (requires code changes). There is a high number of combinations of ESP versions across different features which might be connected in different ways (e.g. EVSE connected via software-serial or HW serial). The maintainer of this project has a clear scope of the software, which might stay in conflict with other peoples ideas.

So, regarding your HW setup, what would be your requirement? Just being interested :-)

HA-TB303 commented 3 years ago

Never mind, I just test-fitted the esp32 and it does not fit :( It's just a little longer then the wemos d1 mini.

We will be redesigning the PCB for the esp32 to fit. We will probably need a different PSU for that. We can then expose any GPIO's we want.

image

What GPIO's do you recommend we need to expose for SimpleEVSE-Wifi-ESP32? Which IO's of the esp32 will be used by default?

This is just a hobby project by that way, no commercial intentions. www.espthings.io is where we are going to share our designs.

HA-TB303 commented 3 years ago

Hi @hoermto we found a better PSU for the job and are in the process of redesigning the PCB. It's a universal Wemos D1 mini / MH-ET live esp32 DIN-Rail enclosure design, but If you can let me know what GPIO's would be ideal for the esp32 version of the Simple-EVSE-Wifi, we will expose those!

This design will be shared on our website in due time, so everybody can build it themselves.

Concept design: image

Maybe we can add headers for a OLED display as well. As far as I understand you would need 5 pins (SPI). That is going to be tight.

HA-TB303 commented 3 years ago

SPI is definitely not doable within this form factor. The display would have to be I2C driven (SDA/SCL). If the code could be adjusted to that, I could have GPIO 26, 18, 19, 23, 5, 17 and 16 free for other stuf, along with TX and RX.

hoermto commented 3 years ago

You have D1-D8 exposed. It depends on what meter you use (Modbus or S0), also whether RFID is used or not. Minimum is D1/D2 for EVSE connection when not using Modbus. With the rest you might use OLED, CPInt and button (or LED) if you dont use RFID. If you use a Modbus Meter, you could use the LED and Button, since the D3 for S0 is released.

There are many options. It all depends finally from the hardware layout. If you want to remain pin-compatible between D1-mini and D1-mini-32, only D0-D8 + TX/RX from D1-mini and their equivalents of D1-mini-32 are available.

Below is the default PIN layout for the 2 versions available (EVSE-WIFI 1.0 and 2.0 / SmartWB). If you can compile yourself, feel free to comment out what you don't need and reassign pins. As long as we cannot freely define the pin assignment via config, the compiled firmware follows this layout. Especially the change of the EVSE-WIFI 2.0 from connecting the EVSE via Modbus only tricky if you are not familiar with all this (requires EVSE register changes to enable Modbus).

For myself I am thinking to add some more config options to the software. However, compatibility to EVSE-WIFI needs to be made sure in case it should have a chance for a merge.

Actually, as far as I know the EVSE-DIN module at least (the others as well I think) expose a 5V pin you could use for the EVSE-WIFI module. Use the free space for a relais for the CPInt probably? http://evracing.cz/evse/evse-wallbox/evse-wb-din_20190712.pdf.

pins EVSE-WIFI

Module Module PIN EVSE-Wifi1.0
Wemos D1 Mini
EVSE-Wifi 2.0
Wemos D1 Mini32
GND 3.3v Remark
LED EVSE-WIFI + D0 26 x optional
EVSE (*1) TX D1 using SoftwareSerial
EVSE (*1) RX D2 using SoftwareSerial
RS485 TX TX (*1) 22 x x Modbus interface
RS485 RX RX (*1) 21 Modbus Interface
EVSE (*1) A - - using RS485 bus A, bus-id=1
EVSE (*1) B - - using RS485 bus B, bus-id=1
SDM120
SDM630
A optional, using RS485 bus A, bus-id=2
SDM120
SDM630
B optional, using RS485 bus B, bus-id=2
S0 Meter S0+ D3 optional
S0 Meter S0- x optional
Button (Charge) D4 16 x optional
Button (Reset) Rst Rst x optional
RFID Base x x
RFID SCK D5 18 (*2)
RFID MISO D6 19 (*2)
RFID MOSI D7 23 (*2)
RFID SS (SDA) D8 5 (*2)
CPInt S 4 x x
RSE 2 (*3)
Oled SSP1327 base x x optional (*4)
Oled SSP1327 CS 12
Oled SSP1327 DC 13
Oled SSP1327 DIN (MOSI) 18
Oled SSP1327 CLK (SCK) 23
Oled SSP1327 reset 33

(1) EVSE connection: in 8266 (EVSE-WIFI 1.0) the EVSE is connected using SoftwareSerial on D1/D2, and RS485 is always enabled on TXD/RXD. The Modbus Meter (SDM120/630) is always connected using the RS485 adapter on TXD/RXD. In EVSE-WIFI 2.0 and SmartWB the RS485 is connected over 22/21 using HardwareSerial. EVSE and ModbusMeters are connected over RS485 only / always. EVSE has different connectors for Modbus and Serial input, so this is not directly pin compatible. (2) RFID uses always first ictl pins from board. Cannot be changed
(3) "Rundsteuerempfänger" (receiver for external control), SmartWB only. Extra hardware required (4) the default display is a WaveShare SSD1327 connected using 4wire SPI interface and uses the VSPI hardware interface (shared with RFID SPI bus). The graphics library (u8g2) does not fit into ESP8266 memory, therefore supported on ESP32 only. Using different SPI (HSPI) requires using 13/14 for DIN and CLK, causing other pin conflicts. (edit): corrections on pins

HA-TB303 commented 3 years ago

Hi, thanks for elaborating this. At the chance of sounding really stupid now, in which file are the pins defined?

hoermto commented 3 years ago

I did analyze the code and made this table for me in order to be ready for changes, which don't break the original design. Maybe I can inject this into the repository later so it will be default documentation.

I hope I didn't made mistakes here.

HA-TB303 commented 3 years ago

Ok thx. I’ll beter wait untill the open source support for the esp32 is more documented and supported then.

cola32 commented 3 years ago

@HA-TB303 where can I get such a board ?

HA-TB303 commented 3 years ago

Hi, We will publish a video and article on https://espthings.io soon where you can then get them made on pcbway.

cola32 commented 3 years ago

Cool thanks!

is it possible to use a version on an esp32 d1 mini?

Langer75 commented 2 years ago

Hi

two remarks: