ASK AN EDUCATOR! – “How can I control a solenoid or motor with an H-Bridge?”

Garrett asks:

how do i send/control the L293DNE motor driver to power a SOLENOID or just a dc motor

This is a really good question, and quite a popular topic. The L293D or DNE, depending on the manufacturer, is a Quadruple Half H-Driver or H-Bridge IC that allows for the control of high current loads from a low current source. The advantage of this chip over just using a transistor or MOSFET is in the fact that you can control the polarity of your motor when used as a full H-Driver.

If you are looking to just control a solenoid, I would recommend using a transistor. Specifically one that can handle the relatively high current loads like a TIP120 or equiv. This transistor with a base resistor will be able to drive ~1A from just about any microcontroller. This can also be used to drive your motor and I actually ran a post earlier which gives a much more in depth overview.

Regarding your L293D, below is a circuit diagram that illustrates 3 possible configurations for driving a motor. The one the left shows the IC being used as a full H-Bridge. The pins are configured as follows:

  • Pin 1 (1/2 Enable) – Channel 1/2 enable HIGH = ON
  • Pin 2 (1A) – Channel 1 logic control
  • Pin 3 (1Y) – Motor Lead
  • Pin 4 – GND
  • Pin 5 – GND
  • Pin 6 (2Y) – Motor Lead
  • Pin 7 (2A) – Channel 2 logic control
  • Pin 8 (Vcc2) – Motor Power Supply

To turn CW, make 1A HIGH and 2A LOW. To turn CCW, make 1A LOW and 2A HIGH.

The diagram on the top and bottom right show how you can control your motor in one direction. The top right diagram shows the motor being controlled on the HIGH side and the bottom right diagram shows the motor begin controlled on the LOW side. The control scheme is essentially the same as above, though you will only be controlling one of the logic control lines.

I hope this has helped to answer you question and clarify the use of the L293D!

Don’t forget, everyone is invited to ask a question!

Click here!

“Ask an Educator” questions are answered by Adam Kemp, a high school teacher who has been teaching courses in Energy Systems, Systems Engineering, Robotics and Prototyping since 2005.


Halloween season is here!
Halloween season is here! Check out all the posts, gift guides, and more!

Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here: adafruit.com/editorialstandards

Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Join over 38,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — NewProducts Featuring Adafruit RP2350 22-pin FPC HSTX to DVI Adapter for HDMI Displays!

Python for Microcontrollers – Adafruit Daily — Python on Microcontrollers Newsletter: Adafruit Grand Opening, Profile MicroPython Memory and More! #CircuitPython #Python #micropython @ThePSF @Raspberry_Pi — Classic editor

EYE on NPI – Adafruit Daily — EYE on NPI Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

Adafruit IoT Monthly — Garden Lights, Bluetooth 6.0, and more!

Maker Business – Adafruit Daily — A look at Boeing’s supply chain and manufacturing process

Electronics – Adafruit Daily — When do I use X10?

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



1 Comment

  1. I love the CAPTCHA!

Sorry, the comment form is closed at this time.