Since the GATOR Plus+ board’s output pins are current-limited for protection to just a few milliamps (more details) they can’t be used to directly turn on motors, solenoids, relays, or other high-current devices. To turn on a single high-current device, an NPN transistor can be used like this (the example circuit is used to switch a 12V lamp on or off but could also be used to switch a solenoid, relay, etc.):
General-purpose NPN transistors like the 2N3904 (Fairchild 2N3904BU 60V/200mA) or 2N2222A (ON Semiconductor P2N2222AG 40V/600mA) can be used for low currents, or power transistors like the TIP31C (Fairchild TIP31C 100V/3A) for even higher voltages and currents. Note that the output of the GATOR Plus+ board is limited to about 7mA in this application (see this graph) which limits the amount of current the transistor can carry. The transistor’s DC current gain (often specified as hfe) can be used to estimate maximum current. The following table lists typical hfe values (warning: these can vary a lot from part to part!) and maximum current assuming 7mA coming from the GATOR Plus+ board.
Care must be taken to ensure the transistor does not overheat. At higher currents a heat sink may be required.
Higher currents and lower transistor temperatures can be achieved by using a logic-level MOSFET instead of a transistor as shown in this circuit:
MOSFET’s are primarily rated by their voltage and on-resistance (rds). The power dissipation of the MOSFET can be estimated as P=I2rds where I is the current they are required to carry. Power dissipations greater than 1W or so should be avoided or considered only with proper heatsinking. The table below lists some common MOSFET choices and rough guidelines on the maximum current they can be expected to carry without heatsinking at room temperature. Keep in mind that you must use a logic-level MOSFET in this application.
The inputs to the device draw very little current, but the outputs can each source or sink 24mA of current (though you should probably not have all outputs sourcing/sinking 24mA of current continuously and simultaneously as the device may overheat). The +5V voltage output supply of the GATOR Plus+ board can be used to power the 74AC244 as shown in the figure with the red wire. The outputs of the 74AC244 are digital outputs and will be near 0V or near 5V. Voltages at the 74AC244 outputs must not exceed VCC or be below GND.
An even higher-current and higher-voltage multi-output solution uses a Darlington driver such as the ULN2803 which can sink a maximum of 500mA for each output (but not continuously and not on all outputs). This device can be used for turning on several relays, solenoids, or other high-current high-voltage devices. The example circuit below shows how one ULN2803 can drive 8 solenoids:
When sinking 200mA of current, do not enable more than 4 outputs continuously in order to prevent the ULN2803 from overheating. At 100mA of current all 8 outputs can be on at the same time.
A bipolar stepper motor typically has four wires which represent two coils. The current in each wire can either flow in one direction or the other, leading to 4 possible combinations of current flow. Moving through these combinations creates motion in discrete steps. The STEPPER application built-in to our software can generate the necessary sequence of combinations, but an external driver is needed to supply the high currents needed by the stepper motor coils. A simple stepper motor driver circuit is shown below. It uses the popular L293D or SN754410 H-bridge driver devices. These are suitable for coil currents of about 500mA or less, at coil voltages up to 36V.
The GATOR Plus+ board’s +5V power output can be used to power the driver (pin 16), and an external motor power supply is applied to pin 8 (it must be between 4.5V and 36V). Don’t forget to connect the motor power supply ground reference to the ground reference of the GATOR Plus+ board and the driver (pins 4, 5, 12, 13).
Some L293D/SN754410 devices can draw a fair amount of current from pin 16 (the logic supply) which may cause the GATOR Plus+ board’s +5V power output to drop too far down for proper operation. You will need an external +5V power supply for powering the logic supply on pin 16 in this case.
When connected as shown above, the PB4 and PD6 outputs are used to control the motor current through pulse-width modulation (PWM). The slider bars in the STEPPER application let you set the PWM duty cycle hence the motor current. You will probably want to set the Equal checkbox next to the slider bars so both motor coils experience the same current.
Using PWM the motor voltage can be higher than the rated voltage of the motor coils. For example, a stepper motor rated at 12V per coil can be driven with 30V as long as the PWM duty cycle is kept at about 30% or lower. Higher voltages have the benefit of higher torque since motor coil currents can change faster. You must be careful, however, and keep an eye on the current to make sure you’re not damaging your motor.
The PWM frequency should be above 20 kHz if audible switching noise is a problem, but lowering the frequency will reduce switching losses in the L293D/SN754410 and allow it to run cooler.
A higher-current motor drive circuit is shown below, using the Allegro A3977 driver. This driver supports motor voltages between 8V and 35V and coil currents up to 2.5A with proper heatsinking.
Unlike the L293D or SN754410 which are phase/enable-type drivers, the A3977 is a step/direction driver. On every rising edge of the STEP input (pin 19 of the A3977) the motor moves by one step in the direction set with the DIR input (pin 3 of the A3977). The driver automatically computes the proper phase sequences for each step.
The A3977 also has a more advanced method of controlling coil currents which does not require directly pulse-width-modulating the coils from the GATOR Plus+ board. Instead, an analog voltage on the VREF pin (pin 8 of the A3977) sets the target current. You could set this analog voltage using a potentiometer, but the GATOR Plus+ board can generate this analog voltage using PD6 as a 1-bit digital-to-analog converter followed by a simple resistor-capacitor low-pass filter (shown in the circuit above). For this application, PD6 should be a high-frequency signal (like 200 kHz) and the resistor-capacitor combination should have a low-pass cutoff frequency well below the frequency of PD6. For example, a 10kΩ resistor and 100nF capacitor form a low-pass filter with a cutoff frequency of 159 Hz which is well below 200 kHz.
With an appropriate resistor-capacitor low-pass filter, the voltage at the VREF pin will be a DC voltage controlled by the duty cycle of PD6. The STEPPER application built-in to our software controls this duty cycle using the PWM slider bar for channel 1, thus setting the motor current.
The GATOR Plus+ board is a 5V board, meaning it accepts input voltages from 0V to 5V and drives output voltages at 5V. When interfacing with 3.3V circuits, inputs are not a concern since 3.3V will be interpreted as a logic “high” and 0V as logic “low”. Outputs, however, need to be reduced from 5V to 3.3V in order to prevent damage to the 3.3V circuit.
The simplest way to reduce 5V outputs from the GATOR Plus+ board to 3.3V is use to use a zener diode, such as a 1N746A, 1N4728A, or 1N5226B. For 3.0V systems, a 1N5225B should be used. The circuit below illustrates the proper connection of a GATOR Plus+ board to a Digi XBee module, in preparation for using the SERIAL application in our GUI Software to communicate with the module. The +5V output of the GATOR Plus+ is used to power the XBee module, after being reduced to 3.3V by a Microchip MCP1700-330 voltage regulator. For higher transmit power, a separate 3.3V supply should be used.
For modest data transfer throughput, the hardware flow control wires (CTS/RTS connections to PC4/PC5) can be omitted.
The same connection approach can be used for other 3.3V modules such as GPS receivers, cellular modems, etc.