Ikta's Ponder Corner

Hi Internet!

If you have to know one thing about me, is that I like collecting music CDs. I like to look at their album art while listening to music, and I like having it at my shelves to look at, it usually comes with nice artworks in it, and (I think) it gives more to the musician compared to streaming. I'm not a snob and think that somehow, they're superior in quality or whatever, I don't really care about those things. What I do care about though, is that using physical CDs are actually kind of a pain.... You have to put it out of the case, put it in the player, navigate the menu sometimes, and because my only CD player is a PS3, the album art doesn't even show up! Outrageous! That's why I built this device for myself.

The Idea

I want to have a device that, when it scans my physical album, it plays it on my desired device. To accomplish that, I chose RFID. No particular reason other than it's the most convenient, and it also has nifty sticker versions that I can stick to my physical album, that way I can display the album and read it at the same time. Perfect.

Spoiler on how the final prototype looks

Full Code can be seen here.

Parts

In this project, I'll be using an ESP32-WROOM-32 Dev Kit Board that I bought online. You can use whatever board you want, just make sure the libraries work for them. For the reader I used the very cheap RFID-RC522 because the seller where I bought the ESP32 from also sells this. If you don't have it, you also will need some header cables to connect the pins from the RC522 and the ESP32.

MIFARE RFID

So, the RFID sticker that I bought is a MIFARE Classic 1k sticker. That means it has 16 sectors, with each sector have a 4 block, and each block having 16 bytes. If you just count that, that means there's 16 * 4 * 16 = 1024 (1k) byte in each card. But not all of the blocks are writeable. For each sector, there will be 1 block reserved as a Sector Trailer, that means from the original 1024 byte, 16 * 16 = 256 bytes are a reserved bytes and cannot be used to store data. Other that that, one block in sector 0 is reserved for manufacturer data, so your card UID and other data from the factory is stored here. That left us with 784 bytes of data left. Plenty of space for storing YouTube links.

Sector Diagram

We need to find a way to format our link and store it in the card. I used a very simple way in which I defined the max length of string as 144, defined the start block where I want to start writing the data, and with some maths calculated where the end block should be. Then just used the MFRC522v2 library to write or read the data to the blocks. Done!

Reading and writing is done, all we need to do is just find a way to send the ESP32 some write information and find a way for the ESP32 to control my TV.

HomeAssistant and MQTT

I don't have an NFC reader / writer. I can use my phone, but I can't be bothered to calculate and manually write to each block of my RFID card, that will be too much work! I want for this to also be able to write my RFID. I don't want to it to write all the time, so I want it to be toggleable between read and write mode. I also want to insert the value of what I want to write from somewhere else so that I don't need to tinker with ESP32 all the time. That's where HomeAssistant comes in clutch.

With HomeAssistant, I can create Helpers. It's a simple UI that I can use to trigger things in HomeAssistant, I created a toggle and a text input field.

Helper

We can setup the helper toggle switch with an automation to send message MQTT to a configured topic with a retain mode. This way whenever the ESP32 connects to the MQTT broker, it will receive the request on what is the current mode and changes it internal value accordingly. This is the same for write value.

Mode

For playing the read URL, we also rely a lot on HomeAssistant. Our device when reading the RFID will send the URL to a certain topic, HomeAssistant listen to that topic and triggers an automation.

Flow

In my case, I had to add one more action before calling play media on my Google TV. Which is pressing the OK button (DPAD_CENTER) before playing media, in order to escape from screensaver as play media doesn't work from screensaver mode (it works from power off and other states but just not screensaver).

#IoT #Arduino #HomeAssistant #MQTT

Summary:

As a child, Shimazaki Shingo was kidnapped by an international terrorist organization and raised as their combat agent. After 30 years, he finally made it back to his peaceful hometown in Japan. Will Shimazaki be able to live a peaceful life in this new world? From the large-scale newcomer Goten Hamada and the artist Takeshi Seshita, the creator of “Harn – Grass, Iron and Sheep -” and “Invincible”, an action story of a man who lives between everyday life and the battlefield!

Read in Mangadex


If you've read the old classic “The Fable”, this story is going to be familiar with you. A highly skilled retired killer / soldier is put in a normal everyday live where he has to adjust to the cultural difference in his harsh environment to the peaceful everyday Japan. But, as it did with The Fable, it's harsh directly adjusting with a new environment. To their credits, both Shimazaki Shingo and Akira Sato do try their best to adjust, but troubles seem to keep coming to them, as we see them uses their trained abilities to get out of situations. But the difference ends there.

While the fable is (arguably) a more lighthearted story of “What if this very cool assassin dude looks like an ordinary person”, Shimazaki's story is a bit bleaker. He's not some child trained assassin born and raised to be the ultimate killer, he's much more human than Akira in The Fable. We can see him have emotions of discomfort, embarrassment, and even traumatic memories of his past. This manga focuses more on the realistic aspect of what a person would be going through if we were to be kidnapped and being forced against their will to be a killer.

Shimazaki is shy, he's often nervous about things, he worries if he's doing a good job adjusting to normal life. We see him talk his feelings out about this to the other people in their life. He uses his abilities to help the people around him, he's kind like that. But as we slowly being exposed to the extents of his abilities, we are also being shown his human and empathetic side. It creates this dilemma of us wanting him to show his cool abilities, but it's also clear that's he's enjoying his new peaceful life. This dilemma is even more clear that it's intentional by the author as we see at the end of each chapter the words “Shimazaki Shingo returns to the battlefield xxx days from now”. With each chapter that shows the humane and kind man is trying his best to return to normal life, we see the inevitability of him returning back to the battlefield that he wanted to get away from.

Of course, it's not all dark and gritty story, this isn't the DC cinematic universe movie. It's still a fun read, with comedy as the overall tone of the story, but with a dark story lurking beneath it. Overall, I say it's good enough to be followed.

#manga #action #hearthfelt