Single board computers (SBCs) are becoming all the rage and are being used in many projects over microcontrollers. However, are such devices necessary or are you overkilling your project?
The Rise of the SBC
Single board computers, for those who do not know, are computers where all the major components needed for a computer to function are on a single PCB. Single board computers were first around in the late 1970s and many popular computers of the â80s such as the Commodore 64, ZX spectrum, and BBC micro were all single board computers.
However, it became apparent that SBC devices were not powerful enough or easy to adapt, so the motherboard was invented, which allowed for RAM slots, CPU upgrades, and external I/O devices.
But then the Raspberry Pi came to the market and completely reignited the demand for SBC devices that include a GPU, RAM, CPU, and IO devices such as USB ports and Ethernet. Now, SBC devices appear in many hobby projects and are used as microcontrollers to control external devices such as motors, lights, power, and much more. But are SBCs really needed in a project? When should you use one?
SBC vs. Microcontroller: Hardware
Microcontrollers (such as AVR, PIC, and STM8) are small ICs that contain a CPU, RAM, ROM, and several peripherals.
Unlike SBC devices, microcontrollers are often much less powerful with smaller CPUs operating in MHz instead of GHz, only one core, and RAM and ROM sizes less than 64KB.
However, microcontroller peripherals are sometimes more advanced and plentiful than those found on SBC. For example, the Raspberry Pi does have I2C and SPI, but even the most basic PIC devices have at least one UART, I2C, SPI, ADC, GPIO, timers, and internal EEPROM.
Since microcontrollers incorporate all of their features in one IC, the resultant circuit can be smaller than one using an SBC as well as using less power. This makes microcontroller devices very appropriate for portable applications, and since many microcontrollers come in prototype-friendly DIP packages, they are also fantastic for prototyping.
So, Do We Need an SBC?
As it turns out, many projects that use SBCs do not actually need them and could easily perform the same function with a microcontroller or even discrete logic (such as the 4000 and 7400 series). Before we can look at how to determine if an SBC is needed, we need to determine how many resources we will need, including:
CPU power is an important point to consider, since some projects will need lots of it while others will need next to none. SBC CPUs will typically allow for multi-tasking, multi-processing, pipelining, and complex data handling, while microcontrollers will be often limited to one core, no multi-tasking, and operate at MHz instead of GHz. Projects that may need a powerful CPU include those involving servers, voice recognition, video capture, image recognition, and heavy data processing. However, projects that donât require powerful CPUs include basic IoT, sensor data gathering, controls, circuit interface, and even home automation.
Memory is often overlooked, but can make or break a project. SBC devices will often contain RAM in the hundreds of megabytes and possibly even gigabytes, whereas microcontrollers commonly have less than 128KB in total.
SBCs will typically have everything stored in the RAM (due to their Von Neuman architecture) and use an SD card to hold data such as files and the OS.
Microcontrollers, however, typically have two distinct memories: RAM and ROM. RAM is often used to hold data variables while ROM is used to hold the main program.
ROM sizes are often larger than RAM, and it is not uncommon to see microcontrollers with as little as 256 bytes of RAM. This means that languages such as C++ are only found on very high-end microcontrollers and SBCs due to the large memory requirements (thank classes for that), and this is why microcontrollers are often exclusively coded in either assembler or C.
Projects involving graphical displays and video output will need plenty of RAM, therefore an SBC may be a better option than a microcontroller. However, some microcontrollers have enough RAM to drive simple LCD and OLED displays with resolutions up to 128x64.
When it comes to I/O, microcontrollers will nearly always win hands down. While some SBC devices such as the Raspberry Pi offer plenty of GPIO and special functions, microcontrollers will typically incorporate interrupts on I/O and peripherals, which means that real-time coding is easier to achieve.
Microcontrollers can also offer an easier platform to code external circuits and devices with since microcontroller programming is closer to the hardware. This is why many projects incorporate an SBC as a main processor and a microcontroller as a hardware interface, and the two are connected via a serial port (UART). This means that the SBC can do all the heavy lifting while the microcontrollerâs only purpose is to interface with sensors, devices, and peripherals.
Sometimes the language you want to code your project in can be a deciding factor. I know this has been the case for me several times now!
Some languages are very easy for implementing features, while others are suitable for efficiency. For example, Python has simplicity at its core and is very easy to use with multi-tasking, socket programming, and classes, while C enables very fast code. Up till now, coding in languages such as Python and C++ have been reserved for SBCs, but thanks to the release of MicroPython, you can now code Python on the ESP8266 and PyBoards.
So if you are looking to code in languages such as C#, C++, and VB.net, you should stick to SBC devices because only they have the capability to run them. But if you are looking to code in Assembler, C, and Python, you should seriously consider using a microcontroller due to their low cost, ease of use, and I/O advantages.
Just because many projects integrate SBC devices doesnât mean that yours should too. Of course, SBCs are great for complex tasks and controlling I/O devices, but if you feel that your SBC is spending most of its time idle, a microcontroller could be for you!