There was a 4-part series published in Servo Magazine starting in September of 2008 featuring contributions from three authors centered around the capabilities and uses of a Propeller Multicontroller board; a DIY multi-purpose control board. This is part 1.
The 4-part series included the following articles / authors:
Part 1 – Introduction and Design of the Propeller Multicontroller Board – Chris Savage
Part 2 – Servo Control – David Carrier
Part 3 – Stepper Motor Control – Kevin McCullough
Part 4 – PWM Control of Motors and Lamps/Lights with Example Code – Chris Savage
Unfortunately I did not write part 2 or part 3 and unable to distribute those articles. However you can order them from Servo Magazine if you’re interested. The parts listed here originated on this site during development.
Recently an artist friend asked me how he might go about automating his latest masterpiece using a BASIC Stamp®. After looking at what he had it turns out he was going to need to control DC motors, hobby servos and stepper motors. While there are solutions for controlling all of these devices it would generally mean having three separate controllers, one for each device. A better solution would be to have one controller that could, ideally, control all three devices. This would simplify the design considerably; something my artist friend can really appreciate. A colleague named David Carrier had recently done some work with servo motor control for the Parallax QuadRover and another colleague named Kevin McCullough with DC motor control and this got me thinking about a cost-effective way to integrate this type of control into a single design. Since the actual interface hardware for each device is somewhat different the goal would be to focus on the control board itself and keep the design simple. This would allow the controller board to focus on providing the correct signals to the various devices. Each device may or may not require its own driver circuitry. My colleagues and I decided to work toward this goal.
Servo Motors are generally pretty easy to control. They can operate from 4.8V to 6V DC (depending on the servo) and do not require any special driver circuitry. Servos require a variable pulse width from about 1 ms to 2 ms at 20 ms intervals on their signal input pin to control them. The width of the pulse determines the position the servo will move to within its range of motion. This pulse must be continuously sent in order for the servo to maintain its position. There are a number of servo controllers out there and many microcontrollers such as the BASIC Stamp can control them directly. Unipolar stepper motors have various voltage ranges and require only a simple driver circuit using MOSFETs or power transistors capable of handling the voltage and current of the stepper motor. You can then control them by energizing the phase coils in sequence. This control can be provided by a 4-bit output from a controller into the driver circuit. DC motors are also available in a wide range of voltages and can have a simple on/off control circuit, such as a transistor or MOSFET, or you can have directional control using an H-Bridge. For speed control the input to the driver must be pulse-width modulated (PWM). Finally, since PWM is also used for controlling lamps and RGB LEDs, it seems only right to include that support in a controller as well.
Many servo and motor controllers are based on SX, PSoC, AVR or PIC microcontrollers and each tends to have functionality specific to the type of controller it is used on with no provisions via hardware or firmware to add or change that functionality, especially by the end user. Achieving our goals of a multi-purpose controller can be most easily realized using the Parallax Propeller™ chip. The Propeller chip has eight 32-bit processors onboard. Each processor has 2K of its own local memory, and the Propeller chip has 32K of shared RAM as well as 32K ROM. Each of the eight processors has dedicated hardware which can be used for counting pulses, generating signals and even generating video. The open-source nature of the Propeller chip community means there is already an abundance of example code for controlling many types of hardware. One of the design goals with this project is to be open-source and provide multiple examples. Due to the amount of information we’ll be covering this will be a 4-part article.
In this part, I will be covering the design of the hardware as well as the construction of a prototype. For those who do not wish to have a PCB made the prototype design will provide an alternative method of constructing this controller. In the second part David Carrier will cover servo control and provide an open-source object for the Propeller which will mimic functions of the Parallax Servo Controller as well as provide some other interesting features. In part three Kevin McCullough will demonstrate stepper motor control and provide an open-source object as well as a simple driver circuit for stepper motors. Finally, in part four, I will round out this article with some examples of PWM control including an open-source object as well as hardware interface schematics, including a simple H-Bridge.
For the prototype it was easy to prove the design using the Parallax Propeller Proto Board. This board already provides much of the circuitry we’d need to build our Multicontroller such as a Prop Plug programming interface, a 3.3V regulator and a power switch, which allows us to power the logic supply and the servo pads independently. There is also a reset button which can help in testing and debugging code.
This photo shows the Propeller Proto Board as it comes from Parallax Inc. The first thing I did was allocate the first 16 I/O pins for the main outputs. These are conveniently located along the right side (P0 through P7) and top (P8 through P15) of the Propeller chip. Next I populated the board with sixteen 3-pin SIP headers. On the Proto Board the first two holes coming from each I/O pin are connected together. Using the outer hole as I guide, I left room for a 3.9K series resistor and a 3-pin SIP header along each of the 16 I/O pins.
This photo shows the top of the Proto Board after being populated. Note the 1/2W resistors were unnecessarily large. 1/4W resistors are called for in the design; however I had an insufficient number of them to complete the prototype but had plenty of 1/2W type so I used what I had. Normally eight 1/4W resistors side-by side is cramped so to get the 1/2W resistors on the board I had to stagger them within the same space. This is done by alternating which hole gets the bent-over lead and which one gets the body of the resistor, and it goes to show what can be accomplished in minimal space with through-hole components.
The 3.9K resistor value was chosen to protect the Propeller chip I/O pins from excessive current under many conditions, including interface to 5V circuitry. Once all 16 I/O pins were completed, two additional 3-pin SIP headers and an LED were connected to P27 and P26. P27 also has a 3.9K series resistor and will serve as the serial I/O pin for sending data back and forth with the controller. P26 is connected through a 150 ohm resistor to an LED for indicating error, busy or serial data indication. On the prototype there is also a 2-pin SIP header shown to the left of the LED. This was connected to P25 through a 1K resistor and P25 was also pulled high by the 10K resistor. This jumper was going to be used to emulate the ID selection used on the Parallax Servo Controller, however David Carrier has decided that since the Proto Board has an additional 32K of EEPROM available we should make use of this for certain settings and some features he will cover in the next article. Because of this the 2-pin SIP header, 1K and 10K resistors in Figure 2a are not included in the reference design schematics and can be omitted. Note that there was already a VSS bus for P0 through P7 on the Proto Board; however I did have to run power down from the servo header pads on the board to each bus as well as VSS for the top row. I also had to install a 3-pin SIP header to select 5V or VIN to go to those pads.
Using the Propeller Proto Board allowed me to prove and test the design; however it is not exactly as I had planned. My original goals were to isolate the servo supply from the controller supply. The Proto Board made it more convenient to test by running 6V into the DC power connector and setting the servo jumper to VIN, but be warned, if you use a wall adapter on the power input you may be putting too much voltage into servos connected to your headers. At the same time, using the 5V setting limits the voltage; however the on-board regulator will not be able to provide sufficient current for running more than a few servos at once.
Time to get Custom!
The final design will require a custom PCB. I have noticed in recent years that the more popular formats for schematics and PCB layouts are ExpressPCB and Eagle CAD. I find the ExpressPCB extremely user friendly and it is a simple task to create and add custom parts to both the schematic and PCB libraries. I can usually create a custom part in a matter of a few minutes at most. Boards can be ordered online right from within the software. Eagle CAD has a higher learning curve and is not quite as user friendly, however it more than makes up in power and still includes a free version for non-commercial use and includes many libraries of parts which can be downloaded from the manufacturer website. The design presented here is available in both formats with both a schematic and linked PCB layout. In both design packages the schematic was drawn first, followed by a linked PCB. By doing this you ensure that you PCB matches your schematic and that there are no missing components, traces or connections.
Here is the standard schematic. You may notice the final design includes an 8-bit AUX I/O port. With eight processors it is unlikely you’ll ever use all of the Propeller resources running the controller as a co-processor. In some cases it may be desirable to use this controller to handle all the necessary tasks instead of just motor control functions. In these cases the eight additional I/O lines would provide possible connections to external serial LCD displays, keypads, keyboards, mice or anything else you may need. The extra ports could also be used for limits switches or encoders from motors.
Parts lists are included for both the prototype as well as the final design. As the project progresses through all four stages and beyond we will have the most up to date information available on the project website. I would be happy to answer any questions you may have regarding this project via this forum thread.
Construction Notes and Testing
All of the parts used are available at most of the electronics distributors such as Jameco, Digi-Key and Mouser. Some of the parts for the prototype were even purchased from Radio Shack. I listed Jameco part numbers simply because I have the catalog handy and have order parts from them many times. In all honesty I have so many parts in stock at my home office that I haven’t had to order anything in a long time. The only two parts that I don’t have part numbers for are the terminal block and the power switch. Most hobbyists will have these parts in some box or bin somewhere as I did. Those who don’t have two options…the first is that you can modify the existing PCB layout to use a part you do have available. Option two is for those who aren’t comfortable modifying the existing layout. You can simply have the board etched as it is and connect the power connections directly to the pads for the terminal block rather than mounting one. For the power switch you can do the same thing. Simply run two wires to your own switch from the PCB.
Here are the trace layout and parts placement diagrams.
You can test the main I/O on the board using objects located on the Parallax Object Exchange. Currently there are several objects for servo control and even DC motor control using an H-Bridge. The Parallax Forums are also a good source for example code and with the Propeller Education kit you can even download free lessons and examples, most of which can be run on this board. Keep playing and see how many new ideas you can come up with for using this controller.
Here are some pictures of the final multi-controller board based on the data from the article above.
Finally, the populated board to be used in the other parts of this article series.
Parts lists are included in the attached ZIP file.
Please leave a comment below with any questions, suggestions or feedback.
Propeller Multicontroller – Part 1 by Chris Savage – Savage///Circuits is licensed under a Creative Commons Attribution 3.0 Unported License.