Pinnovations logo

Microcontrollers




 

This page discusses the microcontrollers used in the project. See the architecture page for more info and for the real good stuff, scan the dev log.

Overview

For the Solar Ride project, two flavors of microcontrollers are used:

  • Basic Stamps from Parallax
  • Picaxes from Rev-Ed (Revolution Education in the UK).

Two models of Basic Stamps were used, the regular "base" model Basic Stamp 2 (BS2), and also the BS2p24.

The BS2 was a late substitution for the relay controller. Two BS2p24ís were used, one for the master controller and one for the switch controller.

The Picaxe model 18A was used for the lamp controller.

Following are some observations on these micros.

Basic Stamps

The Basic Stamp is the king of the hobbyist microcontroller. Parallax leads the way in support, development and education resources. Really a first rate company in my opinion. The BS2 micro seems pretty bullet proof and easy to use. In the few months that I have been using them, I have really had zero problems.

The only reason to consider alternatives is due to cost. The standard BS2 retails for US$49, although HVWTech in Canada (where I am) sells them for US$40.

Check the Parallax web site for feature comparisons, but to summarize here, the BS2 runs about 4000 PBasic (Parallax Basic) instructions per second. Thatís roughly 250usecs per instruction. 16 configurable i/o pins, 26 bytes of user RAM and 2K of EEPROM program space.

The PBasic development environment is free and is easy to use with good syntax hiliting, good online help etc.

The BS2 is delivered in retail configuration as a mini-PCB, sporting a Microchip PIC16C57 processor, with onboard 20mhz resonator and voltage regulator (which you generally shouldnít use).

The BS2p24 micro is the top of the line one Parallax sells in a 24 pin package. There is also a BS2p40 which sports similar specs but with 32 i/o pins versus 16.

The BS2p24 is based on an Ubicom SX48 processor, but is pin-compatible with the BS2.

The BS2p24 retails for US$89, although you can find them for US$75 each. I was fortunate to buy my two as scratch and dent models directly from Parallax for US$40 each. Great deal that was!

The BS2p24 is three times as fast as the regular BS2 (12000 PBasic instructions per second), and contains eight separate 2K programming banks. Kind of odd actually. To run programs in other banks, you transfer control to them. It is not like a subroutine call where your state is saved on a stack.

There is a limited amount of scratch RAM available (96 bytes maybe?) in addition to the standard 26 bytes. Other features also. For me it was great just to get the triple speed of the BS2 with higher serial port rate to the PC. I did not utilized the other 7 programming banks, although I did need the extra scratch RAM.

Picaxes

Picaxes are essentially programmed PIC micros. Unlike the Basic Stamps, they come as raw chips, not processors mounted on a mini-PCB. By far and away the main attraction of the Picaxe is price. The 18A chips used can be had in North America for US$7 each.

At first glance the capabilities of the Picaxe appear almost on par with the BS2, but at 1/7th the retail price!

And if you can get the Picaxe to work properly then you may be farther ahead.

However, speaking from our own experiences, you get what you pay for, and whether it was Harryís stupidity or just bad luck, the Picaxes didnít pay off as well as had hoped.

We ended up only implementing one for the lamp controller, with three others fried and unusable, and one working but unable to receive serial data. Plus 3 others on order that will not be used for this project. So 8 Picaxes have been purchased at a cost of say US$60 with one implemented.

However, itís a neat product, has lots of fans and the Rev-Ed site has lots of very good documentation to help hobbyists. A lot of these appear to be sold in Australia, New Zealand and England.

There are also several models available.

The 18A model (a programmed Microchip PIC16F819 micro) used has 14 bytes of RAM (very limited) but with another 48 or so bytes available via peek/poke operations. Program EEPROM space is very limited at 256 bytes, and I always seemed to be close to that limit. However, the 18X model at US$10 has 2K of program space like a BS2.

The processor internal resonator speed runs at 4mhz by default yielding an approximate throughput of 2000 Basic instructions per second. The 18A supports a setfreq command however which allows you to dynamically increase the speed to 8mhz or about 4000 instructions per second.

Comparison

The Basic language used here however is extremely crude, and makes the Parallax PBasic look fantastic by comparison. However they support many of the same features as the BS2, and maybe more in some ways.

The 18A has 8 dedicated output pins and 5 dedicated input pins. Less than the BS2, but three of the inputs can be used for 8-bit analog to digital conversion (ADC).

One other important point to note is that the BS2 can use CTS and RTS i/o lines for doing serial communication. The Picaxe does not support CTS/RTS although it does support a polled interrupt. This was used successfully for serial communication with the lamp controller, but unsuccessfully with the relay controller (see the dev log for late September).

Serial comm rate between BS2p24 and Picaxe with the 8mhz resonator speed was 4800 baud, versus 9600 bause between BS2p24 and BS2.

Aside from the serial problem we had, the other main bugaboo was wrecking the Picaxes during program download over the PC serial port. Something is just not robust there. The chips may still be usable as raw PIC16F819 processors, but not as Picaxes.

Other Processor Options

Being new to electronics, I did not have time or the experience to look at any other alternatives for this project. However I have ordered a BasicX BX24 processor to test with. It runs a flavor of Basic very close to Visual Basic, supports multi-tasking and is supposedly much faster than a Basic Stamp, all for US$40-$50. The underlying processor is from Atmel.

So it looks like another tradeoff between ease of use and potential power. I will see how it works out.

There are several other processors out there, some of which are programmable in some flavor of Basic. Others can be programmed in assembler or C code or even C++ or Java. I hope to explore some of these options over time.

Last updated: September 26, 2008

   
 
 
 
 
 
 
 
 
 
 
 

 
© Terry Cumming, 2004-2008