Arduino Nano Electrolysis Device

Hello, I want to make an electrolysis device using Arduino Nano. I finished all the designs of the device and prepared its electronic connections.

Device:

  • 18650 batteries will be used as the power source. (The number is not important, but I connected 4 to experiment)
  • A button will be used to activate the device and a red LED will be connected to indicate that it is working.
  • Current, voltage, watt and temperature values will be instantly printed on the screen on the device.
  • With a TOGGLE SWITCH on the device, the device will perform current electrolysis or start the motor that drains the water inside the device.
  • There will be 3 fans on the sides of the device to prevent the battery and components from heating up.

However, the fans connected to the device were rotating very slowly. When I examined the connections I made, I noticed that the Arduino pins gave 4.07V as output. Also, the switch connection I made to control the relays did not work. I'm very new to this and I really need help. I would be glad if you help me.

Code:

//OLED SCREEN - SSD1306
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED weight (128 pixel)
#define SCREEN_HEIGHT 64 // OLED height (64 pixel)
#define OLED_RESET -1    // I don't use reset pin
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

//TEMPERATURE SENSOR - DS18B20
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 6
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float temperature;

//CURRENT SENSOR - ACS712 30A
const int currentSensorPin = A0;
const int voltageSensorPin = A1;
float vOUT = 0.0;
float vIN = 0.0;
float R1 = 10000.0;
float R2 = 1980.0;
float Vdata = 0;
float V,I,I1;
float Cdata;
float watt_value;

//LEDS & FANS
int ledPin = 2;
int fanPin1 = 3;
int fanPin2 = 4;
int fanPin3 = 5;
int switchLed = 9;

int relay1 = 7; //ELECTROLYSIS RELAY
int relay2 = 8; //PUMP RELAY

int switch_ = 10;
int switch_close = 11;
int switch_open = 12;

void setup() {
  Serial.begin(9600);

  pinMode(A0, INPUT);
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
    Serial.println(F("SSD1306 error!!!"));
    for (;;);
  }

  display.display();
  delay(2000);
  display.clearDisplay();
  sensors.begin();//DS18B20 starting

  pinMode(ledPin, OUTPUT);
  pinMode(fanPin1, OUTPUT);
  pinMode(fanPin2, OUTPUT);
  pinMode(fanPin3, OUTPUT);
  pinMode(switchLed, OUTPUT);
  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);
  pinMode(switch_, OUTPUT);
  pinMode(switch_close, INPUT);
  pinMode(switch_open, INPUT);

  digitalWrite(switch_, HIGH);

}

void loop() {

  digitalWrite(ledPin, HIGH);
  digitalWrite(fanPin1, HIGH);
  digitalWrite(fanPin2, HIGH);
  digitalWrite(fanPin3, HIGH);

  int pump_open = digitalRead(switch_open);
  int pump_close = digitalRead(switch_close);

  if(pump_open == HIGH && pump_close == LOW){
    digitalWrite(switchLed, HIGH);
  }
  else if(pump_close == HIGH && pump_open == LOW){
    digitalWrite(switchLed, LOW);
  }


  if(pump_open && !pump_close){
    digitalWrite(relay1, LOW);
    delay(500);
    digitalWrite(relay2, LOW);
    delay(500);
    
    display.clearDisplay();
    display.setTextSize(2);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(0,0);
    display.print("PUMP");
    
    int timeee=10;
    while(timeee>0){
      display.println(timeee);
      delay(1000);
      timeee--;
    }
    display.clearDisplay();
    display.setTextSize(2);
    display.setTextColor(SSD1306_WHITE);
    display.setCursor(0,0);
    display.print("PUMP");
    display.println("OPEN");

    digitalWrite(relay1, LOW);
    delay(500);
    digitalWrite(relay2, HIGH);
    delay(10000);
    
  }
  else{
    
    digitalWrite(relay2, LOW);
    delay(500);
    digitalWrite(relay1, HIGH);
    delay(500);
    
    sensors.requestTemperatures(); //Get data from sensor
    float temperatureCelsius = sensors.getTempCByIndex(0); //Get celcius data from sensor
    
    if (temperatureCelsius != DEVICE_DISCONNECTED_C) {
      temperature = temperatureCelsius;
    } 
    else {
      Serial.println("Sensor is not connected");
    }

    current_sensor();
    
  }
  
}


void current_sensor() {
  for(int i = 0; i < 300; i++){
    //Reading 300 times to get a more stable average result
    Cdata = Cdata + analogRead(currentSensorPin);
    Vdata = Vdata + analogRead(voltageSensorPin);
    delay(1);
  }
  
  Cdata=Cdata/300;         
  V=(Cdata/1024.0)*5000;                       
  I=((V - 2500)/ 96);

  Vdata=Vdata/300;
  vOUT = (Vdata * 5.0) / 1024.0;
  vIN = (vOUT / (R2/(R1+R2)));

  print_screen();
}

void print_screen(){
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(0,0);
  
  display.print("A: ");
  if (I<0) {display.println("0.0");} else {display.println(I, 1);}
  
  display.print("VOLT: ");
  display.println(vIN, 1);
  
  display.print("WATT: ");
  watt_value = (I * vIN);
  if (watt_value<0) {display.println("0.0");} else {display.println(watt_value, 1);}
  
  display.println(temperature, 1);
  display.print("C");
  
  display.display();
  display.clearDisplay();

  Cdata=0;
  I=0;
  V=0;
  Vdata=0;
  vIN=0;
  watt_value=0;
}

Sorry but that colourful Fritzing is useless. It takes a time consuming detective work and making a proper schematics to get hold of the build. Not many helpers take on that work.
Fritzings show positions but they tell nothing. The pin designations are wanted, component ID etc, as per schematics.

I tried to draw the circuit via Proteus, but unfortunately I couldn't.
I can tell the Arduino connections like this:

A0: ACS712 Current Sensor
A1: ACS712 Voltage Sensor
A4: OLED Display SDA
A5: OLED Screen SCK

D2: LED (OPEN)
D3: DC Fan-1
D4: DC Fan-2
D5: DC Fan-3
D6: DS18B20 Temperature Sensor
D7: Relay-1 (Water Pump)
D8: Relay2 (Electrolysis)
D9: LED (Water Pump Open)
D10: SWITCH Middle Pin (COM)
D11: SWITCH Right Pin
D12: SWITCH Left Pin

VIN: 7805 Output
3V3: OLED Display

5V CONNECTIONS:

  • DC Fan 1-2-3
  • ACS712 Current Sensor
  • Relay 1-2
  • DS18B20 Temperature Sensor

GND CONNECTIONS:

  • DC Fan 1-2-3
  • ACS712 Current Sensor
  • Relay 1-2
  • DS18B20 Temperature Sensor
  • OLED Screen
  • LEDS
  • 4S 40A BMS GND
  • 7805 Ground
  • Water Pump

5V into Vin. Not correct. Check specs. Instead feed 5V to the 5V pin.

Most of my sensors are connected to the 5V pin. If I give the input from that part, won't I draw too much current?
I'm sorry, I'm asking because I don't know, I would appreciate it if you could inform me.

No, not if the incoming current comes at the same point.

Sorry but a list of connections is even less wanted.

So I'll try this connection and get the device working again. Thank you

This should not be an issue for turning on the 2N7000 logic level mosfets controlling the fans.

Powering the fans from the 5V pin of the Nano, with all the current going through the voltage regulator on the Nano, would however be a big problem. Compounded by the fact that the OP was only supplying 5 volts to the input of this regulator.

The 5V was applied to the Vin, I suggested going to the 5V pin. 4.07 V at the 5V pin is BECAUSE the 5V was applied to Vin. It's a dead giveaway.

I connected the 7805 output to the 5V pin of the Arduino Nano. When the device is turned on, the voltage is 5V and everything works, but after about 20-30 seconds the voltage drops to 3.5V and everything working with 5V stops.

How hot is the regulator at this point?

Too much, I can't touch it.

But I think there is a short circuit somewhere. For this reason, I decided to sever all connections and start from scratch.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.