Add WiFi control to any EVSE

This is a quick guide how to convert a simple AC charging point in to WiFi enabled one by using Arduino Pro Mini and Sonoff SV Wifi relay. This gives you possibility of activating charging point from anywhere as long as you got access to internet. Also you get standard Sonoff functions like 7 day timer, countdown timer and delayed activation.  This is very easy and quick project. It does not require any altering of high voltage side on your charging point. While Sonoff relay is inactive, pilot signal is interrupted, so charging activation is impossible until relay is activated by user. Arduino board is used to monitor pilot signal and Sonoff relay to deactivate charging if plug was not connected to vehicle in 20 seconds after activation, or 1 second after it was disconnected from vehicle. So it guaranties that it won't be left activated if you activated by mistake or forgot to deactivate after the charging is compete. Also prevents an unauthorized use of a charging point without your knowledge.
This little project is open source, that means anybody can view, use and modify it. The only condition, if you share this project on your website, please include the link to original project. Arduino code is very simple and can be further developed and perfected. If you would like to share your version on my site you are more than welcome to do this. I will share it on this website including the link to your project.

Basic hardware you need is:
Sonoff SV board
Arduino Pro Mini board
If you can't get 5V power supply from your charging point, then you will also need 5V power supply unit
20kOhm resistor
3.3kOhm resistor
BC849 transistor (code for SMD transistor: 2C) or any other general purpose NPN transistor
few centimeters of thin wire
First you will need to modify Sonoff SV board. Do all the next modifications shown in pictures:
Connect your Arduino board to Sonoff SV board. Arduino pins: 2 - relay deactivation signal, 7 - EVSE pilot signal state detection, 8 - relay state detection. Cut the pilot signalwire in your charging station, connect it to your Sonoff board as shown in pictures and connect power feed to Arduino and Sonoff boards. Make sure your 5V power supply is strong enough. I would recommend to use at least 1A 5V power supply:
Copy this code to your Arduino IDE and program your Arduino board (please note that the code was written by the person who never properly learned the programming - me. If you see mistakes or got suggestions please feel free to send me a message):

int status = 0; // connection to EV status;
int i = 0;
int n = 0;
int k = 0;
const long interval = 500;

void setup()
{
  Serial.begin(9600);
  pinMode(8, INPUT); // relay state detection; LOW-relay on, HIGH-relay off;
  pinMode(2, OUTPUT); // relay deactivation impulse (HIGH);
  pinMode(7, INPUT); // EVSE pilot state detection;
  digitalWrite(2, LOW);
}

void loop()
{
  if (digitalRead(8) == HIGH) {
    delay(200);
    status = 0;
  }
  k = 0;
  while ((digitalRead(8) == LOW && digitalRead(7) == HIGH) && status == 0) {
    for (i = 1; i <= 40; i += 1) {
      scan();
      if (k == 1){
        break;
      }
      if (i == 40) {
        digitalWrite(2, HIGH);
        delay(500);
        digitalWrite(2, LOW);
        delay(1000);
      }
    }
  }
  if (digitalRead(8) == LOW) {
    delay(200);
    status = 1;
  }
  k = 0;
  while ((digitalRead(8) == LOW && digitalRead(7) == HIGH) && status == 1) {
    for (n = 1; n <= 2; n += 1) {
      scan();
      if (k == 1){
        break;
      }
      if (n == 2) {
        digitalWrite(2, HIGH);
        delay(500);
        digitalWrite(2, LOW);
        delay(1000);
        status = 0;
      }
    }
  }
}
void scan(){
  unsigned long currentMillis = millis();

  while (millis() - currentMillis < interval) {
    if (digitalRead(7) == LOW || digitalRead(8) == HIGH){
      k = 1;
      return;
    }
  }
}

Download EWeLink app, add your new device in to it by following Sonoff instructions, update Sonoff relay to the latest firmware and test your setup. Make sure your vehicles internal delayed charging timers are off :


I bet you already asking yourself, why Arduino Pro Mini and not Arduino Tiny, why Sonoff SV and not something else, why not just use Tasmota firmware, write a code and just use Sonoff board. It's because I had all these parts at my hand, but you can use anything you like. I like EWeLink app, which I would not be able to use after Tasmota update. I just wanted to share easy and cheap way to make your charging station bit more intelligent.


© Copyright EV-OLUTION