<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Talha Khan on Medium]]></title>
        <description><![CDATA[Stories by Talha Khan on Medium]]></description>
        <link>https://medium.com/@khantalha7367?source=rss-322ab35b1f29------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Hcdil0fkUDIIlWprBcj4Og.jpeg</url>
            <title>Stories by Talha Khan on Medium</title>
            <link>https://medium.com/@khantalha7367?source=rss-322ab35b1f29------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 10:38:56 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@khantalha7367/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Writing Data to EEPROM in ESP32]]></title>
            <link>https://medium.com/@khantalha7367/writing-data-to-eeprom-in-esp32-708c70683b68?source=rss-322ab35b1f29------2</link>
            <guid isPermaLink="false">https://medium.com/p/708c70683b68</guid>
            <category><![CDATA[electrical]]></category>
            <category><![CDATA[esp32]]></category>
            <category><![CDATA[c]]></category>
            <category><![CDATA[eeprom]]></category>
            <category><![CDATA[arduino]]></category>
            <dc:creator><![CDATA[Talha Khan]]></dc:creator>
            <pubDate>Thu, 26 Oct 2023 16:23:28 GMT</pubDate>
            <atom:updated>2023-10-26T16:23:28.588Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*XwxI8R-_tkNUZNqyml5nbQ.png" /></figure><p>The ESP32 microcontroller is an innovative star in the rapidly growing field of IoT devices and smart technologies. Its exceptional adaptability and potent capabilities have established it as a key component in the creation of networked systems. The ESP32 is a popular choice among developers because of its persistent data storage capabilities, which allow devices to retain important information even after a power cycle. Electrically Erasable Programmable Read-Only Memory (EEPROM) is used to unlock this potential.</p><p>We explore the inner workings of the ESP32’s memory management in this article, with a particular emphasis on writing data to EEPROM. This guide will simplify and make sense of the complexities of EEPROM writing, whether you’re an experienced developer looking to expand your knowledge or a novice keen to learn about the workings of embedded systems.</p><p>We’ll examine the basic ideas underlying EEPROM, how it differs from other kinds of memory, and the subtleties involved in writing and reading data to and from it. Equipped with this understanding, you will be able to develop apps that securely store important data, guaranteeing smooth user interfaces and strong device functionality.</p><p><strong>Application of EEPROM</strong></p><p>Typically, microcontrollers such as the ESP32 depend on volatile memory, which loses data in the event of a power outage. Conversely, EEPROM functions as a long-term data storage option. It enables developers to persistently store user preferences, sensor calibration data, configuration settings, and other important data. This feature is especially helpful in situations where devices need to remember operational states or user settings so they don’t have to be reconfigured each time they turn on.</p><p>Because EEPROM is used in IoT devices, it is especially valuable when used with ESP32. These gadgets frequently work in settings where there may be power outages. The utilisation of EEPROM by developers can guarantee the preservation of crucial information, like device configurations or network credentials, thereby augmenting the dependability and amiability of ESP32-based Internet of Things applications.</p><p>One thing to understand is that the EEPROM can be written to only a limited number of times, as opposed to read operation which can be done any number of times. It ranges from 10,000 to 100,000 writes depending on the type of microcontroller. It is a suitable practice to check the datasheet of the microcontroller board being used in order to ensure the maximum amount of write operations allowed.</p><p><strong>Code</strong></p><pre>#include &lt;EEPROM.h&gt;<br><br><br>int address = 0;<br><br>void setup() {<br>  Serial.begin(115200);<br>  <br> <br>  int value = EEPROM.read(address);<br>  Serial.print(&quot;Value read from EEPROM: &quot;);<br>  Serial.println(value);<br>  <br>  <br>  value++;<br>  EEPROM.write(address, value);<br>  EEPROM.commit();<br>  <br>  Serial.print(&quot;Value incremented and stored to EEPROM: &quot;);<br>  Serial.println(value);<br>}<br><br>void loop() {<br>  // Not Used<br>}</pre><p>In the above code, we have the EEPROM library included</p><pre>#include &lt;EEPROM.h&gt;</pre><p>In the void setup block we have EEPROM.read() function with the address value of 0 stored in the address variable.</p><pre>int value = EEPROM.read(address);</pre><p>Note that the value of address can be from 0–511, giving us a total of 512 registers to write.</p><p>This will store a value of 0 in the value integer as the register is empty. So we increment the variable and store the value in a register using the EEPROM.write(address,value),</p><pre>value++;<br>  EEPROM.write(address, value);<br>  EEPROM.commit();</pre><p>The EEPROM.commit() function is used to commit the data to the register. Also remember that a register can store values ranging from 0–255.</p><p><strong>Conclusion</strong></p><p>Understanding the subtleties of EEPROM opens the door to developing dependable, dependable, and user-friendly applications in the field of ESP32 development. By means of this investigation, the notion of Electrically Erasable Programmable Read-Only Memory has been clarified, revealing its function as a protector of data integrity throughout power cycles.</p><p>Through the utilisation of EEPROM, developers can endow their ESP32-based creations with the capacity to retain important data, such as network configurations and user preferences. In the IoT world, this persistence is crucial for ensuring that devices continue to function normally despite unplanned power outages.</p><p><em>P.S, for any paid content writing and/or article writing tasks, and for any free guidance about the ESP32 board, do reach out to me at khantalha7367@gmail.com or visit my Fiverr gigs at </em><a href="https://www.fiverr.com/s/rL3mWN"><em>https://www.fiverr.com/s/rL3mWN</em></a><em>, </em><a href="https://www.fiverr.com/s/7rj8Xy"><em>https://www.fiverr.com/s/7rj8Xy</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=708c70683b68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Economy is Changing, and so Should You]]></title>
            <link>https://medium.com/@khantalha7367/the-economy-is-changing-and-so-should-you-efc2cd5fc52f?source=rss-322ab35b1f29------2</link>
            <guid isPermaLink="false">https://medium.com/p/efc2cd5fc52f</guid>
            <category><![CDATA[money]]></category>
            <category><![CDATA[fiverr]]></category>
            <category><![CDATA[economy]]></category>
            <category><![CDATA[affiliate-marketing]]></category>
            <category><![CDATA[freelancing]]></category>
            <dc:creator><![CDATA[Talha Khan]]></dc:creator>
            <pubDate>Mon, 28 Aug 2023 16:41:05 GMT</pubDate>
            <atom:updated>2023-09-04T10:47:17.956Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In today’s rapidly evolving digital landscape, the gig economy has taken center stage. People worldwide are realizing the potential of freelancing, offering their skills, talents, and expertise to a global audience. For the millennial and Gen Z adults these days, working a 9–5 from your 20s till death with only a handful of holidays and no financial security is just not a viable option anymore. This sentiment has further been amplified by the Covid Pandemic where thousands of people were laid off and a brutal struggle to make end meet ensued.</p><p>On this note, there are many places to showcase your skill and attract people to your virtual shop. The one that I personally use and would recommend to anyone is Fiverr. Now there are many other platforms as well, but Fiverr stands out among the other platforms due to the setting of their marketplace such that one can make gigs about what skill or service they are willing to sell and and then wait for prospective customers to reach out to you. This model is, in my opinion, much better than how other platforms conduct their business such as UpWork, where you as a freelancer have to reach out to buyers and work through cut-throat competition to land a job.</p><p><strong>Why Choose Fiverr?</strong></p><p>Fiverr is not just another freelance marketplace; it’s a thriving ecosystem that connects millions of freelancers with clients seeking a wide array of services. Here are some compelling reasons to choose Fiverr for your freelancing needs:</p><p>1. <strong>Diverse Services</strong>: Fiverr boasts an extensive range of services, from graphic design and content writing to digital marketing and programming. Whatever your skill set, you can find your niche here.</p><p>2. <strong>Global Reach</strong>: Fiverr’s platform spans the globe, enabling you to work with clients from different countries and cultures. This diversity not only broadens your skillset but also your perspective.</p><p>3. <strong>User-Friendly Interface</strong>: Fiverr offers a simple, intuitive interface that makes it easy to create and customize your freelance profile. You can showcase your work, set your rates, and start attracting clients in no time.</p><p>4. <strong>Secure Payments</strong>: Fiverr ensures that both freelancers and clients are protected. Payments are processed securely, and funds are held in escrow until the work is completed, giving you peace of mind.</p><p>5. <strong>Community Support</strong>: Fiverr’s active community of freelancers offers support, advice, and networking opportunities. You’re not just joining a platform; you’re becoming part of a supportive community.</p><p><strong>How Fiverr Can Benefit Freelancers</strong></p><p>Whether you’re a seasoned freelancer or just starting, Fiverr offers numerous advantages that can help you excel in your career:</p><p>1. <strong>Steady Stream of Clients</strong>: Fiverr’s vast user base means a constant influx of clients searching for services. You can leverage this traffic to find work consistently.</p><p>2. <strong>Portfolio Building</strong>: Fiverr allows you to showcase your work, creating a portfolio that acts as a powerful marketing tool for attracting clients outside the platform.</p><p>3. <strong>Flexible Pricing</strong>: You have control over your pricing on Fiverr, allowing you to set rates that reflect your skills and experience. As you gain more positive reviews, you can increase your rates.</p><p>4. <strong>Skill Enhancement</strong>: Working on diverse projects helps you enhance your skills and learn new ones. This ongoing learning process can make you more competitive in your field.</p><p>5. <strong>Affiliate Program</strong>: Fiverr offers an affiliate program that lets you earn additional income by referring new users to the platform.</p><p><strong>How to Get Started on Fiverr</strong></p><p>Getting started on Fiverr is a breeze. Here’s a step-by-step guide:</p><p>1. <strong>Sign Up</strong>: Create an account on Fiverr by providing your details and verifying your email.</p><p>2. <strong>Build Your Profile</strong>: Fill out your profile with information about your skills, experience, and services. Upload a professional photo and add a compelling description.</p><p>3. <strong>Set Your Gig</strong>: Create your first gig, outlining the services you offer, pricing, and delivery time. Be sure to include high-quality images and a detailed description.</p><p>4. <strong>Start Marketing</strong>: Share your gig on social media, and consider using Fiverr’s built-in promotion tools to increase visibility.</p><p>5. <strong>Deliver Exceptional Service</strong>: Once you start getting orders, provide top-notch service to earn positive reviews and build your reputation.</p><p>6. <strong>Join the Affiliate Program</strong>: Maximize your earnings by joining Fiverr’s affiliate program and sharing your affiliate link with potential users.</p><p><strong>Conclusion</strong></p><p>Fiverr is not just a platform; it’s a gateway to success for freelancers and businesses alike. With its diverse services, global reach, and user-friendly interface, it’s the ideal choice for those looking to thrive in the gig economy. Whether you’re a seasoned freelancer or just starting, Fiverr offers the tools and support you need to excel. Join Fiverr today and take the first step towards realizing your freelancing dreams.</p><p><a href="https://www.fiverr.com/pe/D7xZmy">Sign up for Fiverr using this link and get started on your journey.</a></p><p><strong>Disclaimer</strong>: This article contains affiliate links, and we may receive a commission if you sign up through these links. However, we only recommend products and services that we believe will genuinely benefit our readers.</p><p><em>P.S, for any paid content writing and/or article writing tasks, and for any free guidance about the ESP32 board, do reach out to me at khantalha7367@gmail.com or visi my Fiverr gigs at </em><a href="https://www.fiverr.com/s/rL3mWN"><em>https://www.fiverr.com/s/rL3mWN</em></a><em>, </em><a href="https://www.fiverr.com/s/7rj8Xy"><em>https://www.fiverr.com/s/7rj8Xy</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=efc2cd5fc52f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transform Your Business with GetResponse: Unleash the Power of Affiliate and Email Marketing]]></title>
            <link>https://medium.com/@khantalha7367/transform-your-business-with-getresponse-unleash-the-power-of-affiliate-and-email-marketing-768436fdad45?source=rss-322ab35b1f29------2</link>
            <guid isPermaLink="false">https://medium.com/p/768436fdad45</guid>
            <category><![CDATA[affiliate-marketing]]></category>
            <category><![CDATA[business]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[freelancing]]></category>
            <category><![CDATA[marketing]]></category>
            <dc:creator><![CDATA[Talha Khan]]></dc:creator>
            <pubDate>Thu, 10 Aug 2023 10:44:47 GMT</pubDate>
            <atom:updated>2023-08-10T10:44:47.325Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction:</strong></p><p>In today’s digital world, businesses are constantly seeking new and effective ways to reach their customers. Affiliate marketing and email marketing have emerged as powerful strategies to boost brand awareness, attract qualified leads, and drive impressive revenue growth. With countless platforms available, GetResponse offers everything you need to excel in these marketing techniques. In this blog post, we will delve into the distinctive features and advantages of GetResponse, explaining how it can transform your business for the better.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AOf3V2D8DLFc7_z9KWoISA.png" /></figure><p><strong>1. Simplified Affiliate Marketing:</strong></p><p>Affiliate marketing is an invaluable technique that allows businesses to collaborate with partners and influencers, who promote their products or services in exchange for commission. GetResponse provides an all-in-one solution to track, manage, and optimize your affiliate campaigns efficiently. With its intuitive interface, you can easily attract and onboard affiliates, monitor their performance, and generate detailed reports. By automating the process, you save precious time and resources while maximizing your reach and conversions.</p><p><strong>2. Advanced Email Marketing:</strong></p><p>Email marketing has stood the test of time as a highly effective marketing channel. GetResponse takes it to the next level with a plethora of features to streamline and enhance your email campaigns. The platform offers easy-to-use email templates, personalized automation workflows, A/B testing, and advanced analytics. With a robust email deliverability rate and the ability to segment your list based on user behavior, demographics, and preferences, GetResponse ensures that your messages reach the right audience at the right time.</p><p><strong>3. Landing Pages and Conversion Funnels:</strong></p><p>Creating visually appealing and persuasive landing pages is crucial to converting website visitors into leads or customers. GetResponse provides a user-friendly drag-and-drop editor to build stunning landing pages, sales funnels, and webinars effortlessly. With ready-made templates designed for various industries, you can save both time and money without compromising on quality. Moreover, the platform includes robust conversion tracking and analytics tools to understand your customers’ journey better, optimize your funnel, and boost your conversion rates.</p><p><strong>4. Integrated Marketing Automation:</strong></p><p>One of GetResponse’s most powerful features is its marketing automation capabilities. With this tool, you can create intricate workflows, responding to customer behavior, and nurturing leads automatically. From welcome emails and abandoned cart reminders to personalized recommendations and re-engagement campaigns, marketing automation allows you to provide a tailored experience to each customer. By automating repetitive tasks and personalizing communication, you enhance customer engagement and drive conversions, resulting in accelerated revenue growth.</p><p><strong>5. Comprehensive Analytics and Reports:</strong></p><p>To make informed marketing decisions and improve your campaigns continuously, it is crucial to have access to comprehensive analytics and reports. GetResponse offers detailed insights into your email marketing performance, affiliate program effectiveness, and conversion funnels. By tracking open rates, click-through rates, conversion rates, and revenue generated, you can identify areas of improvement and capitalize on opportunities for growth. With real-time data at your fingertips, you can optimize your marketing strategy for maximum impact and ROI.</p><p><strong>Conclusion:</strong></p><p>GetResponse is more than just an affiliate and email marketing platform; it is a comprehensive marketing solution designed to empower businesses of all sizes. With its robust features, user-friendly interface, comprehensive analytics, and automation capabilities, this platform offers the tools you need to elevate your marketing efforts to new heights. Whether you are an established company or a budding entrepreneur, GetResponse is the key to unlocking your potential, driving customer engagement, and achieving remarkable business growth. To create an account, follow the link <a href="https://www.getresponse.com/?a=dh7nHeqNCK">https://www.getresponse.com?a=dh7nHeqNCK</a> and start your journey</p><p><em>For any querries or paid work, do contact me at khantalha7367@gmail.com, or contact me on </em><a href="https://www.fiverr.com/talhakhan7367">https://www.fiverr.com/talhakhan7367</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=768436fdad45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Color Sensor Web Server on the ESP32]]></title>
            <link>https://medium.com/@khantalha7367/color-sensor-web-server-on-the-esp32-9bd75b0e5306?source=rss-322ab35b1f29------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bd75b0e5306</guid>
            <category><![CDATA[c-programming]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[electrical-engineering]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[esp32]]></category>
            <dc:creator><![CDATA[Talha Khan]]></dc:creator>
            <pubDate>Wed, 31 May 2023 11:17:14 GMT</pubDate>
            <atom:updated>2023-05-31T11:17:14.445Z</atom:updated>
            <content:encoded><![CDATA[<p>In many textile industries, the ability to sense color precisely can be crucial. This lab report present design of low cost, high speed portable color sensor suitable for use in external light environment susceptible to disturbances. The system is developed using a solid state RGB sensor and a smart signal processing algorithm implemented on micro-controller architecture and then whole data can be stored in a web page. This architecture is used for color zone classification and exact color identification of paper. Results are discussed to highlight the importance of sensor and accuracy in measurement.</p><p><strong>Components</strong></p><ol><li>Color Sensor (TCS3200) </li><li>Microcontroller (ESP32) </li><li>FTDI Convertor</li></ol><p><strong>Code</strong></p><pre>#include &lt;WiFi.h&gt;<br>#include &lt;ESPAsyncWebServer.h&gt;<br><br>const char* ssid=&quot;DESKTOP-PIOGNLH 0690&quot;;<br>const char* password=&quot;&gt;731N6f8&quot;;<br>AsyncWebServer server(80);<br><br>#define S0 15<br>#define S1 2<br>#define S2 4<br>#define S3 16<br>#define Sensor 17<br>#define redpin 13<br>#define greenpin 12<br>#define bluepin 14<br>String red_pulse=&quot;&quot;;<br>String green_pulse=&quot;&quot;;<br>String blue_pulse=&quot;&quot;;<br>int redp=0;<br>int greenp=0;<br>int bluep=0;<br><br>const char index_html[] PROGMEM = R&quot;rawliteral(<br>&lt;!DOCTYPE HTML&gt;&lt;html&gt;<br>&lt;head&gt;<br>&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;<br>&lt;link rel=&quot;stylesheet&quot; href=&quot;https://use.fontawesome.com/releases/v5.7.2/css/all.css&quot;<br>integrity=&quot;sha384-<br>fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr&quot;<br>crossorigin=&quot;anonymous&quot;&gt;<br>&lt;style&gt;<br>html {<br>font-family: Arial;<br>display: inline-block;<br>margin: 0px auto;<br>text-align: center;<br>}<br>h2 { font-size: 3.0rem; }<br>p { font-size: 3.0rem; }<br>.units { font-size: 1.2rem; }<br>.ds-labels{<br>font-size: 1.5rem;<br>vertical-align:middle;<br>padding-bottom: 15px;<br>}<br>&lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;h2&gt;Color Sensor&lt;/h2&gt;<br>&lt;p&gt;<br>&lt;i class=&quot;&quot; style=&quot;color:#059e8a;&quot;&gt;&lt;/i&gt;<br>&lt;span class=&quot;ds-labels&quot;&gt;RED&lt;/span&gt;<br>&lt;span id=&quot;red&quot;&gt;%RED%&lt;/span&gt;<br>&lt;/p&gt;<br>&lt;p&gt;<br>&lt;i class=&quot;&quot; style=&quot;color:#059e8a;&quot;&gt;&lt;/i&gt;<br>&lt;span class=&quot;ds-labels&quot;&gt;GREEN&lt;/span&gt;<br>&lt;span id=&quot;green&quot;&gt;%GREEN%&lt;/span&gt;<br>&lt;/p&gt;<br>&lt;p&gt;<br>&lt;i class=&quot;&quot; style=&quot;color:#059e8a;&quot;&gt;&lt;/i&gt;<br>&lt;span class=&quot;ds-labels&quot;&gt;BLUE&lt;/span&gt;<br>&lt;span id=&quot;blue&quot;&gt;%BLUE%&lt;/span&gt;<br>&lt;/p&gt;<br>&lt;/body&gt;<br>&lt;script&gt;<br>setInterval(function ( ) {<br>var xhttp = new XMLHttpRequest();<br>xhttp.onreadystatechange = function() {<br>if (this.readyState == 4 &amp;&amp; this.status == 200) {<br>document.getElementById(&quot;red&quot;).innerHTML = this.responseText;<br>}<br>};<br>xhttp.open(&quot;GET&quot;, &quot;/red_pulse&quot;, true);<br>xhttp.send();<br>}, 10000) ;<br>setInterval(function ( ) {<br>var xhttp = new XMLHttpRequest();<br>xhttp.onreadystatechange = function() {<br>if (this.readyState == 4 &amp;&amp; this.status == 200) {<br>document.getElementById(&quot;green&quot;).innerHTML = this.responseText;<br>}<br>};<br>xhttp.open(&quot;GET&quot;, &quot;/green_pulse&quot;, true);<br>xhttp.send();<br>}, 10000) ;<br>setInterval(function ( ) {<br>var xhttp = new XMLHttpRequest();<br>xhttp.onreadystatechange = function() {<br>if (this.readyState == 4 &amp;&amp; this.status == 200) {<br>document.getElementById(&quot;blue&quot;).innerHTML = this.responseText;<br>}<br>};<br>xhttp.open(&quot;GET&quot;, &quot;/blue_pulse&quot;, true);<br>xhttp.send();<br>&lt;/script&gt;<br>&lt;/html&gt;)rawliteral&quot;;<br><br>String processor(const String&amp; var){<br>//Serial.println(var);<br>if(var == &quot;RED&quot;){<br>return red_pulse;<br>}<br>else if(var == &quot;GREEN&quot;){<br>return green_pulse;<br>}<br>else if(var == &quot;BLUE&quot;){<br>return blue_pulse;<br>}<br>return String();<br>}<br><br>void setup()<br>{<br>Serial.begin(9600);<br>pinMode(Sensor,INPUT);<br>pinMode(S0,OUTPUT);<br>pinMode(S1,OUTPUT);<br>pinMode(S2,OUTPUT);<br>pinMode(S3,OUTPUT);<br>pinMode(redpin,OUTPUT);<br>pinMode(greenpin,OUTPUT);<br>pinMode(bluepin,OUTPUT);<br>digitalWrite(S0,HIGH);<br>digitalWrite(S1,LOW);<br>Serial.println(&quot;Connecting to:&quot;);<br>Serial.println(ssid);<br>WiFi.begin(ssid,password);<br>while(WiFi.status() != WL_CONNECTED)<br>{<br>delay(500);<br>Serial.print(&quot;.&quot;);<br>}<br>Serial.println();<br>Serial.println(&quot;Connected&quot;);<br>Serial.println(&quot; IP=&quot;);<br>Serial.print(WiFi.localIP());<br>Serial.println();<br><br>// Route for root / web page<br>server.on(&quot;/&quot;, HTTP_GET, [](AsyncWebServerRequest *request){<br>request-&gt;send_P(200, &quot;text/html&quot;, index_html, processor);<br>});<br>server.on(&quot;/red&quot;, HTTP_GET, [](AsyncWebServerRequest *request){<br>request-&gt;send_P(200, &quot;text/plain&quot;, red_pulse.c_str());<br>});<br>server.on(&quot;/green&quot;, HTTP_GET, [](AsyncWebServerRequest *request){<br>request-&gt;send_P(200, &quot;text/plain&quot;, green_pulse.c_str());<br>});<br>server.on(&quot;/blue&quot;, HTTP_GET, [](AsyncWebServerRequest *request){<br>request-&gt;send_P(200, &quot;text/plain&quot;, blue_pulse.c_str());<br>});<br>server.begin();<br>}<br><br>void loop()<br>{<br>redp=pulseIn(Sensor,LOW);<br>Serial.print(&quot;Red=&quot;);<br>Serial.print(redp);<br>delay(100);<br>digitalWrite(S2,HIGH);<br>digitalWrite(S3,HIGH);<br>greenp=pulseIn(Sensor,LOW);<br>Serial.print(&quot; &quot;);<br>Serial.print(&quot;Green=&quot;);<br>Serial.print(greenp);<br>delay(100);<br>digitalWrite(S2,LOW);<br>digitalWrite(S3,HIGH);<br>bluep=pulseIn(Sensor,LOW);<br>Serial.print(&quot; &quot;);<br>Serial.print(&quot;Blue=&quot;);<br>Serial.print(bluep);<br>delay(100);<br><br>red_pulse=String(redp);<br>green_pulse=String(greenp);<br>blue_pulse=String(bluep);<br>delay(1000);<br>Serial.println();<br>}</pre><p><strong>Result</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*tfFqopxBIuDFZxSOeErS0Q.png" /></figure><p><em>For contact, do reach out to khantalha7367@gmail.com. For any paid tasks, visit my Fiverr gigs at </em><a href="https://www.fiverr.com/s/rL3mWN">https://www.fiverr.com/s/rL3mWN</a>, <a href="https://www.fiverr.com/s/7rj8Xy">https://www.fiverr.com/s/7rj8Xy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bd75b0e5306" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ESP32 Water Level Sensor]]></title>
            <link>https://medium.com/@khantalha7367/esp32-water-level-sensor-ab1fdea2c6f?source=rss-322ab35b1f29------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab1fdea2c6f</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[electrical]]></category>
            <category><![CDATA[esp32]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Talha Khan]]></dc:creator>
            <pubDate>Fri, 14 Oct 2022 06:43:05 GMT</pubDate>
            <atom:updated>2023-05-31T10:56:40.051Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*-K9UVMYw9KkMB7e8FY5Vlw.png" /></figure><p>ESP32 is a development board manufactured by Espressif systems that can be used as a microcontroller board as well as an Internet of Things (IoT) board simultaneously. It contains the necessary features such as PWM, I2C, SPI, etc along with in-built Bluetooth and WIFI connectivity. To read more about the features of the ESP32 and its setup in the Arduino IDE, read the articles <a href="https://medium.com/@khantalha7367/getting-started-with-esp32-on-arduino-ide-fcc0c29118ca?source=friends_link&amp;sk=7174a724820b8daf7fdf9a25d33bad92">here</a> and <a href="https://medium.com/@khantalha7367/esp32-vs-stm32f103c8t6-d8c2cd6e377b?source=friends_link&amp;sk=99b4a213dbb218c04f2ebceedba0f444">here</a>.</p><p><strong>Equipment</strong></p><ol><li>ESP32 DEVKIT V1</li><li>Water Level Sensor</li><li>A container with water</li><li>Jumper Wires</li></ol><p>The complete setup will look something like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*QvUu5sX0PrRPjAp0Z1Dgnw.png" /></figure><p><strong>Water Level Sensor</strong></p><p>A water level sensor is a module designed to sense water, even a small amount of moisture. Such a function can be useful in detecting leaks, rain, and even other moisture sensing functions other than water levels. Looking at the water level sensor, it has a series of parallel copper strips on the length of the module. Five of these are power strips and the other five are sensor strips. When the module is not submerged in water, there is a high resistance between the strips. As the strips come into contact with water, the resistance is lowered and conductivity is increased. The sensor has three pins, one is the VCC pin, the other is the GND pin, and the third is the SIGNAL pin to be attached to the pin where we will take our reading. On the module, the pins are designated as “+”, ”-”, and “S” respectively.</p><p>One thing to keep in mind is that these sensors have a small life span due to the fact that the copper strips surface corrodes as we supply power to the sensor and allow it to come in contact with water. To avoid this, we can supply power to the sensor only when we need to take the reading and not continuously. For this, we can set a pin that we set as high only when providing power to the board.</p><p><strong>Code</strong></p><p>We will use the following code in the Arduino IDE</p><pre>#define POWER 33<br>#define SIGNAL 32<br><br>int value=0;<br><br>int level=0;<br><br>void setup() {<br>  Serial.begin(115200);<br>  pinMode(POWER,OUTPUT);<br>  digitalWrite(POWER,LOW);<br>}<br><br>void loop() {<br>  level=waterSensor();<br>  Serial.print(&quot;Water Level:&quot;);<br>  Serial.println(level);<br>  delay(1000);<br><br>}<br><br>int waterSensor()<br>{<br>  digitalWrite(POWER,HIGH);<br>  delay(10);<br>  value=analogRead(SIGNAL);<br>  delay(10);<br>  digitalWrite(POWER,LOW);<br>  return value;<br>}</pre><p>For the line by line explanation</p><p>First, we define the pins that we are going to use to power up the module and read analog data from it</p><pre>#define POWER 33<br>#define SIGNAL 32</pre><p>Then we define two integer variables that we will use to store the readings from the sensor</p><pre>int value=0;<br><br>int level=0;</pre><p>In the void setup() block, we define the Serial communication as well as configure the power pin as OUTPUT and LOW</p><pre>void setup() {<br>  Serial.begin(115200);<br>  pinMode(POWER,OUTPUT);<br>  digitalWrite(POWER,LOW);<br>}</pre><p>In the void loop() block, we use the user-defined function waterSensor() to check the water level and then display the output on the serial monitor</p><pre>void loop() {<br>  level=waterSensor();<br>  Serial.print(&quot;Water Level:&quot;);<br>  Serial.println(level);<br>  delay(1000);<br><br>}</pre><p>We define the waterSensor() function by setting the power pin as HIGH, using the analogRead() function to check water level, and then again set the power pin as LOW. In this way, we avoid excessive corrosion of our module surface.</p><pre>int waterSensor()<br>{<br>  digitalWrite(POWER,HIGH);<br>  delay(10);<br>  value=analogRead(SIGNAL);<br>  delay(10);<br>  digitalWrite(POWER,LOW);<br>  return value;<br>}</pre><p><strong>Conclusion</strong></p><p>After uploading the code to our ESP32 board, we open the serial monitor at baud rate of 115200. We will see the readings being displayed after every one second. When the module is not submerged in water, the analog reading comes out as zero,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*xNKJ7GQyDwEZGIVBLD4NQw.png" /></figure><p>while submerging it completely in water gives us an analog value of more than 1300.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*crIMgvfWB5OroIw3NhkgCw.png" /></figure><p>We can use this change in analog conductivity value as a trigger to start off any event, for example an LED light up or a buzzer.</p><p><em>For any paid content writing tasks, or any type of guidance related to ESP32 or electrical, feel free to reach out at khantalha7367@gmail.com or visit my Fiverr gigs at </em><a href="https://www.fiverr.com/s/rL3mWN">https://www.fiverr.com/s/rL3mWN</a> and <a href="https://www.fiverr.com/s/7rj8Xy">https://www.fiverr.com/s/7rj8Xy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab1fdea2c6f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UART Communication on ESP32]]></title>
            <link>https://medium.com/@khantalha7367/uart-communication-on-esp32-28fd3df3b6eb?source=rss-322ab35b1f29------2</link>
            <guid isPermaLink="false">https://medium.com/p/28fd3df3b6eb</guid>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[electrical-engineering]]></category>
            <category><![CDATA[microcontrollers]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <category><![CDATA[esp32]]></category>
            <dc:creator><![CDATA[Talha Khan]]></dc:creator>
            <pubDate>Wed, 05 Oct 2022 16:49:30 GMT</pubDate>
            <atom:updated>2023-05-31T11:00:37.950Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*UzHkVLTcE8vsHkNbdUd9Bg.jpeg" /><figcaption>UART communication can be established between two ESP32 modules</figcaption></figure><p>The ESP32 is a popular board designed by Espressif systems. It is a general development board with great features like a great clock speed, PWM, I2C, SPI, UART and many more. But its main strength comes from the inclusion of IoT capabilities such as in-built WIFI and Bluetooth in the board, sparing you the trouble of buying any separate WIFI and Bluetooth modules. For more information on the ESP32 and its programming using the Arduino IDE, refer to the articles <a href="https://medium.com/@khantalha7367/getting-started-with-esp32-on-arduino-ide-fcc0c29118ca?source=friends_link&amp;sk=7174a724820b8daf7fdf9a25d33bad92">here</a> and <a href="https://medium.com/@khantalha7367/esp32-vs-stm32f103c8t6-d8c2cd6e377b?source=friends_link&amp;sk=99b4a213dbb218c04f2ebceedba0f444">here.</a></p><p><strong>Tools</strong></p><ol><li>Two ESP32 DEVKIT V1</li><li>Jumper Wires</li><li>Arduino IDE</li></ol><p><strong>UART</strong></p><p>UART stands for Universal Asynchronous Receiver Transmitter. It is a communication mechanism involving at most three connections. In these connections, the Rx of one module is connected to the Tx of the other module and vice versa, while the two modules can be given common ground. UART can support three types of communication, that is simplex, where only one side communicates, half-duplex, where both sides can communicate but not simultaneously, and full duplex, where both sides can communicate simultaneously.</p><p><strong>UART on the ESP32</strong></p><p>The ESP32 has three UART channels, two external and one internal. The UART pins consist of UART0 with pin 3,1 as Rx and TX, and UART2 with pins 16,17 as Rx and Tx respectively. While UART1 does not have exterior GPIO assigned to them and can be accessed by assigning them exterior pins, something to be discussed later on. In our project, we will use two ESP32 boards and use UART communication to send data from one board to another, which in turn would trigger an event, such as controlling an LED. We will also incorporate the Bluetooth functionality of the ESP32 board, doing so that we can see if the ESP32 can be used as a replacement for the HC-05 module when it comes to providing Bluetooth functionality to other boards. For information about how to setup and use your ESP32 Bluetooth capability, read the article <a href="https://medium.com/@khantalha7367/bluetooth-classic-on-esp32-f284c6894e74?source=friends_link&amp;sk=433ed73c4647368e6f222518456d2a54">here.</a></p><p><strong>Code-Master Module</strong></p><p>The code in Arduino IDE for the master module is as follows</p><pre>#include &lt;BluetoothSerial.h&gt;<br>#include &lt;HardwareSerial.h&gt;</pre><pre>HardwareSerial SerialPort(2);</pre><pre>BluetoothSerial SerialBT;<br>byte BTd;<br>/* Check if Bluetooth configurations are enabled in the SDK */<br>#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)<br>#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it<br>#endif</pre><pre>void setup() {<br>  Serial.begin(115200);<br>  SerialPort.begin(15200,SERIAL_8N1,16,17);<br>  SerialBT.begin(&quot;ESP32&quot;);</pre><pre>}</pre><pre>void loop() {<br>  if(SerialBT.available())<br>  {<br>    BTd=SerialBT.read();<br>    Serial.write(BTd);<br>  }<br>  if(BTd==&#39;1&#39;)<br>  {<br>    SerialPort.print(1);<br>  }<br>  if(BTd==&#39;0&#39;)<br>  {<br>    SerialPort.print(0);<br>  }</pre><pre>delay(100);</pre><pre>}</pre><p>For the line by line explanation</p><p>First we include the necessary libraries for serial communication and Bluetooth connectivity</p><pre>#include &lt;BluetoothSerial.h&gt;<br>#include &lt;HardwareSerial.h&gt;</pre><p>Afterwards, we select the UART port we are to use</p><pre>HardwareSerial SerialPort(2);</pre><p>Then we create the SerialBT instance and also include the code for Bluetooth connectivity error detection.</p><pre>BluetoothSerial SerialBT;<br>byte BTd;<br>/* Check if Bluetooth configurations are enabled in the SDK */<br>#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)<br>#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it<br>#endif</pre><p>In the void setup block, we initialize the serial communication by setting the baud rate and pins. We also setup the Bluetooth connectivity</p><pre>  Serial.begin(115200);<br>  SerialPort.begin(15200,SERIAL_8N1,16,17);<br>  SerialBT.begin(&quot;ESP32&quot;);</pre><p>Finally, in the void loop block, we include the code for Bluetooth serial port data detection and then write conditionals to send data in the UART according to the data received through Bluetooth connectivity. To send the data through the serial port, we use the SerialPort.print(data); function.</p><pre>  if(SerialBT.available())<br>  {<br>    BTd=SerialBT.read();<br>    Serial.write(BTd);<br>  }<br>  if(BTd==&#39;1&#39;)<br>  {<br>    SerialPort.print(1);<br>  }<br>  if(BTd==&#39;0&#39;)<br>  {<br>    SerialPort.print(0);<br>  }</pre><p><strong>Code-Slave Module</strong></p><p>The code for the slave ESP32 is as follows</p><pre>#include &lt;HardwareSerial.h&gt;</pre><pre>HardwareSerial SerialPort(0); // use UART0</pre><pre>char number  = &#39; &#39;;</pre><pre>void setup()<br>{<br>  Serial.begin(115200);<br>  SerialPort.begin(15200, SERIAL_8N1, 3, 1);<br> <br>}<br>void loop()<br>{<br>  if (SerialPort.available())<br>  {<br>    char number = SerialPort.read();<br>    Serial.write(number);<br> <br>  }<br>}</pre><p>First, we include the library</p><pre>#include &lt;HardwareSerial.h&gt;</pre><p>Then we select the port we are to use and define a char variable to store the incoming data</p><pre>HardwareSerial SerialPort(0); // use UART0</pre><pre>char number  = &#39; &#39;;</pre><p>In the void setup block, we begin the UART communciation by setting its baud rate and port pins</p><pre>  Serial.begin(115200);<br>  SerialPort.begin(15200, SERIAL_8N1, 3, 1);</pre><p>In the void loop block, we receive the data from the master and display it on the serial monitor. We use the SerialPort.available() function to check if there is any data in the serial port to receive, then we use the SerialPort.read() function to store the data in our char variable.</p><pre>  if (SerialPort.available())<br>  {<br>    char number = SerialPort.read();<br>    Serial.write(number);<br> <br>  }</pre><p><strong>Results</strong></p><p>After we upload both the codes to our ESP32 modules, we will open the serial monitor for the slave module and send ‘1’ or ‘0’ through Bluetooth communication to the master module. The received data will be displayed on the serial monitor. We can also use the same displayed data to trigger an event by using a conditional such as controlling an LED. Do note that we cannot send the data received through Bluetooth directly, thus we have to use a conditional and we can send only specific data.</p><p><em>P.S, for any paid content writing and/or article writing tasks, and for any free guidance about the ESP32 board, do reach out to me at khantalha7367@gmail.com or visi my Fiverr gigs at </em><a href="https://www.fiverr.com/s/rL3mWN">https://www.fiverr.com/s/rL3mWN</a>, <a href="https://www.fiverr.com/s/7rj8Xy">https://www.fiverr.com/s/7rj8Xy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28fd3df3b6eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programming: Remote Learning vs In-Person]]></title>
            <link>https://medium.com/@khantalha7367/programming-remote-learning-vs-in-person-35fb73867879?source=rss-322ab35b1f29------2</link>
            <guid isPermaLink="false">https://medium.com/p/35fb73867879</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[python3]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[c-programming]]></category>
            <dc:creator><![CDATA[Talha Khan]]></dc:creator>
            <pubDate>Wed, 28 Sep 2022 07:00:57 GMT</pubDate>
            <atom:updated>2023-05-31T11:05:31.134Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*gPFiL45yI9zKWP23VHY5JQ.png" /></figure><p>About two years ago, I started off my first semester at a university as an electrical engineering prospect, and one of the courses that was offered was the Computer Fundamentals and Programming (CFP) course. The course included learning basic to intermediate C++ and was a 3 credit hour course along with a 1 credit hour lab session.</p><p>Three months ago, I was on my semester break and decided to self learn Python from the comfort of my home. Owing to this experience that I have and the current rising populairty of remote learning, I thought I would express my views about how both the experiences went and if free self-learning is better than a paid in-person course.</p><p><strong>Discipline</strong></p><p>One of the things was the self-discipline factor involved in my code learning journey. We as humans need some kind of strong motivation or impetus to move us forward. That motivation in the form of getting a good GPA and keeping up the required attendance policy was present in the in-person session, and it moved us forward even when we felt like giving up. In the case of the Python course, there was no such short term drive present, which served as a huge barrier when it came to actually wanting to understand some of the difficult concepts.</p><p>Furthermore, a paid university course also came with a dedicated lab session with challenging tasks to be performed, again the self-learning Python class lacked such dedicated session of its own and most tutorials would just go by where I would end up watching the person in the video do a code but not do the code myself.</p><p>In short, a strong sense of discipline and motivation is needed for remote learning courses.</p><p><strong>The Urge to Binge Watch</strong></p><p>The urge to binge watch the whole playlist of tutorials videos is a real- and scary — thing. A person would finish the whole thing in a day just to get a false sense of achievement and productivity, all the while lacking any type of practice and project work. One is especially prone to do this when doing a home based self-learning course.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*mXd1gtKBgS8ZUpF-HxYYoQ.png" /></figure><p>On the other hand, at an on-campus course you focus on a certain content a certain amount of time all the while attending lab practice sessions. This can contribute to a healthy learning curve instead of a one day cramming.</p><p><strong>Time Management</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*hC8qK3DbiZsuxKZ9hCXR8w.png" /></figure><p>Now here’s one for the self-learners, as at a home-based course you can control your schedule better. In other words, you have more freedom to set your schedule for your ease and also to adjust it if any inconvenience occurs. An in-campus course lacks any such freedom for the participant and hence you have to make some necessary tweeks to your plans and routine.</p><p><strong>Money Matters</strong></p><p>This may well be the one thing that most people would cite as a reason for going for a self-learning course. There are sites online that basically offer a free course along with certification. For some it might just be a convenience to save some bucks but for more cash strapped people, it would be an actual necessity. On the other hand, a paid in-campus course would need a certain chunk of your finances based on the level and providers of the course.</p><p><strong>Certification</strong></p><p>An in-person course would usually be accompanied by a certification signifying completion of the course. A remote self-learning course consisting of YouTube videos would not have such a privilege, unless you pay for it, which again brings the issue of affordability and pricing in the equation</p><p>This makes an impact when a peron is asked for verification of his/her claimed expertise in job interviews and even when it comes to job hunting on freelance sites like Upwork.</p><p><em>P.S, for any paid content writing and/or article writing tasks, and for any free guidance about the ESP32 board, do reach out to me at khantalha7367@gmail.com or visi my Fiverr gigs at </em><a href="https://www.fiverr.com/s/rL3mWN">https://www.fiverr.com/s/rL3mWN</a>, <a href="https://www.fiverr.com/s/7rj8Xy">https://www.fiverr.com/s/7rj8Xy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35fb73867879" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PWM on the ESP32]]></title>
            <link>https://medium.com/@khantalha7367/pwm-on-the-esp32-e7743c4b56ba?source=rss-322ab35b1f29------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7743c4b56ba</guid>
            <category><![CDATA[led]]></category>
            <category><![CDATA[electrical-engineering]]></category>
            <category><![CDATA[microcontrollers]]></category>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Talha Khan]]></dc:creator>
            <pubDate>Mon, 19 Sep 2022 17:04:14 GMT</pubDate>
            <atom:updated>2023-05-31T11:05:41.885Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/349/1*cM_eZvUw3Qr1b42FM6iB5w.png" /></figure><p>So far we have covered a vast range of tutorials on the ESP32 board, in this article we will cover the PWM function of the board and how we can use it to control the speed of a DC motor or brightness of an LED. For all those that are not familiar with the ESP32 board and how to set it up with the Arduino IDE, they should read the articles here. For a more detailed explanation of the ESP32 board’s features weighed up against the STM32 Bluepill board, read the article here.</p><p><strong>PWM-Pulse Width Modulation</strong></p><p>Pulse width modulation is a method of varying the width of a series of pulse shaped waves. Such a shaped wave is seen as an average value by the component to which the voltage is supplied. In the ESP32, we have 16 PWM channels choosing from 0 to 15 along with a resolution of 16 bit. We can also set the frequency of our pulse signal according to our needs. In the board, the average supply has a spectrum of 0V to 3.3V.</p><p>This signal can be used to set the brightness of an LED or the speed of a DC motor in practical applications ranging from decoration lights to RC cars to helicopter rotors, and even as a simple pulse wave generator or clock supply to a circuit.</p><p><strong>Tools</strong></p><ol><li>ESP32 DEVKIT V1</li><li>LED</li><li>Breadboard</li><li>Jumper Wires</li></ol><p>The complete setup should look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ftHBcTlA5yxcIQYRNW9t7Q.jpeg" /></figure><p><strong>Code</strong></p><p>The code for the PWM LED control is as follows,</p><pre>const int LEDpin=25;<br>const int freq=4000;<br>const int PWM_channel=0;<br>const int resolution=8;</pre><pre>void setup() {<br>   ledcSetup(PWM_channel,freq,resolution);</pre><pre>ledcAttachPin(LEDpin,PWM_channel);</pre><pre>}</pre><pre>void loop() {<br>  int cycle;</pre><pre>for(cycle=0;cycle&lt;=255,++cycle)<br>  {<br>    ledcWrite(PWM_channel,cycle);<br>    delay(20);<br>  }</pre><pre>for(cycle=255;cycle&gt;=0,++cycle)<br>  {<br>    ledcWrite(PWM_channel,cycle);<br>    delay(20);<br>  }<br>  delay(1000);<br>}</pre><p>In this code, we have used an 8-bit resolution with a 4000Hz frequency and the channel 0.</p><p>For the line by line explanation</p><p>First we define the constant values for the PWM led pin, channel, resolution, and frequency</p><pre>const int LEDpin=25;<br>const int freq=4000;<br>const int PWM_channel=0;<br>const int resolution=8;</pre><p>Afterwards, in the void setup() section, we will use the ledcSetup and the ledcAttachPin functions to setup the PWM properties and also the pin to which our LED is attached.</p><pre>ledcSetup(PWM_channel,freq,resolution);</pre><pre>ledcAttachPin(LEDpin,PWM_channel);</pre><p>In the void loop() section, we will use the for conditional statement to first increase the brightness of the LED and subsequently decrease the brightness of the LED</p><pre>for(cycle=0;cycle&lt;=255,++cycle)<br>  {<br>    ledcWrite(PWM_channel,cycle);<br>    delay(20);<br>  }</pre><pre>for(cycle=255;cycle&gt;=0,--cycle)<br>  {<br>    ledcWrite(PWM_channel,cycle);<br>    delay(20);<br>  }</pre><p><strong>Result</strong></p><p>After uploading the code, we have the result as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*76yjO-7ADGecMvj5W7ldNA.gif" /></figure><p>As you can see, the LED brightens up for a certain period and eventually dims out.</p><p><em>P.S, for any paid content writing and/or article writing tasks, and for any free guidance about the ESP32 board, do reach out to me at khantalha7367@gmail.com or visi my Fiverr gigs at </em><a href="https://www.fiverr.com/s/rL3mWN">https://www.fiverr.com/s/rL3mWN</a>, <a href="https://www.fiverr.com/s/7rj8Xy">https://www.fiverr.com/s/7rj8Xy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7743c4b56ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Capacitive Touch Pins on the ESP32]]></title>
            <link>https://medium.com/@khantalha7367/capacitive-touch-pins-on-the-esp32-cb55b08810ae?source=rss-322ab35b1f29------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb55b08810ae</guid>
            <category><![CDATA[arduino]]></category>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[esp32]]></category>
            <category><![CDATA[electronics]]></category>
            <dc:creator><![CDATA[Talha Khan]]></dc:creator>
            <pubDate>Tue, 13 Sep 2022 15:44:11 GMT</pubDate>
            <atom:updated>2023-05-31T11:06:28.976Z</atom:updated>
            <content:encoded><![CDATA[<p>The ESP32 is a versatile board with loads of available features and a strong architecture with respect to its microprocessor. It is a general development board as well as an IoT compatible board with in-built WIFI and Bluetooth. For a general introduction of the ESP32 along with its setup in the Arduino IDE, visit the article <a href="https://medium.com/@khantalha7367/getting-started-with-esp32-on-arduino-ide-fcc0c29118ca?source=friends_link&amp;sk=7174a724820b8daf7fdf9a25d33bad92">here</a>. The ESP32 also boasts capacitive touch pins that can sense any changes in electrical variations in its environment, owing to which it can be used in place of push buttons. Although these pins are mainly used for waking up the ESP32 from its deep sleep mode, we can also use these pins for other purposes as in to execute a certain task when the touch pins are triggered. In this tutorial, we will use the touch pins to trigger the turning ON and OFF of an LED attached to a GPIO pin of the ESP32.</p><p><strong>Tools</strong></p><ol><li>ESP32 DEVKIT V1</li><li>Female-to-Male Wire</li><li>Micro-USB Data Cable</li></ol><p><strong>Touch Pins</strong></p><p>The touch pins of the ESP32 number a total of 10 pins present on the board corresponding to the following GPIOs:</p><ul><li>T0=GPIO 4</li><li>T1=GPIO 0</li><li>T2=GPIO 2</li><li>T3=GPIO 15</li><li>T4=GPIO 13</li><li>T5=GPIO12</li><li>T6=GPIO 14</li><li>T7=GPIO 27</li><li>T8=GPIO 33</li><li>T9=GPIO 32</li></ul><p>The Touch Pin GPIOs can also be observed from the following pinout diagram</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/0*AYtiOGVRSbeO5liA" /><figcaption><a href="https://randomnerdtutorials.com/esp32-pinout-reference-gpios/">https://randomnerdtutorials.com/esp32-pinout-reference-gpios/</a></figcaption></figure><p><strong>Code</strong></p><p>The touch pins can sense electrical variations in anything that has an electrical charge, in this way it can also sense the human skin when it is touched. In our code, we will use the built-in LED along with the GPIO 4 as a touch pin. The code in the Arduino IDE is shown as below:</p><pre>const int touchpin=4;</pre><pre>const int threshold=20;</pre><pre>int touchvalue;</pre><pre>void setup() {</pre><pre>Serial.begin(115200);</pre><pre>delay(1000);</pre><pre>pinMode(LED_BUILTIN, OUTPUT);</pre><pre>digitalWrite(LED_BUILTIN,LOW);</pre><pre>}</pre><pre>void loop() {</pre><pre>touchvalue=touchRead(touchpin);</pre><pre>Serial.println(touchvalue);</pre><pre>if(touchvalue&lt;threshold)</pre><pre>{</pre><pre>digitalWrite(LED_BUILTIN,HIGH);</pre><pre>}</pre><pre>else</pre><pre>{</pre><pre>digitalWrite(LED_BUILTIN,LOW);</pre><pre>}</pre><pre>delay(100);</pre><pre>}</pre><p><strong>Explanation</strong></p><p>First, we define the variables to store our touch pin value, the touch value and also the threshold to trigger the LED as ON.</p><pre>const int touchpin=4;</pre><pre>const int threshold=20;</pre><pre>int touchvalue;</pre><p>In the void setup(), we define our LED_BUILTIN as OUTPUT with the default state being LOW.</p><pre>void setup() {</pre><pre>Serial.begin(115200);</pre><pre>delay(1000);</pre><pre>pinMode(LED_BUILTIN, OUTPUT);</pre><pre>digitalWrite(LED_BUILTIN,LOW);</pre><pre>}</pre><p>In the void loop(), we use the touchRead() function to read the value of the touch pin, and then print it on the serial monitor</p><pre>touchvalue=touchRead(touchpin);</pre><pre>Serial.println(touchvalue);</pre><p>Afterwards, we use a conditional to check if our sensor value has become less than our threshold value, at which point our LED will become ON</p><pre>if(touchvalue&lt;threshold)</pre><pre>{</pre><pre>digitalWrite(LED_BUILTIN,HIGH);</pre><pre>}</pre><pre>else</pre><pre>{</pre><pre>digitalWrite(LED_BUILTIN,LOW);</pre><pre>}</pre><p><strong>Results<br></strong>After uploading the code, we open the serial monitor at a baud rate of 115200 and find a reading of about 80.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*4Mj7VsgJIVKHf32YgM20dw.png" /><figcaption>Normal pin reading before touching</figcaption></figure><p>After we touch the pin of the male header, we find that the reading on the serial monitor drops and as soon as it goes below 20, our on-board LED lights up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*PGOURbwi7Qiu-Aco3SlW4g.gif" /></figure><p><em>P.S, for any paid content writing and/or article writing tasks, and for any free guidance about the ESP32 board, do reach out to me at khantalha7367@gmail.com or visi my Fiverr gigs at </em><a href="https://www.fiverr.com/s/rL3mWN">https://www.fiverr.com/s/rL3mWN</a>, <a href="https://www.fiverr.com/s/7rj8Xy">https://www.fiverr.com/s/7rj8Xy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb55b08810ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ESP32 VS STM32F103C8T6]]></title>
            <link>https://medium.com/@khantalha7367/esp32-vs-stm32f103c8t6-d8c2cd6e377b?source=rss-322ab35b1f29------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8c2cd6e377b</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[microprocessor]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[internet-of-things]]></category>
            <dc:creator><![CDATA[Talha Khan]]></dc:creator>
            <pubDate>Thu, 08 Sep 2022 16:36:47 GMT</pubDate>
            <atom:updated>2022-10-05T16:56:05.172Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*W7iVX_baODSghLYmC8ieIg.png" /></figure><p>In this era, hobbyists and tech enthusiasts have several options available to them when it comes to microcontroller boards and development boards. Personally, I currently have the ESP32 and the STM32F103C8T6 in my possession and having worked with both, I thought best if a comparison were to be made between the two boards. Generally speaking, both boards pack a powerful punch of specs along with a decent size, that is small. But one thing is certain, and that is that both are better than the Arduino UNO (Sorry Arduino lovers).</p><p><strong>Specs Comparison</strong></p><p>The BluePill board belongs to a family of boards of medium density and having the ARM Cortex M3 microprocessor in it. In appearance it mostly looks like an Arduino Nano but is much more cost efficient as compared to it. On the other hand, we have the ESP32 developed by Espressif Systems as an IoT and general development board. As for the bit by bit comparison, here it goes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*BJh-xIs9wVh-xObvdBJ10Q.png" /></figure><p>Other than this, both boards have the usual PWM, I2C, SPI ,UART, ADC, and CAN. By looking at the specifications, we can see that the ESP32 has a clear edge, and while the STM32 BluePill has impressive features of its own, it does not come close to the ESP32. Although with respect to physical compatibility with a breadboard, the BluePill board fits perfectly on a breadboard while an ESP32 does not</p><p><strong>Programming Options</strong></p><p>Both boards have several IDE options you can choose from when it comes to programming the boards. For the BluePill board, we have the Keil uVision5 IDE as well as the STM32CUBEMX IDE. The board can also be programmed using the Arduino IDE by using an FTDI Converter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/164/1*ie4gGYcXo2bf2F8Mrzml0Q.png" /><figcaption>FTDI Converter</figcaption></figure><p>The ESP32 can be programmed using the Arduino IDE along with Micropython IDEs and It can also be programmed via the Espressif IDF. When it comes to the Arduino IDE, the ESP32 has more resources available online for any hobbyists willing to undertake a project as compared to the BluePill board. The ESP32 also has an easier interface procedure with external modules as compared to the BluePill board.</p><p>While all this is true, the Keil IDE along with the CUBEMX provide a much more in-depth programming experience when it comes to the BluePill. With knowledge of assembly language, one can set the pin output type as well as the pin clock speed. The CUBEMX IDE also provides extended options when it comes to pin function selection. The Arduino IDE and even the other ESP32 IDEs do not provide such in-depth programming options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/203/1*0Ae5VzYA2P3_OdnaB36SaQ.png" /><figcaption>STM32F103C8T6</figcaption></figure><p>When it comes to hobbyists, the Arduino IDE provides the efficiency and simplicity that is more than enough. When it comes to applications where high end precision is needed, then the Keil and CUBEMX environments are better suited for the purpose.</p><p><strong>IoT Compatibility</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/1*LA8_t_cvpfBV41pnfoi5aA.png" /><figcaption>ESP32 DEVKIT V1</figcaption></figure><p>When it comes to the hot trend of Internet of Things or automation, the BluePill and the ESP32 are both starkly different. Apart from being a general development board, the ESP32 also has WIFI and Bluetooth Low Energy as well as Bluetooth Classic compatibility, while the BluePill lacks in both these areas. Coupled with this, the ESP32 also has Deep Sleep modes which makes it an ideal candidate when it comes to periodic data logging over a long period of time without much energy consumption. The internet capability also helps in accessing cloud servers to log such data without any external modules.</p><p>The STM32F103C8T6 does not have any IoT compatibility, and for any wireless connectivity, we would need external modules such as the HC-05 Bluetooth module or the ESP8266 WIFI module, thus adding to extra costs.</p><p><strong>Pricing</strong></p><p>When it comes to the boards alone, you can get both the boards for a price of less than ten dollars, but other required accessories can increase the price. While you can programme the ESP32 using even your mobile chargers micro-USB cable, you are gonna need an ST-Link for the BluePill, which is even more expensive than the board itself. For Arduino IDE, we would also need an FTDI converter, which is cheaper than an ST-Link but cannot be used with IDEs other than Arduino.</p><p><strong>Final Verdict</strong></p><p>Comparing the overall specs of both boards, I would personally go with the ESP32 development board, owing to its higher clock speed, dual core processor along with IoT functions. Furthermore, it can be programmed fairly easily for any hobbyist and aspiring electronics engineer to get some practice and experience up their sleeve.</p><p>The BluePill is also a board that packs a powerful punch for its small size factor, but if its more detailed programming methods are to be used, then the Keil and CUBEMX IDEs are not really beginner friendly, although they give much more in-depth control of the GPIO pins as compared to the ESP32. This makes it ideal for operations where high end precision and accuracy are required.</p><p>So, it would depend upon the person, suit yourself.</p><p><em>P.S, for any paid content writing and/or article writing tasks, and for any free guidance about the ESP32 board, do reach out to me at khantalha7367@gmail.com</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8c2cd6e377b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>