Book Image

Arduino Essentials

Book Image

Arduino Essentials

Overview of this book

Table of Contents (17 chapters)
Arduino Essentials
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Motor control with a transistor


Analog outputs can be very useful sometimes and not just to change the brightness of an LED. There are plenty of devices that operate on an analog signal; motors, for example, where you can change its speed by varying the voltage you apply to them.

However, motors can be sometimes tricky to operate, mainly due to the fact that they are big current consumers. A typical toy DC motor can easily consume more than 200 mA when running without a load and up to 1 Amp when stalled.

We mentioned in the previous chapter that an Arduino pin can't give more than 40 mA, or it could burn. So, how can we deal with a motor using an Arduino? Well, usually when dealing with high-current devices, we use a driver circuit that allows the device to be powered from an external power source and use the Arduino pin just as a regulator.

This way, we can avoid the need to power the device directly from the Arduino pin, like we have done till now when dealing with LEDs that operate with...