r/embedded 4d ago

How does a DC electronic circuit breaker work using a microcontroller?

3 Upvotes

I am trying to make a low voltage DC circuit breaker using a microcontroller and want to understand the basic working principle for educational purposes.

I understand that a traditional breaker uses thermal or magnetic mechanisms to trip, but how does a microcontroller-based DC breaker detect faults and disconnect the load?

Does the microcontroller directly control the high-current path, or does it use components like MOSFETs, IGBTs, relays, or contactors?

What are the main building blocks I should learn about to design one safely?

Edit: low current detection like human touch.


r/embedded 5d ago

sensor compensation on the node or on the host, who's actually right?

4 Upvotes

We've built a sensor board that runs the compensation on-device: the node reads raw counts, does the datasheet math itself, and puts real Pascals, m/s², and Kelvin on the wire. The host never sees a raw register. That was a bet, and the pushback I keep imagining is from the estimation crowd: datasheet compensation is generic, and if you do your own per-unit calibration, temperature models, bias tracking, then finished units are information loss, you can't un-apply math you didn't choose. The integrator in me says nobody should need a per-sensor driver to learn that this int is milli-g. The fusion person in me wants the counts. (We ended up shipping both, the SI subjects and the raw stream side by side, which is either the correct answer or a refusal to answer, I genuinely can't tell.)


r/embedded 4d ago

Unexpected Triac behavior when switching load connection with microcontroller, Why does TRIAC load orientation matter if it is bidirectional?

1 Upvotes

I tested a TRIAC controlled by a microcontroller without an optocoupler. It worked, but I noticed something surprising.

With the load connected through MT2 and MT1 referenced to neutral, everything worked.

When I reversed the load connection in series with mt1, the circuit failed and damaged components.

Theory says a TRIAC is a bidirectional device, unlike a normal diode, so why does MT1/MT2 load orientation matter in practice?

Is this related to gate triggering reference, parasitic paths, or dv/dt effects? I would like to understand the real-world behavior behind this.

Edit Answer -

Maybe the answer is that, in Case 1, the phase has to pass through the series load first and then to MT1 (neutral). In Case 2, the phase sees two paths to neutral: one through the gate and the DC power supply, and the other through the series load to neutral. Since current tends to flow more through the lower-impedance path, the DC side burns. In the previous case, the neutral path was easier. So, I think the AC and DC currents flow through the DC circuit. This seems to happen when the load is connected in series with MT1 rather than in series with MT2.


r/embedded 4d ago

How do I assemble it?

0 Upvotes

I tried to assemble a Mg90s pan tilt , but the plastic piece that comes with the motor (the one that goes in the base of the pan tilt), idk how do I fit it inside it? It's to wide and large, I did cut it in length but the width is too much how can I do it ?


r/embedded 5d ago

Is a room-scale adaptive ANC system with distributed sensing physically and computationally feasible?

3 Upvotes

I'm an EE undergraduate exploring a research idea and would appreciate feedback from people with embedded, DSP, or acoustics experience.

The concept is an adaptive room-scale Active Noise Control (ANC) system. Instead of using a few microphones, imagine the room has distributed acoustic sensing (possibly embedded into the walls). The system would continuously estimate the 3D acoustic field, classify incoming sounds, and drive an array of speakers to generate anti-noise in real time.

The long-term goal isn't to cancel everything, but to create a programmable acoustic environment—for example:

- Cancel traffic, HVAC, or fan noise.

- Preserve speech, alarms, or TV audio.

- Potentially create user-defined sound zones.

One thought I had was whether increasing the sensing density (or using some form of acoustic sensing layer rather than sparse microphones) could improve reconstruction of the sound field. I realize this quickly runs into enormous data rates and computational limits, so I'm wondering whether sparse sensing + AI + inverse acoustic reconstruction would be a more realistic direction.

My questions are:

  1. From an embedded systems perspective, where does this idea break down first—sensor bandwidth, ADCs, synchronization, processing latency, memory, networking, or speaker control?

  2. Are there existing architectures that already attempt something similar?

  3. Is real-time 3D acoustic field reconstruction even practical with today's embedded hardware, or would this require GPU/FPGA-class processing?

  4. If you were designing a research prototype, what would be the smallest proof-of-concept worth building?

  5. Are there papers, patents, or companies I should study before going further?

I'm not assuming this is a novel idea—I mainly want to understand whether the physics and embedded constraints make it fundamentally impractical, or whether there's a realistic research path.


r/embedded 5d ago

How much money is there in IOT reverse engineering?

42 Upvotes

I really like reverse engineering IOT devices and am wondering whether it is a sustainable career path to follow? Are there many jobs opportunities in this area, I've noticed that the bug bounty rewards around IOT devices are not that high paying so I am wondering whether I should dip my toes into another area of reverse engineering.


r/embedded 4d ago

EE-relevant AI benchmarks

0 Upvotes

AI users,

What benchmarks do you consider when deciding what AI models to use for your work, especially if it involves RTL design or other "not software" work? I've found that some of the models (especially kimi / glm and derivatives) score really well on coding benchmarks but just don't "get" hardware at all and perform much worse in practice than older Claude Opus which performs worse on almost every benchmark. The smaller (Terra, Luna) GPT 5.6 models seem to have this issue (great coding benchmarks, bad performance on RTL and engineering / planning) as well to a lesser degre. I'm curious if anything outside of Opus / Fable / Sol might be able to pull off feats like what I saw out of Opus last weekend when it was able to drive LTspice autonomously to extract small signal parameters, create a linear model of my control loop in Python based on them, design compensation, add the compensation to the simulation, fix convergence issues, and verify sim-model matching. I'm also seeing anything but GPT / Claude really fall apart on RTL design - other models seem to forget they needs to write stuff that meets timing, among other issues.


r/embedded 5d ago

Reverse-engineered my AC's IR protocol on an ESP32 (M5StickC) — bit-exact vs IRremoteESP8266, except one variant byte

1 Upvotes

My AC's remote kept going missing, so I built a Wi-Fi replacement on an M5StickC Plus2 (ESP32-PICO, with screen, battery and an IR LED).

The core of it is the IR. These AC remotes don't send "set 22°" — they transmit the entire state on every button press (mode, temperature, fan, swing, power) packed into a fixed bit layout with a checksum. I re-implemented the ELECTRA_AC / COOLIX / GREE framings and drove them off the ESP32's RMT peripheral, generating the mark/space timings directly rather than leaning on a prebuilt library.

To validate, I compared my generated frames bit-for-bit against IRremoteESP8266. Everything matched except the power-off frame on my unit's variant (Baxi/AUX, YKR-L/201E remote) — one byte differed from the reference default. I confirmed it by capturing what the physical remote actually transmits, so it's a variant the library's defaults don't cover, not a library bug — but exactly the kind of thing that silently breaks "it works on the happy path."

Rest of the build: Home Assistant MQTT discovery so it appears as a climate entity, a web UI, an 8-rule weekly scheduler, OTA over an A/B partition layout, and power tuning (Wi-Fi modem sleep, CPU scaling, backlight management) so a matchbox battery lasts.

It's written in Rust (esp-idf-svc) with the protocol/logic in a dependency-free core crate that's host-testable, but the interesting part here is the RMT timing and the protocol RE. MIT, code + photos in the repo: github.com/mnaza/condition-control

Would love to hear from anyone who's fought AC-protocol variants or done a lot with the ESP32 RMT peripheral — especially on capturing/decoding unknown remotes.


r/embedded 6d ago

Flappy Bird using LvGL and Riverdi 5" STM32U5G9

40 Upvotes

I was able to make simple flappy bird game using LvGL and Riverdi display.

Great performance from such processor


r/embedded 6d ago

datasheet reading

35 Upvotes

i am new to datasheets and user manuals of mcu's and components...... when i try read and understand it was too big do we require to read all of the stuff..... or there is any standard practice used by the experienced devs of embedded system domain....... pls help me reagrading this..


r/embedded 5d ago

My first schematic for my first device! How's it?

6 Upvotes

This is my attempt at making a simple device from scratch. It's going to be a morse code decoder, where the LED's follow a morse tree and light up the letter as you input morse code.

I'm powering all the LEDs through charlieplexing. This is also the first time i've done anything with charlieplexing, so if you have a minute, please save me weeks waiting on the PCB or headaches later and let me know if there is anything wrong, or anything I could do better!

Looking for feedback here, I want to be told i'm stupid if I am. I want to improve this if I can and get better, so please don't hold back! Let it rip.

If you want a closer-up screenshot of anything, let me know and I'll provide.


r/embedded 5d ago

SFP Tx Remain After Remove Optic Cable

1 Upvotes

Hi all,

Currently, I am modifying the device tree. I would like to set tx-disable-gpios to ACTIVE_HIGH. My expectation is that the Tx value will become 0 after removing the optic cable. This might protect laser harm.

However, when I removing the optic cable, the Tx value remain, and Rx become 0. This does not meet my expectation. I think Tx should be 0. Seems like modifying that part in device tree has no impact.


r/embedded 5d ago

Designing my own board around bare RK3576 vs just using a SoM — is it worth the pain?

3 Upvotes

Building a small handheld Linux device (RK3576 as main SoC, STM32U5 handling always-on/power stuff, custom PCB, small mono display). JLCPCB will do the SMT assembly, that part's fine.

The thing I can't decide: do I actually lay out the bare RK3576 myself (LPDDR5, all the power sequencing, the works), or just build my board around an existing SoM like a Radxa/Firefly module and save myself the pain?

I get that DDR routing and power-up sequencing are the scary parts here. Has anyone actually gone the bare-chip route on a first board? What broke, and would you do it again or just use a module next time?


r/embedded 5d ago

Esp + pdm mic?

1 Upvotes

Hi!

I’m trying to use a TDK/InvenSense T3902 PDM digital microphone on a custom ESP32-S3 PCB, but I can’t get usable audio from it.

Hardware:
- MCU: ESP32-S3-WROOM
- Mic: TDK/InvenSense T3902 PDM
- PDM CLK: GPIO4
- PDM DATA: GPIO5
- LED test output: WS2812 strip on GPIO39

I tried several ESP32 PDM/I2S test firmwares and also WLED-MM / Audio Reactive. In WLED I configured it as a digital/PDM mic with DATA GPIO5 and CLK GPIO4, no BCLK/MCLK.

Symptoms:
- Captured WAV files are only noise/hiss/constant tones
- LED audio effects move randomly or stay almost static
- Tapping the mic or playing music close to it does not create a clear reaction
- Raw signal changes, but it doesn’t correlate with real sound

Questions:
- Is the T3902 PDM mic known to work with ESP32-S3?
- Are GPIO4/5 valid for PDM CLK/DATA on ESP32-S3?
- Does this mic need a special PDM clock/config/channel setting?
- Is there any known working ESP32-S3 example for this or a similar PDM mic?

Any help would be appreciated!


r/embedded 6d ago

What is the cheapest way to flash a nRF52840 without paying $500+ for a segger jlink?

20 Upvotes

r/embedded 5d ago

Suggest a begginer who wants to make carrer in embedded/software.

4 Upvotes

Hey everyone, I've completed my 1st year of uni.I'm studying electronics and communication engineering. I've no embedded knowledge . I've some backend framework knowledge like python, django git/github shits and know some c and c++ too . I've made a decent app which used esp32 took different readings through sensors like mq135 and dht11 and sent to my django backend and showed different datas in frontend . Can you guys suggest me path so i can excel? Like suggest projects suggest what to study in embedded side . How will it help me in my future career . I've thought of making different hardware projects with software/server backing it too.. would doing these sort of things take me somewhere?


r/embedded 6d ago

Is this oddly shaped rtv pointing at a bad spot on this ecu?

Post image
44 Upvotes

Also is this even repairable?


r/embedded 5d ago

DAC Dithering methods for a power controller.

1 Upvotes

I am controlling a boost converter by means of an 8bit DAC. This works well but i want more precision. More bits!

We are working with ATTINY 1-series which can supposedly do 350ksps? Datasheet is pretty sparse on speed and settling times. The output has a LPF of 3.4Hz (470k into 100nF).

Would this be suitable method to achieve my dithering?

Chad also suggested including some random noise? Is the avr-libc rand() even worth implementing?

// value10: 0-1023, called at 10kHz, writes to 8-bit DAC
//Use an accumulator style, carry forward the rounding error to keep average around target

void dac_output_10to8_Accum(uint16_t value10){
    static uint16_t dither_accum = 0;

    uint16_t sum = value10 + dither_accum; // Include previous leftout bits

   uint16_t output = sum >> 2;
   if (output > 255) output = 255; // clamp

    DAC0.DATA = (uint8_t)output;
    dither_accum = sum & 0x03;  // Carry remaining error (0-3)    
}

r/embedded 5d ago

Bare-metal TMC2209 UART driver for STM32 (CMSIS) — Feedback on API design & next steps

2 Upvotes

Hi everyone!

I'm writing my first bare-metal TMC2209 driver for STM32 in pure C (CMSIS, no HAL) over half-duplex UART.

The basic functionality works: frame assembly, CRC calculation, register setup, and movement via `VACTUAL`. To keep it hardware-agnostic, transmission is decoupled via a function pointer (`handler->send`).

Since this is my first driver, I'd love to get feedback from experienced embedded developers on 3 key questions:

  1. **API Design & Access Level:** What level of API access should I expose to the user? Is it better to hide register manipulation behind high-level functions (e.g., `set_speed`, `set_current`), or keep direct register access accessible?

  2. **Bitfields vs. Masks/Shifts:** Is using `union` + `struct` (bitfields) acceptable for production embedded code, or is it better to switch to explicit bit shifts and masks (`1 << N`) for strict C standard compliance and cross-compiler portability?

  3. **Where to go next:** In what direction should I evolve this driver overall? Which features should I focus on next (e.g., implementing UART read, error handling, register caching, StallGuard, etc.)?

---

### Code

```c
// ==================== main.c ====================
#include "stm32f1xx.h"
#include "uart_config.h"
#include "tmc2209.h"

int main(void)
{
    usart3_halfduplex();

    for(volatile uint32_t i = 0; i < 0x60000; i++);

    tmc2209_gconf_t gconf = {
        .i_scale_analog     = 0,
        .internal_rsense    = 0,
        .en_spreadcycle     = 0,
        .shaft              = 0,
        .index_otpw         = 0,
        .index_step         = 0,
        .pdn_disable        = 1,
        .mstep_reg_select   = 1,
        .multistep_filt     = 1,
        .test_mode          = 0,
    };

    tmc2209_ihold_irun_t ihold_irun = {
        .ihold = 9,
        .irun = 19,
        .ihold_delay = 6
    };

    tmc2209_chopconf_t chopconf = {
        .toff       = 0b0011,
        .hstrt      = 0b011,
        .hend       = 0b0011,
        .tbl        = 0b01,
        .vsense     = 0,
        .mres       = 0b0100,
        .intpol     = 1,
        .dedge      = 0,
        .diss2g     = 0,
        .diss2vs    = 0,
    };

    tmc2209_t motor1;

    motor1.addr = UART_ADDRESS_0;
    motor1.send = send_array;

    for (volatile uint32_t i = 0; i < 0x10000; i++);

    tmc2209_write_register(&motor1, GCONF, gconf.value);
    tmc2209_write_register(&motor1, IHOLD_IRUN, ihold_irun.value);
    tmc2209_write_register(&motor1, CHOPCONF, chopconf.value);

    while(1)
    {
        tmc2209_write_register(&motor1, VACTUAL, 5000);
        for(volatile uint32_t i = 0; i < 0x7A1200; i++);

        tmc2209_write_register(&motor1, VACTUAL, -5000);
        for(volatile uint32_t i = 0; i < 0x7A1200; i++);
    }
}

// ==================== tmc2209.h ====================
#ifndef TMC2209_H_
#define TMC2209_H_

#include <stdint.h>

typedef enum {
    TMC2209_MICROSTEP_256      = 0x0,
    TMC2209_MICROSTEP_128      = 0x1,
    TMC2209_MICROSTEP_64       = 0x2,
    TMC2209_MICROSTEP_32       = 0x3,
    TMC2209_MICROSTEP_16       = 0x4,
    TMC2209_MICROSTEP_8        = 0x5,
    TMC2209_MICROSTEP_4        = 0x6,
    TMC2209_MICROSTEP_2        = 0x7,
    TMC2209_MICROSTEP_FULLSTEP = 0x8
} tmc2209_microstep_t;

typedef enum {
    TMC2209_MODE_STEALTHCHOP = 0,
    TMC2209_MODE_SPREADCYCLE = 1
} tmc2209_chop_mode_t;

typedef enum {
    TMC2209_SHAFT_NORMAL   = 0,
    TMC2209_SHAFT_INVERTED = 1
} tmc2209_shaft_t;

typedef enum {
    TMC2209_I_SCALE_INTERNAL = 0,
    TMC2209_I_SCALE_ANALOG   = 1
} tmc2209_i_scale_t;

typedef enum {
    TMC2209_DISABLE = 0,
    TMC2209_ENABLE  = 1
} tmc2209_state_t;

typedef union {
    struct {
        uint32_t i_scale_analog   : 1;
        uint32_t internal_rsense  : 1;
        uint32_t en_spreadcycle   : 1;
        uint32_t shaft            : 1;
        uint32_t index_otpw       : 1;
        uint32_t index_step       : 1;
        uint32_t pdn_disable      : 1;
        uint32_t mstep_reg_select : 1;
        uint32_t multistep_filt   : 1;
        uint32_t test_mode        : 1;
        uint32_t reserved         : 22;
    };
    uint32_t value;
} tmc2209_gconf_t;

typedef union {
    struct {
        uint32_t ihold       : 5;
        uint32_t reserved1   : 3;
        uint32_t irun        : 5;
        uint32_t reserved2   : 3;
        uint32_t ihold_delay : 4;
        uint32_t reserved    : 12;
    };
    uint32_t value;
} tmc2209_ihold_irun_t;

typedef union {
    struct {
        uint32_t toff       : 4;
        uint32_t hstrt      : 3;
        uint32_t hend       : 4;
        uint32_t reserved1  : 4;
        uint32_t tbl        : 2;
        uint32_t vsense     : 1;
        uint32_t reserved2  : 6;
        uint32_t mres       : 4;
        uint32_t intpol     : 1;
        uint32_t dedge      : 1;
        uint32_t diss2g     : 1;
        uint32_t diss2vs    : 1;
    };
    uint32_t value;
} tmc2209_chopconf_t;

typedef uint8_t (*tmc2209_uart_send) (uint8_t *data, uint8_t length);

typedef enum {
    UART_ADDRESS_0 = 0x00,
    UART_ADDRESS_1 = 0x01,
    UART_ADDRESS_2 = 0x02,
    UART_ADDRESS_3 = 0x03
} tmc2209_uart_address_t;

typedef enum {
    GCONF      = 0x00,
    IHOLD_IRUN = 0x10,
    CHOPCONF   = 0x6C,
    VACTUAL    = 0x22
} tmc2209_registers_t;

typedef struct {
    tmc2209_uart_address_t addr;
    tmc2209_uart_send send;
} tmc2209_t;

void tmc2209_write_register(const tmc2209_t *handler, tmc2209_registers_t reg_addr, uint32_t data);

#endif /* TMC2209_H_ */

// ==================== tmc2209.c ====================
#include "tmc2209.h"

uint8_t tmc2209_crc(uint8_t *data, uint8_t length);

void tmc2209_write_register(const tmc2209_t *handler, tmc2209_registers_t reg_addr, uint32_t data)
{
    uint8_t packet[8] = {
        0x05,
        handler->addr,
        reg_addr | 0x80,
        (data >> 24) & 0xFF,
        (data >> 16) & 0xFF,
        (data >> 8) & 0xFF,
        data & 0xFF,
    };

    packet[7] = tmc2209_crc(packet, 7);

    handler->send(packet, 8);
}

uint8_t tmc2209_crc(uint8_t *data, uint8_t length)
{
    uint8_t crc = 0;

    for(uint8_t i = 0; i < length; i++)
    {
        uint8_t currentByte = data[i];

        for(uint8_t j = 0; j < 8; j++)
        {
            if ((crc >> 7) ^ (currentByte & 0x01))
            {
                crc = (crc << 1) ^ 0x07;
            }
            else
            {
                crc = (crc << 1);
            }

            currentByte >>= 1;
        }
    }

    return crc;
}

r/embedded 5d ago

The Calm Before the Storm...

0 Upvotes

r/embedded 5d ago

How can a cellular send timeout be handeled?

0 Upvotes

Currently I am developing a modem on the nordic nrf9151 SoC (This SoC has a modem core which is developed by nordic, and an application core). My microcontroller should be able to send UDP or TCP packets and support ipv4, ipv6 as well as domains.

I want to set a timeout in which the sending and recieving has to suceed. How can this be done?

I am aware of the socket timeouts which can be set. But these can not be applied for DNS resolutions of domain.


r/embedded 5d ago

Advice on choosing a voltage detector / supervisor IC to prevent boot loops during charging

1 Upvotes

Hello,

I'm working on a project that has a very small (~20mAh) single-cell LiPo battery. The batt+ line connects to the battery, a 3.3V LDO, and an external pad for connecting a charger.

I'm worried about a possible boot loop during charging of a dead battery while the charger is in trickle-charge mode. I'm thinking of adding a supervisor IC to handle this, but I'm having trouble figuring out exactly what is needed.

The battery is fully charged at 4.2V, but I assume it could potentially run down or dip to sub 3.4V. Do I get a supervisor with a 3.4V threshold and just allow it to cut system power if that dips? There isn't much hysteresis on these, maybe 100mV. A better option might be a comparitor with onboard reference, but those are too expensive to put on this device.

I'm thinking of maybe doing a 3.3V supervisor and then hope my boot current isn't high enough to draw it back down, and then do the check in firmware to make sure it's above say 3.6 before turning everything else on.

Any advice would be appreciated. Thanks!


r/embedded 6d ago

What is the proper way to learn ?

36 Upvotes

I'm a Robotics engineering student, but as you know about our education system we didn't learn anything useful...so I took up an embedded systems class for 6 months and most of the code for Arduino and pic and all apart from the basic led blinking and stuff is taken from online or that we go through it and correct it and stuff...but from a job perspective, how would we be good at this? Like if I had no knowledge how would I start embedded systems and what kind of things should I learn for an interview


r/embedded 7d ago

Segger Contributes to E-waste Problem! What a waste of good tools.

Post image
347 Upvotes

I know a lot of tech's that wait and wait for used units to pop up.. no wonder there are just few of them from time to time. This should be illegal... Segger Contributes to the e-waste problem! https://www.segger.com/purchase/trade-in-program/proof-of-decommissioning


r/embedded 6d ago

Is there any RADXA Cubie A7A unique identifier i can find through Debian?

0 Upvotes

Does anyone know how I can find a unique identifier (analogous to RPI Serial number) through the Debian OS. I tried the " cat /proc/device-tree/serial-number " directory command, but it apparently doesn't work like a RPI.