Microcontrollers

Electronic ChipsThere are many different types of microcontrollers produced by companies like Microchip, Atmega and Texas Instruments. All of these manufacturers make an array of different chips to suit different applications but there is a problem, programming equipment can be expensive and learning to properly program a microcontroller is difficult.

Luckily there is an open source hardware development board for the Atmega chips called the Arduino and they are cheap. No need to worry about programming either because the engineers at Arduino have hidden all the complex code required to program an MCU behind some very basic code designed to be understood by someone without an engineering degree or any knowledge of electronics.



Arduino

Before the Arduino came along you needed to understand how microcontrollers worked, you needed to learn a programming language and you needed to buy expensive programmers to program the microchips. Then you needed to wire an oscillator circuit to the chip so that it could function and a voltage regulator to ensure you didn’t burnout the chip with too much voltage.

When you buy an Arduino board you get an Atemga chip with the voltage regulator, oscillator circuit, smoothing capacitors and reset switch built in. Most importantly though the chip comes programmed so you don’t need a programmer, you just need an FTDI connection to upload your programs and most boards have this built into the boards too.

The Atmega chip comes with an Arduino boot loader programmed to the chip, you write a program in the Arduino programming language and you upload it to the chip using the Arduino IDE. The Arduino IDE comes with many built in examples and if those don’t do what you want there is a high chance someone else has done it so a quick google search should results in useful code.

Getting Started with the Arduino


PIC Microcontrollers

A PIC is a microcontroller produce by Microchip Technology and is an alternative to the Atmega chips used in the Arduinos. When I first got into microcontrollers, I started with the Microchips PIC and I programmed them using Assembly which gave me a great understanding of what really happened in an MCU. That is the reason why I prefer to send values in Hex rather than ascii characters in my Arduino code.

I decided to switch to the Arduino because it is much easier to learn and doesn’t require a programmer because you aren’t really programming the Atmega chip, you’re just telling the Arduino program what to do. These features seemed more important as I assume most people wanting to know how to build an RC Tractor don’t have programming knowledge or programmers.

From time to time I use PICs in some of my RC tractor attachment builds for no other reason than on that particular day I felt like working with a PIC.


Programming a PIC

Programming PICs is obviously not as easy as programming the Arduino’s because you are not just telling a software what to do, you are actually programming the chip and must know the limitations of your chosen device if you want the code to work. With the PIC you are directly programming the chip so you can pretty much use any programming language you like provided you compile it into the correct machine language file which the PIC can understand.

The most common languages would be assembly which is a bit old school or C. I had done a little C in university so I decided to go the Assembly route to see what that was like. It was a good decision as you really learn exactly what is happening inside the chip as it is doing exactly what you are programming. In C and in the Arduino programming languages you are very removed from reality, in Assembly you are moving bits. Microchip provide a good IDE called MPLAB which can compile C and Assembly code.

The C code and Arduino programming language have a major advantage when it comes to looping code or performing conditional statements. It is not straight forward in Assembly which would make something as complex as an RC Tractor very difficult so I wouldn’t advise it for that. Controlling a trailer though is not difficult to do so if you’re adventurous you could try PIC Assembly

Genuine Microchip programmers can be very expensive so I’ve usually gone for cheaper alternatives. My first programmer was a Vellman K8048 which was good but required a serial port so I needed a desktop to use it. I then bought a K150 PIC Programmer which is a cheap ebay programmer and has a few bugs but it gets the job done. This one is a USB programmer so I was able to use it with my laptops.
A downside of the PIC is that you don’t get small modules like the Arduino pro mini so a lot of the time you are using through hole chips which are taller and sometimes require additional clock crystals. So the PIC is only for the very bravest (or craziest) of you RC vehicle builders.