MECH 400 Microprocessor Supplemental Handout One Circuits for Hardware Interface Motor capacitors A significant amount of electrical noise is generated at an electric motor’s armature, electrical noise which will interfere with the behavior of the OOPic. To counteract this behavior, solder three capacitors to each motor, as shown in figure 1. Solder one capacitor between the positive and negative terminals, and one between each terminal and the motor can. It may be necessary to use a file to remove the clear coat or paint from the motor can prior to soldering. Figure 1: Motor capacitors Digital input from switches and similar devices To interface with mechanical switches, a pull up circuit as shown in figure 2 is required. The 5K resistor is sized so that 1 mA of current will flow into the digital input port when the switch is triggered. For reference, the I/O ports on the OOPic R board can source or sink a maximum of 20 mA. When the switch is open, the pin will read HIGH (+5 VDC), and when the switch is closed, the pin will be pulled down to GND. Figure 2: Digital input interface circuit Solenoid control circuit In order to control a solenoid (or any other on-off DC component) with the logic-level power available on the OOPic digital output ports, a Mosfet is used. Connect the Mosfet and resistor as shown in figure 3. When the digital output pin is high (+5 VDC) the Mosfet’s gate will be saturated and electrons will flow through it from source (S) to drain (D), thereby driving the solenoid. It is also possible to use pulse width modulation at the gate to vary the current flow through the Mosfet. This is the basis of the Mosfet speed controls and H-Bridges. Figure 3: Solenoid valve control circuit