<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Shajan Jacob</title>
  <subtitle>Tech Lead</subtitle>
  <link href="https://shajanjacob.com/feed.xml" rel="self"/>
  <link href="https://shajanjacob.com"/>
  <updated>2026-04-21T00:00:00Z</updated>
  <id>https://shajanjacob.com/</id>
  <author>
    <name>Shajan Jacob</name>
    <email>shajanjp at gmail dot com</email>
  </author>
  <entry>
    <title>A simple smart DIY AC controller to cut power bills</title>
    <link href="https://shajanjacob.com/blog/a-simple-smart-diy-ac-controller-to-cut-power-bills/"/>
    <updated>2026-04-21T00:00:00Z</updated>
    <id>https://shajanjacob.com/blog/a-simple-smart-diy-ac-controller-to-cut-power-bills/</id>
    <content type="html">
      <![CDATA[
        <p>The temperature in my place is around 38°C during the daytime, and the AC in my room is running almost all the time.</p>
<p>In the last couple of months, I started noticing something. My electricity bill was quietly going up. Not dramatically, just enough to make me uncomfortable.
See: <a href="/blog/how-i-track-and-predict-electricity-consumption-at-home/">How I track and predict electricity consumption at home</a></p>
<p>I usually set my AC to 26°C, expecting it would maintain that temperature efficiently. But that’s not how it works. Even when the room becomes cooler than 26°C, the AC doesn’t really “turn off”.</p>
<p>It just keeps running. The compressor keeps working. Power keeps getting consumed. Basically, my AC had no idea when to stop even though it has a sensor inbuilt.</p>
<h2>The Idea</h2>
<p>What if I could sense the temperature using an external device and turn the AC on/off only when needed?</p>
<p>Meaning:</p>
<ul>
<li>Monitor room temperature</li>
<li>Turn OFF when it’s cool</li>
<li>Turn ON when it gets hot again</li>
</ul>
<p>That’s it. Nothing fancy.</p>
<h2>The Setup</h2>
<img src="./m5stack-c6-nano-and-env-iv-sensor.jpg" alt="M5Stack Nano C6 and temperature humidity sensor" style=" height: auto; width:100%;">
<p>I used:</p>
<ul>
<li><a href="https://shop.m5stack.com/products/m5stack-nanoc6-dev-kit">M5Stack Nano C6</a> (An ESP32-C6FH4 SoC with built-in IR and RGB LED)</li>
<li><a href="https://shop.m5stack.com/products/env-iv-unit-with-temperature-humidity-air-pressure-sensor-sht40-bmp280?variant=44010397106433">M5 Stack ENV IV unit</a> (An environmental sensor unit embedded with SHT40 and BMP280 sensors for measuring temperature, humidity, and atmospheric pressure data)</li>
</ul>
<p>No cloud. No app. No overengineering.</p>
<p>M5Stack makes prototyping easy. No soldering required, and plenty of sensors and controllers to choose from.</p>
<h2>How AC Remote Works</h2>
<p>AC remotes don’t work like TV remotes. They don’t send:</p>
<ul>
<li>Increase fan speed</li>
<li>Decrease temp</li>
</ul>
<p>Instead, they send the <strong>entire state</strong>:</p>
<ul>
<li>Mode (cool/dry)</li>
<li>Temperature</li>
<li>Fan speed</li>
<li>Timer</li>
<li>Swing</li>
</ul>
<p>Everything. In one shot.</p>
<p>So I captured the IR signal from my remote using an IR receiver, stored that signal in my code so that i can replay that using Nano C6. Now I can reliably control my AC.</p>
<h2>The Logic</h2>
<p>The controller checks the temperature every few minutes:</p>
<ul>
<li>If the room is <em>hot → turn AC ON</em> (send IR signal)</li>
<li>If the room is <em>cool → turn AC OFF</em> (send IR signal)</li>
</ul>
<p>That’s it.</p>
<h2>A Small Safety Net</h2>
<p>I didn’t want the AC running forever if my device fails.</p>
<p>So every time I send the <strong>ON signal</strong>, I also include a <strong>30-minute timer</strong>.
Even if my microcontroller dies, the AC will turn off automatically.</p>
<h2>Some UX for the Controller</h2>
<p>The controller has a built-in RGB LED. I used it to show the temperature:</p>
<ul>
<li>🔴 Red → Hot</li>
<li>🟢 Green → Ideal Temperature</li>
<li>🔵 Blue → Cool</li>
</ul>
<p>Now I don’t need an app or display to understand the current temperature of the room.</p>
<p>Since the room is closed, it stays cool for a while even after turning off.
All of this is handled by a tiny device sitting quietly in the corner, saving me on power bills.</p>
<p>Here is the <a href="https://github.com/shajanjp/smart-ac-thermostat">source code for Smart AC Thermostat</a> if you want to have a look or use the same.</p>

      ]]>
    </content>
    <summary>A simple ESP32-based controller that turns your AC on/off based on room temperature - saving electricity without apps, cloud, or complexity.</summary>
  </entry>
  <entry>
    <title>Trekking to Agasthyarkoodam – A random plan that turned into a lifetime experience</title>
    <link href="https://shajanjacob.com/blog/trekking-to-agastiyarkoodam/"/>
    <updated>2026-01-30T00:00:00Z</updated>
    <id>https://shajanjacob.com/blog/trekking-to-agastiyarkoodam/</id>
    <content type="html">
      <![CDATA[
        <h2>Booking the Ticket and Preparation</h2>
<img src="./shajan-walking-to-forest-station-in-the-morning.jpg" alt="Shajan walking to forest station in the morning" style=" height: auto; width:100%;">
<p>I went trekking to Agasthyarkoodam with my friend <a href="https://www.instagram.com/nithin_cs/" target="_blank" rel="noopener noreferrer">Nithin</a>. The plan actually started very randomly. One day in January 2026, during a casual conversation, we decided to try booking tickets. There was no serious planning behind it. We just checked some random dates, tried a few times, and surprisingly, we got the ticket. That was it.</p>
<p>After booking, there was almost no preparation at all. I walked everyday atleast 5 KM from just 1 week before the trip. Apart from that we didn't train, didn't research much, and didn't buy fancy gear. The only things we bought were a head cap and a trekking stick. That's it. Apart from that, we carried some dry fruits and a few apples/bananas. Looking back, it sounds crazy, considering what we were about to do.</p>
<h2>About Agasthyarkoodam Trekking Program</h2>
<p>Agasthyarkoodam trekking is a 3-day trekking program organized by the Kerala Forest Department. It is considered one of the hardest and longest treks in South India, covering nearly 50 kilometers in total, including steep climbs and descents.</p>
<ul>
<li>Day 1: Trek from the picket station to the base camp at Athirumala (around 16 km). We stay overnight at the Athirumala base camp.</li>
<li>Day 2: Trek from the base camp to the Agasthyarkoodam peak and return back to the base camp.</li>
<li>Day 3: Trek back from the base camp to the picket station.</li>
</ul>
<p>Some people complete the trek in just 2 days by directly trekking down from Agasthyarkoodam to the picket station on Day 2 itself.</p>
<p>The trek starts from a place called Bonacaud, which is around 54 kilometers from Trivandrum town.</p>
<img src="./a-view-of-agasthyamala.jpg" alt="A view of Agasthyarkoodam" style=" height: auto; width:100%;">
<h2>Day 1</h2>
<p>We reached Trivandrum by train and stayed there the previous day because there are only a few buses available to Bonacaud. Early in the morning, at 5:00 AM, we boarded a KSRTC bus from the Trivandrum bus stand. By 7:00 AM, we reached Bonacaud. The bus was completely packed with trekkers, which itself felt exciting.</p>
<p>From Bonacaud, we had to walk about 2 kilometers to reach the forest station. On the way, we had a light breakfast. Before starting the trek, we had to submit our entry pass, medical certificate, and affidavit. Our bags were also inspected carefully to make sure we weren't carrying plastic or anything harmful to the forest.</p>
<p>After all the checks, we were finally allowed to start trekking.</p>
<p>For every 10 people, one guide is assigned. But that doesn't mean the guide stays with you throughout the trek. In our case, we were mostly alone in the forest for long stretches.</p>
<p>We started trekking from the forest station at 9:50 AM.</p>
<h3>About the Trek</h3>
<p>The trek had a mix of terrains and changing climate. In the morning, while climbing up, it was quite sunny. As we reached almost halfway, the weather became cooler, with mist and light drizzle here and there.</p>
<p>On the way to the Athirumala base camp, there are many waterfalls. We drank water directly from them, it was crystal clear and incredibly fresh.</p>
<img src="./taking-rest-in-one-of-the-waterfalls.jpg" alt="Taking rest in one of the waterfalls" style=" height: auto; width:100%;">
<p>By 5:00 PM, we reached the base camp. We had a small evening snack and black coffee from the canteen and then settled inside the shed. By then, my entire body was aching. I wasn't used to trekking, and with zero preparation, the pain was expected. After some light stretching and rest, we went for a bath in a nearby stream. The water was ice-cold, flowing directly from a waterfall.</p>
<img src="./nithin-on-deep-forest.jpg" alt="Nithin on deep forest" style=" height: auto; width:100%;">
<p>When we reached the base camp, the climate was completely different from what we experienced inside the forest. There were strong winds, and it felt extremely cold. The stay was a temporary shed, similar to a dormitory. There is no electricity, and everything runs on solar power. The stored solar power is used only for basic lighting, and after 9:00 PM, all lights are switched off to save energy.</p>
<p>The air quality there is unbelievably good, no pollution at all. Because of that, the sky was extremely clear. The base camp has around 10 water taps, with fresh water flowing throughout the day, supplied directly from a waterfall through pipes.</p>
<img src="./athirumala-base-camp-shed.jpg" alt="Athirumala base camp shed" style=" height: auto; width:100%;">
<p>Everyone must report to the camp, and no one is allowed to step outside after 6:00 PM due to the presence of wild animals like elephants and bears. We even spotted a few snakes inside the camp compound. There is a small area near the camp where mobile network is available for a few providers, but inside the camp, there is no signal at all.</p>
<p>That night, around 11:00 PM, a bear came very close to the dormitory. It was a terrifying experience. We could hear it roaring loudly. The bear had come to eat food waste from the canteen area. There were strong winds and continuous rainfall throughout the night. I was awake until almost 3:00 AM, unable to sleep properly.</p>
<h2>Day 2</h2>
<p>We woke up early at 5:00 AM, freshened up, and had a cup of black coffee from the canteen. It was still raining. After some stretching and packing our bags, we had breakfast and started trekking towards Agasthyarkoodam by 8:00 AM.</p>
<img src="./treking-to-the-top-of-agasthyamala.jpg" alt="Treking to the top of Agasthyarkoodam" style=" height: auto; width:100%;">
<p>The path to Agasthyarkoodam was even more difficult than Day 1. The elevation was steep, there was no proper straight path, and the trail was full of mud and stones. By 9:30 AM, we reached Pongalapara.</p>
<p>Beyond that point, no one was allowed to trek further due to the harsh weather conditions. The wind was extremely strong at the top. It was difficult even to stand still on the rocks because of the force of the wind. We waited for about 30 minutes, hoping the weather would improve, but it didn't.</p>
<p>So we made the tough decision to turn back.</p>
<p>We couldn't trek the last 3 kilometers to the peak because of the weather. Since we still had enough time, we decided to trek all the way down to the picket station on the same day. Trekking down was comparatively easier than climbing up. By 5:00 PM, we reached the picket station.</p>
<h2>Experience</h2>
<p>Overall, the trek was an amazing experience, despite the physical exhaustion and body pain. It pushed my limits and taught me a lot about endurance and nature.</p>
<p>I would strongly recommend this trek to anyone who truly loves forests, mountains, and raw nature. It's not easy, but it's absolutely worth experiencing at least once in a lifetime.</p>

      ]]>
    </content>
    <summary>A randomly planned trek to Agasthyarkoodam that turned into a challenging and unforgettable journey through forest, wind, and rain.</summary>
  </entry>
  <entry>
    <title>A bottle full of nature</title>
    <link href="https://shajanjacob.com/blog/a-bottle-full-of-nature/"/>
    <updated>2025-06-21T00:00:00Z</updated>
    <id>https://shajanjacob.com/blog/a-bottle-full-of-nature/</id>
    <content type="html">
      <![CDATA[
        <img src="./a-tiny-terrarium-i-made.jpg" alt="A tiny terrarium I made" style="height: auto; width: 100%;">
Plants have a quiet way of making everything feel more alive—and I love that. Something about plants and greenery instantly lifts my mood. There’s a calmness in them, a sense of life that makes everything feel just a little better.
<h2>Discovering the Magic of Terrariums</h2>
<p>A few years ago, I came across a picture of a bottle with plants growing inside it. It made me curious—why would someone put plants in a sealed bottle? How would the plants even survive? Where do they get air or carbon dioxide? I started searching for similar images, and soon I discovered the term <a href="https://in.pinterest.com/search/pins/?q=terrarium">terrarium</a>, a self-sustaining ecosystem inside a bottle. Once I knew what to call it, my recommendations on Google, YouTube, and Pinterest were filled with terrarium-related things. People were creating tiny, beautiful, almost magical landscapes inside glass jars. I was fascinated.</p>
<h2>My First Attempt</h2>
<p>A few months later, during the rainy season, I spotted some moss growing on the walls around my house. I picked up a glass bottle from the kitchen and decided to try making one myself. I didn’t have the fancy tools or materials like the ones shown in YouTube tutorials—all I had was some moss, a bit of soil, and the bottle. Still, I managed to create something that looked pretty nice. Unfortunately, it didn’t survive more than a month. The humidity and soil quality weren’t right for the moss to thrive. But that didn’t stop the excitement I felt when I first made it.</p>
<h2>Moss Finds a Home Again</h2>
<img src="./items-for-tiny-terrarium.jpg" alt="Items for the tiny terrarium" style="height: auto; width: 100%;">
<p>A few days back, I visited a hill station near <a href="https://maps.app.goo.gl/BMbwU2uT1ktfskG87">Idukki</a> and spotted thick green moss growing over big roadside rocks. I gently collected a small piece to bring back home. I wanted to try again—to see that little patch of green thrive inside a bottle once more. This time, I created it in a tiny glass bottle, which made it even more beautiful.</p>

      ]]>
    </content>
    <summary>A personal journey of discovering terrariums — tiny self-sustaining ecosystems in glass bottles</summary>
  </entry>
  <entry>
    <title>Merry Pixels: Hand crafted programmable christmas star</title>
    <link href="https://shajanjacob.com/blog/merry-pixels-a-hand-crafted-programmable-christmas-star/"/>
    <updated>2024-12-23T00:00:00Z</updated>
    <id>https://shajanjacob.com/blog/merry-pixels-a-hand-crafted-programmable-christmas-star/</id>
    <content type="html">
      <![CDATA[
        <h2>TLDR:</h2>
<p>I created a christmas star with 300 led bulbs and hung it in front of my house, which can be programmed by anyone around the world the way they want. Give it a <a href="https://merry-pixels.deno.dev/">try here</a>.</p>
<h2>Backstory:</h2>
<p>Like a lot of other people, I like the December season very much. The holidays, snow weather, lights, gifts, and Christmas cake. The time spent on decorating the house with lights and making the Christmas crib always gives a warm feeling. This season brings back good childhood memories too. Colorful lights blinking everywhere always make me happy. I’ve written a few lines on how obsessed I am with lights <a href="https://shajanjacob.com/blog/2022/07/16/the-story-of-a-light-bulb.html">here</a>.</p>
<p>Nowadays there are a lot of Christmas stars available in the market. Everyone is buying them, and almost all the stars in the neighborhood look the same, which is boring. Me, together with my wife, wanted to make a star handcrafted from locally available materials and hang it in front of the house, which would be special compared to what others have.</p>
<h2>The Journey: From Idea to Reality</h2>
<img src="./star-wooden-frame.jpg" alt="Star wooden frame" style=" height: auto; width:100%;">
<p>We started with creating the frame for the star using teak wood, which we bought from the local wood store. Angles and measurements were taken precisely so that the 5 sides of the star would have the same shape. We cut the wood and attached them with wood glue and iron nails. Each side of the star leg is 50 cm in length, and the entire perimeter of the star is thus 300 cm. Once the wood frame was ready, we tied the diffuser light panel to the frame using wire ties.</p>
<p>For the lighting, I decided to go with the addressable RGB LED strip I had in my stock. The LED strip I had was also 5 meters in length, which means each side of the star leg will get 30 LEDs. Perfect.</p>
<img src="./star-led-panel-and-light-strip.jpg" alt="Star LED panel and light strip" yle=" height: auto; width:100%;">
<p>I cut the strip into 10 pieces, each 50 cm long, and my wife stuck the LED strips to the panel easily. We soldered the LED strips together and made sure they were working fine. I hung it in the room for the first couple of days and tried some animations before hanging it in front of my house.</p>
<p>I chose to use the ESP32 as the controller to drive the LEDs. I had an M5Stack Atom S3 in my stock, so I took that one for this project. I created a web server using Deno with a couple of REST APIs to accept and provide the animation data to the star. The ESP32 controller is connected to Wi-Fi and is listening to the Deno server to get the star animation data.</p>
<img src="./merry-pixels-webpage.jpg" alt="Merry Pixels webpage" tyle=" height: auto; width:100%;">
<p>I also created a <a href="https://merry-pixels.deno.dev/">web page that has an emulator of the star</a> using HTML canvas with the same number of lights and the same shape as the physical star. I also added a code editor to the web page, which can be used to program the star. The editor has a boilerplate JavaScript function called twinkle() which can be programmed to return a string that includes the colors for each LED in the star and a delay value that will decide how much time that particular color should stay lit.</p>
<p>Each leg of the star has 60 LEDs (30 LEDs on each side), which makes 300 LEDs in total for the star. To animate it, we need 300 colors to be there in a single frame (colors of the star at a given moment). Also, for creating an animation (for example: to make an LED run from start to end), we need 300 frames. I decided to take the color input in hexadecimal colors.</p>
<pre class="language-markdown"><code class="language-markdown">F00-0F0-00F:1000  
000-000-000-F00-0F0-00F:1000  </code></pre>
<p>The above format is the expected output from the twinkle function. Each line represents a frame. In each frame, the color for each LED is represented by hexadecimal values, and LEDs are delimited with hyphens. The last numerical part decides the delay value. With this sample animation data given above, the first LED will be set as red, the second green, and the third as blue, and then stay that way for 1 second. Then the 4th LED is set to red, the 5th LED to green, and the 6th LED to blue and kept for 1 second.</p>
<p>Using this idea, any animation can be created.</p>
<iframe width="315" height="560" src="https://www.youtube.com/embed/NqWbfRxFq-4" title="YouTube video player" frameborder="0"></iframe>
<h2>Challenges:</h2>
<h3>1.	Powering the LEDs</h3>
<p>The RGB LED strip used is the WS2812b model, and it consumes 60mA of power when red, blue, and green are lit at full brightness. This means 60mA × 300 = 18A is the power needed for this project. I was initially using a 4A mobile phone charger, and I had issues when lighting all the LEDs at the same time. Later, I bought a 5V 20A power adapter to solve this.</p>
<h3>2.	Emulator</h3>
<p>Programming the Arduino each time and then uploading it to the ESP32 controller was a hectic process. So, I decided to create a web page with a star emulator and an editor that can be used to program the LEDs. This introduced many challenges, like handling the data and processing it in the controller.</p>
<h3>3. APIs for Getting the Animation Data</h3>
<p>I initially created a REST API that returned all the 300 frames as JSON, but the size was too large for the ESP32 to parse and process. 300 hex colors × 300 frames + JSON encoding characters made it around 1.5 MB for a single animation. Microcontrollers usually have very limited RAM and are not efficient at processing data like this.
Even though I reduced the 6-character color (eg FF0000) to a 3-character hex color string (eg: F00), it didn’t help much.</p>
<p>I decided to get rid of the JSON format and use plain text input instead. Also, instead of returning all the frames at once, I made changes in the Deno server to make the response a stream. I updated the ESP32 to handle the stream and process the colors, which resolved the issue.</p>
<h2>Why and What’s Next:</h2>
<p>Like every other hobby project, I started this as a weekend fun activity. This taught me so many things, like powering so many LEDs, streaming API responses, and creating each animation like solving an algorithm problem. I enjoyed spending time with my wife making the star together.</p>
<p>Anyone can contribute animations. I will be running all the animations together and posting a video showing all the submissions in one go.</p>
<p>Thanks, everyone. Merry Christmas! 🎄</p>
<img src="./star-hung-in-front-of-house.jpg" alt="Star hung in front of my house" tyle=" height: auto; width:100%;">

      ]]>
    </content>
    <summary>A hand crafted christmas star thats programmable using javascript by anyone around the world</summary>
  </entry>
  <entry>
    <title>How I track and predict electricity consumption at home</title>
    <link href="https://shajanjacob.com/blog/how-i-track-and-predict-electricity-consumption-at-home/"/>
    <updated>2024-10-05T00:00:00Z</updated>
    <id>https://shajanjacob.com/blog/how-i-track-and-predict-electricity-consumption-at-home/</id>
    <content type="html">
      <![CDATA[
        <img src="./ios-widget-power-bill-monitor.jpg" alt="My iphone widget for tracking electricity consumption" style=" height: auto; width:100%;">
<h2>TLDR</h2>
<p>After receiving an unexpectedly high electricity bill, I built a system to track and predict my electricity consumption using a <a href="https://deno.com/">Deno</a> REST API thats connected to a <a href="https://www.notion.so">Notion</a> database. It calculates daily usage, current costs using the KSEB API, and future bill predictions. I log my meter readings via an <a href="https://support.apple.com/en-in/guide/shortcuts/welcome/ios">iPhone Shortcut</a>, and an iOS widget created with <a href="https://scriptable.app/">Scriptable</a> displays the data on my phone home screen.</p>
<h2>The bill that started it all</h2>
<p>About six months ago, I received an electricity bill that was almost three times higher than what I usually pay. This unexpected spike made me take a closer look at my electricity usage to figure out what had gone wrong and how I could prevent it from happening again.</p>
<p>I used <a href="https://bills.kseb.in/">KSEB’s official electricity bill calculator</a> to understand the billing structure. Here’s a brief breakdown of the slabs and rates for those unfamiliar:</p>
<ul>
<li>For usage below 500 units:
<ul>
<li>₹3.25 per unit for the first 100 units</li>
<li>₹4.05 per unit for the next 100 units</li>
<li>₹5.10, ₹6.95, and ₹8.20 for higher slabs</li>
</ul>
</li>
<li>If consumption falls between 500 and 600 units, the rate is ₹6.40 per unit.</li>
<li>Between 600 and 700 units, it increases to ₹7.25 for the lower slab and ₹7.60 for the higher one.</li>
</ul>
<p>That month, I had consumed nearly 600 units, which explained the steep bill. To ensure this didn’t happen again, I decided to track my power usage on a daily basis.</p>
<h2>Meter reading tracking</h2>
<p>The digital electricity meter in my home shows various details, including voltage, frequency, and meter readings. Since I use Notion as my personal organization tool, I thought it would be convenient to store and monitor my electricity data also there.</p>
<img src="./notion-electricity-reading-db.jpg" alt="Notion electricity reading database" style=" height: auto; width:100%;">
<p>I built a Deno REST API server to handle the tracking. It has two main endpoints:</p>
<p>•	<strong>POST /electricity:</strong></p>
<p>This API calculates the average daily electricity consumption and the current bill amount using the KSEB API, then logs the data in my Notion database.</p>
<p>•	<strong>GET /electricity/summary:</strong></p>
<p>This API retrieves a summary that includes my average daily electricity consumption, the current meter reading, total bill amount for the units consumed so far, and a predicted final bill. The prediction is based on the average daily consumption multiplied by the number of days in the billing cycle (60 days).</p>
<h2>Automation &amp; Analysis</h2>
<p>To make the logging process easier, I created a Shortcut on my iPhone. Every time I enter the current meter reading, the shortcut automatically sends the data to the <strong>POST API</strong>, logging it in Notion.</p>
<img src="./electricity-reading-ios-shortcut.jpg" alt="iPhone electricity reading shortcut" style=" height: auto; width:100%;">
<p>For quick access to the data, I also built an iOS widget using the Scriptable app. This widget pulls data from the summary API and displays key information like:</p>
<ul>
<li>The total units consumed so far</li>
<li>The current bill amount</li>
<li>A predicted final bill</li>
<li>Average daily consumption</li>
</ul>
<p>This setup allows me to effortlessly track my electricity consumption, with the data visible at a glance on my phone. By doing this regularly, I have a better understanding of my electricity usage and can keep a closer eye on how much I’m likely to be charged.</p>
<h2>So, thats it</h2>
<p>By tracking my electricity consumption daily, I’ve managed to stay on top of my usage and avoid unexpected spikes in my bill. The combination of Notion, the Deno REST API, and iPhone automation has made the process efficient and seamless.</p>
<p>If you’ve ever been surprised by a high electricity bill, setting up a similar system could help you gain better control over your electricity consumption. If you are lazy, atleast write down the meter readings in a book once in a while and analyse it.</p>
<p>I know there are other smarter methods to track this, like a Wi-Fi connected electricity meter, etc., but this is the easiest and cheapest way I found to solve the issue.</p>
<h2>Whats Next</h2>
<p>With a clear understanding of my daily power usage, I’m planning to reduce consumption by replacing all old fans with energy-efficient BLDC models. Additionally, I’m exploring solar power to support some of my energy needs.</p>

      ]]>
    </content>
    <summary>How I automated electricity tracking and prediction at home using a Deno REST API, Notion, and iPhone shortcuts to monitor daily usage and forecast bills effortlessly.</summary>
  </entry>
  <entry>
    <title>My journey of using and contributing to google maps</title>
    <link href="https://shajanjacob.com/blog/my-journey-of-using-and-contributing-to-google-maps/"/>
    <updated>2022-11-24T00:00:00Z</updated>
    <id>https://shajanjacob.com/blog/my-journey-of-using-and-contributing-to-google-maps/</id>
    <content type="html">
      <![CDATA[
        <img src="./map-drawing" alt="My journey of using and contributing to google maps" tyle="height: auto; width:100%;">
<h2>My perspective on maps</h2>
<p>The map is a spectacular invention, without any doubt. Plotting and understanding the planet we live in to a single image is a tremendous achievement. Every time I zoom out on the map, I realize how tiny I am and my surroundings. Seeing photos of places around the world without physically going there is a luxury. I’ve not traveled to any places outside of my country. I've not even visited 1% of the places in the country I’m living-in, still, I can imagine how certain places look like, or how to navigate to places. I also like the idea of knowing and letting others know about places.</p>
<h2>How I use Google Maps</h2>
<p>I primarily use maps to locate and navigate places. I also read reviews about the places before visiting. Using google maps, it is easy to make a list of places to visit when you are going to a new city. I also use live location sharing which makes it handy to know and let others know our real-time location.</p>
<h2>Google Maps pointing system</h2>
<p>Google maps is a community-driven navigation application. People can use it to locate places, plan travels, read/write reviews and add or edit missing roads and places. Every contribution is counted towards the google maps reward points. Depending upon the reward points you earn, you will be placed in one of 1-10 levels.</p>
<h2>How I started</h2>
<p>I started contributing to google maps 10 years ago (2012). My first contribution was adding a local shop near my house. I used to take maps and see surrounding places whenever I visit new places and when I’m bored.</p>
<h2>Contributions</h2>
<p>In the last couple of years, I’ve added lots of photos to locations and reviewed many places. Even though I’ve added so many missing roads and places, I contributed more to removing the clutter from maps, like removing non-publicly accessible places like houses. I’ve also contributed to translating places to the local language.</p>
<p>It took me 4 years to reach level 10 from level 6.</p>
<h2>Benefits</h2>
<p>There's not much to expect. Google doesn’t pay anything for any contribution. But gives away freebies like google drive storage space or free/trial subscriptions to their services depending on which level you belong.</p>
<h2>What's next</h2>
<p>I just love to read what people tell about places. I may continue contributing whenever I’m free.</p>

      ]]>
    </content>
    <summary>How I started with google maps and reached level 10 as a contributed</summary>
  </entry>
  <entry>
    <title>Story of a light bulb</title>
    <link href="https://shajanjacob.com/blog/the-story-of-a-light-bulb/"/>
    <updated>2022-07-16T00:00:00Z</updated>
    <id>https://shajanjacob.com/blog/the-story-of-a-light-bulb/</id>
    <content type="html">
      <![CDATA[
        <img src="./the-diy-internet-connected-bulb" alt="The story of a light bulb" style=" height: auto; width:100%;">
<h2>Short Story</h2>
<p>I made a simple internet-connected table lamp that blinked when you visited this page.
It will blink again if you click on the below button.</p>
<p><button class="button send-message-button w-full px-6 py-4 text-2xl mb-4 text-zinc-800 dark:text-zinc-100 bg-zinc-100 dark:bg-zinc-800" style="">Give me a clap</button></p>
<p>See a better playground <a href="https://globo.deno.dev/">here</a>.</p>
<h2>Love for lights</h2>
<p>I get attracted to lights very easily. My shelf, windows, and drawer are almost filled up with different types of LED bulbs and fairy lights.
This interest hit me long back when I was in 5th grade and one of the seniors named Riya brought a battery and bulb for the school science exhibition.
That was the first time I came to know that a battery and wire can light up a bulb. That day I returned home and pulled out batteries from the TV remote control, and started trying out the same.
I was so happy when it worked for the first time. I knew nothing about battery and bulb, but it just worked. Even now, when I make something with the bulb, I remember her.</p>
<h2>From zero</h2>
<p>Fast forward to 2022. It was a boring rainy weekend and I had a ton of time to kill. Like everyone else, I have a dozen of DIY project ideas on my bucket list. I wanted to finish at least one of them per month. One of the ideas was to make a mood light that stays on my table and should be more than just a light at the same time.</p>
<p>The initial thought I had in my mind was to hack the IoT bulbs I already have (so that I don't have to build one). But most commonly available IoT bulbs don't have public APIs. I have even reached out to the Smitch and Syska team regarding this, but no hope. Reverse engineering their protocol is a headache.</p>
<p>I decided to build one. These things happened over the night.</p>
<h2>Why</h2>
<p>Why should I do this ? For fun. Yeah, that's the first priority.</p>
<p>I like to get notifications that won't disturb me. Notifications are supposed to be disturbing, but I wanted to make them friendlier. Notifications from the calendar, social media, chat, GitHub hooks, and whatnots.</p>
<h3>Choosing the stack</h3>
<p>My interest in electronics (and obviously bulbs) grew up with me (no, I still don't know how to use a multimeter properly). I used to disassemble and repair electronic gadgets in my house (and damaged most of them for some mysterious reasons).
I chose computer science as my main subject in 12th grade. I learned some programming concepts. Then I came to know about Arduino boards (programmable microcontrollers), and started playing with them.</p>
<p>I have a couple of RaspberryPi boards but it will be an overkill for this tiny little project. Even <a href="https://www.raspberrypi.com/products/raspberry-pi-zero/">RaspberryPi Zero</a> would be too much. <a href="https://www.raspberrypi.com/products/raspberry-pi-pico/">RaspberryPi Pico</a> is ok, but I would have to wire up additional <a href="https://en.wikipedia.org/wiki/ESP8266">esp-01</a> with it for the WiFi connectivity. <a href="https://www.raspberrypi.com/news/raspberry-pi-pico-w-your-6-iot-platform/">RaspberryPi Pico W</a> is perfect but it's not available in stores at the time of writing this.</p>
<p>A couple of years back, I bought some <a href="https://en.wikipedia.org/wiki/NodeMCU">NodeMCU</a>s (think of them as Arduino + WiFi) but way cheaper. It was like 2$ when I purchased it. I also bought some sensors and relays to make hobby projects out of it.</p>
<p>Finally, I decided to use the NodeMCU.</p>
<h3>Neopixels</h3>
<p>We all know about LEDs, they are awesome. Think of LED strips(LED bulbs connected to each other), they are super cool. Think of led strips in which each LED can make more than 10000 colors(combinations of red, green, and blue), superb.
Now think about controlling each LED and its color individually, that's heaven!
<a href="https://www.adafruit.com/category/168">NeoPixel</a> is the one.
There was no doubt about using addressable LEDs like WS2812B. The one I chose is the rounded <a href="https://www.electronicscomp.com/sensors-module/modules/24-bit-ws2812-5050-rgb-led-built-in-full-color-driving-lights-circular-development-board?sort=pd.name&amp;order=DESC">WS2812B with 24 LEDs</a>.</p>
<h3>Power</h3>
<p>Even though this is going to be on my table all day, I'm hesitant to power it with a wired adapter of any sort. I had a plan to use a few <a href="https://commonsensehome.com/18650-battery/">18650</a> batteries I have, but the charging modules and voltage regulators are going to complicate things. Then I thought that I will use my old Mi power bank, but since it doesn't have a low power mode, it will turn off if a minimum amount of power is not consumed from it. NodeMCU only draws around 110 mA when idle.</p>
<p>Finally, I bought the <a href="https://store.mi.com/in/item/3204500003">Mi pocket power bank pro</a>, which is considerably small and has a low power mode.</p>
<h3>Software and services</h3>
<p><a href="https://deno.land/">Deno</a> is used to build the backend REST API and WebSocket server. Deployed on deno deploy. <a href="https://glitch.com/">Glitch</a> is also a good alternative, but it sleeps when no requests are made for 5 mins or so.</p>
<p>Logic in NodeMCU is written in <a href="https://www.arduino.cc/">Arduino</a> (a framework built on top of C++).</p>
<h2>How it works</h2>
<p>I have deployed the REST API and a web socket server in <a href="https://deno.com/deploy">deno edge</a>. The REST API can be used as a hook API. The server accepts messages and broadcasts to all the connected web socket clients. NodeMCU is subscribed to the above-mentioned WebSocket server and handles incoming requests whenever a message event occurs.</p>
<h2>Future plans</h2>
<ul>
<li>I will be adding a push button that will act as an IoT button(like an <a href="https://en.wikipedia.org/wiki/Amazon_Dash">Amazon button</a> or <a href="https://bt.tn/">bttn</a>) to trigger useful events.</li>
<li>I will also add a buzzer for handling more priority notifications. (Thinking of using morse code at some point).</li>
<li>Add a firefly light effect and play that randomly.</li>
<li>Add a real-time clock module and use the LEDs to show time.</li>
</ul>
<p><button class="button send-message-button w-full px-6 py-4 text-2xl mb-4 text-zinc-800 dark:text-zinc-100 bg-zinc-100 dark:bg-zinc-800" style="">Give me a clap again</button></p>
<img src="./globo-iot-mood-light-table.jpg" alt="Globo IoT mood light table" style=" height: auto; width:100%;">
<script>
    const sendMessageButtons = document.getElementsByClassName('send-message-button');
    const url = `wss://globo.deno.dev`;
    const socket = new WebSocket(url);
    
    for(const sendMessageButton of sendMessageButtons) {
        sendMessageButton.addEventListener('click', () => {
            console.log("sending...")
            socket.send(JSON.stringify({ r: 255, g: 255, b: 0 }));
        })
    }

    // Connection opened
    socket.addEventListener('open', function (event) {
        socket.send(JSON.stringify({ r: 255, g: 255, b: 0 }));
    });

    // Listen for messages
    socket.addEventListener('message', function (event) {
        console.log('Message from server ', event.data);
    });

    function sendMessage(message){
        socket.send(message);
    }
</script>

      ]]>
    </content>
    <summary>I just love seeing them glow</summary>
  </entry>
  <entry>
    <title>Representing IP addresses using WS2812B</title>
    <link href="https://shajanjacob.com/blog/representing-ip-address-using-rgb-leds/"/>
    <updated>2019-02-25T00:00:00Z</updated>
    <id>https://shajanjacob.com/blog/representing-ip-address-using-rgb-leds/</id>
    <content type="html">
      <![CDATA[
        <p>Colors and lights always make me happy. Its a pleasant feeling when I see my favorite color palettes. I'm a bit strict about the colors I choose, but I still like seeing random colors floating around.</p>
<p>I was making an IoT moodlight using <a target="_blank" href="https://www.nodemcu.com/index_en.html">NodeMCU</a> and <a target="_blank" href="https://en.wikipedia.org/wiki/LED_strip_light">WS2812B</a>. Which can be controlled using <a target="_blank" href="https://shajanjacob.com/easyhome">easyhome</a> (dashboard for controlling RGB WS2812B from the web). Every time the NodeMCU get connected to the WiFi access point, it had different IPs assigned to it. So it was hard to find the current IP, I used to connect the NodeMCU to the computer and made use of the serial monitor of Arduino IDE to find its IP. This worked for me as long as the computer and MCU are close enough for a wired USB connection.</p>
<img src="./ip-address-using-rgb-leds.jpg" alt="IP address using RGB LEDs" style="height: auto; width:100%;">
<p>I just wanted the NodeMCU to tell me the IP through some interface without needing a computer. All I had was a WS2812B strip, So I represented the IP using 4 LEDs. Initially IP was split into 4 parts. Parts were displayed in red, green, blue and white respectively. This is how the LED shows, when the IP address is lets say, 192.168.100.1</p>
<table>
<thead>
<tr>
<th>Pixels</th>
<th>Color</th>
</tr>
</thead>
<tbody>
<tr>
<td>...*</td>
<td>RED</td>
</tr>
<tr>
<td><em>..</em></td>
<td>RED</td>
</tr>
<tr>
<td>..*.</td>
<td>RED</td>
</tr>
<tr>
<td>...*</td>
<td>GREEN</td>
</tr>
<tr>
<td>.**.</td>
<td>GREEN</td>
</tr>
<tr>
<td>*...</td>
<td>GREEN</td>
</tr>
<tr>
<td>...*</td>
<td>BLUE</td>
</tr>
<tr>
<td>....</td>
<td>BLUE</td>
</tr>
<tr>
<td>....</td>
<td>BLUE</td>
</tr>
<tr>
<td>...*</td>
<td>WHITE</td>
</tr>
</tbody>
</table>

      ]]>
    </content>
    <summary>I just wanted the NodeMCU to tell me the IP through some interface without needing a computer.</summary>
  </entry>
</feed>
