Built-in project · no microcontroller

Emergency stop on a motor

A TT motor on four AA cells behind a rocker switch and a latching emergency stop: the rocker runs it, the red button cuts it. There is no microcontroller in it: the simulator solves the 4 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 10 minutes to build and run. Runs in your browser. Free, and no account needed.

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

The circuit runs here once the page has loaded.

What you'll learn

  • Switches in series: all must be closed
  • Normally closed contacts and why safety stops use them
  • A latching button versus a momentary one
  • Powering a DC motor straight from a battery
  • Difficulty: Beginner
  • Time: About 10 minutes
  • Parts: 4

How it works

This is a series circuit with no code. Four AA cells feed the rocker switch, then the emergency stop button, then the motor, and back to the battery. Current only flows if every part in the chain is closed.

Set the rocker to I and the motor runs. Press the red e-stop and it latches down, opening the circuit even with the rocker on. Click it again to twist it back out. The e-stop is normally closed, so a broken wire stops the machine instead of hiding.

Parts list

4 parts, plus the jumper wires. They retail for about $8.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
Rocker switch, SPST pin 1Battery: AA, coin cell, LiPo pin V+
Battery: AA, coin cell, LiPo pin V-Ground
DC motor pin 2Ground
Emergency stop button pin 1Rocker switch, SPST pin 2
DC motor pin 1Emergency stop button pin 2

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
// A motor behind a rocker switch and an emergency stop.
//
// Four AA cells (6 V) through the rocker, then the e-stop's normally closed
// contact, then the motor. Click the rocker to I and the motor runs. Click
// the red button and it latches down, opening the circuit whatever the
// rocker says; click it again to twist it back out. That is why an e-stop is
// normally closed: a broken wire stops the machine instead of hiding.

Troubleshooting

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

  • The motor does not run This project
    Check that the rocker is on and the e-stop is twisted back out. Either one open breaks the circuit.
  • The motor spins with the e-stop pressed This project
    Check that the e-stop sits between the rocker and the motor in the same loop, so it cuts the whole path.
  • The battery is wired backwards, or the voltage is too low or too high for the circuit. A fresh AA is about 1.5 V, a LiPo is 3.7 V nominal and 4.2 V full. Battery: AA
    Match the plus and minus marks. Check the voltage your parts need. Two AAs make 3 V, four make 6 V. Never feed a LiPo to a 3.3 V chip directly at 4.2 V.
  • The circuit resets or browns out when a motor or servo starts. A battery has internal resistance, so the voltage sags under load. Battery: AA
    Use a fresh pack with enough current rating. Add a 100 uF or larger capacitor near the load. Power motors from their own pack and join the grounds.
  • The switch never turns the load on or off. Rocker switch
    An SPST rocker just opens or closes two legs. Wire it in series with the load on the live side. The side marked I closes the circuit.
  • The input reads random values when off. Rocker switch
    An open switch leaves a pin floating. Add a pull-up or pull-down resistor, or use INPUT_PULLUP and read LOW as on.
  • The button does not cut anything. Emergency stop button
    Use the normally closed (NC) contact in series with the circuit it protects. The normally open contact would only close when pressed, which is the wrong way around.
  • The circuit stays dead after the button is released. Emergency stop button
    The button latches. Twist or pull the head to reset it. With INPUT_PULLUP and the NC contact to GND, running reads LOW and pressed reads HIGH.

Change it and keep it

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