Built-in project · no microcontroller

L9110 motor by hand

An L9110S module, a motor, a four-AA pack and two switches, no board: each output follows its input, and equal inputs brake. There is no microcontroller in it: the simulator solves the 5 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.

Teaching? Assign it to your class in one click.

Beginner About 15 minutes to build and run. Runs in your browser. Free, and no account needed.

The parts retail for about $7.50. On Mokxi they're free.

The circuit runs here once the page has loaded.

What you'll learn

  • How an H-bridge reverses a motor
  • Two inputs, four combinations
  • Braking versus coasting
  • Staying within a chip's voltage rating
  • Difficulty: Beginner
  • Time: About 15 minutes
  • Parts: 6

How it works

An L9110S module drives a motor, and here two slide switches stand in for a microcontroller. Each switch sends its input, AIA or AIB, either to the battery's plus or to its minus. Each output follows its own input.

If one input is up and the other down, the motor spins one way. Swap them and it spins the other way. If both inputs are equal, either both up or both down, the motor brakes. This chip has no coasting. A four-AA pack gives about 6.4 V when fresh, and the L9110S is rated to 6.5 V.

Parts list

6 parts, plus the jumper wires. They retail for about $7.50; on Mokxi they're free.

Wiring table

Every connection, pin by pin, read from the circuit itself. Each row joins the pin on the left to the pin on the right, by a jumper wire or a breadboard strip.

Part and pinConnects to
Slide switch (1) pin 1Ground
Slide switch (2) pin 1Ground
Motor driver, L9110S pin GNDGround
Battery: AA, coin cell, LiPo pin V-Ground
Motor driver, L9110S pin AIASlide switch (1) pin 2
Slide switch (2) pin 3Slide switch (1) pin 3
Motor driver, L9110S pin VCCSlide switch (1) pin 3
Battery: AA, coin cell, LiPo pin V+Slide switch (1) pin 3
Motor driver, L9110S pin AIBSlide switch (2) pin 2
DC motor pin 1Motor driver, L9110S pin OA1
DC motor pin 2Motor driver, L9110S pin OA2

The notes that come with it

There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.

sketch.ino
// An L9110S (HG7881) module, a motor and two switches. No board.
//
// A-IA and A-IB each go to a switch between the pack's - and +.
// Each output follows its own input:
//
//   A-IA  A-IB   motor
//   up    down   one way
//   down  up     the other way
//   down  down   brake
//   up    up     brake (there is no coast on this chip)
//
// Four AA cells are 6.4 V fresh: the L9110S is rated to 6.5 V.

Troubleshooting

The usual mistakes with this circuit, and the fix for each.

  • The motor does not spin This project
    The two switches must be in different positions. With equal inputs the motor brakes.
  • The module gets too much voltage This project
    Do not go above the chip's 6.5 V rating. A fresh four-AA pack is already close.
  • The input reads random values in one position. Slide switch
    A switch only connects or disconnects. Add a pull-up or pull-down resistor, or use INPUT_PULLUP, so the pin has a defined level when the switch is open.
  • The load never turns on when the switch is flipped. Slide switch
    Use the center (common) leg and one outer leg. The unused outer leg goes nowhere. Check that the switch is in series with the load.
  • The motor does not turn or stops quickly when both inputs are the same. Motor driver
    Each output follows its input. Set one input high and the other low to turn, swap them to reverse. Equal inputs brake the motor rather than coast. Use PWM on one input for speed.
  • The driver gets hot or the board resets. Motor driver
    Power the motors from a separate supply of about 2.5 to 12 V, within the chip's rating, and share ground with the controller. Small motors only: stalled or large motors exceed its roughly 800 mA limit.
  • The motor does not spin, or the pin gets hot or the board resets when it is wired straight to a GPIO pin. DC motor
    A pin gives about 20 mA and a motor needs far more. Drive it through a transistor or motor driver, with its own supply and a shared ground.
  • The transistor or pin is damaged by spikes when the motor stops. DC motor
    Put a flyback diode across the motor, cathode to the positive side. A motor is a coil and kicks back voltage when switched off. Add a 0.1 uF capacitor across the motor terminals to cut noise.

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.