Hello All I am new to this forum so let me introduce myself.
I am currently a senior EE major at the UM Duluth. I am working on a custom PCB that is giving me some issues. Now this is just the second PCB that I have ever designed so If you see anything at all that you would change or do different PLEASE let me know. I would love to learn more about this area of the field.
PCB specs
Power supply 2 18650 batterys at 7.4V
IC- ATmega328P
L298N hbridge
The PCBS job is to monitor an Infared sensor and when it sets a pin high it has a list of instructions to execute some of which include operating 3 small 6V dc motors that need to be turned CW and CCW. Currently I am using the Hbridge as that is what I originally used to make the circuit work using an Arduino Uno and qunqi L298N motor drive board. I plan to change this later to a Fet based design to avoid the voltage drop and low input voltage issues.
Now my PCB works however I have issues with the Hbridge. These include a 3V drop at the motors which seems higher then it should be and when the motors are running sometimes it glitches out where the motors just rapidly change direction and freeze the IC in that command until I turn off power supply. I am wondering If this is a back EMF issue or a ground bounce issue. I did not have this large of a voltage drop in my circuit with the UNO and drive board and it worked perfect then so I know it is an issue with my PCB.
Attached are my schematic and IDE code.
Moderator edit: Added code tags like this [code]... your code [/code]
I am currently a senior EE major at the UM Duluth. I am working on a custom PCB that is giving me some issues. Now this is just the second PCB that I have ever designed so If you see anything at all that you would change or do different PLEASE let me know. I would love to learn more about this area of the field.
PCB specs
Power supply 2 18650 batterys at 7.4V
IC- ATmega328P
L298N hbridge
The PCBS job is to monitor an Infared sensor and when it sets a pin high it has a list of instructions to execute some of which include operating 3 small 6V dc motors that need to be turned CW and CCW. Currently I am using the Hbridge as that is what I originally used to make the circuit work using an Arduino Uno and qunqi L298N motor drive board. I plan to change this later to a Fet based design to avoid the voltage drop and low input voltage issues.
Now my PCB works however I have issues with the Hbridge. These include a 3V drop at the motors which seems higher then it should be and when the motors are running sometimes it glitches out where the motors just rapidly change direction and freeze the IC in that command until I turn off power supply. I am wondering If this is a back EMF issue or a ground bounce issue. I did not have this large of a voltage drop in my circuit with the UNO and drive board and it worked perfect then so I know it is an issue with my PCB.
Attached are my schematic and IDE code.
Code:
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
int IN1 = 9;
int IN2 = 8;
int IN3 = 7;
int IN4 = 6;
int trg = A1;
int swt = A2;
int count = 0;
void setup() {
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(trg, OUTPUT);
pinMode(swt, INPUT);
//HBRIDGE PINS
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Mouse Masher");
Serial.println("Mouse Masher");
}
void loop() {
lcd.setCursor(0, 1);
lcd.print("V2");
Serial.println("Mouse Masher");
int Sensor_Value= digitalRead(swt);
Serial.println(Sensor_Value);
if(Sensor_Value == HIGH)
{
//fireing
digitalWrite(trg,HIGH);
delay(750);
digitalWrite(trg,LOW);
//delay(10800000);
delay(5000);
analogWrite(trg,HIGH);
delay(500);
//pause for kill and wind up smasher
digitalWrite(IN1,HIGH);
delay(1750);
//wind up trap arm
digitalWrite(trg, LOW);
delay(500);
//engage latch
digitalWrite(IN1,LOW);
delay(500);
//disengage windup
digitalWrite(IN2, HIGH);
delay(250);
//add slack
digitalWrite(IN2,LOW);
delay(500);
//shutoff slack adjustment
digitalWrite(IN3,HIGH);
delay(500);
digitalWrite(IN3,LOW);
//activate mouse remover
digitalWrite(IN4,HIGH);
delay(750);
digitalWrite(IN4,LOW);
delay(5000);
count++;
}
}
Attachments
-
246.4 KB Views: 18