Embedded software -GUI #LVGL

The Tutorials section has been updated with the very first page! It’s related to the Light and Versatile Graphics Library (LVGL), which is an open-source, lightweight embedded library for displays and touch screens. I’ve found many interesting applications for microcontrollers (such as STM32, ESP32, PIC) as well as systems on a chip (RPI). At this moment, the tutorial includes setting up the simulator, but it’ll be updated with designing a custom GUI from scratch and migrating the project to ESP32 (and maybe STM32 in the future). If this sounds interesting to you, then the tutorial can be found here.

PCB design: ESD shields and guard rings.

This short post is dedicated to hardware enthusiasts, who design their custom boards/dev kits/breakout boards/etc., and who are looking for some improvements regarding the ESD protection and handling. Techniques presented below have evaluated throughout different projects and multiple discussions with other designers.

When starting a project or simply experimenting with new technologies, I like to design development kits with many test points, variations of connections, and easy access to almost every component. All of this is to make work easier and to reduce the risk of some unpredicted things (such as noise, component overheating, crosstalk, or multimeter falling my knee) from happening. For me, such dev kits become reference designs for future iterations (which are significantly miniaturized and compact).

One of the things which I often use in such designs is an ESD protection using an ESD shield/guard ring. When developing new products, there can some playing around with the hardware, debugging, measuring, etc. Having proper ESD protection can save us some bucks and time, so we don’t have to assembly new units or search for new ICs. If for some reason, our circuit survives the ESD event, then the ESD itself still might introduce a significant voltage bounce on our GND planes, which then can couple to other conductors and disrupt our measurements.

Schematic and PCB design

The schematic consists of the following, simple section which makes my PCB design use two groundings. Those groundings are connected by a TVS diode (an ESD protection diode), and a 0R resistor (to make the grounding connect in a single point). By using such a simple circuit on a schematic, I will not forget about doing the ESD shield in my design and the ESD energy can be “guided” to the TVS diode.

The ESD shield (GND_CHASIS net) is routed around the PCB. Those tracks/polygons must be exposed to work as intended.

If anyone picks up the PCB and the ESD occurs, this energy will be guided to the ESD protection section (TVS diode), without damaging/disrupting the circuit. Other shieldings and housings shall be connected to the GND_CHASIS as well (e.g. USB connector shielding).

Placement of the TVS diode plays a critical role here. This diode should “catch” the ESD energy before it reaches our 0R resistor and returns e.g. to our power supply source.

In my future projects, I’m going to make another improvement, which is rounded corners. According to the following document from Texas Instruments:


when an ESD event occurs, there is a big difference between the trace’s shape by the means of radiated EMI.

I strongly encourage you to take a look at the TI’s document, as it shows more interesting aspects of the PCB layout for ESD dissipation. That’s it for this post. What kinds of protection do you use when developing new products?

Electric vehicles: how to talk about battery systems in a proper way

There are thousands of engineers working on the development of modern electric vehicles. From hardware designers, firmware developers, testers, up to system architects, and project managers. One project may involve so many people that you won’t even speak to them. Because that much engineering has been put into development, it’d be great to understand some basic terms and be able to communicate with others more efficiently. Why? Because one term may mean different things for different people.

In this post, I’d like to speak about electric vehicle batteries. Or rather I should say battery packs because this is what many people refer to when they say batteries. The battery pack system is quite complex, and on a system level, every component has its own name. I will also show some interesting nuances and refer them to the norms, so you will know exactly where the information is coming from.

First of all, let’s point out that the EV’s battery is called a battery pack. The ISO 6469:3 [3] defines it as Mechanical assembly comprising battery cells and retaining frames or trays, and possibly components for battery management. Let’s take a look at the simplified block diagram:

Followed by a real-life example of Audi e-tron battery pack:

If we take a look at the block diagram, we can see that the battery pack consists of a battery management system, battery modules, cooling and/or heating system, a switch-box, and a housing/interfaces section. Let’s break down each of them:

  • Battery management system (BMS)

This term should be common to most engineers, as BMS’s or PCMs (protection circuit modules) are being used in many different fields where li-ion batteries are on a daily basis. When it comes to the automotive field, things get more complex. The EV’s BMS is responsible for:
-providing a mechanism in case of uncontrolled conditions, emergency (fail-safe mechanisms);
-monitoring the conditions of individual cells/battery modules (State of Charge, State of Health),
-estimating the range possible with the remaining SoC,
-managing the two-stage charging to limit inrush currents,
-maintaining all of the cells/modules within their operating limits (undervoltage, overvoltage, undertemperature, overtemperature, overcharge, overdischarge, short circuit),
-compensating any cell imbalances by actively or passively managing their state of charge,
-recording battery usage and abuse (log book),
-communication with other vehicle systems.

The main BMS controller has to fulfill strict ASIL-D requirements. A TMS570LS0432 from TI or ST’s SPC58 E Line MCUs will do the job.

  • Battery modules

Battery packs are commonly designed as pack-module-cell structures. Depending on the power and capacity requirements, the number of cells and modules vary. Cells and modules can be connected in series, in parallel, or combined. Parallel connections increase the battery’s capacity and amperage ratings, whilst series connection increases overall voltage rating. To give some perspective, a Tesla Model S’s 85kWh battery pack consists of 16 modules with 6 groups in series (groups contain 74 cells). This provides a 403.2V maximum voltage and a total number of 7104 li-ion Panasonic 18650A NCA cells [2].

An interesting thing to point out is that the international norm ISO 6469-3 distinguishes two voltage classes, called Low Voltage (voltage class A) and High Voltage (voltage class B) [3].

Low voltage class: Also referred as voltage class A. Classification of an electric component or circuit with a maximum working voltage of less than 30 V A.C. (RMS) or 60 V D.C.

High voltage class: Also referred as voltage class B. Classification of an electric component or circuit with a maximum working voltage between 30 V A.C. (RMS) and 1000 V A.C. (RMS) or between 60 V D.C. and 1500 V D.C.

Because of that, battery modules are typically designed to meet Low Voltage ratings. This enables OEMs to handle them without cost-intensive safety measures during production and transport.

Battery packs must meet high voltage ratings (1000V DC).

  • Cooling/heating system

One of the aspects determining the lithium-ion battery pack performance is its thermal management. Factors influencing lithium-ion cell’s thermal behavior are extremely complex and if you’re interested in reading more about it, then [4] might be a good source. The essential conclusions are that for EV battery pack’s performance, temperature range, and variation are the two critical, influential parameters. The desired temperature range of the li-ion cell is between +15°C and +35°C. At the single cell’s level, three important processes can be distinguished: heat generation, heat transport, and heat dissipation. These processes dominate the battery temperature. Having said that, it is clear that battery thermal management is one of the key factors regarding its design. There are various cooling strategies, such as air-based, liquid-based (direct and indirect), phase change material based, and others. Each strategy is a trade-off between ease of use, adaptability, heat transfer efficiency, maintenance, life, first cost, and annual cost, etc. Air-based cooling is said to be the easiest in use, but the temperature distribution of individual battery cells is the most uneven.

After such an explanation, it’s clear that there has to be some kind of a cooling and heating system.

  • Switch-box

Also called S-box or battery junction box (BJB). This component plays a critical role in the system, as it is responsible for the instantaneous shutdown of high-voltage electric currents in case of traffic accidents and malfunctions. Since an instantaneous shutdown of such currents (above 1000A) is not an easy task to do electronically, the BJBs tend to use pyrotechnic fuses instead (Tesla, Porsche).

  • Housing/interfaces

Hermetic housing to prevent liquid intrusion with interfaces for power, communication, and cooling/heating pipes.

[1] Alvarez, Sachenbacher, Ostermeier, Stadlbauer, Hummitzsch, Alexeev (2017): D6.1 – Analysis of the state of the art on BMS. Technical report. Everlasting.
[2] L. David Roper (2020): Website. http://www.roperld.com/science/TeslaModelS.htm
[3] ISO 6469 (2011): Electrically propelled road vehicles. Safety specifications. Part 3: Electrical safety. Standard. International Organization for Standardization. Geneva, CH.
[4] Bandhauer T., Garimella S., and Fuller T. (2011): A critical review of thermal issues in lithium-ion batteries. Journal of The Electrochemical Society 158: pp. R1.

New project: SIGMA MOSFET – Production test rig

A new page has appeared in the ‘Projects’ section. From now on, you can read about a test rig for the SIGMA MOSFET (a product that I and my friends created for airsoft electric pistols).

Custom PCBs, Raspberry PI, 3D printing, PMMA cutting, python scripts, and of course zip ties! This is what you’ll find there. Also, feel free to suggest improvements for future rigs, their description, etc.

.initial post: short introduction

Hey there,

after few years of professional experience in the field of firmware and electronics design (combined with “side quests” that were supposed to go commercial), I decided to create a blog where I could not only put my research results but also discuss it with readers. Having said that, please feel free to comment as I appreciate every feedback.

Hardware issues (EMC, layout, production), embedded software/firmware, and maybe even machine learning related projects. This is the content I am going to publish here once in a while. My name is Grzegorz Wójcik, but you can call me Greg -for foreigners it’s easier to pronounce 🙂 Stay tuned!

In the meantime, here is a lithium-ion “smart” battery that my friends and I designed from scratch when we were working for the UAV company. The design consists of a battery holder, protection circuit module, OLED driver and radiator which besides heat dissipation, also serves as a touch sense panel: