Now it’s time to start with building a weather station and make things happen!

Before connecting sensors to the microcontroller and starting to take measurements, you should configure the microcontroller and install the necessary software.

Connecting microcontroller to your laptop/PC

In order to do anything with our microcontroller, it needs to be connected to the PC/laptop. ESP32 microcontroller has a USB port, so connect your microcontroller to the PC/laptop via a micro USB cable.
A COM port is essentially a serial port on a computer used for serial connection, meaning data is sent over a single wire, bit by bit. This is in contrast to parallel connection, where multiple wires are used to send data bits simultaneously. In the early days of computing, serial ports were used for connecting mice, modems, and other peripherals, but in modern contexts, they're often used for programming microcontrollers and debugging them.
When you're working on an IoT project, you typically write code on your computer that tells the microcontroller what to do. However, to transfer this code from your computer to the microcontroller, you need a communication channel, and that's where the COM port comes in. Through a USB connection, your microcontroller connects to your computer's COM port, allowing you to upload your code directly to the device.

Info

To find the COM port required to connect the microcontroller to the computer, follow these steps:

Open Device Manager: Search bar → type “Device Manager” → click on the “Device Manager” app.

Device Manager

Under the section Ports (COM & LPT), you should see your microcontroller. My microcontroller was under the name “Silicon Labs CP210x USB to UART Bridge (COM 5)”.

Port in Device Manager

Tip

If you don’t know which device is your microcontroller, just unplug it, plug it in again, and pay attention to which device reappears after plugging in!

Notice that it says “(COM5)” to the right of my microcontroller’s name. This is the COM port I used to establish a serial connection between it and my computer.

Alert

When you open Device Manager, there is a good chance that a yellow triangle will appear next to your device. Nothing to worry about, the most common cause is missing or incorrect drivers.

To fix this problem, search for the drivers for your microcontroller on the Internet using the device name or the hardware ID of the device, and install them.

Port property

I found the drivers for my microcontroller by copying the hardware ID from Device Manager and Googleing it. The first result was this page. If you’re using an ESP32 like me, you can just do the following:

  • Download the Universal Windows Driver (or the OS X driver if you’re on Mac).
  • Unzip the driver.
  • Install the driver. On Windows, the steps are:
    • In Device Manager, right-click on the device → Update driver → Browse my computer for drivers → Navigate to the unzipped folder → Follow the prompts to install the driver.
  • Write down the COM port next to your device, as you will need it later.

Once the microcontroller and computer are connected, let’s continue with installing required tools.