MCU learning, Entry-Level, Part 1, HelloWorld


Learning could be a painful process, especially dealing with the world that you are not familiar with. But at the same time, it could be an exciting process if you on the right track.

For this series, I would like to show you how to learn some basic knowledge about MCU step-by-step without hazard. Also try to help you to identify what is essential and what is nice to know at your stage. So you can stay at ideal “FLOW” or “ZONE”, which should help you to reduce your anxiety.


First, let’s clarify who should read the entry-level series. If you are a beginner in the micro-controller world, such as a EE/CS freshman, an engineering degree student, or a DIY maker, then it could be the right series. If you already had related experience in any MCU development, including flashing a LED matrix to create a certain pattern, I will say it could be too easy for you. Do not waste your time, you should skip this one.

What do you need for the Part 1 exercise?

  1. Particle Photon(LINK)
  2. A Computer/Laptop with a USB port(Windows is ideal)

Why I select Particle Photon as a demo platform?

  1. Super easy to use and learn.
  2. Low cost, similar price with Arduino development board, but build-in WIFI module and more powerful MCU core.
  3. No monthly fee require. But Particle Electron will require it.
  4. Could service and IoT environment is friendly to the developer.
  5. It is the best-fit candidate for commercial level product fast prototype-concept evaluation.

What should you complete before the following practice?

  1. Follow the instruction to install desktop IDE
  2. Follow the instruction to install CLI
  3. Purchase a particle photon from a local supplier.
    Particle photon contains a wireless communication module which could be a problem if you try to import to your country. Some countries’ customs will require an extra license or certificate to prove your device meets local regulation. If you can deal with it or you are in the USA, just purchase it in the official store. (LINK)
  4. Make sure you registered and have a valid particle console account.
  5. Finish the quick start tutorial to make sure your device is functional:
  6. Claim your device:
    And you should see the device appears on your Particle Console page:
  1. Find out your device OS version via Particle Console. (You will need the number later)

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — —


The ultimate target of this part exercise is to let MCU send messages to the host computer.

a. Choose a location to create a folder called “MCU_LEARNING”(You can name it whatever you want.)

b. Open your Vscode and create a new project under “MCU_LEARNING” folder from welcome page.

You should see the welcome page like this. At the same time, you can find the CREAT A PROJECT button.

If you miss the welcome project, do not worry. Press “CTRL +SHIFT+ P” and type “Particle: Create new project”

OR you can find the particle workbench button to go back to the welcome page.

Let’s name our project “HelloWorld”. Once you did it, you should be able to find a folder that contains several files like this:

The green words in the “HelloWorld.ino” file already contains some message for beginners. Have a look! It helps a lot.

In the setup() function type following code:


In the loop() function type following code:

Serial.println("Hello World!");

The full code in ino file you can find here:

Choose the target device OS to the same as what you find in your console page.

In Vscode, press “CTRL+SHIFT + P” to call command palette and type
“ Particle: Cloud Compile”. You can do the local compile, but seems cloud one is much faster.

And you should generate a .bin file in the project folder if your code has no errors.

Navigate your Vscode to TERMINAL page. And select Powershell.

Put your particle photon in DFU mode and type:

Particle flash --usb "Your bin file name"

For example, my bin file name is: photon_firmware_1606183742298.bin
The command will be:

Particle flash --usb photon_firmware_1606183742298.bin

Note: You can type photon and using TAB to auto-complete the file name

Press enter and you should see the message like the following picture:

Now, how do we check whether Photon is sending Hello World message?

Using the terminal window again, type the following command :

Particle serial monitor

You should see something like this:

Knowing what have you done is really important as well.

In this exercise, we are trying to use the library called “Serial”. Serial here is also known as UART interface which allows you to send and receive some messages between MCU and other devices, the host computer is the device in our’s case.

Every communication interface has some parameters that need to define before you start using it. This process called Initialization. In this case, we used “Serial.begin();” to initialize the communication protocol.

We put this part of code in “Setup()” section is because it only did once after MCU power-on. Initialize process normally only need once, unless you need to change parameters during operating.

However, in the loop, it will repeat again and again which is similar to the following code. That is why you will see endless “Hello World” messages.

//Put your code which should repeat again and again here.

In general, if you do not have special parameters for it, Particle’s library will automatically initialize UART to the following parameters:

Check the official reference for more information.

Then, we used “Serial.println();” function to send “Hello World” message from MCU to Host computer. This function will automatically print a new line for the next message.

If you are a C language programmer, you might remember using the following code you can achieve the same effect:

printf(" Hello World \n ") ;

Congratulation!! You did a simple MCU application by yourself!
It is a tiny step for MCU learning. But at least you start it.

For the full project, you can find it here: Bitbucket LINK

Hmm… Not satisfied? Sure! … there is a ton of things we need to improve.

Let’s do the Part2 exercise later to see how can we improve it!

Software engineer, Movie lover, Karate beginner.