ATtiny 85 to drive motors

I’m thinking of getting an ATtiny, and for my first project I was thinking of using it to run a couple motors. I wanted to ask if anyone’s worked with them before and if you have any suggestions for someone who’s still getting the hang of hardware.

1 Like

Why not just use an ATmega328P?

Well I’d never heard of it before just now. What’s the difference? Or rather, is it particularly better for such an application?

It’s the processor on the Arduino Uno. Using it gives you access to a plethora of libraries. The processor is easily and cheaply moved to a protoboard when everything is working.

There are two reasons to use an ATtiny processor: physical size and exotic hardware. Otherwise a processor from the ATmega line is a better choice.

Well I’m partly driven by the size factor here, but perhaps the mega 32’s footprint isn’t out of bounds. I’ll have to put it all to paper and see.

Though, I do have a more specific question in case you know something about it: Do I really need an H bridge per motor if said motors just need to run at the same time and not be precise or anything?

328P :wink:

The only requirement is that the H bridge be capable of handling the total power. One motor or ten motors should not matter.

1 Like

Precision is my best friend and greatest enemy when it comes to technology :stuck_out_tongue:

Thank Christ, I kept seeing people whose application was robotics related and super precise and none of their work had much to do with my plans. Thanks!

The H bridge is mainly for running the motor in both forward and reverse.

Russell Ward

1 Like

Well then I have to wonder if there’s something more appropriate if I just need something between it and a microcontroller to provide appropriate current and whatnot.

If you decide to use an Arduino [which I suggest because of its ease to learn & we typically have several classes using them], an example on very simple motor control can be found here: https://www.arduino.cc/en/Tutorial/TransistorMotorControl. If you need more current, you can swap out the transistor.

The H-Bridge will allow putting the motor in reverse [http://www.modularcircuits.com/blog/articles/h-bridge-secrets/h-bridges-the-basics/], having an H-Bridge per motor allows the motors to be independently controlled.

1 Like

Thanks for the info, I keep being busy when the arduino classes are held, but hopefully I can make it to one soon.

This motor board in awesome.

2 Likes
2 Likes

It sounds like you have a fascinating but somewhat ambitious project for a beginner. I’ve done a lot of beginner level Arduino classes at DMS including an ATtiny85 class but, due to my schedule, will probably not have more until mid September. I would suggest taking the following three steps.

Become familiar with Arduino and use it to carry out the motor functions you will require. The advantage here is that it has everything you require and can be programmed very easily. (I like Arduino Nanos very much since they are very breadboard and protoboard friendly. (A friend and I built a board for a high altitude balloon project and used a Nano instead of going to the trouble of just using a microcontroller chip.)

If a Nano is too big or whatever for your requirements, I would take a step to your goal by using an Arduino with a through hole ATmega328 on it. Its very simple to program and then you can pull the microcontroller chip and put it on a breadboard for further testing. It has a large debugging advantage over an ATtiny in that it includes a UART that can communicate with the Serial Monitor to help with debugging.

If you decide to continue on, acquire a through hole ATtiny… In my ATtiny class, we program these with an Arduino board and a capacitor just to show how easy it is but the more conventional approach is to use a programmer board. The lack of a UART here does not prevent serial communication but it is awkward.

Summary: Use an Arduino Nano if it will meet your requirements, otherwise go for the beautiful, small, elegant solution with an ATtiny.

@Bernard_Gray has some some motor classes with Arduino but has been quiet lately. Bernard, do you have any classes coming up soon?

I

Not anytime soon. Football season is starting up again, and my time gets consumed quickly. I do have some slides/sample program I could share on how to drive a brushed motor using L298N H-bridge, if that is something of interest.