H bridge ATTINY85

hey guys pls i need help with this. this H bridge does not work correctly with chi ATTINY85. When i move over attiny and connect arduino pins with pins on pcb (to make arduino behave like attiny) everything works fine, regulation is continous and polarity change works well too. but with attiny chip there are current jumps while regulating pwm.Also led (not drawned on scheme, but its connected as output from pin 2 through resistor to gnd) is lightly blinking while regulating but this current jumps are only between 0-30% pwm cycle approximately. and this behaviour is only with inductive load. and ONLY with attiny chip. Program down there is for arduino connected to pcb, program for attiny is equal with only i/o pins are swapped for proper functionality .

int butt = 4; int led = 7; int pwmA = 11; int pwmB = 10;
int stav = 0; int predstav = 0; int citac = 0;

void setup() {
pinMode(led,OUTPUT);
pinMode(butt,INPUT);
pinMode(pwmA,OUTPUT);
pinMode(pwmB,OUTPUT);
}
void loop() {

int pot = analogRead(A0);
int reg = map(pot,0,1023,0,255);
stav = digitalRead(butt);

if(stav != predstav)
{
if(stav == HIGH){
citac ++;delay(500);}}
delay(100);
predstav = stav;
if(citac % 2 ==0)
{analogWrite(pwmA,reg);
digitalWrite(pwmB,LOW);
digitalWrite(led,HIGH);
}
else{analogWrite(pwmB,reg);
digitalWrite(pwmA,LOW);
digitalWrite(led,LOW);
}
}

-- Spojený príspevok 13 Feb 2018, 18:48 --

Have you tried it with a filter using capacitors? I've seen some problems like this before. Try to search it in combination with triacs or power-MosFets

robot_chobot:
hey guys pls i need help with this. this H bridge does not work correctly with chi ATTINY85.

What h-bridge?

Post a link to its datasheet.

...R

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html 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.

OPs circuit;


Can you post a picture of your ATTINY85 project so we can see your component layout?

Can you post an image of your PCB please, so we can see your copper tracks.

It looks like the H-Bridge is getting spurious signals to the gates of the non-conducting MOSFETs causing basically a brief short.

Have you put a 0.1uF bypass cap across the power input pins of the Attiny?

Does the 7805 get warm/hot?

Thanks.. Tom... :slight_smile: