One of the most important and often neglected aspects of embedded system design is power supply. Even in cases that don’t involve mobile or remote systems, it is still critical to consider how power is supplied to and consumed by your system’s various components. In the case of the MicroKit and this tutorial, we will be learning specifically how to approach powering your microcontroller and its accompanying peripherals efficiently and safely.

WARNING: Safety is ALWAYS the first priority while working with powered devices, so make sure power is off before handling circuits. Double check your circuits before turning on the power to or from any device.

Safe Practices for Powered Electronics

Before getting into the basics, we need to cover safety precautions. In order to ensure safe operation of your MicroKit, here are a few useful practices to remember.

  1. Turn off the power to your equipment before inspecting or changing anything in your circuit.
  2. Double check your connections before powering on.
  3. Do not touch your circuits with any conductive materials (e.g. metal tools).
  4. Discharge static electricity from your body before interacting with sensitive electronics by briefly touching a grounded metal object.
  5. Ensure proper ground connection with respect to any powered device.
  6. Use one hand to interact with your circuit if it is currently in operation.
  7. Keep your workspace free of clutter.
  8. Do not eat/drink or keep foods/liquids while working with circuits.
  9. Wash your hands after interacting with any soldered connections.

While this is not an exhaustive list, it will help reduce some of the main safety concerns and failure modes associated with electrical systems.

Powering Your MicroKit

To begin, let’s review some of the basic power characteristics of our HUZZAH32 Feather board. When deciding how to supply power to your board, you have the option of either using an independent power source in the form of the LiPo battery from your kit or using power from your computer over the micro USB cable connection. You will eventually have the option of using harvested power from your solar panel, but that discussion will be covered in course content.

In the case of battery-supplied power, the HUZZAH32 Feather board has a built-in JST connector that connects directly to your LiPo battery. No need for extra circuitry! Your LiPo battery comes with built-in overcharge and discharge protection.

Charging your battery is convenient as well. The HUZZAH32 Feather board will automatically begin charging your battery when connected to your computer over USB. The battery will be charging at $200mA$. You will be able to confirm that the battery is charging by checking that the CHG LED on the board is lit.

Note: Before using your battery, visually inspect it to make sure that it has not puffed up. This is a sign of a defective or failing battery and could be dangerous!

What about other components that require power? In many examples and activities, you will need to supply power to external components, peripherals, and circuits by using your microcontroller’s onboard voltage regulator. The HUZZAH32 Feather board’s regulator has the capacity to output $3.3V$ at a maximum of $500mA$. However, the ESP32 SoC will require around $250mA$ when in full operation, so it is important to budget your external power requirements accordingly. We will see an example of how to calculate power consumed by electrical loads in a later example when we cover power consumption.

Let’s take a closer look at how to draw power from your board’s voltage regulator by looking at it’s dedicated power pins in the table below.

3.3V (3V)3.3V output from the on-board regulator. Can supply up to 500mA.
GND (GND)Common ground for power and logic.
VUSB (USB)Positive voltage from USB jack, if connected. ~5V.
VBAT (BAT)Positive voltage from the backup Lipoly battery, if connected. ~3.7V.
EN 3.3V (EN)3.3V regulator enable pin. Tie to ground to disable.
RESET (RST)Reset, tie to GND to reset (or press Reset button).

For more information on the specific functions of each of these pins, refer to the GPIO Basics tutorial or the microcontroller documentation.

The3.3V and GND pins are going to be what we use to supply power to external components from our voltage regulator. Often, we will need to supply power to multiple components. Fortunately, we have equipment that facilitates rapid prototyping of these electrical circuits.

When using your breadboard to prototype circuits, many of your components will require power, so it makes sense to parallelize the supply as much as possible. To do so, we will leverage the power rails on the breadboard which are located at the top and bottom of the breadboard. Take a look at Figure 2.

Figure 2. Supplying $3.3V$ to one set of breadboard power rails.

Conventionally, the power rails on your breadboard are the only channels whose connectivity travels longitudinally along the breadboard, making it easy to draw power from for any circuits that lie along the remainder of the breadboard space.

In many cases, peripheral components of a system that require power will return signals that are read by the microcontroller (e.g. sensors). As we know, voltages are measurements of potential energy, so reading any voltage signal depends on a relative comparison. To enable an accurate reading, we should use the same ground reference that the microcontroller uses by connecting to the GND on our board. In this way, both the microcontroller and the peripheral are comparing to a common reference!

What if we need to use power from a different source? A common example of this scenario is in the control of DC motors because they frequently require higher voltages and currents than what a standard microcontroller can provide. Since we usually can’t provide enough power to drive something like a high-torque DC motor through the microcontroller’s analog output pins, we use a separate and more powerful source in combination with transistors. Often, this circuitry will come packaged in the form of a motor driver!

A Word on Grounding

When working with multiple independently powered devices with interconnecting grounds, phenomena known as ground loops can be sources of potential issues as well. For reasons like this, it is important to be cognizant of where and how your device is connected to ground, especially when dealing with high voltages or sensitive equipment.

As an example, consider the following simplified circuit involving your microcontroller and another externally powered device (a motor, motor driver, and encoder package) in Figure 3.

Figure 3. Illustration of a ground loop in a simplified circuit.

Above, we can see that we have two separate power supplies and accompanying connections to two separate grounds. In addition, there is a data signal between the microcontroller and the motor package that has a ground or shielding.

Although we think of grounds as ideally $0V$, they are really just a reference for a relative measurement. Actually, there is a certain amount of voltage that does exist at a given reference ground. If the ground from the data cable in this example is tied to the respective grounds of each device (as is often the case), then there can be a voltage differential across grounds leading to the generation of unanticipated current, which can cause signal noise. This is represented by the red dotted line in Figure 3.

While the signal noise caused by a ground loop in this example might seem like a minor nuisance, ground loop related issues can compound to wreak havoc on your system and lead to unreliable performance if not dealt with properly.

There is certainly plenty more to say on the topic of proper grounding, and we could spend all day. For now though, let’s move on to powering an example LED circuit to help us understand the theory behind power consumption.

Power Consumption

To give us a better understanding of power consumption in an electrical system, it will be useful to review some fundamentals of electrical circuits. In particular, recall Ohm’s Law.


Voltage is equal to the product of current and resistance. In cases where rated current draw is not explicitly given in a datasheet (e.g. in the case of a custom circuit), this equation can be useful for determining characteristics of our circuits which allow for the calculation power consumption. Consider the LED circuit below.

Figure 4. Simple LED circuit powered by your microcontroller.

Shown above, we have a simple circuit for powering a single LED from your $3.3V$ voltage regulator on your microcontroller. A $100\Omega$ resistor and an LED are connected in series and powered with $3.3V$. We place the resistor here in this circuit in order to regulate the amount of current flowing into the LED. How much power will the electrical load in this circuit consume?

Note: we refer to any component or set of components in a circuit that consumes power as an electrical load. The electrical loads shown above (resistor and LED) are outlined.

Well, we can quantify power by understanding that an electrical load consumes power based on the amount of current and voltage being applied, so let’s examine those quantities in the electrical loads of this circuit. By checking the documentation on our LED, we can determine that it has an approximate voltage drop of $2V$. The remaining voltage is taken by the resistor. Using Ohm’s law, we can calculate the current through the circuit.


Power (in watts) is equal to the product of voltage and current.


So this circuit consumes approximately 42.9mW of energy. However, this is purely a theoretical calculation. In practice, inefficiencies and slight variations in electrical characteristics are all involved in the accurate calculation of power consumption.

In the context of battery usage, we can use our kit’s LiPo battery as an illustration. Our battery is rated at around 290mAh. The unit used here is ampere-hours (Ah) and represents the amount of electrical charge in the battery when fully charged. Multiplying by the rated voltage of the battery of $3.7V$, we get the total battery capacity.


Let’s imagine that we are powering solely the above circuit with a fully charged battery (i.e. no microcontroller or other components). In that case, the total amount of time that the LED would stay lit before the battery ran out of charge can be calculated by dividing the battery capacity by the power required by the LED and resistor.


It would last for approximately a day! In reality, there are many other components that will draw power in your system. Recall that our microcontroller alone requires around $200mA$ of current in normal operation!

However, there is a way to reduce the amount of power required by the operation of the microcontroller. Microcontrollers often have built-in functionality that allow them to enter a low-power or “sleep mode”. While in this mode, the microcontroller will be consuming significantly less energy, but it will only perform very limited functions. Let’s look at an example with your HUZZAH32 Feather board.

void setup() {
  esp_sleep_enable_timer_wakeup(10000000);  // Set sleep timer in microseconds
  esp_deep_sleep_start();                   // Enter sleep mode

void loop() {
from machine import deepsleep   # Import deepsleep

deepsleep(10000)                # Set sleep timer in milliseconds

Make sure to note that Arduino’s version is set in microseconds while MicroPython’s version is set in milliseconds. In both cases, however, the microcontroller will effectively become dormant. Upon completion of the sleep timer, the microcontroller will awaken and run through the same processes that it would on boot.

What this means is that the above codes will simply repeat on the set timer! Other than timers, you can define your own triggers to activate sleep mode and to wake the microcontroller from sleep. We will leave that material to be discussed in your courses!

Understanding power requirements and capacities is of critical importance to the design of systems. But even more important than that is remembering to always stay safe when dealing with powered systems, so be sure to refer back to our safety tips when in doubt!

Leave a Comment.