0

For a long time I have had a simple question to which I can't find an answer which convinces me. Basically the title: when should I use a microcontroller, when should I use a microprocessor and when should I combine both.

For example, an easy project that I want to do is a weather station. If I'm not mistaken, I can do it with both separately; therefore, which one should be used?

Something I understand (I think) is that the arduino is useful when you want to sample constantly and the RPi for sampling at specific moments.

I had other projects, like controlling lights remotely, knowing the flow of water through the pipes, water station of wells to know, temperature, turbidity, pH... I think I could do it with either option, therefore it is clear that there is some concept that I do not understand.

Sorry if is silly question but I need to clear this doubt once and for all.

1
  • 1
    you need to define the difference between microcontroller and a microprocessor
    – jsotola
    Mar 14 at 21:06
5

There are differences between the definitions of the two. Microcontroller is actually a microprocessor with a bunch of built-in, built-around peripherals. Such as ADC (analog digital converter), DAC (digital analog converter), EEPROM or other memory, comparators, general timers, RTC (real time clock), UART, I2C, SPI etc.

So while there are many overlapping areas and there are so called microprocessors that could include peripherals as well a microprocessor typically (or by some definitions) is only a processor with less or no built-in, built-around peripherals at all. You may have to add external program memory as well. It is a more generic chip, focusing on the processor mainly.


You have mentioned Arduino and Raspberry Pi. None of these could be considered as microcontroller or microprocessor.

Arduino is a platform, an embedded eco-system that supports many hardware, includes SW libraries, IDEs, etc. For example an Arduino UNO is not a microcontroller, the ATmega328P on the Arduino UNO board is a microcontroller. The Arduino UNO is a development board built around the microcontroller that includes power supply, USB interface and other circuity that is not integrated into the microcontroller itself.

The Raspberry Pi is again a platfrom with many more than just the hardware. If we focus on the hardware it is generally called a single-board computer built around a SoC (system on chip). This SoC includes powerful processor cores, multimedia support, peripherals same as microcontrollers have and some others such as HDMI or Ethernet ports.


Development boards and single-board computers are ready to use, you do not need to design and build hardware. With a microcontroller or microprocessor you have to design and build additional hardware such as power supply, etc.

A single-board computer will be much more powerful than a uC dev-board, you can do almost everything with a single board computer that you can do with a uC dev-board but probably you won't use the device to its full potential and you could have cons as well like higher power consumption. On the other hand there are applications that require a single-board computer let's say because you want to drive a full HD monitor or you need high computing capacity, or 1 gigabit/s network connection. There are many more factors (most of them listed in the other answer), for example:

  • Supported programing languages.
  • Supported operating systems.
  • Multiprocessing.

You have wider selection in case of single-board computers.

About microcontroller selection you can check out this earlier answer of mine: Selecting a microcontroller for a battery operated data collection project.

4

Engineering is the art of compromise. You usually have to juggle with several parameters, some of which may be at least partially contradictory.

For instance, you could have to find the best compromise between:

  • speed
  • precision
  • size
  • cost
  • battery life
  • heat dissipation
  • networking requirements
  • UI and ease of use
  • ease of development

A microcontroller will usually be good for size, cost, battery life. It may be limited in terms of speed or precision, networking, UI, and ease of development.

At the other end, a full grown computer will be good for speed, networking, UI and ease of development, but will be quite bad for size, cost, battery life, heat dissipation, etc.

Of course the limit is quite blurry, with chips such as an ESP32 being a bit in the middle, as are many chips based on ARM M cores.

For each project, you should start by listing your requirements. Many will outright eliminate one or the other. If they eliminate both, then you know you may need both, to play different roles, eventually in different places or at different times (for instance a small low power micro controller in a remote battery powered sensor, and a more powerful CPU on mains power to process that data). That’s often where cloud-backed systems come into play, but not always.

Or it just may not be doable at all at the present time: if you need a sub-$1 chip to perform very computing intensive work on battery with a 5-year lifetime, this may not be possible until new chips come on the market (if at all).

If both fit the bill, then you weigh the pros and cons of each, which may be dependent on your specific circumstances: being able to reuse code or knowledge or existing tools and systems may play in favour of one or the other.

The most sensitive parameter is often power. If your need to run on battery with a significant lifetime (months or years, not hours or days), you can just forget about an RPi.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.