Week 06

Reflection

This week is both a breeze and a load of new information for me. As I mentioned in my lecture overview, I'm fairly familiar with writing code given my background as web developer. The basic concept and even the syntax of C++ language is very similar to web development languages such as Javascript or PHP. Variable, function, array, loop, object, etc. they all the same between one language to another. Learning to program in C++ is as simple as learning the different syntax between it and other language that I'm already familiar with it. Now learning how it relates to the hardware is totally a different story.

Things I Learned

For our group assignment, we were tasked to browse and compare data sheet of some micro-controllers. Those documents might as well as written in alien language for me at the beginning of this week, I barely understand anything there. Well I still don't understand the majority of it now, but at least I start to understand some basic information such as:

Processor

Though many people see me as the tech guy, most of the time I actually only understand the broad concept without fully understand the little details. One of them is my understanding of a processor. I know that it measured by their clock speed, some has multiple cores, there are multiple architectures, etc. Again I know about it, but I don't understand it.

Throughout the week, I start to understand how that clock speed corelate to our very own code that we write; how our code will run differently from one processor to another; how we should choose processor that enough for our application, not simply the fastest, latest, greatest, and most expensive one.

Memory

This is one of the very basic question I had that was answered by reading data sheet. When I leaned to program Arduino by myself, I always wonder how do you choose which micro-controller to choose for an IoT project. Other than the obvious one like number of pins, to me one board to another looks the same. Now I learned that one of the most fundamental thing to consider is how much memory space our program will take.

In web programming, you don't have that concern because we have large and seemingly infinite infrastructure. On contrary, micro-controllers designed with relatively small memory because most projects only do simple task instead of multiple complex tasks. However, if you start using multiple peripherals that require installing multiple libraries, the memory will start to creep up. For example, one of my test program used up about 70% of an Arduino UNO's memory, but the same program only takes up 3% of a XIAO RP2040's memory.

Operating Voltage

When I did research for understanding electronic concepts back on week 4, I learned why electronic devices have different voltage from one to another. For example, usually there are two different voltages used in car electronic system - some car use 12 V, other use 24 V. Similarly, micro-controller commonly can be divided to two categories based on their operating voltage, 5 V and 3.3 V.

Older and bigger micro-controller such as Arduino Uno usually operates at 5 V. Now more and more micro-controller used 3.3 V instead especially the smaller one such as the XIAO series, which makes them more power efficient. However, this requires us to understand how to design a circuit has different voltages, because there are more sensors or output devices that works at 5 V. Our XIAO may not be able to drive a device that require 5 V and if a sensor output a value at 5 V to our XIAO might damage it.

Pinout

Each micro-controller has their own unique pinout layout. A development board also has their own unique pinout that will be different from other board and to their own processor. The XIAO series have a standardized pinout with standardized alias (A0, D1, etc.). However, you will need to be vigilant when you are using the micro-controller pin number. I find out the hard way, when working with XIAO RP2040. The pin number for D7, D8, D9, and D10 are P1, P2, P4, then P3.

Alt text
XIAO ESP32-S3 pinout
Alt text
XIAO RP2040 pinout

Additional Features

These might be the most obvious one, nowadays there are micro-controller that has extra features built into it. For example, ESP32 has built in WIFI and Bluetooth. We can add those features by adding separate components to micro-controllers that doesn't have them, but having it built in makes our design and fabrication process more convenient. However, on the other hand, if say you only need a specific feature, adding only that one on a more basic micro-controller might be more economical and more energy efficient.