How to: pick the right frequency for your oscillator

Try to think of the crystal oscillator as the "heartbeat" of your MCU, without a steady, reliable pulse (namely, the clock), the processor's "brain" simply can’t function. Most of the time, your design process is straightforward because the MCU manufacturer has already done the heavy lifting. If you check the datasheet, you’ll typically find a recommended part number or a list of specific requirements for frequency, Equivalent Series Resistance (ESR), and load capacitance (CL). When you're shopping for a crystal, you’ll see everything from 32.768 kHz to 50 MHz. So, how do you choose? It’s not always "faster is better."

Communication needs

First, look at your communication needs. This is the biggest trap. If you are using UART or CAN bus, you need a frequency that can be divided perfectly to hit standard baud rates (like 115,200 bps). If your clock speed is slightly off, your data will come out as gibberish. This is why frequencies like 7.3728 MHz or 14.7456 MHz exist, they actually divide perfectly into standard communication speeds with 0% error.

Power consumption

Next, you should consider power consumption. In the world of MCUs, Current = Frequency. If you run your chip at 48 MHz instead of 8 MHz, you’re going to drain your battery much faster. If your project just reads a temperature sensor once a minute, a high MHz crystal is just wasting energy.

MCU's limits

Finally, check your MCU's Limits. Every datasheet has a "Maximum Operating Frequency" section. Some chips can hit 100 MHz, but only if the voltage is high enough (e.g., 3.3V). If you’re running on a 1.8V battery, the silicon literally can't "flip" its internal gates fast enough, and you might be limited to a much lower MHz.

A little practical tip: you can start by identifying your fastest peripheral (USB usually needs 48 MHz, for example). If you don't have high-speed needs, pick the lowest frequency that keeps your code responsive.

#mcu# #layout# #pcb design# #frequency#

MCU
Why PCB layout matters for MCU: some tips

#mcu# #layout# #pcb design#

Ever had code that runs perfectly on a development kit but when you actually try it, it crashes on your custom PCB? It’s a nightmare, and the problem is almost always the layout. In the real world, traces aren't just "lines" on a screen as you already know, they have parasitic inductance and resistance that can ruin your signal integrity. When you're dealing with sensitive signals, the layout is arguably the most important part of your entire design.

  • To keep things stable, try to place your MCU centrally. This allows you to keep high-speed SPI or clock lines as short as possible, which is the best way to minimize EMI (Electromagnetic Interference).
  • And please, whatever you do, don’t skip the decoupling! Think of those 0.1µF capacitors as tiny energy reservoirs; you must place them right against the VDD pins to filter out high-frequency noise before it ever hits the silicon.
  • Also, don’t forget about your crystal oscillator. It’s the "heartbeat" of your system, and because it generates the clock for your MCU, it is incredibly sensitive. Keep it as tight as possible to the XTAL pins and surround it with a grounded guard ring. This acts as a shield, protecting those delicate oscillations from "noisy" components like switching regulators.
  • Finally, always use a solid ground plane. It provides the low-impedance return path your signals crave, preventing "ground bounce" and those mysterious random resets that drive engineers crazy.
MCU
Navigating the World of Educational robotics: an insider thought

I’ve participated in many educational robotics competitions over the years, and I’m convinced they are the single best way to introduce students to STEM. There’s something unique about solving engineering problems in a competitive environment, even if it's on a small scale, that transforms abstract concepts into real-world skills. If you are an educator in Europe looking to dive into robotics, the first challenge isn't building the robot, it's choosing the right arena. To help you decide, here is my honest take on the "Big Three" competitions based on my personal experience in the pits. Also it doesn't only foster the engineer area, but also all of the soft skills: they actually get to work in group, organize, divide in sub-teams and organize tasks, as well as travel.

1. RoboCup: The Professional Standard

Let’s start with the biggest and, in my opinion, the best: RoboCup. It is one of the most complete and inspiring ways to approach robotics education.

What makes RoboCup stand out is its range. It offers subcategories for every level, from RoboCup Rescue Line for beginners to RoboCup Industrial, where you’re essentially competing at a university level. I’ve personally taken part in the Rescue Line and Maze categories, and they are extraordinary. Seeing students spend hours tinkering and competing against peers from across the globe is pure magic.

  • The Vibe: Very serious and highly organized. It operates like a true championship at both European and World levels.
  • The Tech: Unlike other competitions, RoboCup encourages a "pro" approach. You aren't limited to kits; you can use Arduino, Raspberry and industry-standard chips.
  • The Trade-off: It is less "free-form" than others. The regulations are strict and specific, so while you need immense creativity to solve the problems, you must do so within a very rigid framework.

2. WRO (World Robot Olympiad): The Creative Alternative

The WRO is another massive worldwide competition, but it feels very different from RoboCup. If I’m being honest, WRO is often better suited for students who are just starting their journey in electronics and software.

The challenges change frequently and tend to be more "creative" in their themes and is actually very nice to explore also how technology and engineering can be creative. However, there is a distinct hardware ceiling:

  • The Hardware: WRO leans heavily into the LEGO ecosystem. This is great for accessibility, but for students who already have significant expertise, it can start to feel a bit "too easy."
  • The Goal: It’s a fantastic entry point. But if your students are ready to move toward professional-grade hardware used in the industry, they might eventually outgrow this format.

3. FIRST (Lego League / Tech Challenge)

If you are looking to build a pipeline that includes elementary and middle school students, FIRST is the way to go. While they have tiers for older students, their ecosystem is masterfully designed for younger ages. It’s less about "pure engineering" and more about the holistic experience of teamwork and themed challenges. It’s the perfect "on-ramp" to get kids excited about STEM before they move on to the more technical rigors of RoboCup. This is the only competition I have not taken part in so actually I can't get any insight thought about.

FINAL THOUGHTS

Choosing a competition depends on your students' current level and your school's resources. If you want to push them toward "real" industrial hardware and a professional mindset, RoboCup is my top pick. If you want to foster quick creativity and stay within a familiar ecosystem, WRO is a brilliant choice.

The most important thing? Just get them to the starting line.

Educational Robot Competitions
How to solder SMD components.

Ever feel like you need the steady hands of a neurosurgeon just to put a circuit board together? You’re not alone. As components get smaller and "legs" disappear in favor of tiny pads tucked underneath, the old-school soldering iron can feel a bit like trying to perform surgery with a hockey stick. Personally, that has been one of the main issues for me when approaching components always smaller.
But here’s the secret: SMD (Surface Mount Device) soldering isn't actually harder; it’s just different. Choosing the right technique depends entirely on what you’re building and how many tiny parts you're willing to chase across your desk with tweezers.

The Trusty Soldering Iron (Manual Hand Soldering)
Don't retire your iron just yet. For basic SMD components like resistors, capacitors, and LEDs (the 0805 or 0603 sizes), a standard iron is often the fastest way to go. The Technique is actually very simple.

You "tin" one pad first, slide the component into the molten solder with tweezers, let it freeze, and then hit the other side. For chips with many legs (QFP), you can use drag soldering, where you pool a glob of solder and drag it across the pins.

When to use it: Perfect for one-off prototypes, repairs, or when you only have a couple of components to swap. A little tip that I think is very useful: use flux. Then use more flux. It’s the "magic juice" that prevents bridges and makes solder flow like a dream.

Hot Air Rework

If you’re dealing with components that have pads underneath the body (like QFN or BGA chips), a traditional iron literally can't reach the solder. This is where hot air shines. How? You apply solder paste to the pads, place the component, and blast it with controlled hot air. The coolest part? Surface tension. If your placement is slightly off, the molten solder will actually pull the chip into perfect alignment.

When to use it: well, it's essential for complex integrated circuits (ICs) or when you need to "non-destructively" remove a component to fix a mistake.

Reflow Soldering (The "Batch" Method)
If you have a board with 50+ tiny components, soldering them one by one is a recipe for a headache. Reflow is how the pros (and advanced hobbyists) do it. Basically, you apply solder paste to the entire board using a stencil, "pepper" your components onto the paste, and then heat the whole board at once using a reflow oven or a dedicated hot plate. When to use it: Best for high-density boards or when you're "mass-producing" a small run of your project. It ensures every joint melts at the same time, leading to a much cleaner, professional look.

So actually the "best" technique is the one that keeps your frustration levels low and your joints shiny haha. If you're just starting out, grab some flux and a fine-tip iron. Once you start eyeing those tiny QFN chips, it’s time to level up to a hot air station.

8726892628246990848

#soldering#

Soldering Techniques
Designing Around Mechanical Constraints: Importing DXF to PCB.

Electrical engineers prefer clean schematics, while mechanical engineers have more of an appreciation for reality. Thus, DXF imports are utilized to help address the discrepancies between “this is how it should fit…” and “this does not fit…”

image.png

DXF file interface (generic)

A DXF file (drawing interchange file format) allows you to place mechanical outlines (such as panels, mounting holes and cutouts) directly into your PCB layout. Almost all professional EDA software products (KiCad, Altium, etc.) support the importing of DXF files onto a mechanical or keep-out layer of the PCB layout. By placing mechanical outlines onto a PCB layout before starting design with the electronic components, you are ensuring that the PCB will fit into the enclosure when it is manufactured, rather than negotiating aggressively with it after the fact.

image.png

DXF file interface (PCB design)

When first importing the DXF, you should do so on a mechanical or outline layer; do not import onto a copper layer unless you like chaos. The first thing to do once you have imported the DXF is to verify the scale of the file. Different DXFs can use different unit types. If the DXF file has not been set to the appropriate unit of measure, your PCB may physically fit but not necessarily work in our world.

Once you verify that the DXF file is properly scaled and in the correct file format, you can use the DXF to assist in designing your PCB outline, your mounting holes, and your keepout area. Additionally, be sure to align connectors, buttons and LEDs on the PCB with the openings of the enclosure. There’s nothing worse for an enclosure than to have a USB port hiding behind a piece of plastic, it will just give you a reason to design a revision “B”.

Take care when designing with tolerances; mechanical parts can vary from what designers expect just as PCBs can. Always provide clearance around all edges as well as holes so that tolerances can be accommodated for during manufacturing. A snug fit is preferable to force-fitting parts together and can significantly add to the cost of assembly.

At the end of your design process, you should lock the DXF layer so you do not risk accidentally nudging it while aligning other layers.

Communicate closely with your Mechanical Team as it is important to remember that DXF imports are not one-time activities. They are repeating processes that will need to be updated as your design goes through revisions and/or changes.

In summary, importing a DXF file allows for more precise placements when designing a PCB than would otherwise be done relying solely on “almost fits” when placing components on a PCB.

image.png

PCB design using DXF file

PCB Design
Understanding PCB Finishes: ENIG vs. HASL vs. OSP

Selecting a surface finish for a PCB can be like ordering a coffee: many options will work but what may appear to be similar at first can actually differ vastly when you consider all of the particulars.

image.png

HASL finished PCB

HASL (Hot Air Solder Leveling) is the most traditional surface finish option to use, as it first dips the board into hot liquid solder, then levels them with hot air afterward. It's a low-cost solution that produces an extremely durable surface finish; however, the surface will not be perfectly smooth after being leveled with hot air. That's perfectly acceptable for through-hole parts or for larger surface mount designs, but not ideal for using very fine-pitch parts. Think of HASL as being similar to a plain cup of black coffee: very simple, easy to depend upon, but somewhat rough around the edges.

image.png

ENIG finished PCB

ENIG (Electroless Nickel Immersion Gold) is considered the premium surface finish option. ENIG produces a very flat/smooth surface that provides excellent solderability, corrosion resistance, and is a great surface finish for BGAs and high-density surface mount designs. ENIGs drawbacks are that they cost significantly more than HASL and you will need to carefully control the ENIG processes to prevent defects, such as "black pad." Think of ENIGs being similar to a highly crafted latte: smooth, refined, and expensive.

image.png

OSP finished PCB

OSP (Organic Solderability Preservatives) is the simplest form of PCB board finishes and it provides copper with a protective coating which protects its surface from oxidation. OSP is inexpensive and provides a fairly flat surface but is not very robust and does not have a long shelf life. It may degrade after multiple reflows, so pay attention to how you handle it. OSP is like a cheap, fast coffee - works well, cheap and works most effectively when used quickly.

So, what should you use? If your project has a low budget and a simple design then HASL is acceptable. However, for a complex and dense design where the use of high-speed technology, ENIG will normally be the better option. In the case of producing large quantities of products (cost-effective and with strict quality control) OSP would be the best.

The type of finished surface of your PCB will affect not only the overall looks of your PCB but also the quality of solderability, reliability and manufacturability. So, select wisely and your PCB will be forever grateful (in silence).

PCB Design
Comparing ESP32 Variants: S2, S3, C3, and C6

A showdown of family members' opinions.

If the ESP32 lineup were a family group chat conversation, every variant would claim to be the "most optimized." Let's break down the family drama.

image.png

ESP32-S2

A minimalist approach, the ESP32-S2 provides a single core, Wi-Fi only, no Bluetooth. The ESP32-S2 is great for secure IoT applications, provides extensive hardware security features, uses low power, and provides stability without the excess noise of additional radios.

image.png

ESP32-S3

The ESP32-S3 is the high achiever. Its dual-core design has Wi-Fi + Bluetooth LE, provides support for vector instructions for use with AI/ML applications (i.e., tiny neural networks), and is ideal for edge AI, vision and USB applications. If your project has "smart" in it, this is likely the variant that is included.

image.png

ESP32-C3 and ESP32-C6

The ESP32-C3 is the efficient underachiever. It features a RISC-V core (instead of an Xtensa core), provides low power consumption and cost-effective Wi-Fi + BLE, and is a great choice for scalable deployments of IoT where cost matters, but performance cannot be far behind.

Each ESP32-C6 represents cutting-edge technology. Both can offer RISC-V-based SoCs and both devices also include 802.11ax (Wi-Fi 6) and Bluetooth LE 5 communications standards. This variant further allows for network efficiency in busy environments. Imagine smart homes where there are multiple devices connected, but they share bandwidth (as though they were quietly talking) instead of yelling.

Key points: All are good, but fit is most important!

  1.   S2: simple and secure but only has Wi-Fi capabilities
    
  2.   S3: best for advanced applications with power and AI functionality
    
  3.   C3: most affordable; good performance in RISC-V
    
  4.   C6 :advanced connectivity (Wi-Fi 6)
    

Prior to implementing sensors, it is critical to analyze the surrounding environment prior to implementing the described sensors. To create the various types of sensor nodes, choose an ESP32-C3. If you plan to use artificial intelligence within your devices, purchase an ESP32-S3. Those that need an ideal range of connectivity options in the future will want to opt for an ESP32-C6. Lastly, if you intend for your sensor nodes to provide exemplary reliability, then configure your devices to utilize an ESP32-S2.

#mcu# #esp#

MCU
Dual-Core Programming: How to Offload Tasks to Core 1.

Using dual-core microcontrollers, such as the ESP32 or RP2040, allows for parallel processing by running tasks on two independent processors. By taking advantage of Core 1, for non-time-critical, processor-intensive tasks, like sensor processing, display updates or filtering algorithms, you can improve the responsiveness of time-critical tasks, such as I/O operations, networking or user interface functions.

image.png

core seperation

The main idea behind utilizing dual core microcontrollers is to separate tasks. Core 0 is responsible for all interrupt, communication stack, and other latency sensitive tasks, where as Core 1 is responsible for all non-time critical, processor intense, or blocking tasks.

This separation of tasks reduces bottlenecks from occurring, and thus aide in eliminating watchdog processor reset occurrences. On platforms such as the ESP32 (FreeRTOS based platform), tasks can be pinned to specific cores. You can do this with the API call xTaskCreatePinnedToCore() to assign a task(s) to a specific core, which will improve execution predictability, and reduce contention created by other tasks.

image.png

inter-core communication

Inter-core communication is essential. Shared Global Variables should be avoided through the use of Queues, Semaphores or Mutexes to prevent Race Conditions Always protect your shared resources with synchronization primitives to maintain the integrity of the data.

Also, minimize the dependencies between tasks on the two cores as much as possible. The more independent a task is of another, the better it will run on its designated core. For example, if you were to have a single processor do all of the pre-processing of sensor data and then only send to Core 0 the final post-processed data; this would result in less overhead (communication) between two processed sets of data.

image.png

multi-core debugging

Debugging is quite difficult on multi-core systems. Multi-core systems contain many more types of problems which make debugging more difficult than single-core systems, i.e., Dead Locks and Priority Inversion etc… As a rule, you should verify that your application is functioning prior to debugging when transferring from single to multi-core.

You also will want to monitor CPU Utilization in relation to Core 1, Core 1 may be underutilized due to Priority not being distributed evenly. Proper scheduling of processes and testing of processes should ensure the efficient utilization of all cores.

#microcontrollers#

esp32 #esp32#

MCU
Mastering Differential Pair Routing: Keeping Impedance Consistent

Differential pairs form the basis for high-speed interfaces such as USB, Ethernet, and LVDS. To achieve this, we need to have consistent impedance and close proximity between both signals to ensure that the two signals arrive clean and at the same time.

image.png

A differential pair consists of two traces, with both traces carrying opposite and equal signals from each end of the differential pair. The distance between the two traces and their geometry determine their differential impedance (typically 90 ohm or 100 ohm). Most importantly, both traces must be identical in length, width, and environment; any variation will introduce skew and degrade the quality of the signal.

Spacing between the two traces is essential. If the traces are spaced too far apart, the differential pair will lose coupling and behave as two separate traces. If the traces are spaced too closely together, the impedance will decrease. Make sure to follow any stack-up calculations you create, and keep the spacing uniform throughout the entire route of the circuit (this is especially important through bends and layer transitions).

image.png

Speaking of bends, you should avoid using sharp corners when bending the traces; you should use either 45-degree bends or arcs when bending the traces to maintain a consistent impedance reading. You should also keep both traces together at all times; if you need to separate them or pass one trace through a detour, you will create a distortion in the signal that will also create an increase in EMI and noise.

You should always have a solid reference plane (usually GND) underneath the differential pair. Any disruption to the reference plane (e.g., splits and voids) causes the return current to take longer paths; therefore, an increase in EMI and noise will occur. When you change layers, always use a matched via for both traces and maintain the symmetry of the traces.

image.png

While it's important to match length, don't get carried away with it. There are some minor differences before the two lines meet that usually won’t cause a timing problem depending on the type of interface. I would use moderate serpentine tuning as necessary.

Finally, to limit cross-talk interference, keep your differential pairs away from other signals. An easy way to do this is to maintain a minimum of 3 times the spacing (in width) of the traces to other traces.

What's the bottom line? Differential routing is not just about drawing two traces. It is about maintaining symmetry, uniformity, and the electrical character of the path as a whole.

#PCB#

PCB Design
Designing a PCB for Vibration: Component Placement for Durability

It is important to be mindful of component placement and understanding of how they will function together when designing PCBs to meet the demands of high vibration environments (automotive, Industrial & Aerospace). There are many stresses placed on the mechanical structures at the PCB level due to cyclic nature of vibrational forces. If these stresses are not properly mitigated, mechanical failure will occur within components or solder joints due to fatigue, cracks or intermittent failure.


image.png

When locating heavier components, such as inductors, large capacitors and connectors, it is best to place them as close as possible to the mounting point or areas of board support. This serves two purposes; reducing the mechanical leverage applied to the components thus reducing stress on the solder joints and keeping these heavier components from being placed in large unsupported areas of the PCB, which have the highest amount of flexure when subjected to vibration forces.


image.png

Using low-profile components whenever possible will also reduce the overall amount of inertial (force) produced during vibration for these parts. Sensitive integrated circuits (BGAs and QFNs) should be located within the mechanically stable areas of the PCB and not at the edges or corners of the PCB where bending is most pronounced.

The orientation of the components will also matter. The longer axis of the component should be aligned with the direction of the expected vibrational load. This will reduce the concentration of the stress on the solder joints. By evenly distributing the components you can avoid the imbalanced distribution of mass, which can enhance the vibrations.


image.png

For all critical areas you should reinforce these with mechanical support, such as standoffs or additional mounting holes. In addition, you may also want to utilize adhesive, underfill and/or staking compounds when securing connectors and/or larger components to provide additional mechanical stability.

Ensure your PCB thickness and stack-up are appropriate to ensure structural rigidity. Thicker pcbs or multi-layer designs will minimize flex during vibration due to increased strength. Use good soldering techniques and reliable pad design to help improve durability.

#PCB#

PCB Design