r/hardwarehacking • u/Henrikbiscuit • 1h ago
Reverse-engineered and cloned a 2.4 GHz lamp remote with an ESP32, an nRF24 and a CC2500
Second-hand ceiling lamp (Lindby Velua), 8-button remote, PCB marked YM-2.4G-B: one unmarked SOP16, a 16 MHz crystal and a meander antenna. No app, no hub, nothing online about it. I wanted it in Home Assistant, so I cloned the remote with an ESP32-S3. No SDR or logic analyser, and I didn't solder on the remote since it's the only one I have.
Finding the signal. nRF24L01+ in promiscuous mode got me to 2-FSK, 250 kbps, hopping 2402/2448/2479 MHz, with B9 A1 99 0D BF 29 in every packet. Using B9 A1 99 as the nRF24's address gave clean 17-byte frames.
The rolling code that wasn't. Every press looked different, so I assumed a rolling code. After logging 30 presses it was an 8-state counter in a fixed order. Sending the same frame three times toggled the lamp three times, so the receiver doesn't check it at all. XORing frames showed the whole frame is linear over GF(2), so it's a CRC-style scramble, not crypto. Each button's press frame is the on/off frame XOR a fixed 17-byte mask, which is the same at every counter state.
The wall. I built a transmitter with a CC2500 + CC2591 PA (VT-CC2500PA-S2). Checked with the nRF24, my packets were identical to the remote's, bit for bit. The lamp reacted about 1 press in 3. More power made it worse.
Going through the registers I found MCSM1 = 0x32 (TXOFF_MODE = stay in TX) where I meant 0x31. So the radio sat in TX between packets and every packet waited out a timeout. That was a real bug, and fixing it got me clean 849 µs packets with no underflows. Still 1 in 3.
The actual problem. An RTL-SDR doesn't reach 2.4 GHz and I don't have a HackRF. But it hit me that both my receivers only ever showed me bytes after a sync word match. I had never seen what the remote sends before B9 A1 99.
So I put the CC2500 in RX with no sync word, free-running, dumping 48-byte windows, and had the ESP32 search for B9 A1 99 at every bit offset. 189 packets in 4 seconds, and the bits in front were the same every time:
remote: 10101010 11001100 11001100 11001100 11001100 | B9 A1 99 | frame
mine: 1001100 11001100 11001100 11001100 11001100 | B9 A1 99 | frameThe remote sends an AA preamble and mine never did, so the lamp's receiver only locked on when it got lucky. The same capture gave the real timing: 1245 µs between packets, three per channel, ~11.7 ms per hop cycle. After adding AA AA AA AA and matching the timing, every press works, through walls. Removing the preamble brings the misses straight back.
Cheaper radios didn't work. An nRF24 and an A7105 sending the exact same packet and timing were both ignored. My guess is the remote's deviation (around ±250 kHz) is too wide for them. The A7105 also never decoded the remote, although its RSSI scan saw it.
One quirk I can't explain: on each channel the second packet is garbled from byte 9 onwards, on both nRF24 and CC2500, about half of all packets. The lamp doesn't care. Firmware bug in the remote?
Lessons: packet-mode radios hide the preamble and sync. Matching bytes after sync doesn't mean the transmission matches. And when tuning stops helping, build a way to measure instead.
It's my own lamp and remote. The lamp doesn't authenticate anything, so I keep the TX power low.
The code, protocol notes and logs are open source in my GitHub repo (lindby-velua-rf-bridge), and I'm happy to link it if anyone wants it.
Does anyone recognise the unmarked SOP16 (photos 1–2)? With a 16 MHz crystal, 250 kbps FSK and wide deviation, I'd love to know what it actually is.
