ATTiny85 motor controller circuit

Hi there,

Ive build a small circuit around the ATTiny85 to have control over a 12V motor for 2 small upcoming projects.

I attached the schematics below.

The very simple code looks as follows:

#define sensorPin A2
#define motorPin 0

void setup() 
{
  pinMode(motorPin, OUTPUT);
}

void loop() 
{
  int poti = analogRead(sensorPin);
  int val = map(poti,0,1023,0,255);
  analogWrite(motorPin, val);
  delay(10);
}

In general it works well (at least for the 12v 150ma motor).

I expirienced a few problems though that I would love to solve:

  1. Sometimes when changing the poti the motor jumps to full speed or stays at a certain speed level and I can only changing it again by reseting/turn off the circuit and restart. 12v motor with approx. 150mA (no load)

  2. A bigger 12v motor with 700mA (no load) is not controllable at all. It just stays a full speed.

What could be the problem?

Thanks in advance!

Please check the connection of the pot, it should hang between Vcc and Gnd.
Control the Vcc using a scope. You may need some more capacitors to prevent oscillation.

A 10K pull-up on Vcc will help to prevent the tiny from resetting from motor noise.

A 0.1uF cap from the pot wiper to ground can help to stabilize the pot reading.

I would also suggest a 0.1uF decoupling cap from Vcc to ground as close to the tiny chip as possible.

Thanks for your replies!

Yes it really seems that the tiny is resetting itself all the time.

Just 2 things:

  • A 10k pull-up on Vcc: Not really sure what you mean by that? Its allready "up" on + ?! How to connect the pull-up resistor on Vcc?
  • I tried to connect 0.1uF cap at a few spots but it does not really help unfortunately (I think I try the wrong spots...)

Im going to update the schematics accordingly so you see what I am doing.

Thanks again! :slight_smile:

Sorry, I meant to say a 10K resistor from the reset pin to Vcc.

Hi,
Please check your circuit, do you have the adj pin of the LM7805 connected to gnd?
If you look at your circuit you have both ends of the pot connected to gnd.

Please double check your circuit.

Thanks.. Tom.. :slight_smile:

Hi,
This may help, with some of the suggested addons.


Tom... :slight_smile: