<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>IoT on FooBar Blog</title>
    <link>https://blog.foobardevs.com/tags/iot/</link>
    <description>Recent content in IoT on FooBar Blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 21 Mar 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.foobardevs.com/tags/iot/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>DIY portable monitor for temperature &amp; humidity</title>
      <link>https://blog.foobardevs.com/posts/diy-esp32-temp-hum-monitor/</link>
      <pubDate>Sat, 21 Mar 2026 00:00:00 +0000</pubDate>
      <guid>https://blog.foobardevs.com/posts/diy-esp32-temp-hum-monitor/</guid>
      <description>&lt;h2 id=&#34;the-need-for-a-hands-on-project&#34;&gt;The need for a hands-on project&lt;/h2&gt;
&lt;p&gt;Almost all of my personal projects rely entirely on software solutions, in which I either set up existing tools or write them myself. Even though the projects and software in question vary greatly, interacting only with code can get stale after a while. This encouraged me to start a hands-on DIY project. It specifically appealed to me since I&amp;rsquo;ve rarely built anything physical during my education, so it was mostly uncharted territory. I looked for something in my daily life that would benefit from a simple device I could build myself.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<h2 id="the-need-for-a-hands-on-project">The need for a hands-on project</h2>
<p>Almost all of my personal projects rely entirely on software solutions, in which I either set up existing tools or write them myself. Even though the projects and software in question vary greatly, interacting only with code can get stale after a while. This encouraged me to start a hands-on DIY project. It specifically appealed to me since I&rsquo;ve rarely built anything physical during my education, so it was mostly uncharted territory. I looked for something in my daily life that would benefit from a simple device I could build myself.</p>
<p>One thing came to mind: my house has poor insulation, so some rooms have higher humidity which attracts mold. While there are existing solutions for monitoring humidity, I wanted something simple and portable that I could build myself without spending much money.</p>
<p>This is why I decided to build a portable monitor to measure temperature and humidity. These were the features I wanted:</p>
<ul>
<li>Ability to measure air temperature and humidity</li>
<li>A small screen to display the data</li>
<li>Battery-powered operation for portability around the house</li>
<li>Battery percentage display to know when to recharge</li>
<li>A small, portable 3D-printed case to house everything</li>
</ul>
<h2 id="designing-the-circuit">Designing the circuit</h2>
<p>The problem was that I didn&rsquo;t know where to start, as I had no experience with electronics. This hurdle was quickly cleared with the help of Claude, which suggested the core components and a basic circuit design. I used this as a starting point for my research.</p>
<p>After researching for a few days, I settled on the following components:</p>
<ul>
<li>SH1106 - 1.3&quot; OLED display</li>
<li>DHT22 - temperature and humidity sensor</li>
<li>ESP32 - microcontroller for fetching data and driving the screen</li>
<li>2000 mAh 3.7V Li-Po battery - powers the device</li>
<li>TP4056 - battery charger module</li>
<li>Rocker switch - power switch</li>
<li>2x 47k$\Omega$ resistors - voltage divider for battery monitoring</li>
</ul>
<p>All of these components are easily found on websites like AliExpress for around 20€ total.</p>
<p>The reason I needed a voltage divider is that the ESP32&rsquo;s ADC can only measure up to 3.3V, while the battery can output up to 4.2V when fully charged. The voltage divider reduces the battery voltage to a safe level. Since two resistors of the same value are used, the voltage is halved, meaning the maximum voltage the ESP32 sees is 2.1V—well within its safe range.</p>
<p>Before building the circuit, I designed it using EasyEDA. This helped me visualize the connections and how the components would fit together.
<img alt="schematic" loading="lazy" src="/posts/diy-esp32-temp-hum-monitor/schematic.png"></p>
<h2 id="prototyping">Prototyping</h2>
<p>For prototyping, I used a full-width breadboard and 10 cm jumper wires.</p>
<p>I programmed the ESP32 using the Arduino IDE, which I was already familiar with. Most of the code was adapted from the &ldquo;Examples&rdquo; section after installing the ESP32 board manager. For the display and sensor, I followed these tutorials:</p>
<ul>
<li>Display - <a href="https://www.iotsharing.com/2017/05/how-to-use-arduino-esp32-to-display-oled.html">Demo 6: How to use Arduino ESP32 to display information on OLED</a></li>
<li>Sensor - <a href="https://randomnerdtutorials.com/esp32-dht11-dht22-temperature-humidity-sensor-arduino-ide/">ESP32 with DHT11/DHT22 Temperature and Humidity Sensor using Arduino IDE | Random Nerd Tutorials</a></li>
</ul>
<p>Since I chose an OLED screen, I was concerned about burn-in—permanent damage caused by displaying static elements like &ldquo;Humidity:&rdquo; for too long. To prevent this, I implemented a simple screensaver that turns the display off for 10 seconds for every 5 seconds it&rsquo;s on. During those 10 seconds of inactivity, I also put the ESP32 into deep sleep to save battery. To further increase the display&rsquo;s lifespan, I added a random pixel offset for the text so that static labels don&rsquo;t always use the same pixels.</p>
<p>You can find the code in <a href="https://git.foobardevs.com/helix/esp32-environmental-sensor">this repository</a>.</p>
<h3 id="mvp-minimum-viable-product">MVP (Minimum Viable Product)</h3>
<p>The current prototype is shown below.
<img alt="prototype" loading="lazy" src="/posts/diy-esp32-temp-hum-monitor/prototype.jpg">
It&rsquo;s not the prettiest setup, but it&rsquo;s a working proof of concept. The ESP32 is elevated because it&rsquo;s so wide that it would otherwise cover most of the breadboard holes, leaving no room for jumper wires.</p>
<p>I&rsquo;m still waiting for battery and resistors to arrive so I&rsquo;ll update the article once I integrate them into my prototype.</p>
]]></content:encoded>
    </item>
  </channel>
</rss>
