Optimizing EV Battery Performance in Cold Climates

In the world of Electric Vehicles (EVs), the Battery Management System (BMS) isn't just about monitoring voltage—it’s about managing temperature. Lithium-ion batteries are electrochemical devices that are highly sensitive to thermal environments. When temperatures drop below $10^{\circ}\text{C}​** (**$50^{\circ}\text{F}), the internal resistance of the cells increases, and at sub-zero temperatures, charging can even cause permanent damage through "lithium plating."

To maintain optimal performance and safety, active heating solutions—specifically Flexible Heaters—are integrated directly into the battery architecture.

The Role of Flexible Heaters in EV Packs

  • Internal Resistance Mitigation: By raising the battery temperature to an optimal window (typically $15^{\circ}\text{C}$ to $30^{\circ}\text{C}$), flexible heaters reduce internal resistance, allowing for faster DC charging and full power delivery during acceleration.
  • Surface Area Coverage: Unlike centralized heating elements, Silicone and Polyimide (PI) heaters can be manufactured as large, thin foils. This allows them to cover the expansive surface area of battery modules, ensuring that heat is distributed evenly across all cells to prevent thermal gradients.
  • Space Optimization: Modern battery packs are designed for maximum energy density. Flexible heaters offer a "zero-profile" solution. PI heaters, for example, are often less than $0.2\text{mm}$ thick, allowing them to be sandwiched between cooling plates and battery cells without increasing the pack's footprint.
  • Cold Start Reliability: In extreme winter conditions, the heater draws a small amount of energy to "pre-condition" the battery before the vehicle starts, ensuring the chemistry is active enough to provide the required cranking amps.

Silicone vs. Polyimide in Battery Applications

Engineers typically choose between two primary materials based on the pack design:

  1. Silicone Rubber Heaters: Preferred for their ruggedness and ability to handle higher power densities. Their slightly thicker, cushioned nature helps absorb mechanical vibrations within the pack.
  2. Polyimide (PI/Kapton) Heaters: Favored for their extreme thinness and excellent dielectric strength. They are ideal for tight-tolerance applications where weight and volume must be minimized.

Technical Consideration: When designing a heating circuit for EV batteries, it is crucial to factor in the Watt Density. Too high, and you risk localized degradation of the cell; too low, and the "time-to-temperature" becomes inefficient for the user.

Discussion:

For those working on thermal modeling: Do you prefer placing heaters at the bottom of the module for natural convection, or interleaving them between individual cells for direct conduction?

Flexible Heater
Serial Communication Between STM32 Microcontrollers Using UART Protocol

Reliable data exchange between microcontrollers is a core requirement in embedded systems. UART (Universal Asynchronous Receiver/Transmitter) is one of the simplest and most widely used serial communication protocols for point-to-point communication.

This article outlines a practical approach to implement UART communication between two STM32 microcontrollers using a structured data frame and interrupt-based reception.

System Overview

Two STM32 boards are connected via UART:

  • TX (Master) → RX (Slave)
  • RX (Master) ← TX (Slave)
  • Common GND

Baud rate and frame format must match on both sides (e.g., 115200, 8N1).

image.png

Data Frame Design

To avoid parsing errors, use a structured frame:

<stx> ID,VAL1,VAL2,CHK <etx></etx> </stx>

Example:

$01,123,456*5A#

Where:

  • $ = start (STX)
  • 01 = device ID
  • 123,456 = payload
  • *5A = checksum (optional)
  • = end (ETX)

A clear delimiter-based frame prevents partial reads and simplifies parsing.

Transmit (TX) Implementation

On the master:

  1. Format payload into string
  2. Append delimiters and checksum
  3. Send via UART

Pseudocode:

sprintf(txBuf, "$%02d,%d,%d*%02X#", id, v1, v2, checksum);
HAL_UART_Transmit(&huart1, (uint8_t*)txBuf, strlen(txBuf), 100);

Receive (RX) Using Interrupt

Use interrupt (or DMA) to avoid blocking:

  • Enable HAL_UART_Receive_IT (or DMA)
  • Buffer incoming bytes
  • Detect end marker #
  • Parse complete frame

image.png

Parsing Strategy

After a full frame is received:

  1. Validate start/end markers
  2. Verify checksum (if used)
  3. Split CSV payload
  4. Convert to numeric values

Example (concept):

  • Find $ and #
  • Extract substring
  • sscanf or tokenization

This ensures deterministic and error-tolerant parsing.

Timing and Reliability

Key considerations:

  • Match baud rate on both devices
  • Use hardware UART (not bit-bang)
  • Keep frames short to reduce latency
  • Add timeout/reset for incomplete frames
  • Consider DMA for high throughput

Error Handling

Improve robustness with:

  • Checksum (XOR or CRC)
  • Frame timeout (discard incomplete data)
  • Re-sync on next $ if corruption occurs

Practical Applications

  • Sensor node → controller communication
  • HMI ↔ controller data exchange
  • Multi-board modular systems
  • Industrial gateways

UART provides a simple and effective method for microcontroller communication. By combining a structured data frame, interrupt-based reception, and basic error handling, STM32 systems can achieve reliable and maintainable serial communication.

#EmbeddedSystems#
#STM32#
#UART#
#SerialCommunication#
#Microcontroller#
#Firmware#

Embedded Systems2
Designing a Digital Tachometer (RPM Counter) Using Interrupt-Based Measurement

Measuring rotational speed (RPM) is essential in many applications such as motor control, industrial machinery, and automotive systems. A digital tachometer can be implemented using a pulse-based sensing method combined with interrupt-driven processing on a microcontroller.

This approach ensures accurate measurement even at high rotational speeds.

System Overview

A tachometer measures rotation by counting pulses generated from a rotating object.

Common sensing methods:

  • Hall Effect sensor
  • Infrared (IR) sensor
  • Encoder

Each pulse represents one rotation or a fraction of rotation.

image.png

Interrupt-Based Pulse Counting

Instead of continuously polling the sensor, interrupts are used.

How it works:

  1. Sensor generates pulse
  2. Interrupt is triggered
  3. Counter increments instantly
  4. System calculates RPM over time

Advantages:

  • No missed pulses
  • High accuracy
  • Efficient CPU usage

RPM Calculation

RPM is calculated using pulse count over a fixed time interval.

image.png

Example:

  • 20 pulses in 1 second → 1200 RPM

If multiple magnets are used:

image.png

image.png

Hardware Components

Typical setup:

  • Microcontroller (ESP32 / Arduino)
  • Hall Effect or IR sensor
  • Rotating object with marker/magnet
  • Optional display (LCD / Serial monitor)

Improving Measurement Accuracy

To improve stability:

  • Use debounce filtering
  • Ensure proper sensor alignment
  • Use fixed sampling interval
  • Avoid noise in signal line

Practical Applications

Digital tachometers are used in:

  • Motor speed monitoring
  • Industrial machinery
  • Automotive systems
  • Fan speed control

An interrupt-based tachometer provides an efficient and accurate way to measure rotational speed. By using pulse detection and time-based calculation, the system can deliver reliable RPM readings across various applications.

#TestAndMeasurement#
#RPMMeasurement#
#Tachometer#
#EmbeddedSystem#
#Sensor#
#Automation#

Test & Measurement
The Foundational Chips

ESP8266 — Design Tradeoffs and Upgrade Path

Is it obsolete? Technically no. Is there a better option for new designs? Usually yes.
The ESP32-C3 gives you BLE + Wi-Fi with a modern RISC-V core at a similar cost. For new projects, the ESP32-C3 is the recommended upgrade path, offering roughly 5× the usable RAM and native USB support without an external serial chip. But for legacy designs and ultra-simple nodes, the ESP8266 remains perfectly valid.

ESP32 — Still the King of General-Purpose IoT

The classic ESP32 features a dual-core Xtensa LX6 microprocessor running up to 240 MHz, delivering approximately 600 DMIPS. It includes 520 KB of on-chip SRAM, Wi-Fi (802.11 b/g/n), Bluetooth Classic, and BLE 4.2. Peripheral-wise, it's loaded: 34 GPIOs with a flexible hardware GPIO matrix, 18 ADC channels, two 8-bit DACs, capacitive touch sensing, a CAN bus controller (TWAI™), I²S, and a hardware crypto accelerator. At $2–4 in volume, nothing else comes close on the feature-per-dollar ratio.
The dual-core architecture is the real game changer. The Wi-Fi/BLE stack runs on protocol core (core 0), while your application runs on the application core (core 1). No more fighting over CPU time with the radio stack. Real-time tasks run in real time. This alone makes the ESP32 significantly more reliable than the ESP8266 for complex applications.
If I had to recommend one ESP chip for 90% of IoT projects, it's still the classic ESP32. It has the largest community, the most library support, the most examples, and the most battle-tested production deployments. When in doubt, use the ESP32.

8738064082420105216

ESP32-S2 — The USB Specialist Nobody Talks About Enough

Espressif made an interesting call with the S2: drop Bluetooth entirely, add native USB OTG, and beef up the security features. It's a single-core Xtensa LX7 microprocessor, which means it's cheaper than the dual-core ESP32. For applications that need USB device functionality, HID keyboard, CDC serial, mass storage, without Bluetooth, it's a perfect fit.
The security angle is also serious here. The S2 implements secure boot using RSA-PSS with 3072-bit keys, and flash encryption uses the industry-standard AES256-XTS scheme. A Digital Signature peripheral can store private keys in eFuses that can never be read out by software, allowing cryptographic operations without key exposure. If you're building an industrial device that needs USB configuration and strong security but doesn't require BLE, the S2 deserves a hard look.

8738064622961168384

Wireless & IOT
The ESP Family, The Foundational Chips

The ESP Family: From a $1 Wi-Fi Chip to a Full Microcontroller Ecosystem

Back in 2014, a strange blue module started appearing on AliExpress for under a dollar. It had "ESP-01" printed on it and claimed to turn any microcontroller into a Wi-Fi device with AT commands. Nobody expected that cheap little module to eventually power hundreds of millions of connected devices worldwide.

Let's Talk About Where This All Started

Espressif Systems is a Shanghai-based semiconductor company that, by most accounts, nobody in the West had heard of before 2014. Then they released the ESP8266, and everything changed. Not because it was the first Wi-Fi chip, but it wasn't. But because it was the first one that a hobbyist could afford, program, and build a real product with. The maker community went wild.

Fast forward a decade, and Espressif now has a family of chips that covers everything from a basic sub-dollar Wi-Fi SoC to an AI-accelerated dual-core processor with native USB and Octal-SPI RAM. They've gone from a niche Wi-Fi module maker to one of the most influential IoT semiconductor companies in the world. As of early 2026, Espressif shipped over 1 billion IoT chips cumulatively, a testament to the ecosystem's dominance. And the best part?

The development tools are excellent, the community is enormous, and the documentation makes sense.

If you're going to work with ESP chips, whether you're a student learning IoT, a maker building a project, or an engineer designing a commercial product, you need to understand the whole family. Not just "ESP32 good, ESP8266 old." There's nuance here and choosing the wrong chip will cost you time and money.

8738057404014395392

The Foundational Chips — What They Actually Are!

ESP8266 — The Legend That Won't Die

The ESP8266 integrates a single-core Tensilica L106 32-bit RISC processor clocked at 80 MHz (or 160 MHz when pushed), with on-chip SRAM and support for external SPI flash. It offers Wi-Fi (802.11 b/g/n) but no Bluetooth. The total on-chip SRAM is 160 KB, but only approximately 80 KB is available to the user application, the rest is reserved for the Wi-Fi stack and ROM. On paper, it sounds weak. In practice, for a sensor node that wakes up every five minutes, reads a value, posts it to MQTT, and goes back to deep sleep, it's more than enough.

The biggest gotcha with the ESP8266 is that your application code and the Wi-Fi stack share the same single core. Write blocking code, and you'll starve the Wi-Fi stack and get random disconnects. This is the number one reason beginners pull their hair out. Once you understand it and code around it (using non-blocking patterns, callbacks, or an RTOS), the chip is rock solid.

8738058618328588288

Wireless & IOT
Firebase + ESP32 Limitations and Fast Setup Guide

Why it works for prototypes, but not for large-scale IoT systems

Firebase is often a fast and convenient choice for connecting ESP32 devices to the cloud, especially in early prototypes and proof-of-concept systems. However, its architecture introduces limitations that become clear when the system starts scaling.

Firebase Realtime Database stores data in a JSON tree structure rather than a time-series optimized format. This makes it flexible for simple applications, but less efficient when dealing with continuous sensor streams. Without careful data modeling, retrieving historical data or performing time-based analysis can become inefficient.

Another key limitation is the communication model. Firebase relies on persistent WebSocket connections for real-time updates. While this is useful for instant synchronization, it does not provide messaging features like QoS levels, message queuing, or guaranteed delivery that are typically found in IoT-focused protocols like MQTT. This makes it less reliable in unstable network conditions or distributed systems with many devices.

In practice:

  • Works well for small to medium prototypes and dashboards
  • Starts to struggle with large-scale deployments and high-frequency telemetry

Key takeaway:

Firebase is excellent for fast development and validation, but MQTT-based architectures are generally better suited for scalable, production-grade IoT systems where reliability and efficiency are critical.

Wireless & IOT
ESP Connectivity Strategy: The Hidden Cost of Wi-Fi

After optimizing sleep modes and securing OTA updates, there is one remaining system-level problem that silently destroys battery life and user experience: connectivity behavior. Most ESP systems do not fail because Wi-Fi does not work. They fail because Wi-Fi is used inefficiently.

Wi-Fi reconnect is not free. On ESP32, a full scan and authentication cycle can cost hundreds of milliseconds of CPU time and several hundred milliamps of current draw. If your device wakes every minute, reconnecting from scratch every time is more expensive than the sensor reading itself.

The key optimization is state retention. Store the last connected BSSID, channel, and IP configuration in RTC memory. On wake, bypass scanning and reconnect directly using cached parameters. This reduces reconnect time dramatically and stabilizes power consumption across cycles.

Another important technique is exponential backoff for failed connections. If a network is unavailable, retrying aggressively only drains battery and increases thermal load. Instead, progressively increase the retry interval to avoid wasted wake cycles.

For advanced systems, consider hybrid connectivity strategies. BLE can be used for provisioning and fallback communication, while Wi-Fi handles bulk data transfer only when needed. This reduces radio usage significantly in intermittent reporting devices.

Finally, always align connectivity events with your sleep schedule. Waking the chip just to attempt a Wi-Fi reconnection is often worse than delaying transmission until multiple sensor samples are aggregated.

In real IoT systems, power is not saved by sleep alone. It is saved by how intelligently the device decides to talk to the network.

Wireless & IOT
ESP OTA Updates: Ship Once, Update Forever

The day you ship a product without OTA updates is the day you commit to never fixing bugs or adding features without physically retrieving every device. That's fine for a breadboard. It's a business problem at any scale. Here's how OTA works on ESP, from the simplest version to what production systems need.

How OTA Works Under the Hood

The ESP's flash is divided into partitions defined by a CSV file. For OTA, you need at least two app partitions: ota_0 and ota_1. Your current running firmware resides in one of them. During an OTA update, the new firmware writes to the other, the inactive one. When writing is complete and the SHA256 hash verifies, the bootloader checks it on reboot, and the device restarts into the new firmware.**

If the new firmware fails to boot correctly, for example if it crashes repeatedly or never calls esp_ota_mark_app_valid_cancel_rollback(), the bootloader automatically marks the update as invalid and reverts to the previous working firmware on the next power cycle. This rollback mechanism prevents bricks and is a critical production safety net.

Three OTA Methods, Pick Your Level

ArduinoOTA, for development

Install the library, add four lines to setup(), and your board appears in the Arduino IDE port list over the network. Upload new firmware exactly like USB over Wi-Fi. No authentication by default, so add a password at minimum. Not for production, but for rapid development iteration it is extremely convenient.

HTTP OTA, the production standard

Your device polls an HTTPS endpoint every N hours, or on command from the server. The endpoint returns either a 304 Not Modified response, meaning nothing to update, or a new firmware binary. The device downloads it to the inactive partition, verifies integrity, optionally checks signature, then reboots. ESP-IDF's esp_https_ota() handles most of this in a few lines of code.

Wireless & IOT
ESP Sleep Modes: Light Sleep and Choosing the Right Mode

ESP Sleep Modes: The Practical Guide to Not Killing Your Battery

In the previous post, we covered the five power states of the ESP32 family and took a deep dive into deep sleep, the go-to mode for battery-powered sensor nodes. Now we turn to light sleep, a mode that offers sub-milliampere current consumption while preserving RAM state and enabling fast wake-up.

Light Sleep: The Overlooked Middle Ground

Light sleep pauses the CPU while keeping RAM powered, typically around ~0.8 mA depending on configuration. When a wake source fires, execution resumes exactly where it stopped, no reboot, no re-initialization required. If your device needs to respond quickly to GPIO events but does not need to stay fully active all the time, light sleep is often the right choice.

The tradeoff is power. While ~0.8 mA is significantly lower than active mode, it is still much higher than deep sleep (~10 µA). At scale, this difference has a major impact on battery lifetime.

For devices that wake frequently, light sleep can be more energy-efficient overall because it avoids the repeated cost of system reboots and Wi-Fi reconnections. However, for longer sleep intervals measured in minutes or hours, deep sleep remains the clear winner.

Wake sources for light sleep include timers, GPIO interrupts, UART activity, and capacitive touch sensors. These are configured similarly to deep sleep using APIs such as esp_sleep_enable_timer_wakeup() and esp_sleep_enable_gpio_wakeup().

Wireless & IOT
Deep Sleep: The Right Tool for Battery Sensors

For a device that wakes up periodically to send data and then sleeps, which covers most of the battery IoT nodes, deep sleep is what you want. You call esp_deep_sleep_start() and the chip powers down to approximately 10 µA, keeping only the RTC oscillator ticking. Your specified wakeup source brings the chip back.

The GPIO16 trick for ESP8266: On the original ESP8266, you must wire GPIO16 to RST to wake from deep sleep via timer. The RTC fires a low pulse on GPIO16 which resets the chip. Forget this wire and your device sleeps forever.

On the ESP32, the timer wakeup is cleaner, no external wire needed. Call esp_sleep_enable_timer_wakeup(duration_in_microseconds) before esp_deep_sleep_start() and you're done.

Surviving Deep Sleep: RTC Memory

 Here's the subtle part: deep sleep kills your chip's state. All RAM is wiped. Your variables are gone. To preserve data across sleep cycles, use RTC memory, a small (16 KB) memory region powered by the RTC that survives deep sleep.

In Arduino: RTC_DATA_ATTR int bootCount = 0; that RTC_DATA_ATTR prefix stores the variable in RTC SLOW memory. Use it for boot counters, cached Wi-Fi credentials, last sensor value, or anything you need to remember between wakes.

 Cache your Wi-Fi BSSID and channel in RTC\_DATA\_ATTR variables. On subsequent wakes, pass them to WiFi.begin() explicitly to skip the channel scan. This alone cuts reconnect time from 3–5 seconds to under 1 second, a significant battery saving at scale.
Wireless & IOT
Relay vs Solid State Relay (SSR): Which One to Use in Automation Systems?

Relays are widely used in automation systems to control electrical loads such as motors, lamps, and industrial equipment. Two common types are mechanical relays and solid state relays (SSR). While both serve the same purpose, their working principles and performance characteristics are significantly different.

This article compares both relay types to help engineers choose the right solution for their application.

Working Principle

Mechanical Relay

A mechanical relay uses an electromagnetic coil to physically switch contacts.

Key characteristics:

  • Uses moving parts
  • Provides electrical isolation
  • Produces clicking sound during operation

Solid State Relay (SSR)

An SSR uses semiconductor components (triac, MOSFET, or optocoupler) to switch loads without moving parts.

Key characteristics:

  • No mechanical movement
  • Silent operation
  • Faster switching

image.png

Performance Comparison

Feature Mechanical Relay SSR
Switching Speed Slow (ms) Fast (µs)
Lifespan Limited (wear) Very long
Noise Audible click Silent
Heat Generation Low Higher
Power Consumption Coil required Low control power
Isolation High High (optical)

Load Handling

Mechanical Relay

  • Suitable for AC and DC loads
  • Handles high current surge
  • Better for inductive loads

SSR

  • Ideal for frequent switching
  • Best for resistive loads
  • Some types limited to AC only (triac-based)

image.png

Advantages and Limitations

Mechanical Relay Advantages

  • Low cost
  • Handles high current
  • Good isolation

Mechanical Relay Limitations

  • Contact wear over time
  • Slower switching
  • Mechanical noise

SSR Advantages

  • Long lifespan
  • Fast switching
  • No mechanical noise

SSR Limitations

  • Heat dissipation required
  • Higher cost
  • Leakage current (important for low-load systems)

Engineering Considerations

Choose based on application:

  • Use mechanical relay for:
    • Motor control
    • High current switching
    • Low-frequency operation
  • Use SSR for:
    • High-speed switching
    • Silent operation
    • Long-term reliability

Thermal management is critical when using SSR, especially in high-current applications.

Both mechanical relays and SSRs are essential components in automation systems. Mechanical relays are robust and cost-effective for general-purpose switching, while SSRs provide faster, quieter, and more reliable operation for high-frequency switching applications.

Selecting the right relay depends on load type, switching frequency, and system requirements.

#Automation#
#Relay#
#SSR#
#EmbeddedSystem#
#PowerElectronics#
#ControlSystem#

Automation & Control
Measuring Motorcycle Speed Using Hall Effect Sensor and Interrupt-Based Pulse Counting

Accurate speed measurement is essential in vehicle monitoring and safety systems. In this project, motorcycle speed is measured using a Hall Effect sensor combined with interrupt-based pulse counting on a microcontroller.

A magnet attached to the wheel generates pulses as the wheel rotates. These pulses are detected by the sensor and converted into speed using wheel dimension parameters.

System Overview

The system uses a Hall Effect sensor mounted near the rotating wheel. Each time the magnet passes the sensor, a pulse is generated.

image.png

Hardware Architecture

Main components:

  • Hall Effect sensor (NJK-5002C)
  • ESP32 microcontroller
  • LCD display
  • Power supply (battery + step-down)
  • Additional sensors (distance monitoring system)

The wiring configuration is shown in the system diagram.

image.png

Interrupt-Based Pulse Detection

To ensure accurate measurement, pulse detection is handled using interrupts.

Each pulse corresponds to one wheel rotation (or fraction, depending on magnet count).

Basic logic:

  1. Sensor detects magnet → generates pulse
  2. Interrupt triggers on rising/falling edge
  3. Pulse counter increments
  4. Speed calculated over time interval

This approach ensures no pulses are missed, even at high speeds.

Speed Calculation Method

Speed is calculated using wheel circumference.

From the configuration procedure:

  • Tire width
  • Tire height
  • Wheel diameter

These parameters are used to calculate effective wheel circumference.

Formula:

image.png

Where:

image.png

Final output is converted to km/h.

System Calibration

Accurate speed depends on proper calibration.

Key parameters:

  • Tire width and aspect ratio
  • Wheel diameter
  • Unit system (metric or imperial)

Incorrect values will result in inaccurate speed readings.

Integration with Safety System

This speed measurement is integrated into a safe distance warning system.

Based on system logic:

  • Speed affects warning level
  • Distance sensors monitor front and rear
  • System outputs:
    • SAFE
    • WARNING
    • DANGER

image.png


Engineering Considerations

Important design factors:

  • Sensor alignment affects detection accuracy
  • Noise filtering may be required
  • Debouncing needed for stable pulse detection
  • Interrupt handling must be efficient

Using interrupt-based detection significantly improves reliability compared to polling methods.

Conclusion

The implementation demonstrates how Hall Effect sensors and interrupt-based pulse counting can be used for accurate real-time speed measurement in vehicles.

By combining mechanical calibration, embedded processing, and system integration, the design provides a reliable foundation for advanced automotive monitoring systems.

#TestAndMeasurement#
#HallEffectSensor#
#RPMMeasurement#
#EmbeddedSystem#
#ESP32#
#Automation#

Test & Measurement