<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ankit Agrawal</title>
    <description>The latest articles on DEV Community by Ankit Agrawal (@ankit_agrawal_40841deea96).</description>
    <link>https://dev.to/ankit_agrawal_40841deea96</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2039698%2Fdcc83fc2-46a7-42c0-a01d-d18fe9663a9d.jpg</url>
      <title>DEV Community: Ankit Agrawal</title>
      <link>https://dev.to/ankit_agrawal_40841deea96</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ankit_agrawal_40841deea96"/>
    <language>en</language>
    <item>
      <title>I lost my TV remote, so I built one with an Arduino</title>
      <dc:creator>Ankit Agrawal</dc:creator>
      <pubDate>Mon, 11 May 2026 20:24:24 +0000</pubDate>
      <link>https://dev.to/ankit_agrawal_40841deea96/i-lost-my-tv-remote-so-i-built-one-with-an-arduino-588c</link>
      <guid>https://dev.to/ankit_agrawal_40841deea96/i-lost-my-tv-remote-so-i-built-one-with-an-arduino-588c</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frykcboessgrkmtntiaql.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frykcboessgrkmtntiaql.webp" alt="arduino web ui for mi tv remote" width="800" height="452"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So, yesterday my primary TV suddenly stopped working, it's a Sony Bravia. What happened?… well god knows… and believe me, sony has no clue even after being on a call with them for over 30 mins!&lt;/p&gt;

&lt;p&gt;I had to try out Spider-Man 2 on my PS5; and I know I am way too late in doing so.&lt;/p&gt;

&lt;p&gt;But anyways, I needed a screen and so I connected to the TV in my room and turned it on but I had no remote to change the input to HDMI3. I looked and searched and found but no luck!&lt;/p&gt;

&lt;p&gt;Xiaomi has a Mi Remote app and so, I could have used it but for that it had to be connected to wifi but I constantly (every month) rotate my wifi creds and this model (Mi TV 4A 43 inch) of Mi TV had no Bluetooth and so, this app was also a fail.&lt;/p&gt;

&lt;p&gt;This is when it hit me… why not connect the IR blaster to my d1-mini and simply program it so that I can send commands using serial monitor and connect it to the wifi. So, I first asked Claude to just add a command to simulate the power button such that when I send “p” using serial monitor, it sends the relevant pulse using the IR blaster and it didn’t work! I tried some more codes that I found on the internet for this button but still no luck!&lt;/p&gt;

&lt;p&gt;It was not as easy as I initially thought it to be.&lt;/p&gt;

&lt;p&gt;Anyways, next best option → bruteforce 7 common power code sets that I found on the web . I flashed this code thinking this is it. I opened serial monitor and sent the command to start sending codes one at a time. None worked!&lt;/p&gt;

&lt;p&gt;I thought to then reverse engineer the Mi TV remote app. I mean it should have all the codes needed since it can control any mi tv. But before that I thought to use the superpower of searching the web to see if someone else has already done it and I found this: &lt;a href="https://github.com/ysard/mi_remote_database" rel="noopener noreferrer"&gt;https://github.com/ysard/mi_remote_database&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;now, someone had already done something similar and so, now I had all the code sets needed. so, I cloned the repo then decrypted Xiaomi brand 153, model 5122 via their Python exporter in flipper zero format then extracted the raw mark/space microsecond timings at 38 kHz.&lt;/p&gt;

&lt;p&gt;Now, this led me to discover that Mi TV uses a non-standard quaternary protocol (4 different space lengths: 578/867/1147/1428 µs).&lt;/p&gt;

&lt;p&gt;Next, I flashed 3 commands → power, volume up and down.&lt;/p&gt;

&lt;p&gt;All 3 worked!&lt;/p&gt;

&lt;p&gt;Next, I added all the commands from a remote like navigation keys, back button etc and then used this to connect to my wifi. This TV, now I could control using the Mi Remote app as well since it was on the same network as my phone.&lt;/p&gt;

&lt;p&gt;The next time I change my wifi password, I would again need this “gadget” and so, I created a web-ui for all the buttons of a remote and hosted a tiny server on this d1 mini.&lt;/p&gt;

&lt;p&gt;Here is the code file if you need it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://drive.google.com/file/d/1INZLRXr2k0VmKKlSUtJZjiqaEJE04-5M/view?usp=sharing" rel="noopener noreferrer"&gt;https://drive.google.com/file/d/1INZLRXr2k0VmKKlSUtJZjiqaEJE04-5M/view?usp=sharing&lt;/a&gt; &lt;/p&gt;

</description>
      <category>arduino</category>
      <category>iot</category>
      <category>esp8266</category>
      <category>reverseengineering</category>
    </item>
  </channel>
</rss>
