Amplifying analogWrite to something useful.

I want to drive a couple DC motors. Small jobs, from an inkjet printer. I can use analogWrite, but then I realized that the microcontroller itself probably can't drive any sort of useful motor. I need an amp. I'm using a 9v battery.

It seems to me I can hook up a op-amp with infinite gain straight to the PWM pin on the microcontroller. Then when the microcontroller outputs PWM, it will switch on the opamp with the same duty cycle, but giving me +9v at 255 and as much current as my battery can put out, instead of +5v and only the few ma that the Arduino can put out.

Seems like a waste of an opamp though. A transistor would do it, but what kind of transistor do I need? I don't think BJT or Mosfet matters, but I think NPN or PNP matters. And I'm not sure if I should put it between the motor and ground, or between the Arduino and the motor.

Simplest way I feel is to use a logic level N-channel MOSFET switching transistor. Wire source lead to ground, drain lead to motor, gate lead to Arduino PWM output pin. Wire other end of motor to + voltage.

Lefty

but giving me +9v at 255 and as much current as my battery can put out,

Have you read the specifications on op amps? The output current is much less than an arduino.

Have you read the specifications on op amps? The output current is much less than an arduino.

Really? Theoretically, opamps have zero output impedence, and they are used for amplification all the time, such as for audio amps and such.

Theoretically, opamps have zero output impedence

Oh well you better go an buy a theoretical one, send me the link when you find it. :wink:

I looked at radioshack, but all of them were square and not triangle shaped like the ones on my diagram.

What do you mean like the ones in your Diagram?

An op-amp is an op-amp, the triangle is just to make it easier to draw a diagram with all the pins. (More often than not, the pins will be switched around in the diagram as well, again just to make it easier)

You should be fine using any of the OP amps you can get at Radioshack. Although, if you don't mind waiting, I highly suggest you order from an online retailer. (Assuming you need more than just the op-amp) They're much cheaper through other vendors, and you can get a bunch of stuff through other vendors that Radioshack doesn't offer.

:smiley:

I was just making a joke about the "ideal op-amp"

I actually pillaged the electronics lab at school and came up with 2 power Nmosfets. 8A 100v should be enough I should think.

2 power Nmosfets.

Best to check out the data sheet for the specific FETS you 'found'. Most N channel MOSFETS require 10vdc to fully turn on, only 'logic level' MOSFETS will fully turn on using TTL level voltages.

Lefty

The transistor I used was the 2N6796

http://www.datasheetcatalog.org/datasheet/fairchild/2N6796.pdf

I can't get the tranistors to work right now, and I'm wondering if they are going to work with TTL level voltages. According to figure 5, it looks like they are saturated at 5v? Maybe I'm not reading the datasheet right.

Maybe I'm not reading the datasheet right.

No you are interrupting it wrong. It takes 10v to saturate the device to it's max current rating. 4 volts barely turns it on, that's called its threshold voltage, which is where it just starts to conduct. You either need to drive the gate with a npn transistor switch with a 10v or higher collector voltage. Or better yet get a logic level N mosfet, they are great for Arduino projects.

Lefty