Monday, September 25, 2017
Home » Bot Books » Programming And Customizing The Multicore Propeller Microcontroller

Programming And Customizing The Multicore Propeller Microcontroller

Author: Harry Mueller

From Robot Magazine Issue 28 – May/June 2011

by Shane Avery, Chip Gracey, Vern Graner, Martin Hebel, Joshua Hintze, André LaMothe, Andy Lindsay, Jeff Martin and Hanno Sander, Parallax, Inc.; © 2010 McGraw-Hill, available at www.parallax.com and www.amazon.com

BotBook_Prog_00As hobbyists and students, we all search for the perfect microcontroller, the software to create that magic code snippet and the hardware to transfer it to the microcontroller. Those with deep pockets or folks with loads of spare time have lots of choices. But what about the rest of us? What do we do? If you have a few extra bucks, a smattering of time and a huge desire to get into robotics development and programming, one option worth serious consideration is the Parallax Propeller microcontroller.

A new book from Parallax is “Programming and Customizing the Multicore PROPELLER Microcontroller.” Featuring a bunch of different authors, this 475-page, soft-cover book provides a multifarious exploration of what this chip is capable. Along the way, it provides a multitude of tips for prospective programmers, offers ideas for further research and provides exercises to extend the reader’s understanding. Each chapter, 12 in all, deals with a unique topic and most discuss real projects in the context of goals and solutions. All projects are open source and open-ended and readers are encouraged to take the example projects even further.

Here’s a brief description of what each chapter offers:

Chapter 1– Introduces and defines what a multicore microprocessor is and provides a description of the Propeller microcontroller hardware.

Chapter 2– Provides a cursory introduction to programming the Propeller using the Spin language and describes some basic considerations. This chapter also goes into available resources, like the Propeller Object Exchange (OBEX), user forum and Webinars. You can extend the power of your Propeller and share your objects with others in the Propeller Object Exchange. Check out this remarkable resource at http://obex.parallax.com; it is free and where other developers share their objects.

As a personal comment, I think most intermediate and expert programmers can move forward from here, but newcomers to programming should really consider going through the Propeller Education Fundamentals (free download) first.

Chapter 3– Discusses debugging techniques, from root cause to tool availability such as serial terminals, ViewPort and PASD. Several hands-on debugging examples are included.

Chapter 4– Delves into sensor basics and provides examples of how sensors are used based on interface category types. These categories are: on/off, resistive and conductive, etc., pulse and duty cycle, frequency, voltage and serial interfaces. Examples of how to process sensor data and store it on EEPROM or send it on to a PC are provided.

Chapter 5– Looks at wireless networks using a Propeller. Using XBee hardware and the XBee protocol, a three-node wireless network is established. The network consists of a robot controller (as in a gizmo to control robot movements), a robot that performs directed missions and a TV screen that displays telemetric data.

Chapter 6– Describes how to build the DanceBot, a creation of Hanno Sander. Included is a parts list, the code and an explanation of how the robot balances and steers. Here’s a great chance to learn a bit about PID control, fuzzy logic and Kalman filters.

Chapter 7– Discusses using the DanceBot, or AnyBot for that matter, to explore the interesting world of computer vision. Hanno developed PropCV which acts as a frame grabber (at 30 fps), and this allows viewing camera scenes on a TV or in ViewPort and provides multiple buffers that allow the use of a number of filters to enable vision-based actions. Explanations and code examples are provided to track bright spots, follow lines and track a defined pattern. Also described is a plug-in, again developed by Hanno, which allows ViewPort to use OpenCV filters. Several of the programs provided in the chapter are written in Propeller assembly code.

Chapter 8– Looks at networking the Propeller using Ethernet and Internet protocols. Included is a fairly comprehensive discussion of  TCP/IP and UDP/IP protocols and how they are used in setting up a simple HYDRA based game called Button Masher.

Chapter 9– Gets into the nuts and bolts of GPS tracking, altitude estimation and data logging. The example project uses a GPS and barometric pressure sensor to create a waypoint track and elevation estimate. This data is in turn stored on a Secure Digital (SD) card. The waypoint track can be plotted and viewed on Google Earth. Suggestions are provided to turn this into a full-blown autopilot system, a real enticement for this RC junkie.

Chapter 10– Explores using a Propeller Demo Board (Rev C/D) as slave/server to host/client PC. In addition to a Propeller Demo Board, this project requires an NTSC TV, VGA monitor, PS/2 keyboard and a host PC. By using your PC in terminal mode, commands can be sent to various peripheral drivers. A command library is provided to initiate a number of device actions; clear screen, play note, check for key press, etc. The code uses only 6 of the 8 cores present and readers are encouraged to modify and expand the program. This can be done by adding other devices such as a mouse or by experimenting with communication protocols other than RS-232 such as SPI or I2C.

Chapter 11– Explains how the Propeller can be used to experiment with optimization of a heating, ventilation and air conditioning (HVAC) system using a model house. By building a small model with several rooms, sensors and a few custom motherboard/daughterboard combinations the author looks at how airflows can be varied to achieve some optimum condition. A variety of subjects are covered in exploring this project, including sensor sampling, network communication, servo control, video display and data recording.

Chapter 12– Moves into the field of speech synthesis. This author has done extensive work in the field and offers some of his insights and developed software. The chapter provides a lot of the theory behind the program and the “software goodie pack” includes a spectrograph to analyze sounds and the VocalTract object to get you on the road to creating your very own intelligible sounds.

Two appendices follow, one a Propeller Language Reference and the second a glossary of Unit Abbreviations.

For the intermediate/expert programmer, or the advanced beginner who has learned the lessons of the Propeller Education Kit, this book can be your vehicle to a whole range of interesting and exotic destinations. My own plan is to build Hanno’s DanceBot and explore some of the many (over 500) functions of OpenCV. Also on my radar is wireless networking, GPS tracking and OMG, how can I pass up speech synthesis. You can see where this book can lead to some serious time management issues but hey, these are the kinds of problems I can learn to live with. Can you?

—by Harry Mueller