About this section
User Rating: / 1
PoorBest 
Written by Bryce Ringwood   

This is a series of notes for people who are interested in playing with microprocessors, such as the Arduino and PIC, which have become popular with many hobbyists. I also slipped in a home-made analog computer made from junk box parts.

Of course, this is an "oldradios" web-site, so the emphasis will be on getting an in-depth understanding by looking at "oldcomputers".  To be more exact, "very old computers indeed" because computer development has been almost uncannily rapid - to the extent that it has introduced profound changes in human behaviour.

When I was growing up in the mid- 1950s, we talked about the possibility of television, atomic power (I was at school near Calder Hall) and "electronic brains". We hadn't been told about Babbage and his mechanical computer and the "Colossus" was classified. We saw adverts in the "Exchange and Mart" for "bombsight computers" - for 65 bob, we could take one apart and get lots of gears, motors and other bits and pieces. These were analog computers, which probably used wheel and disc integrators to calculate the bomb trajectory from the aircraft's wind speed, and point the aiming device. The wheel and disk integrator is the principle behind a device called a planimeter, which surveyors used to use to calculate areas from plans.

A mechanical analog computer using this principle was  made from 1928 to 1931 at MIT by Vannevar Bush and Harold Locke Hazen, although it may not have been the first. He called it the "differential analyzer" and you can see it in action in old movies, such as "When Worlds Collide".

My first analog computer encounter was programming an electronic analog computer called PACE. The idea was to get the machine to calculate the deflection of a steel beam by successively integrating the deflection, then the radius of curvature and so on. It was an inappropriate application and by this time electronic digital computers were becoming more common and are far better suited to the task.

My digital computer experience began with a Ferranti Pegasus in 1963. It was part of our maths tuition that we should program "Newton's method" for solving equations in a language called "Extended autocode". None of us had a clue what we were doing and it really put me off digital computers. My next encounter was many years later with an IBM1130 - solving Highway geometry and surveying problems. This was a happier experience, in spite of the "coding the problem" on to punched cards, then waiting for the answer a day later. Eventually, we were to use a Sperry 1100 to run the office. It had 240Mb of disk, about 1M of RAM and a processor capable of nearly 2 million instructions/sec. In other words, a fraction of the power of a modern cell-phone.

Although the PIC and Arduino (Based on Atmel microprocessors) have become popular with hobbyists, they are perhaps more correctly described as microcontrollers. Microcontrollers have been used for a long time in many domestic appliances. In elderly radios, you may encounter a microprocessor to handle the tracking and tuning functions. Hopefully, this part will work, because unless you have some way of re-programming a new part, all is lost.

But what is it exactly the microprocessors do? and why should they be of any interest to anyone reading this web-site? To begin with, microprocessors can simplify your designs and even allow them to have more functionality than would otherwise have been the case. Physically, a microprocessor looks like any other chip - often in a 28 or 40 pin package, or a 44 pin package for surface mount. There are some microprocessors that come in 8 pin or less packages, for those small tasks. Almost every pin can be programmed to perform some task. This can range from switching something on or or off, or operating lamps, switches and motors in sequence - or driving a LCD display.

My own interest would be using them to make test equipment, maybe a valve characteristic curve tracer, or a magnetometer for sunspot activity, perhaps a gadget to assist in aligning FM receivers. Maybe I won't get around to any of these things, but very often the journey itself is worth it.

Experimenting with microprocessors has received a great deal of interest thanks to the open-source Arduino project. Indeed, I got the last Arduino in stock, as all the University students had bought them.

Now the raspberry pi has been introduced. This is like a BIG computer in a small package. Its a very different thing from the PIC and Arduino - more like a fully fledged desktop PC.

PIC 

The Microchip PIC is also a very popular choice of microprocessor among hobbyists. In South Africa, a "Pic Trix" board is available for hobbyists and experimenters. This comes with a Microchip PIC16F877A already programmed with a boot loader. This development board is available in kit form from Mantech Electronics.

In the end I got a PIC Kit 2 programmer with the Pic Trix development board. This allows for programming the PIC the traditional way by writing the program to it with the programmer, then running it on the development board. You have to build your own development board from the bag of parts, and if you are using the Pic Kit 2, you have to make a small board from stripboard to connect the PIC to its PIC TRIX Kitprogrammer.

This means that the chip has to be plugged into the programmer, the program has to be written to it, then the chip has to be unplugged and plugged into the development board (or application)  then the application can be run.

If the Pic Trix boot loader is used, the PIC can be used in a similar way to the Arduino - the chip can be programmed via a serial port on the board, and then the application can be made to run. As far as I can see, you would be limited to using assembly language if you choose this route.

The PIC can be programmed in 'C' or Assembly language - although there are other options available, e.g. BASIC.

If you purchase the Pic Trix development board, you might have to change the example programs supplied with the compiler quite a bit to get them to work.

Download info for the PIC TRIX board here.

Arduino

I purchased the Arduino from Radiospares as a complete kit with a prototyping board, jumpers, a box of parts and an Arduino Uno . There were no instructions of any kind, which seemed a bit odd, but not too serious as everything you need is available as a download.

ArduinoThe Arduino uses an Atmel micrprocessor  with a boot loader burned in. There is no plugging and unplugging in the  way I elected to use the PIC. You simply write your application program then compile and download it to the Arduino and let it run.

NOTE that if you intend to deploy your project, you will need another Atmega168 CPU - and this will have to have a bootloader burned into it. You can burn a bootloader yourself, but you will possibly need an Atmel programmer to do it.

The Arduino is programmed in 'Wiring', a language derived from C/C++.

The software for the Arduino is open source. The software for the PIC is not, although the "Non Professional" version of the compiler is free.

The Atmel CPU in the Arduino kit has 32k of flash memory compared to the PIC's 8k, which makes the need for an optimizing compiler for the PIC quite strong. (And the fact you have to pay for it a bit annoying. Well, very annoying).

If you are of a gregarious nature, there are a few "Arduino Clubs".

The PC/104

If money is no object, then the PC/104 is a possible development platform. The PC/104 is a regular PC on a small board. You can attach disk drives VGA screens, keyboards and many other devices to it. The power required is 5 volts at 1 Amp or so. PC/104 interface boards can be stacked on the main CPU board. The CPU can be as heavy as you like and you can run touch screens with a Windows interface.PC/104 platform

If you intend accessing hardware from a Windows NT (Windows XP, for instance) platform, then you will have to learn how to develop device drivers.( I never managed to master this skill.)

Getting it all together

To get your project to work, you need to know how to program and also the basics of electronics. What I'm going to try to do here is just run through the basics of each simultaneously. This means there will be a little theory a program example around the theory, if possible a puzzle and an Introduction to some useful parts. The 'C' compiler will be Turbo C for MSDOS or  Microsoft's Visual Studio Express (Your choice) for the PC and Hi-Tech C for the PIC. The Arduino uses 'Wiring', which you download from the web site. It is similar to 'C'.

 I hope you will find these notes entertaining.


Raspberry Pi

The PC/104 is a PC in miniature. The Raspberry PI is a complete LINUX machine in an even more miniature format. It is easy to use, fun and educational. True it has very little to do with OldRadios. It does have rows of pins you can presumably connect things to. I am going to have to find out ore about them...

 
Joomla template by a4joomla