There 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.
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.
Getting Started with the Arduino
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