![]() |
|
|
DPRG
Events
Shoptalk
Search DPRG Web Site
Member Login
Support the DPRG
Make a tax deductible donation to the DPRG through PayPal.
Website design and hosting by NCC |
DPRG Interfacing PrimerJuly 1997, Written by Jim Brown DC Motors
Overview
Speed Control
Direction Control
+v
|
+-------+-------+
| | 1 2 3 4 result
1 ---@ @--- 3 ------------------------------
|-------|(------| on off off on foward spin
| | off on on off backward spin
+-----(MOT)-----+ on off on off break
| | off on off on break
| |
2 ---# #--- 4 @ = P channel mosfet
| | # = N channel mosfet
+-------+-------+
|
gnd
If break is not necesary lines 1 & 4 and 2 & 3 may be tied together and switched with an inverter to make the direction only require one line for control.
Interfacing to a MCU Stepper Motors
Interfacing to a MCU I found out a nice alternative using a ULN2803 (or 2804). It's really is a nice way to go. I've gotten the ULN2804 version at Tanners! Works practically the same as the 2803 but available at Tanners. I think they were .50 or 1.00 or something like that. Well worth it!!! And the circuit makes sense! One can drive two steppers from one 2803 (or 2804) chip.
+5v
| _________ +-----------------+--- +12v
+-------+-+ | 10|---+ _________ |
| 8051 1|-----|1 2803 18|--------| | |
| 2|-----|2 17|--------| stepper | |
| 3|-----|3 16|--------| |--+
| 4|-----|4 15|--------|_________| |
| | | | |
| | | | _________ |
| 5|-----|5 14|--------| | |
| 6|-----|6 13|--------| stepper |--+
| 7|-----|7 12|--------| |
| 8|-----|8 11|--------|_________|
| | +--|9 |
+---+---+ | +---------+
| |
+------+-----gnd
Each of the 8 buffers in the 2803 has a incoming resistor, 500ma sink, and a flyback diode.
+12
|
+--+--+
| |
| _
1k | ^
|\ |
to mcu ----/\/\/\----| >---+--- to stepper
|/
|
gnd
I think the only difference between the 2803 and the 2804 is that the 1k resistor in the 2803 is a 10k resistor in the 2804. These 2803's work great for unipolar steppers. For the bipolar ones, I'd probably resort to a nasty stepper chip or just switch to a unipolar stepper. Servos
Overview
Interfacing to an MCU For the signal that controls the positioning of the servo, it needs a pulse of 1ms to 2ms and that pulse needs to be sent every 20ms to 30ms. The positioning goes that a pulse of 1.5ms is the shaft center position, and any other pulse width would move the shaft proportionally to the left or right.
Click here if you want to see the C source code for to the servo controller. The software just goes through a test pattern of: 1000us, 1250us, 1500us, 1750us, 2000us, 1750us, 1500us, 1250us, 1000us, 2000us, and repeats. In other words, it goes from left to right in steps, and then right to left in steps, and then quickly to the left and back to the right. LEDs
Overview
Interfacing to a MCU
+5v
+--------+ |
| |--+ 220 LED
to MCU ------| 7414 |-----/\/\/\---|<--- +5v
| or |
| 7404 |
+--| |
| +--------+
gnd
IR pairsInterfacing to a MCU Buttons & Bumper SensorsOverviewA button is just a mechanical device that connects or disconnects a circuit. Since the signal from a button may actually be several very quick pulses instead of one simple on signal, a debounce algorithm is usually implemented in software to check that a signal is actually sticking on. A debounce algorithm is handy if one is counting the number of signals actually received and where multiple signals for one actual touch is not desired. If the signal sticks on for more than about 50ms it's considered to really be on, otherwise it is a false signal and is ignored. If only a leading edge on detection is desired then the debounce algorithm is not required.
Interfacing to a MCU
/
/
to MCU ---+---- --------- +5v
|
| 10k
+---/\/\/\---- gnd
Audio
Overview
Interfacing to a MCU
+5v
+-----+ |
| |---+
to MCU ------| | 10uf /
| 386 |-----|(----| speaker
+---| | +--- \
| +-----+ |
gnd----------------+
Sonars
Overview
Interfacing to a MCU
+5v
+---------+ |
init | |---+
to MCU -------| sonar |
echo | module | /
-------| |===| transducer
| | \
+---| |
| +---------+
gnd
|
Copyright © 1984 - 2010 Dallas Personal Robotics Group. All rights reserved.