BEAM From the Ground Up is a BEAM Reference Library site.
Reverse without sensors
The circuit works on the fact that the motor draws more current when loaded, and the power travels through a small but finite output resistance in the inverters. The inverter U1 can be referred to as the trigger, and sets the direction of the motor, but is sensitive to the voltage drop at the output of the inverters. Since U1 sets the state of U2 (U2 will be opposite), and since the outputs of both inverters are connected across the motor, the motor will be driven in one direction or the other.
Understanding what happens in the circuit when the motor is running is crucial to understanding how the circuit works. Observing the voltage levels with an oscilloscope taught me a lot about how BEAM circuits operate.
When the motor is free running, it will generate periodic noise as the brushes inside the motor rotate and break connections to the commutator:
The two scope traces show the voltage levels on either
side of the motor. There's about three volts across the
motor in these examples (the vertical grid represents one
volt for each channel). In the left trace, you can see the
periodic ripple generated by the brushes at a frequency of
658 Hz (cycles per second). The frequency of the ripple
gives a rough estimate of the speed of the motor - but it
depends on the construction of the motor. For example, if
there were three brushes in this motor, the shaft would be
rotating about 220 times per second (658 / 3). The scope
trace on the right shows the same picture, but zoomed out to
a horizontal resolution of 100 ms per grid. I used the
Mabuchi motor from Solarbotics for all these snapshots.
Loading the Motor
The motor draws more current from its source as it
becomes loaded (as the motor's back-EMF is directly
proportional to the speed of the motor - less speed, less
back-EMF, less 'resistance' put up by the motor. Conversely,
the faster the motor, the more apparent resistance.) This is
one of the driving principals behind BEAM. As the motor
draws more current, the output resistance of the inverters
causes the voltage at each node of the motor to move away
from ideal (+5 volts or Ground) towards 1/2 Vdd. This can be
seen in the scope trace above. (Compare it to the first
scope trace). In addition, the frequency of the periodic
noise slows down (459 Hz in this shot), corresponding to a
slower motor shaft speed.
Stalling the Motor
When the motor is loaded to the point of stalling,
maximum current is drawn (about 80 mA, compared to 40 mA
when not loaded at all), and the output resistance of the
driving inverters causes the voltage drop across the motor
to approach zero volts. There is no periodic brush noise, as
the motor shaft is not turning.
Loading the Motor Quickly
So what happens when the motor is stopped suddenly? Everything described above:
The motor goes from quietly humming along, and drawing about 40 mA, to a sudden stop, drawing about 80 mA. The current ramps up in response to the applied load, and the corresponding voltage drop across the motor goes close to zero, in a relatively short period of time. This response is what causes the reverser circuit to flip states.
The Reverser Circuit
The inverter U1 can be called the trigger inverter, as it is the key element in the circuit that detects motor loading. The input of U1 is biased close to its switching threshold by the voltage divider, comprised of resistors R2 and R3. Depending on the state of the circuit, the input voltage to the trigger inverter will be either 3 volts, or 2 volts. If the output of U1 is 5 volts, the output of U2 will be 0 volts - and the input to U1 will be 2 volts. Two volts is below the switching threshold of a 74240 inverter (the switching threshold is 1/2 Vdd -> 2.5 volts), so the inverter sees the 2 volts as a logic 'zero', outputting a logic 'one' of 5 volts.
However, the state of the circuit may be the opposite case - U1 may be zero volts, and U2 be five volts. In this case the bias voltage of U1 would be 3 volts - U1 would see this input as a logic 'one', so it will continue to drive its output at zero volts.
Long story short, the circuit acts as a memory element by remaining in a stable state, provided that the input voltage to U1 does not cross over 1/2 Vdd...
Positive AC Feedback
This is where the capacitor C1 comes into play. C1 provides positive feedback of the motor noise to the input of U1. A capacitor only passes non-DC signals through it - in other words, it passes only the transitions of the motor noise into the input of U1, not the average DC voltage at the motor input. This is important because it DC isolates U1's input from the DC motor voltage, allowing the input of U1 to be biased at either two or three volts (so its close to the trigger level of 1/2 Vdd).
In the above scope shots, green shows the voltage at the motor input driven by U2. Black shows the voltage at the input of U1, the trigger voltage. Notice how the positive feedback 'plucks' at U1's bias voltage - the rising voltage pulls up the bias, which then settles back down to the bias voltage determined by the voltage divider (at a time constant of appx. 2 Mohms X 0.1 uF = 0.2 seconds). (quick note - the trigger voltage should be at about 2 volts , but the oscilloscope probe I had was only 50 ohms, so it acted like a 50 ohm resistor to ground, pulling down the bias voltage to about 0.7 volts).
The scope probe on the other side of the motor shows what you'd expect:
When the motor encounters enough loading, the trigger inverter's input bias voltage crosses over 1/2 Vdd, changing the driving output to be opposite of what it was before. U1 then causes U2 to flip, and it again becomes stable in the opposite state (reverse). You can see this in the scope shots below, showing the voltage on either side of the motor:
The traces show the motor changing direction, and how the current (and inverters' output drop) ramps up after the motor accelerates in the other direction. These shots also show some interesting behavior - the first shows a 'glitch' in the amount of current drawn by the motor. The second shows how the DC offsets can shift after the circuit changes states.
There was plenty of this. The circuit would toggle on its own, while free running, and when completely stopped. It would go into a burst of oscillation, and then settle down for a while, sometimes oscillating in the 10 kHz range, sometimes in the MHz range, but never in a noticeably repeatable fashion.
While free running:
While under some loading:
And when stopped:
The power supply was unaffected by the motor noise. This was with a high quality zero impedance power supply, who knows what it'd be like with a battery.