Doing it Digital by John Burton

from BAEC Newsletter No. 128 June 1998

The modern electronics world is digital. In every area of design (with the possible exception of power supply), be it radio, video or control systems, signals are mainly processed in the digital domain. The advantages of this approach are:

In short, digital systems can have higher performance, cost less than their analog counterparts, and in some cases the only way to realise end systems is with digital techniques.

Why then, do hobbyists (and small businesses!) often shy away from digital techniques?

The answer is a number of reasons. These include price, availability of specialist components and simple reluctance to change. One genuine barrier to the hobbyist to date has been the cost of development tools. The vast majority of digital systems require some sort of processor at the core - these require programs to be written and then debugged and tested. This can involve some very expensive development equipment. (By the way, 'bugs' and 'debugging' are much more literal descriptions than most people realise. One of the main problems with early computers was flying insects getting fried in the high power circuitry - hence 'the computer's got a bug in it').

Nothing moves faster than modern electronics, and recent developments mean that most of these barriers no longer exist. The one remaining hurdle is to take a different view of solving design problems!

Lets take a very simple system and look at how it might be implemented in a digital system.

Imagine you wanted a box that could measure a temperature and control a heating element, so a substance could be warmed to a pre-set temperature and then held there. This system could be done fairly easily in an analog or Digital manner, so it provides a good contrast between the two techniques. We can then look at some of the enhancements possible in the Digital version that would be extremely difficult in the analog.

A basic block diagram of the Digital system is shown below:


Block Diagram for the design of a Digital Temperature Controller

The circuit works in the following way:

A temperature is sensed as a voltage and applied to an Analog to Digital converter. I've chosen 8 bit resolution as these are extremely popular and inexpensive devices. The voltage is converted into a number between 0 and 255 and read by the microcontroller.

A pre-set temperature level is provided by a POT and also read by the microcontroller. A simple program compares which of the two numbers is higher. If it is the pre-set temperature, the heating element is kept on (a high voltage is applied to the gate of an external MOSFET), if the measured temperature is higher, the MOSFET is switched off.

Readings are taken on a continual basis (say 10 times a second) to allow very accurate control of the heated substance.

Obviously there's a little bit more to getting an actual system to work, but in essence, this would be a fully functioning digital control system. Some of the enhancements we could easily incorporate are:

Imagine doing some of this in an Analog system?

Of course the input voltage can be measuring any physical property, not exclusively temperature and the output controlling heat, a motor or any number of physical devices. The wonderful thing about microprocessors is that they can be given any number of instructions making the limit to complexity almost infinite.........

In the next article I'll look into implementing the above system in a bit more detail, including choosing the microcontroller, developing a program and debugging and testing it.