Vishwas Navada
Published © CC BY-SA

Smart Soft Switch

A soft switch with integrated energy monitoring enabling spark-free switching for electric vehicles and drones.

IntermediateFull instructions provided5 hours2,446

Things used in this project

Hardware components

CoolMOS C7 Gold SJ MOSFET
Infineon CoolMOS C7 Gold SJ MOSFET
×1
Arduino Pro Mini 328 - 5V/16MHz
SparkFun Arduino Pro Mini 328 - 5V/16MHz
×1
ACS 712 Current sensor
×1
OLED Display SSD1306
×1
Resistor 10k ohm
Resistor 10k ohm
×4
Resistor 100k ohm
Resistor 100k ohm
×1
Resistor 330 ohm
Resistor 330 ohm
×1
Resistor 1M ohm
Resistor 1M ohm
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1
BC 557 transistor
×1
12V relay
×1
BC 547 Transistor
×1
Resistor 1k ohm
Resistor 1k ohm
×1
1uF capacitor
×1
SD card module
×1

Software apps and online services

Arduino IDE
Arduino IDE
KiCad
KiCad

Hand tools and fabrication machines

Cutting Knife
Soldering iron (generic)
Soldering iron (generic)
3D Printer (generic)
3D Printer (generic)

Story

Read more

Schematics

SoftSwitch

Opensource smart SoftSwitch for DC and AC applications

SoftSwitch.sch

SoftSwitch

Schematics

Code

SoftSwitch

C/C++
This is a basic Arduino code which will display data on OLED display and log the same on an SD card for further analysis
#include <Wire.h>
#include <Adafruit_SSD1306.h>
#include <SPI.h>
#include "SdFat.h"
SdFat SD;

#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
float energy = 0;
float Amps = 0;
float voltage = 0;
unsigned int previousMillis = 0;
unsigned int interval = 100;
const int chipSelect = 10;

File TimeFile;
File Volt1File;
File Volt2File;
File Volt3File;
File CurFile;


void setup() {
  SD.begin(chipSelect);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);

}

void loop() {
  unsigned long currentMillis = millis();
  if (currentMillis - previousMillis >= interval)
  {
    previousMillis = currentMillis;
    measure();

    TimeFile = SD.open("TIME.txt", FILE_WRITE);
    if (TimeFile) {
      TimeFile.println(currentMillis);
      TimeFile.close();
    }

    Volt1File = SD.open("VOLTAGE.txt", FILE_WRITE);
    if (Volt1File) {
      Volt1File.println(voltage);
      Volt1File.close();
    }

    CurFile = SD.open("CUR.txt", FILE_WRITE);
    if (CurFile) {
      CurFile.println(Amps);
      CurFile.close();
    }
    displaydata();
  }
}

void displaydata() {
  display.clearDisplay();
  display.setTextColor(WHITE);
  display.setTextSize(1);
  display.setCursor(0, 0);
  display.println("V:");
  display.setCursor(18, 0);
  display.println(voltage);
  display.setCursor(43, 0);
  display.println("V");
  display.setCursor(64, 0);
  display.println("P");
  display.setCursor(82, 0);
  display.println(voltage * Amps);
  display.setCursor(107, 0);
  display.println("W");
  display.setCursor(0, 10);
  display.println("E");
  display.setCursor(18, 10);
  display.println(energy);
  display.setCursor(43, 10);
  display.println("Wh");
  display.setCursor(0, 20);
  display.println("I:");
  display.setCursor(15, 20);
  display.println(Amps);
  display.setCursor(53, 20);
  display.println("A");
  display.display();
}
void measure()
{
  int ACSoffset = 2503;
  float Voltage1 = 0;
  voltage = (5.0 * analogRead(A0) / 1023.0) / 0.249;
  Voltage1 = ((analogRead(A3) / 64) / 1023.0) * 5000; // Gets you mV
  Amps = ((Voltage1 - ACSoffset) / 189);
  energy = energy + voltage * Amps / 3600;
  delay(1000);
}

Credits

Vishwas Navada

Vishwas Navada

24 projects • 66 followers
Full stack hardware engineer.

Comments