<?xml version="1.0" encoding="utf-8" standalone="yes"?><?xml-stylesheet type="text/xsl" href="/localcopy.xslt"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Home on Ankshilp</title>
    <link>https://ankshilp.in/</link>
    <description>Recent content in Home on Ankshilp</description>
    <generator>Hugo</generator>
    <language>en-US</language>
    <lastBuildDate>Thu, 26 Feb 2026 21:37:05 +0530</lastBuildDate>
    <atom:link href="https://ankshilp.in/index.xml" rel="self" type="application/rss+xml" />
            <item>
            <title>For The Love of Internet</title>
            <link>https://ankshilp.in/posts/for-the-love-of-internet/</link>
            <pubDate>Thu, 26 Feb 2026 21:37:05 +0530</pubDate>
            <guid>https://ankshilp.in/posts/for-the-love-of-internet/</guid>
                        <description> &lt;p&gt;Two decades ago, when Indian ISPs had adequate IPv4 addresses, they were allocating free public IPs. I remember how exciting it was to host my own website from home and be able to access it from anywhere. Gaming was seamless with public IP. Peer to peer apps just worked. But as Internet users grew ISPs decided to deploy NAT. No more public IPs, no more free hosting. And it’s been like that for two decades now.&lt;/p&gt; </description>
            <content:encoded>&lt;p&gt;Two decades ago, when Indian ISPs had adequate IPv4 addresses, they were allocating free public IPs. I remember how exciting it was to host my own website from home and be able to access it from anywhere. Gaming was seamless with public IP. Peer to peer apps just worked. But as Internet users grew ISPs decided to deploy NAT. No more public IPs, no more free hosting. And it’s been like that for two decades now.&lt;/p&gt;&#xA;&lt;p&gt;Take a look at table below. It shows countries, their population and % IPv4 address allocation. I have ommitted most countries which have adequate IP addresses except United States which has excess of IPs. You can view the full table &lt;a href=&#34;https://en.wikipedia.org/wiki/List_of_countries_by_IPv4_address_allocation&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;table&gt;&#xA;  &lt;thead&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;th&gt;#&lt;/th&gt;&#xA;          &lt;th&gt;Location&lt;/th&gt;&#xA;          &lt;th&gt;IP addresses&lt;/th&gt;&#xA;          &lt;th&gt;%&lt;/th&gt;&#xA;          &lt;th&gt;Population&lt;/th&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/thead&gt;&#xA;  &lt;tbody&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;1&lt;/td&gt;&#xA;          &lt;td&gt;United States&lt;/td&gt;&#xA;          &lt;td&gt;1,611,297,420&lt;/td&gt;&#xA;          &lt;td&gt;43.71&lt;/td&gt;&#xA;          &lt;td&gt;343,477,335&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;2&lt;/td&gt;&#xA;          &lt;td&gt;China&lt;/td&gt;&#xA;          &lt;td&gt;343,125,576&lt;/td&gt;&#xA;          &lt;td&gt;9.31&lt;/td&gt;&#xA;          &lt;td&gt;1,422,584,933&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;3&lt;/td&gt;&#xA;          &lt;td&gt;Japan&lt;/td&gt;&#xA;          &lt;td&gt;189,145,768&lt;/td&gt;&#xA;          &lt;td&gt;5.13&lt;/td&gt;&#xA;          &lt;td&gt;124,370,947&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;4&lt;/td&gt;&#xA;          &lt;td&gt;United Kingdom&lt;/td&gt;&#xA;          &lt;td&gt;134,054,832&lt;/td&gt;&#xA;          &lt;td&gt;3.64&lt;/td&gt;&#xA;          &lt;td&gt;68,682,962&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;11&lt;/td&gt;&#xA;          &lt;td&gt;Netherlands&lt;/td&gt;&#xA;          &lt;td&gt;48,112,552&lt;/td&gt;&#xA;          &lt;td&gt;1.31&lt;/td&gt;&#xA;          &lt;td&gt;18,092,524&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;12&lt;/td&gt;&#xA;          &lt;td&gt;Australia&lt;/td&gt;&#xA;          &lt;td&gt;46,444,728&lt;/td&gt;&#xA;          &lt;td&gt;1.26&lt;/td&gt;&#xA;          &lt;td&gt;26,451,124&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;13&lt;/td&gt;&#xA;          &lt;td&gt;Russia&lt;/td&gt;&#xA;          &lt;td&gt;44,859,860&lt;/td&gt;&#xA;          &lt;td&gt;1.22&lt;/td&gt;&#xA;          &lt;td&gt;145,440,500&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;14&lt;/td&gt;&#xA;          &lt;td&gt;India&lt;/td&gt;&#xA;          &lt;td&gt;41,624,148&lt;/td&gt;&#xA;          &lt;td&gt;1.13&lt;/td&gt;&#xA;          &lt;td&gt;1,438,069,596&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;      &lt;tr&gt;&#xA;          &lt;td&gt;15&lt;/td&gt;&#xA;          &lt;td&gt;Taiwan&lt;/td&gt;&#xA;          &lt;td&gt;35,715,484&lt;/td&gt;&#xA;          &lt;td&gt;0.97&lt;/td&gt;&#xA;          &lt;td&gt;23,317,145&lt;/td&gt;&#xA;      &lt;/tr&gt;&#xA;  &lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;p&gt;Do you see the issue? The country with largest population, India, is allocated merely 1.13% of total IPv4 addresses. China, the second largest country by population, has somewhat better allocation than India but still nothing as compared to United States. Both India and China has to deploy layers upon layers of NAT to deal with these limited IPv4 addresses. It’s mind boggling to me that we are letting IPv4 continue in it’s current state even after knowing this sad reality.&lt;/p&gt;&#xA;&lt;p&gt;Sometimes, I wonder, if India should just switch off IPv4. I mean we have done something far more crazier than this. We changed the currency notes over a course of few months. A transition from IPv4 to IPv6 seems far more easier especially since we already have 77% of people on IPv6. A drastic move like this seems to be the only way the west would take concrete steps to move on to IPv6.&lt;/p&gt;&#xA;&lt;p&gt;There are countless threads online on forums like Hacker News, Reddit where people who never really got comfortable with idea of IPv6 and are still discussing whether it’s the right choice going forward. Some of them keep using NAT out of convenience and believe that’s what makes their networks secure. Others believe IETF should have adopted IPv4 to include more addresses. I don’t know if that’s possible but I do know that the people who designed IPv6 were experts in their domain. Maybe we should trust them and move on.&lt;/p&gt;&#xA;&lt;p&gt;Besides, it’s been 3 decades, the world has been preparing for IPv6 to be the backbone of the Internet. Most devices now have support for IPv6. Any discussions questioning IPv6 now are absurd. IPv6 is the only way forward and the sooner we do it the better it is for everyone.&lt;/p&gt;&#xA;</content:encoded>
            </item>
            <item>
            <title>Distractions</title>
            <link>https://ankshilp.in/posts/distractions/</link>
            <pubDate>Mon, 18 Aug 2025 21:37:05 +0530</pubDate>
            <guid>https://ankshilp.in/posts/distractions/</guid>
                        <description> &lt;p&gt;Our age is age of distractions. Instant messages, notifications, breaking news, endless stories, cute pet videos, random comments on social media are all distractions of one form or other. These distractions are dividing our attention which is already in short supply. Due to this, anything real like relationships, our own problems and issues, our thoughts and ideas forever remain on back burner. We don&amp;rsquo;t have time to sit with our own thoughts and ideas. How can we be healthy if we remain disconnected from ourselves?&lt;/p&gt; </description>
            <content:encoded>&lt;p&gt;Our age is age of distractions. Instant messages, notifications, breaking news, endless stories, cute pet videos, random comments on social media are all distractions of one form or other. These distractions are dividing our attention which is already in short supply. Due to this, anything real like relationships, our own problems and issues, our thoughts and ideas forever remain on back burner. We don&amp;rsquo;t have time to sit with our own thoughts and ideas. How can we be healthy if we remain disconnected from ourselves?&lt;/p&gt;&#xA;&lt;p&gt;We distract ourselves with shorts, reels or some random series on a streaming platform. We desperately want connection with real people but settle for fictional characters. Binge watching helps subsume the pain of truth. Truth that we should be working on our own problems, developing new skills, building strong relationships with real people. Somewhere in the back of our minds we all are well aware of this. We know all these distractions are sucking happiness out of our lives. But instant gratification wins over real hard work. &amp;ldquo;What are you talking about, Rohan? I can easily stave off distractions&amp;rdquo;. Maybe you can but I have found it incredibly hard thing to do. Maybe that&amp;rsquo;s just me but something tells me I&amp;rsquo;m not alone.&lt;/p&gt;&#xA;&lt;p&gt;Large corporations have poured billions to ensure as many eyeballs as possible remain active on their platforms. Why is notification on every social media plotform, red? Because we humans associate red with danger, something that needs our attention. That is why traffic light for stop is red. These large corporations have discovered numerous such hacks and they employ it without any regard for users well being. For them our attention is worth billions. The real question is how much our own attention is worth to us? What would we achieve if we could direct all our energy into our own well being?&lt;/p&gt;&#xA;&lt;p&gt;So how do we focus on ourselves? Well the first thing is to identify these distractions. It may be the most crucial step. Once we identify distractions it becomes easier to block them. The blocking process can involve using browser extensions or apps that block access to certain websites with fixed time slots. No solution is fool proof. You will go back and forth between blocking and unblocking. What is important is you enable blocking every time you unblock. Think of it like this: blocking distractions is like building a muscle in your brain. The more you practice the stronger it becomes. Doom scrolling is what they gave us and took control of our time. Blocking is our way of fighting back and taking back that control.&lt;/p&gt;&#xA;</content:encoded>
            </item>
            <item>
            <title>Why Start Self Hosting</title>
            <link>https://ankshilp.in/posts/why_self_host/</link>
            <pubDate>Wed, 23 Mar 2022 00:02:34 +0530</pubDate>
            <guid>https://ankshilp.in/posts/why_self_host/</guid>
                        <description> Take control back of your digital life </description>
            <content:encoded>&lt;p&gt;Remember Picasa? There is no native application even today that comes close to it&amp;rsquo;s feature parity. But sadly it was discontinued in favour of a cloud application: Google Photos. What happened with Picasa also happened to millions of other applications around the same time Picasa was discontinued. The applications we use to run on our PC have moved to cloud. It makes sense from corporations perspective because they get more control over updates, user data and licenses but users are at huge disadavantage as they no longer are in control of their own data. You might ask why that is such an issue? Let&amp;rsquo;s see:&lt;/p&gt;&#xA;&lt;p&gt;Consider this, you carefully curate your playlists on Spotify but every now and then you see a certain song missing from your playlist. Same goes for videos saved in your YouTube playlists or other music/video streaming services. Then there is also the case of OTT streaming platforms where the show you were going to watch over weekend has now disappeared. If this was not bad imagine what happens when you need document from your email but the provider has suspended your account because of something you did (which was not even violation of terms of service) on other service of that email provider. &lt;a href=&#34;https://hn.algolia.com/?q=account&amp;#43;suspended&#34;&gt;Hacker News is littered with such stories&lt;/a&gt;. There are some stories where the user never figured out what they had done wrong to deserve suspension of account.&lt;/p&gt;&#xA;&lt;p&gt;Then there is this whole different problem of corporations tracking you and your data. Whenever I bring this up people are like &amp;ldquo;I don&amp;rsquo;t care, I have nothing to hide&amp;rdquo;. But this is exactly similiar to saying &amp;ldquo;I don&amp;rsquo;t care about free speech because I have nothing to say&amp;rdquo;. Would you give up your right to free speech because you have nothing to say? No. The same goes about right to privacy. The data you share is used to cater you personalized ads. That same data is also used to ensure that you spend maximum time with the particular service. There are millions of engineers across the world who are getting paid hefty sum to keep as many eyeballs as possible glued to service offered by their employers. This engineering talent is supposed to be solving world&amp;rsquo;s problems but instead they are ensuring how everyone wastes their time. That&amp;rsquo;s a whole different topic for another blog post.&lt;/p&gt;&#xA;&lt;p&gt;What self hosting does is it protects you against all these issues and more. It gives you the peace of mind by keeping you in control of your data. You can choose if you never want your data to leave your premises or home. You can also choose to make your data available to you whenever or wherever you want it securely. In upcoming posts, we will explore self hosted applications and how they protect you and your data. But if you cannot wait, head over to &lt;a href=&#34;https://www.reddit.com/r/selfhosted&#34;&gt;r/selfhosted&lt;/a&gt; or check out this &lt;a href=&#34;https://github.com/awesome-selfhosted/awesome-selfhosted/blob/master/README.md&#34;&gt;awesome self hosted list&lt;/a&gt; to get started with your self hosting journey.&lt;/p&gt;&#xA;&lt;p&gt;Subscribe to RSS feed to stay updated.&lt;/p&gt;&#xA;</content:encoded>
                <category>self hosting</category>
            </item>
            <item>
            <title>Monitoring Solar Power Over WiFi</title>
            <link>https://ankshilp.in/posts/monitoring_solar_panel_output_over_wifi/</link>
            <pubDate>Wed, 20 Jan 2021 00:00:00 +0000</pubDate>
            <guid>https://ankshilp.in/posts/monitoring_solar_panel_output_over_wifi/</guid>
                        <description> Measuring solar panel output with Arduino and ESP8266 and viewing it on Grafana dashboard with InfluxDB hosted on Raspberry PI </description>
            <content:encoded>&lt;p&gt;&lt;figure&gt;&lt;a href=&#34;https://ankshilp.in/static/solar_panel.jpg&#34; class=&#34;lightbox-image&#34;&gt;&#xA;  &lt;img src=&#34;https://ankshilp.in/static/solar_panel.jpg&#34; alt=&#34;solar panel&#34; loading=&#34;lazy&#34;&gt;&#xA;&lt;/a&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;India is rapidly switching to renewable energy sources. It&amp;rsquo;s not just the government that&amp;rsquo;s making the switch but people as well have been switching to solar roof tops for their power requirements. In our society, 30-40% houses have set up solar panels on their roofs. Most of these houses do not pay at all to the MSEB but on the other hand contribute surplus to the grid.&lt;/p&gt;&#xA;&lt;p&gt;The one that is setup at my home - shown in picture above - has 2.27 kWh capacity. Over the past 3-4 months I have been monitoring the output of these panels and they have been on average producing 220-270 kW per month. There is around 70-100 units of surplus which is fed into the grid every month. I have seen output of about maximum 11.6 kWh in a single day. Rest of days it fluctuates in 6-8 kWh range. There are many parameters affecting output like weather, panel temperature, dust on the panels. I do not have any control over the weather but rest two parameters can be kept in check to improve efficiency of these panels.&lt;/p&gt;&#xA;&lt;p&gt;Currently, only way to monitor output of these panels is by checking the inverter manually. This is not helpful at all. Moreover I would prefer to have this data recorded on per minute basis rather than looking at aggregates at the end of the day. I need a system that will continuously log the panel output to a central database. Logging to central database has its own advantages: I can not only do a thorough analysis but also get power stats over the Internet. Let&amp;rsquo;s build this 😃&lt;/p&gt;&#xA;&lt;h3 id=&#34;components&#34;&gt;&#xA;  Components&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;&lt;figure&gt;&lt;a href=&#34;https://ankshilp.in/static/sct_resize.jpg&#34; class=&#34;lightbox-image&#34;&gt;&#xA;  &lt;img src=&#34;https://ankshilp.in/static/sct_resize.jpg&#34; alt=&#34;&#34; title=&#34;The sensor must be clipped on phase&#34; loading=&#34;lazy&#34;&gt;&#xA;&lt;/a&gt;&#xA;&lt;figcaption&gt;The sensor must be clipped on phase&lt;/figcaption&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;SCT-013-030: A non-invasive current sensor with a clip-on. I did not wanted to meddle with 230V mains supply, hence this sensor. You can clip it on any wire and it will generate output voltage corresponding to the current flowing from the wire.&lt;/li&gt;&#xA;&lt;li&gt;Arduino Uno: I had this sitting in my closet. It has an ADC onboard which can be used to measure output of the current sensor.&lt;/li&gt;&#xA;&lt;li&gt;ESP01 WiFi module: This module can directly transmit data over WiFi network and it was the cheapest one that I found. Also, it seems it can be easily interfaced with Arduino.&lt;/li&gt;&#xA;&lt;li&gt;3.3V power supply: ESP01 needs a regulated 3.3v power supply&lt;/li&gt;&#xA;&lt;li&gt;A raspberry pi: This is used for capturing the data shared by ESP01 and as a data logger. Eventually this will also be used as a server to broadcast captured data over Internet.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;a-note-on-esp01&#34;&gt;&#xA;  A Note on ESP01&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;I am using Micropython firmware for ESP01. Stock AT firmware should also work. I chose Micropython because I was facing issues communicating with Arduino over serial. Although I later found out that the issue was because of power supply. ESP01 strictly needs 3.3V[1]. The issue went away once it was powered by a dedicated 3.3V power supply instead of Arduino&amp;rsquo;s 3.3V supply. I spent lot of time resolving this issue. 😅&lt;/p&gt;&#xA;&lt;h3 id=&#34;interfacing-arduino-with-esp01&#34;&gt;&#xA;  Interfacing Arduino With ESP01&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;The interfacing here is for serial communication between Arduino and ESP01. If you want to flash or load programs on ESP01 using Arduino you will have to change wiring. Refer this &lt;a href=&#34;https://www.ankshilp.com/flashing_esp_with_arduino/&#34;&gt;note&lt;/a&gt; for wiring, flashing and loading programs on ESP01.&lt;/p&gt;&#xA;&lt;p&gt;Below is the wiring between UNO and ESP01 for serial communication. You can choose different pins for RX &amp;amp; TX in your code.&lt;/p&gt;&#xA;&lt;div class=&#34;codeblock&#34;&gt;&#xA;  &lt;div class=&#34;codeblock-actions&#34;&gt;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--wrap&#34;&#xA;            data-wrap-toggle&#xA;            data-icon-button&#xA;            aria-pressed=&#34;false&#34;&#xA;            title=&#34;Enable soft wrap&#34;&#xA;            data-wrap-title=&#34;Enable soft wrap&#34;&#xA;            data-nowrap-title=&#34;Disable soft wrap&#34;&gt;&#xA;      &lt;svg viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M4 6h16M4 10h12a4 4 0 0 1 0 8h-2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;/&gt;&#xA;        &lt;path d=&#34;M14 18l-2-2m2 2l-2 2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--copy&#34;&#xA;            data-copy-code&#xA;            data-icon-button&#xA;            title=&#34;Copy code&#34;&#xA;            data-copied-title=&#34;COPIED&#34;&gt;&#xA;      &lt;svg class=&#34;icon-copy&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;rect x=&#34;9&#34; y=&#34;9&#34; width=&#34;13&#34; height=&#34;13&#34; rx=&#34;2&#34; ry=&#34;2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34;&gt;&lt;/rect&gt;&#xA;        &lt;path d=&#34;M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;      &lt;svg class=&#34;icon-check&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M20 6L9 17l-5-5&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;  &lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;UNO — ESP8266&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    RX — 11 &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    TX — 10 &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    GND — GND &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    3.3V — VCC &#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    3.3V — CH_PD&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;The configuration of Arduino environment is out of scope of this article. Arduino IDE makes it very easy to load programs on Arduino.&lt;/p&gt;&#xA;&lt;h3 id=&#34;serial-io-and-broadcast&#34;&gt;&#xA;  Serial I/O and Broadcast&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;&lt;strong&gt;Serial write with Arduino&lt;/strong&gt;&lt;br&gt;&#xA;Here&amp;rsquo;s listing of code that writes &lt;code&gt;Hello from Arduino&lt;/code&gt; to ESP01&lt;/p&gt;&#xA;&lt;div class=&#34;codeblock&#34;&gt;&#xA;  &lt;div class=&#34;codeblock-actions&#34;&gt;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--wrap&#34;&#xA;            data-wrap-toggle&#xA;            data-icon-button&#xA;            aria-pressed=&#34;false&#34;&#xA;            title=&#34;Enable soft wrap&#34;&#xA;            data-wrap-title=&#34;Enable soft wrap&#34;&#xA;            data-nowrap-title=&#34;Disable soft wrap&#34;&gt;&#xA;      &lt;svg viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M4 6h16M4 10h12a4 4 0 0 1 0 8h-2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;/&gt;&#xA;        &lt;path d=&#34;M14 18l-2-2m2 2l-2 2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--copy&#34;&#xA;            data-copy-code&#xA;            data-icon-button&#xA;            title=&#34;Copy code&#34;&#xA;            data-copied-title=&#34;COPIED&#34;&gt;&#xA;      &lt;svg class=&#34;icon-copy&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;rect x=&#34;9&#34; y=&#34;9&#34; width=&#34;13&#34; height=&#34;13&#34; rx=&#34;2&#34; ry=&#34;2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34;&gt;&lt;/rect&gt;&#xA;        &lt;path d=&#34;M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;      &lt;svg class=&#34;icon-check&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M20 6L9 17l-5-5&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;  &lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#include&lt;/span&gt; &lt;span class=&#34;cpf&#34;&gt;&amp;lt;SoftwareSerial.h&amp;gt;&lt;/span&gt;&lt;span class=&#34;cp&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#define RX 10&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;#define TX 11&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;cp&#34;&gt;&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;SoftwareSerial&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;esp8266&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;RX&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;TX&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;setup&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;esp8266&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;begin&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;115200&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;loop&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;esp8266&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;Hello from Arduino&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;delay&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3000&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;&lt;strong&gt;Serial read from ESP01&lt;/strong&gt;&lt;br&gt;&#xA;ESP SoC has 2 serial I/Os. UART 1 is write only and UART 0 can do perform both read and write. That is why we have to use UART0 for communication with Arduino. But there&amp;rsquo;s a catch with UART0, it is used by micropython REPL for loading programs. The only way to communicate with Arduino over serial is to detach UART0 from REPL. Doing this would disable the functionality to load or edit programs until it is re-attached[2].&lt;/p&gt;&#xA;&lt;div class=&#34;codeblock&#34;&gt;&#xA;  &lt;div class=&#34;codeblock-actions&#34;&gt;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--wrap&#34;&#xA;            data-wrap-toggle&#xA;            data-icon-button&#xA;            aria-pressed=&#34;false&#34;&#xA;            title=&#34;Enable soft wrap&#34;&#xA;            data-wrap-title=&#34;Enable soft wrap&#34;&#xA;            data-nowrap-title=&#34;Disable soft wrap&#34;&gt;&#xA;      &lt;svg viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M4 6h16M4 10h12a4 4 0 0 1 0 8h-2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;/&gt;&#xA;        &lt;path d=&#34;M14 18l-2-2m2 2l-2 2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--copy&#34;&#xA;            data-copy-code&#xA;            data-icon-button&#xA;            title=&#34;Copy code&#34;&#xA;            data-copied-title=&#34;COPIED&#34;&gt;&#xA;      &lt;svg class=&#34;icon-copy&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;rect x=&#34;9&#34; y=&#34;9&#34; width=&#34;13&#34; height=&#34;13&#34; rx=&#34;2&#34; ry=&#34;2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34;&gt;&lt;/rect&gt;&#xA;        &lt;path d=&#34;M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;      &lt;svg class=&#34;icon-check&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M20 6L9 17l-5-5&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;  &lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;uos&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dupterm&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;kc&#34;&gt;None&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;            &lt;span class=&#34;c1&#34;&gt;# detach UART from REPL. &lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;uart&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;UART&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;115200&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;          &lt;span class=&#34;c1&#34;&gt;# UART 0 is available for our program&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;if&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;uart&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;any&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;():&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;message&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;uart&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;readline&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;   &lt;span class=&#34;c1&#34;&gt;# read data from serial input&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;uos&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;dupterm&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;uart&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;            &lt;span class=&#34;c1&#34;&gt;# re-attach UART with REPL before end of program&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;&lt;strong&gt;Broadcast over WiFi&lt;/strong&gt;&lt;br&gt;&#xA;Now that the data is read from serial it&amp;rsquo;s time to broadcast it over WiFi using below function&lt;/p&gt;&#xA;&lt;div class=&#34;codeblock&#34;&gt;&#xA;  &lt;div class=&#34;codeblock-actions&#34;&gt;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--wrap&#34;&#xA;            data-wrap-toggle&#xA;            data-icon-button&#xA;            aria-pressed=&#34;false&#34;&#xA;            title=&#34;Enable soft wrap&#34;&#xA;            data-wrap-title=&#34;Enable soft wrap&#34;&#xA;            data-nowrap-title=&#34;Disable soft wrap&#34;&gt;&#xA;      &lt;svg viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M4 6h16M4 10h12a4 4 0 0 1 0 8h-2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;/&gt;&#xA;        &lt;path d=&#34;M14 18l-2-2m2 2l-2 2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--copy&#34;&#xA;            data-copy-code&#xA;            data-icon-button&#xA;            title=&#34;Copy code&#34;&#xA;            data-copied-title=&#34;COPIED&#34;&gt;&#xA;      &lt;svg class=&#34;icon-copy&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;rect x=&#34;9&#34; y=&#34;9&#34; width=&#34;13&#34; height=&#34;13&#34; rx=&#34;2&#34; ry=&#34;2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34;&gt;&lt;/rect&gt;&#xA;        &lt;path d=&#34;M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;      &lt;svg class=&#34;icon-check&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M20 6L9 17l-5-5&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;  &lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;def&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;broadcast&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;message&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;bytes&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;cs&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;socket&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;AF_INET&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;SOCK_DGRAM&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;cs&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sendto&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;message&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;192.168.0.255&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;7007&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;))&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;The socket is a UDP socket as selected by &lt;code&gt;SOCK_DGRAM&lt;/code&gt; parameter. We are choosing to send the message over broadcast address &lt;code&gt;192.168.0.255&lt;/code&gt; so that we can receive it on any device on network. Listening to the message on a Linux system is as easy as running the command&lt;/p&gt;&#xA;&lt;div class=&#34;codeblock&#34;&gt;&#xA;  &lt;div class=&#34;codeblock-actions&#34;&gt;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--wrap&#34;&#xA;            data-wrap-toggle&#xA;            data-icon-button&#xA;            aria-pressed=&#34;false&#34;&#xA;            title=&#34;Enable soft wrap&#34;&#xA;            data-wrap-title=&#34;Enable soft wrap&#34;&#xA;            data-nowrap-title=&#34;Disable soft wrap&#34;&gt;&#xA;      &lt;svg viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M4 6h16M4 10h12a4 4 0 0 1 0 8h-2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;/&gt;&#xA;        &lt;path d=&#34;M14 18l-2-2m2 2l-2 2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--copy&#34;&#xA;            data-copy-code&#xA;            data-icon-button&#xA;            title=&#34;Copy code&#34;&#xA;            data-copied-title=&#34;COPIED&#34;&gt;&#xA;      &lt;svg class=&#34;icon-copy&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;rect x=&#34;9&#34; y=&#34;9&#34; width=&#34;13&#34; height=&#34;13&#34; rx=&#34;2&#34; ry=&#34;2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34;&gt;&lt;/rect&gt;&#xA;        &lt;path d=&#34;M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;      &lt;svg class=&#34;icon-check&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M20 6L9 17l-5-5&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;  &lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;# listen continuosly for messages on udp socket port 7007&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;nc -kul &lt;span class=&#34;m&#34;&gt;7007&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;I would recommend that you run the serial read and broadcast operation on your ESP01 before you load the actual program to confirm everything is working properly.&lt;/p&gt;&#xA;&lt;h3 id=&#34;measuring-current&#34;&gt;&#xA;  Measuring Current&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;We can measure AC output voltage of CT sensor using ADC on Arduino. The signal first needs to be shifted above 0V in order to meet requirements of ADC. We use a voltage divider circuit as shown below to shift the analog signal by 2.5V so that its lower peak always stays above 0V. Note that our CT sensor has  output of 0-1V.&lt;/p&gt;&#xA;&lt;p&gt;&lt;figure&gt;&lt;a href=&#34;https://ankshilp.in/static/circuit.png&#34; class=&#34;lightbox-image&#34;&gt;&#xA;  &lt;img src=&#34;https://ankshilp.in/static/circuit.png&#34; alt=&#34;&#34; loading=&#34;lazy&#34;&gt;&#xA;&lt;/a&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;p&gt;We will be using &lt;a href=&#34;https://github.com/openenergymonitor/EmonLib&#34;&gt;EmonLib&lt;/a&gt; from &lt;a href=&#34;https://openenergymonitor.org/&#34;&gt;Open Energy Monitor&lt;/a&gt; to sample and measure the RMS current. Here&amp;rsquo;s a code listing to read current from A0 pin with EmonLib.&lt;/p&gt;&#xA;&lt;div class=&#34;codeblock&#34;&gt;&#xA;  &lt;div class=&#34;codeblock-actions&#34;&gt;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--wrap&#34;&#xA;            data-wrap-toggle&#xA;            data-icon-button&#xA;            aria-pressed=&#34;false&#34;&#xA;            title=&#34;Enable soft wrap&#34;&#xA;            data-wrap-title=&#34;Enable soft wrap&#34;&#xA;            data-nowrap-title=&#34;Disable soft wrap&#34;&gt;&#xA;      &lt;svg viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M4 6h16M4 10h12a4 4 0 0 1 0 8h-2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;/&gt;&#xA;        &lt;path d=&#34;M14 18l-2-2m2 2l-2 2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--copy&#34;&#xA;            data-copy-code&#xA;            data-icon-button&#xA;            title=&#34;Copy code&#34;&#xA;            data-copied-title=&#34;COPIED&#34;&gt;&#xA;      &lt;svg class=&#34;icon-copy&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;rect x=&#34;9&#34; y=&#34;9&#34; width=&#34;13&#34; height=&#34;13&#34; rx=&#34;2&#34; ry=&#34;2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34;&gt;&lt;/rect&gt;&#xA;        &lt;path d=&#34;M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;      &lt;svg class=&#34;icon-check&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M20 6L9 17l-5-5&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;  &lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;EnergyMonitor&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;emon1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;setup&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;n&#34;&gt;Serial&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;begin&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;9600&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;n&#34;&gt;emon1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;current&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;30&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt; &lt;span class=&#34;c1&#34;&gt;//specify pin and calibration&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kt&#34;&gt;void&lt;/span&gt; &lt;span class=&#34;nf&#34;&gt;loop&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kt&#34;&gt;double&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;I&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;emon1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;calcIrms&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;1480&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt; &#x9;&#x9;&lt;span class=&#34;c1&#34;&gt;//number of samples to take &#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;  &lt;span class=&#34;n&#34;&gt;Serial&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;cu value=&amp;#34;&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;+&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;String&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;I&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;));&lt;/span&gt;&#x9;&lt;span class=&#34;c1&#34;&gt;//write data to esp in a InfluxDB line format&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c1&#34;&gt;&lt;/span&gt;  &lt;span class=&#34;n&#34;&gt;delay&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;3000&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;);&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;&lt;code&gt;emon1.current(1,30)&lt;/code&gt; is used to choose ADC pin and for calibration. For the sensor I am using, it is 30. You can find out more about calibration calculation &lt;a href=&#34;https://github.com/openenergymonitor/learn/blob/master/view/electricity-monitoring/ctac/emonlib-calibration-theory.md&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;h3 id=&#34;data-logging-and-dashboarding&#34;&gt;&#xA;  Data Logging And Dashboarding&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;For logging we are going to use timeseries database InfluxDB. InfluxDB integrates well with Grafana which we will be using for dashboarding. Both InfluxDB and Grafana will be installed on Raspberry Pi. Installation of both application is pretty straightforward. You can refer the guides included in notes below[3].&lt;/p&gt;&#xA;&lt;h4 id=&#34;ingesting-data-with-influxdb-line-protocol&#34;&gt;&#xA;  Ingesting Data With InfluxDB Line Protocol&#xA;&lt;/h4&gt;&#xA;&lt;p&gt;The fastest way of inserting a record in InfluxDB is through it&amp;rsquo;s CLI. Here&amp;rsquo;s an example:&lt;/p&gt;&#xA;&lt;div class=&#34;codeblock&#34;&gt;&#xA;  &lt;div class=&#34;codeblock-actions&#34;&gt;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--wrap&#34;&#xA;            data-wrap-toggle&#xA;            data-icon-button&#xA;            aria-pressed=&#34;false&#34;&#xA;            title=&#34;Enable soft wrap&#34;&#xA;            data-wrap-title=&#34;Enable soft wrap&#34;&#xA;            data-nowrap-title=&#34;Disable soft wrap&#34;&gt;&#xA;      &lt;svg viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M4 6h16M4 10h12a4 4 0 0 1 0 8h-2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;/&gt;&#xA;        &lt;path d=&#34;M14 18l-2-2m2 2l-2 2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--copy&#34;&#xA;            data-copy-code&#xA;            data-icon-button&#xA;            title=&#34;Copy code&#34;&#xA;            data-copied-title=&#34;COPIED&#34;&gt;&#xA;      &lt;svg class=&#34;icon-copy&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;rect x=&#34;9&#34; y=&#34;9&#34; width=&#34;13&#34; height=&#34;13&#34; rx=&#34;2&#34; ry=&#34;2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34;&gt;&lt;/rect&gt;&#xA;        &lt;path d=&#34;M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;      &lt;svg class=&#34;icon-check&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M20 6L9 17l-5-5&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;  &lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;$ influxdb&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&amp;gt; CREATE pmon&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&amp;gt; USE pmon&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&amp;gt; cu value=2.2&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&amp;gt; cu value=2.5&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;First we create database pmon and then insert values 2.2 and 2.5 as current(cu) in it. You can see inserted records along with timestamps using &lt;code&gt;show measurements&lt;/code&gt; command. InfluxDB supports a lot of interfaces REST, UDP, etc,. Since we have already implemented the broadcast over UDP with ESP01 we will be using UDP interface of InfluxDB but first we need to enable UDP interface before we can start ingesting data over it. You can enable the interface in &lt;code&gt;influxdb.conf&lt;/code&gt;. This file on  exist at &lt;code&gt;/etc/influxdb/influxdb.conf&lt;/code&gt; on raspbian. In the udp section add&lt;/p&gt;&#xA;&lt;div class=&#34;codeblock&#34;&gt;&#xA;  &lt;div class=&#34;codeblock-actions&#34;&gt;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--wrap&#34;&#xA;            data-wrap-toggle&#xA;            data-icon-button&#xA;            aria-pressed=&#34;false&#34;&#xA;            title=&#34;Enable soft wrap&#34;&#xA;            data-wrap-title=&#34;Enable soft wrap&#34;&#xA;            data-nowrap-title=&#34;Disable soft wrap&#34;&gt;&#xA;      &lt;svg viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M4 6h16M4 10h12a4 4 0 0 1 0 8h-2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;/&gt;&#xA;        &lt;path d=&#34;M14 18l-2-2m2 2l-2 2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;/&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;&#xA;    &lt;button type=&#34;button&#34;&#xA;            class=&#34;codeblock-action codeblock-action--copy&#34;&#xA;            data-copy-code&#xA;            data-icon-button&#xA;            title=&#34;Copy code&#34;&#xA;            data-copied-title=&#34;COPIED&#34;&gt;&#xA;      &lt;svg class=&#34;icon-copy&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;rect x=&#34;9&#34; y=&#34;9&#34; width=&#34;13&#34; height=&#34;13&#34; rx=&#34;2&#34; ry=&#34;2&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34;&gt;&lt;/rect&gt;&#xA;        &lt;path d=&#34;M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;      &lt;svg class=&#34;icon-check&#34; viewBox=&#34;0 0 24 24&#34; aria-hidden=&#34;true&#34; focusable=&#34;false&#34;&gt;&#xA;        &lt;path d=&#34;M20 6L9 17l-5-5&#34; stroke=&#34;currentColor&#34; stroke-width=&#34;2&#34; fill=&#34;none&#34; stroke-linecap=&#34;round&#34; stroke-linejoin=&#34;round&#34;&gt;&lt;/path&gt;&#xA;      &lt;/svg&gt;&#xA;    &lt;/button&gt;&#xA;  &lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;o&#34;&gt;[[&lt;/span&gt;udp&lt;span class=&#34;o&#34;&gt;]]&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nv&#34;&gt;enabled&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  bind-address &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;0.0.0.0:7007&amp;#34;&lt;/span&gt;&#x9;&#x9;&lt;span class=&#34;c1&#34;&gt;# port address to listen on&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nv&#34;&gt;database&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;pmon&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  retention-policy &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;s2&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  batch-size &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; 2&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;span class=&#34;c1&#34;&gt;# write to database after collecting this many measurements&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&#xA;&lt;p&gt;There are more options in the config file which you can explore as per your requirement.&lt;/p&gt;&#xA;&lt;h4 id=&#34;dashboard-with-grafana&#34;&gt;&#xA;  Dashboard with Grafana&#xA;&lt;/h4&gt;&#xA;&lt;p&gt;Integrating Grafana with InfluxDB is pretty easy. Grafana can be accessed from browser for its configuration. Just point your browser to your Pi IP with 3000 port and that should open Grafana. You will have to go through some basic configuration steps and then from the settings panel you can add InfluxDB as data source. That&amp;rsquo;s it. You can start creating panels for the data that has been recorded.&lt;/p&gt;&#xA;&lt;p&gt;Here&amp;rsquo;s Grafana dashboard for my home setup&lt;/p&gt;&#xA;&lt;p&gt;&lt;figure&gt;&lt;a href=&#34;https://ankshilp.in/static/solar.png&#34; class=&#34;lightbox-image&#34;&gt;&#xA;  &lt;img src=&#34;https://ankshilp.in/static/solar.png&#34; alt=&#34;&#34; loading=&#34;lazy&#34;&gt;&#xA;&lt;/a&gt;&#xA;&lt;/figure&gt;&#xA;&#xA;&#xA;&lt;/p&gt;&#xA;&lt;h4 id=&#34;creating-grafana-panels&#34;&gt;&#xA;  Creating Grafana Panels&#xA;&lt;/h4&gt;&#xA;&lt;p&gt;InfluxDB queries are fairly easy to understand so I will just put the queries behind each panel that I have used&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Current Panel&lt;br&gt;&#xA;&lt;code&gt;SELECT value FROM &amp;quot;cu&amp;quot;&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Power Panel&lt;br&gt;&#xA;&lt;code&gt;SELECT value*252 FROM &amp;quot;cu&amp;quot;&lt;/code&gt;&lt;br&gt;&#xA;The voltage at my home averages around 252V. Since, P=VxI. Power generated = 252*value.&lt;/li&gt;&#xA;&lt;li&gt;Energy Generated Hourly in Wh panel&lt;br&gt;&#xA;&lt;code&gt;SELECT integral(&amp;quot;power&amp;quot;)/3600 FROM (SELECT value*252 AS power FROM &amp;quot;cu&amp;quot;) WHERE $timeFilter GROUP BY time(1h) fill(null)&lt;/code&gt;&lt;br&gt;&#xA;Energy generated is the area under the power curve. Hence, the integral. We are calculating energy generated on per hour basis.&lt;/li&gt;&#xA;&lt;li&gt;Today&amp;rsquo;s generation panel&lt;br&gt;&#xA;&lt;code&gt;SELECT integral(&amp;quot;value&amp;quot;)*252/3600000 FROM (SELECT value FROM &amp;quot;cu&amp;quot;)  where time &amp;gt; now()-12h&lt;/code&gt;&lt;br&gt;&#xA;Same as energy generated calculation but here we do for last 12 hours.&lt;/li&gt;&#xA;&lt;li&gt;Monthly energy generated panel&lt;br&gt;&#xA;Same as today&amp;rsquo;s generation panel but calculated over period of &lt;code&gt;30d&lt;/code&gt;&lt;/li&gt;&#xA;&lt;li&gt;Carbon panels&lt;br&gt;&#xA;Carbon generated per kWh is called as carbon factor for the grid. For India, it is 0.7 and thus &lt;code&gt;Energy(E)*0.7&lt;/code&gt; gives us the carbon removed from atmosphere.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;h3 id=&#34;final-words&#34;&gt;&#xA;  Final Words&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;I am very happy with this setup and it&amp;rsquo;s been very reliable so far even though I have done all of this on a bread board! The current readings are pretty accurate above 1A. There is deviation in power and energy measurements but this is because we are assuming constant voltage while in reality it fluctuates quite a bit. Maybe I will add voltage sensor to this!&lt;/p&gt;&#xA;&lt;h3 id=&#34;repository&#34;&gt;&#xA;  Repository&#xA;&lt;/h3&gt;&#xA;&lt;p&gt;Both micropython and arduino code is uploaded at &lt;a href=&#34;https://github.com/quaintdev/EnergyMonitor&#34;&gt;https://github.com/quaintdev/EnergyMonitor&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;Notes:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;There are instances when people have ran ESP01 chip on 5V. This is most probably because of how different manufactures design their chips. The ESP8266 SoC on board ESP01 needs 3.3V.&lt;/li&gt;&#xA;&lt;li&gt;Our program is expected to communicate with Arduino continously and that is why we cannot re-attach the REPL. In the final code listing I have added delay of 10 seconds before detatching REPL. This gives us enough time to load new programs on ESP if required. If we do not do this then we loose the ability to load programs on ESP until we re-flash the firmware.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://grafana.com/tutorials/install-grafana-on-raspberry-pi/&#34;&gt;Install grafana on Raspberry PI&lt;/a&gt;&lt;br&gt;&#xA;&lt;a href=&#34;https://gist.github.com/boseji/bb71910d43283a1b84ab200bcce43c26&#34;&gt;Install influxdb on Raspberry PI&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://learn.openenergymonitor.org/electricity-monitoring/ct-sensors/interface-with-arduino&#34;&gt;CT sensor interfacing with Arduino&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;</content:encoded>
                <category>projects</category>
            </item>
  </channel>
</rss>
