L6205 not working.

Hi. I’m new to this forum so if I make any dumb mistakes, please point them out :slight_smile: . I made automated driveway gates for my home (tutorial found here: Automated Driveway Gate(s) (LPR) - Hackster.io ) using a motor driver from amazon (found on my tutorial), an Arduino Uno, and a Wemos d1-mini. I’m trying to make it cheaper and more permanent by making my own pcb with a motor driver and the d1-mini on it. I’ve designed and had printed two versions so far and neither works :confused: >:( . The first one uses 8 MOSFETs in a h-bridge formation. The second uses the l6205pd motor driver. I figured out what was wrong in The first one (some mosfets were backwards) but can’t find what’s wrong in the second. I pretty much copied and pasted the schematic found in the data sheet and only added a mosfet for a magnet lock and a voltage regulator for the d1-mini. Both the mosfet and regulator work fine. I’ve now soldered two boards and tested both in every way I can think of, but am getting nothing from the motor driver >:( .

settings.h (1.02 KB)

New_Driveway_Gates.ino (11.3 KB)

PCB_PCB_2020-11-01_12-27-20_2020-11-28_08-33-20.pdf (195 KB)

Schematic_Driveway with L6205_2020-11-28_08-48-12.pdf (48.3 KB)

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
If you have code then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

You should be able to EXPORT your schematic and PCB pattern in jpg form rather than screen saves.
This will make it easier for all to read.

Can I suggest you make your prototype on a protoboard, rather than wasting money on PCBs.
Have you got any code, if so please post it as well.

The schematic is hard to read due to all the component info printed around it.
Can I suggest you draw your circuit on a piece of paper, labeling pins and including the power supply and the motor, this will enable a clearer look at your project.

Thanks.. Tom... :slight_smile:

Here's the code:

#define BLYNK_PRINT Serial

#include "settings.h"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <math.h>
#include <Wire.h>
#include <SPI.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

char auth[] = BLYNK_AUTH_TOKEN;

int beginning=6;
int ending=18;
int timer = 0;
int timer1 = 0;
int timer2 = 0;
int button;
int emergency;
int setting;
int delayAMOUNT;
int gpsSelect;
int distanceSelect;
int comingHome;
int openTest;
int closeTest;
float GPSLat;
float GPSLong;

float dist_calc=0;
float dist_calc2=0;
float diflat=0;
float diflon=0;

boolean away = false;

Adafruit_BME280 bme;
WidgetRTC rtc;
WidgetBridge bridge1(V77);

int counter=0;
int p=0;
int pre=0;

BLYNK_CONNECTED() {
  Blynk.syncAll();
  bridge1.setAuthToken("Td-96Moiv04el-IIM-TruwgdZejlegml");
  Serial.println("Syncing...");
  delay(2000);
}
BLYNK_WRITE(V0){
  button = param.asInt();
}
BLYNK_WRITE(V17){
  emergency = param.asInt();
}
BLYNK_WRITE(V16){
  setting = param.asInt();
  if (setting == 1) {
    Mode = "automatic";
  }
  else if (setting == 0) {
    Mode = "button";
  }
}
BLYNK_WRITE(V3){
  gateOpenAmount = param.asInt();
}

BLYNK_WRITE(V15){
  delayAMOUNT = param.asInt();
}
BLYNK_WRITE(V14){
  GpsParam gps(param);
  GPSLat = gps.getLat();
  GPSLong = gps.getLon();
}
WidgetLED led(V6);
BLYNK_WRITE(V8){
  gpsSelect = param.asInt();
}
BLYNK_WRITE(V9){
  distanceSelect = param.asInt();
}
BLYNK_WRITE(V10){
  comingHome = param.asInt();
}
BLYNK_WRITE(V12){
  openTest = param.asInt();
}
BLYNK_WRITE(V13){
  closeTest = param.asInt();
}
BLYNK_WRITE(V20){
  pressureReadings = param.asInt();
}
BLYNK_WRITE(V18){
  beginning = param.asInt();
}
BLYNK_WRITE(V19){
  ending = param.asInt();
}
void setup() {
  Serial.begin(9600);
  unsigned status;
  status = bme.begin(0x76);
  if (!status) {
    Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
    Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
    Serial.print("        ID of 0xFF probably means a bad address, a BMP 180 or BMP 085\n");
    Serial.print("   ID of 0x56-0x58 represents a BMP 280,\n");
    Serial.print("        ID of 0x60 represents a BME 280.\n");
    Serial.print("        ID of 0x61 represents a BME 680.\n");
  }
  ArduinoOTA.setHostname("DrivewayESP8266");
  ArduinoOTA.setPassword("!KGray7777!");
  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH) {
      type = "sketch";
    } else { // U_SPIFFS
      type = "filesystem";
    }

    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
    Serial.println("Start updating " + type);
  });
  ArduinoOTA.onEnd([]() {
    Serial.println("\nEnd");
  });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
  });
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) {
      Serial.println("Auth Failed");
    } else if (error == OTA_BEGIN_ERROR) {
      Serial.println("Begin Failed");
    } else if (error == OTA_CONNECT_ERROR) {
      Serial.println("Connect Failed");
    } else if (error == OTA_RECEIVE_ERROR) {
      Serial.println("Receive Failed");
    } else if (error == OTA_END_ERROR) {
      Serial.println("End Failed");
    }
  });
  ArduinoOTA.begin();
  if (gateNumber == 1){
    pinMode(a1, OUTPUT);
    pinMode(a2, OUTPUT);
  }
  else if (gateNumber == 2){
    pinMode(a1, OUTPUT);
    pinMode(a2, OUTPUT);
    pinMode(b1, OUTPUT);
    pinMode(b2, OUTPUT);
  }
  pinMode(emergencyButton, INPUT_PULLUP);
  Blynk.begin(BLYNK_AUTH_TOKEN,WIFI_SSID,WIFI_PASS);
  rtc.begin();
  led.on();
  led.setColor(BLYNK_RED);
  manualoff();
  digitalWrite(0, HIGH);
  digitalWrite(2, HIGH);
}

void loop() {
  ArduinoOTA.handle();
  if (hour() == 8){
    if (minute() == 1){
      if (second() == 1){
        Blynk.email("kkidsgray@icloud.com", "Personal Weather Update", "Welcome to the daily weather update. The temperature today is " + String((bme.readTemperature()*1.8)+32) + ". The humidity is " + String(bme.readHumidity()) + ". Barometric pressure is " + String(bme.readPressure() / 100.0) + " mBar and " + String((bme.readPressure()/100)/32.75) + " inches.");
        Blynk.email("kristinlgray@yahoo.com", "Personal Weather Update", "Welcome to the daily weather update. The temperature today is " + String((bme.readTemperature()*1.8)+32) + ". The humidity is " + String(bme.readHumidity()) + ". Barometric pressure is " + String(bme.readPressure() / 100.0) + " mBar and " + String((bme.readPressure()/100)/32.75) + " inches.");
      }
    }
  }
  counter++;
  Serial.println(counter);
  if (counter == pressureReadings){
    if (pre < p/counter){
      Blynk.virtualWrite(V27, 0);
      Serial.println("pre < p/counter");
    }
    else if (pre > p/counter){
      Blynk.virtualWrite(V27, 1);
      Serial.println("pre > p/counter");
    }
    else if (pre == p/counter){
      Blynk.virtualWrite(V27, 0.5);
      Serial.println("pre == p/counter");
    }
    pre = p/counter;
    
    counter=0;
    p=0;
  }
  p+=(bme.readPressure()/100.0);
  Serial.println(p);
  
  Blynk.virtualWrite(V11, WiFi.RSSI());
  Blynk.virtualWrite(V4, (bme.readTemperature()*1.8)+32);
  Blynk.virtualWrite(V5, bme.readHumidity());
  Blynk.virtualWrite(V1, bme.readPressure() / 100.0);
  Blynk.virtualWrite(V2, (bme.readPressure()/100)/32.75);
  if (emergencyButton == LOW){
    Serial.println("Emergency Button!");
    Blynk.notify("Emergency Button on Gates was just Pressed!!!");
    gates();
  }
  if (openTest == 1){
    Serial.println("open test");
    openGate();
    delay(500);
  }
  else {
    allStop();
  }
  if (closeTest == 1){
    Serial.println("close test");
    closeGate();
    delay(500);
  }
  else {
    allStop();
  }
  if (button == 1){
    Serial.println("Button pressed.");
    gates();
  }
  if (emergency == 1){
    Serial.println("M");
    led.setColor(BLYNK_YELLOW);
    manual();
    delay(delayAMOUNT*1000);
    led.setColor(BLYNK_RED);
  }
  if (gpsSelect != 1){
    Blynk.virtualWrite(V7,calcDist(GPSLat, GPSLong, YOUR_LAT, YOUR_LONG));
    //if (comingHome == 1){
    if (calcDist(GPSLat, GPSLong, YOUR_LAT, YOUR_LONG) < distanceSelect){
      away=false;
    }
    else if (calcDist(GPSLat, GPSLong, YOUR_LAT, YOUR_LONG) > distanceSelect){
      away=true;
    }
    if (away==true){
      Serial.println("Away = true");
      //Serial.println(calcDist(GPSLat, GPSLong, YOUR_LAT, YOUR_LONG));
      if (calcDist(GPSLat, GPSLong, YOUR_LAT, YOUR_LONG) < distanceSelect && calcDist(GPSLat, GPSLong, YOUR_LAT, YOUR_LONG) > (distanceSelect - 100)){
        Serial.println("GPS triggered!");
        Mode = "button";
        timer=0;
        gates();
      }
    }
  }
  Blynk.run();
}

Here's the other half because it wouldn't let me post such a large amount of characters:

void gates(){
  Serial.println("Got Mail!");
  if (Mode == "automatic"){
    Serial.println("Mode = Automatic");
    Blynk.notify("Driveway Gates were opened!");
    Serial.println("Opening gate...");
    led.setColor(BLYNK_BLUE);
    offMagnet();
    openGate();
    waitForGate();
    allStop();
    led.setColor(BLYNK_GREEN);
    Serial.println("Open.");
    Serial.println("Waiting...");
    delay(gateOpenAmount*1000);
    Blynk.notify("Driveway Gates were closed!");
    Serial.println("Closing gate...");
    led.setColor(BLYNK_BLUE);
    closeGate();
    waitForGate();
    allStop();
    onMagnet();
    led.setColor(BLYNK_RED);
    Serial.println("Closed.");
  }
  else if(Mode == "button"){
    Serial.println("Mode = Button");
    if (timer == 0){
      Blynk.notify("Driveway Gates were opened!");
      Serial.println("Openning gate...");
      led.setColor(BLYNK_BLUE);
      offMagnet();
      openGate();
      waitForGate();
      allStop();
      led.setColor(BLYNK_GREEN);
      Serial.println("Open.");
      timer = 1;
    }
    else if(timer == 1){
      Blynk.notify("Driveway Gates were closed!");
      Serial.println("Closing gate...");
      led.setColor(BLYNK_BLUE);
      closeGate();
      waitForGate();
      allStop();
      onMagnet();
      led.setColor(BLYNK_RED);
      Serial.println("Closed.");
      timer = 0;
    }
  }
}

void openGate(){
  if (gateDirection == 1){
    if (gateNumber == 1){
      digitalWrite(a1, HIGH);
      digitalWrite(a2, LOW);
    }
    else if (gateNumber == 2){
      digitalWrite(a1, HIGH);
      digitalWrite(a2, LOW);
      digitalWrite(b1, HIGH);
      digitalWrite(b2, LOW);
    }
  }
  else if (gateDirection == 2){
    if (gateNumber == 1){
      digitalWrite(a1, LOW);
      digitalWrite(a2, HIGH);
    }
    else if (gateNumber == 2){
      digitalWrite(a1, LOW);
      digitalWrite(a2, HIGH);
      digitalWrite(b1, LOW);
      digitalWrite(b2, HIGH);
    }
  }
  if (hour() >= beginning && hour() <= ending){
    for(int i;i<15;i++){
      bridge1.virtualWrite(V50, 1);
      delay(1000);
      bridge1.virtualWrite(V51, 0);
      delay(500);
    }
  }
}

void closeGate(){
  //if (gateDirection == 1){
  //  if (gateNumber == 1){
      //digitalWrite(a1, LOW);
      //digitalWrite(a2, HIGH);
  //  }
  //  else if (gateNumber == 2){
      digitalWrite(a1, LOW);
      digitalWrite(a2, HIGH);
      digitalWrite(b1, LOW);
      digitalWrite(b2, HIGH);
   /* }
  }
  else if (gateDirection == 2){
    if (gateNumber == 1){
      digitalWrite(a1, HIGH);
      digitalWrite(a2, LOW);
    }
    else if (gateNumber == 2){
      digitalWrite(a1, HIGH);
      digitalWrite(a2, LOW);
      digitalWrite(b1, HIGH);
      digitalWrite(b2, LOW);
    }
  }
  */
}

void allStop() {
  if (gateNumber == 1){
    digitalWrite(a1, LOW);
    digitalWrite(a2, LOW);
  }
  else if (gateNumber == 2){
    digitalWrite(a1, LOW);
    digitalWrite(a2, LOW);
    digitalWrite(b1, LOW);
    digitalWrite(b2, LOW);
  }
}

void manual() {
  digitalWrite(en1, LOW);
  digitalWrite(en2, LOW);
}

void manualoff() {
  digitalWrite(en1, HIGH);
  digitalWrite(en2, HIGH);
}

void waitForGate() {
  int tim = 5500;
  Begin:
  timer1++;
  while(timer1 < tim){
    Blynk.run();
    delay(2);
    Serial.println(timer1);
    goto Begin;
  }
  timer1 = 0;
  //delay((inchesPerSec*(maxActuatorStroke/percentOfMaxStroke))*1400);
}

void onMagnet(){
  digitalWrite(MagnetRelay, HIGH);
}

void offMagnet(){
  digitalWrite(MagnetRelay, LOW);
}


float calcDist(float CurrentLatitude, float CurrentLongitude, float SavedLatitude, float SavedLongitude)
{
// HaverSine version
    const float Deg2Rad = 0.01745329252;               // (PI/180)  0.017453293, 0.0174532925
    //const double EarthRadius = 6372.795;              //6372.7976 In Kilo meters, will scale to other values
    const float EarthRadius = 20908120.1;              // In feet  20908128.6
    float DeltaLatitude, DeltaLongitude, a, Distance;

    // degrees to radians
    CurrentLatitude = (CurrentLatitude + 180) * Deg2Rad;     // Remove negative offset (0-360), convert to RADS
    CurrentLongitude = (CurrentLongitude + 180) * Deg2Rad;
    SavedLatitude = (SavedLatitude + 180) * Deg2Rad;
    SavedLongitude = (SavedLongitude + 180) * Deg2Rad;

    DeltaLatitude = SavedLatitude - CurrentLatitude;
    DeltaLongitude = SavedLongitude - CurrentLongitude;

    a =(sin(DeltaLatitude/2) * sin(DeltaLatitude/2)) + cos(CurrentLatitude) * cos(SavedLatitude) * (sin(DeltaLongitude/2) * sin(DeltaLongitude/2));
    Distance = EarthRadius * (2 * atan2(sqrt(a),sqrt(1-a)));
    Blynk.virtualWrite(V7, Distance);
    return(Distance);
}

Hi,
You aren't having a very good day.
Please do not go back and edit posts, place your corrections in a new post so that the thread makes sense to anyone who begins reading it.
Also jpg rather than pdf, pdf is difficult to read on some platforms, where as jpg is pretty universal.

Can I suggest you spread your schematic out so that component values and designators can be read, you have a very large sheet to do your schematic.
You have plugs and sockets that have no info on what they are connected to?

You need a schematic that can be read for trouble shooting, that is clear and concise.
Can I suggest you draw your circuit on a piece of paper, labeling pins and including the power supply and the motor, this will enable a clearer look at your project.

Sorry but if your schematic is not readable the number of members helping you will not be optimised.
It needs to show all the hardware and connections in your project so we know what you are talking about.
A picture is worth a thousand words, and in this case can save 10s of posts and a lot of time.

Tom... :slight_smile:

Hi,
Have you written code in stages to test each part of your project separately?

Tom... :slight_smile:

Kind of. I made a new code with just toggling the inputs to the motor driver but still nothing.
Sorry about the formatting. EasyEDA doesn't have the option to export to jpeg.

Hi,
Do you have a DMM?
If so check that the controller that controls the motor driver is outputting signal to the driver when you try to activate the motors.
Also check that the power supply for the motors does not drop out.
What are the motor specs and what are you using to power them?

Thanks.. Tom... :slight_smile:

Just posted a new schematic. Sorry, I'm still kind of new to electronics; What is a DMM? I took the d1-mini off the board and tested the outputs with just some leds and they work fine. The motors are linear actuators and I bought them from here: https://www.windynation.com/Linear-Actuators/Windy-Nation/Linear-Actuators-various-stroke-lengths/-/244?p=YzE9Mjg=. I'm using a 12v 6a Power supply.

Here's the EasyEDA share link for the schematic:

Here's the L6205pd Datasheet:

Hi,
DMM == Digital MultiMeter.

Its 1:31am here, I'll look at your info tomorrow, there may be some other members come up and help you.

Tom... :sleeping: :sleeping: :sleeping: :sleeping:

oh. Thanks. Its 9:30am here. My digital multimeter is almost a whole other topic by itself. I don't know if it's just my misusing or the multimeter itself, but I can't get it to work. Every time I try to test a voltage, it doesn't read correctly and sparks.

kgray9:
...Every time I try to test a voltage, it doesn't read correctly and sparks.

Check that you have the probe test leads plugged into the correct connections on the DMM. Usually there is a COMMON (black probe), but for measuring voltage make sure the other (red?) lead is in a hole marked 'V / ohms' (I can't find the symbol Omega). Avoid the 'A', 'mA', or 'current' connections....that could solve your sparking problem.

Hi,
I have the black in the COM and the red in the 10ADC. The unused one says V(ohm) mA.

kgray9:
Hi,
I have the black in the COM and the red in the 10ADC. The unused one says V(ohm) mA.

Plug the RED into the unused one, that is what V stands for Volts.
Use COM and V(ohm)ma sockets.
Tom... :slight_smile:

Yes, that "10ADC" is the one you absolutely do not want it to be plugged in! :astonished: :astonished: :astonished:

Red goes in the "V(ohm) mA".

Hi,
Ok. Thanks. Anyone have any idea what’s wrong with my schematic?

Hi,
Export as png.

Hi,
What is are your power supplies?
Can you please post your simple motor test code?
Have you tried your actuators connected directly to their power source?

Tom... :slight_smile:

Hi,
My power supplies are standard 12v DC 6A Led Strip power supplies (found here: Amazon.com ).
Ive tested the linear actuators by themselves straight to that power supply and they work just fine.
The testing code is the BasicOTA and basic Blynk sketch combined. Here's the code:

#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <BlynkSimpleEsp8266.h>

#ifndef STASSID
#define STASSID "****************"
#define STAPSK  "************"
#endif

const char* ssid = STASSID;
const char* password = STAPSK;
char auth[] = "*********************";

void setup() {
  Serial.begin(115200);
  Serial.println("Booting");

  // Hostname defaults to esp8266-[ChipID]
   ArduinoOTA.setHostname("DrivewayESP8266");

  // No authentication by default
   ArduinoOTA.setPassword("test");

  // Password can be set with it's md5 value as well
  // MD5(admin) = 21232f297a57a5a743894a0e4a801fc3
  // ArduinoOTA.setPasswordHash("21232f297a57a5a743894a0e4a801fc3");

  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH) {
      type = "sketch";
    } else { // U_SPIFFS
      type = "filesystem";
    }

    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
    Serial.println("Start updating " + type);
  });
  ArduinoOTA.onEnd([]() {
    Serial.println("\nEnd");
  });
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
  });
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) {
      Serial.println("Auth Failed");
    } else if (error == OTA_BEGIN_ERROR) {
      Serial.println("Begin Failed");
    } else if (error == OTA_CONNECT_ERROR) {
      Serial.println("Connect Failed");
    } else if (error == OTA_RECEIVE_ERROR) {
      Serial.println("Receive Failed");
    } else if (error == OTA_END_ERROR) {
      Serial.println("End Failed");
    }
  });
  ArduinoOTA.begin();
  Serial.println("Ready");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  Blynk.begin(auth,ssid,password);
}

void loop() {
  ArduinoOTA.handle();
  Blynk.run();
}