<?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 Jinalka Herath on Medium]]></title>
        <description><![CDATA[Stories by Jinalka Herath on Medium]]></description>
        <link>https://medium.com/@jinalkaherath?source=rss-3468fa76366------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*K0f7xfH3gkWwzXrJFlcVbg.png</url>
            <title>Stories by Jinalka Herath on Medium</title>
            <link>https://medium.com/@jinalkaherath?source=rss-3468fa76366------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 10:47:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jinalkaherath/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[Motor Driver Using L293D]]></title>
            <link>https://medium.com/@jinalkaherath/motor-driver-using-l293d-9e835674082f?source=rss-3468fa76366------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e835674082f</guid>
            <dc:creator><![CDATA[Jinalka Herath]]></dc:creator>
            <pubDate>Tue, 14 Nov 2023 02:09:39 GMT</pubDate>
            <atom:updated>2023-11-14T02:09:39.236Z</atom:updated>
            <content:encoded><![CDATA[<p>A motor driver is an electronic circuit that is used to provide the necessary current and voltage to the motor in order to control the speed and direction of the motor. The motor driver is the medium that is used to interface between the microcontroller and the other control circuit. The motor driver plays a vital role in the circuit, where it is used for power amplification. The motor driver amplifies the low-power signal that is received from the microcontrollers and delivers it to the higher currents and voltages that are required by the motor. Also, the motor driver plays a vital role in speed control, where speed can be achieved by PWM techniques where the duty cycle of the PWM signal is used to determine the average voltage applied to the motor. The direction of the motor can be controlled by the motor driver, who controls the signal to change the motor direction.</p><p><strong>Methodology</strong></p><p>Ø First solder the L293D motor driver IC to the dot board with the help of IC socket (Solder the IC socket to the dot board and then fix the L2943D IC on the IC socket).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/329/1*WphLT_lbf1u-Jiu4gBB8Sw.png" /><figcaption>Figure 1</figcaption></figure><p>Ø We then soldered the other components, such as terminal blocks, male headers, and diodes, to the dot board.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*Tzbnk3pHCTPDSlAbWTPVYw.png" /><figcaption>Figure 2</figcaption></figure><p>Ø We then start placing the connection between the components.</p><p>Ø Connect pins 2, 3, pin 6, and pin 7 of the L293D motor driver to the output terminal of the motor 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*mpGAxo9JEQOcWraoJFkA8Q.png" /><figcaption>Figure 3</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/254/1*m74ZsaWWbOYKrt4rBNKbTg.png" /><figcaption>Figure 4</figcaption></figure><p>Ø We then connect the pins 15, 14, 11, and 12 of the diver to the output terminal of motor 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*puHEl3H5SuwOEMJIWdldfg.png" /><figcaption>Figure 5</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*06de9UzA3LEB-QbWfHrLzA.png" /><figcaption>Figure 6</figcaption></figure><p>Ø Pin 16 is the 12V pin of the driver, pin 8 is the Vcc, and pins 4, 5, 13, and 12 are the terminal blocks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*FMeUriBQeNpdUlcWPV4aug.png" /><figcaption>Figure 7</figcaption></figure><p>Ø We then connect the male header to take the output from the circuit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*W8Zwr4_3t3sehgpPiDBIcQ.png" /><figcaption>Figure 8</figcaption></figure><p>Ø We then connect the motor with the motor driver M1 terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*IhKrOWfOy0SA4suLjWIzwA.png" /><figcaption>Figure 9</figcaption></figure><p>Ø We then connect our motor driver with the Arduino by connecting the GND, IN1, and IN2, as shown in the above figure.</p><p>Ø We then upload the code to Arduino using the Arduino IDE and see the operations of the motor through the driver.</p><p>code: <a href="https://github.com/JinalkaHerath/Motor-driver.git">https://github.com/JinalkaHerath/Motor-driver.git</a></p><p>Results through this video: <a href="https://youtu.be/z_1i1DgO1Wc">https://youtu.be/z_1i1DgO1Wc</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e835674082f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Power supply]]></title>
            <link>https://medium.com/@jinalkaherath/power-supply-9f744972ecf2?source=rss-3468fa76366------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f744972ecf2</guid>
            <dc:creator><![CDATA[Jinalka Herath]]></dc:creator>
            <pubDate>Tue, 14 Nov 2023 01:48:10 GMT</pubDate>
            <atom:updated>2023-11-14T01:48:10.207Z</atom:updated>
            <content:encoded><![CDATA[<p>A power supply is an electrical device that is used to supply electrical power to a certain electrical load. The power supply is mainly used to convert electric current from a certain source to a specific voltage, current, and frequency to power the necessary load. Power supplies are used for various functions, such as limiting the current that is drawn by the load at a safer level, shutting off the current if there is any electrical fault, and also in power conditioning to prevent electrical noises on the input from reaching the load.</p><p>LM7805 Pinout</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*uafbQI4Z18Wpl8oNqxOOmQ.png" /><figcaption>Figure 1</figcaption></figure><p>In building my power supply, I used the LM 7805 voltage regulator, where my intention was to convert a power of 12V to 5V. LM 7805 is a voltage regulator that is used to give an output of 5 volts. It consists of a three-pin IC where the input pin is used to accept the incoming DC voltage, the ground pin is used to provide a ground for the regulator, and the output pin provides a voltage of 5V if any voltage above 7V is supplied to the input. It can give an output current of 1.5A, and it has internal thermal overload protection to protect the IC from high heat. It has a higher power dissipation capability that can be used as an internal short-circuit current limiter.</p><p><strong>Methodology</strong></p><ol><li>First, we design the circuit using Proteus in order to ensure that our calculations are correct and the circuit works properly.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*AARIQHfacDWrA4o5gkXLag.png" /><figcaption>Figure 1</figcaption></figure><p>When we supply a voltage of 12V and the switch is on, we can distinguish that the current passes through the circuit and provides an output voltage of 4.92 V, which is approximately equal to 5V.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*ICvgcLmda3cIPcBWzUFHEA.png" /><figcaption>Figure 2</figcaption></figure><p>2. Then we start building the circuit on the dot board by placing the LM 7805 voltage regulator first.</p><p>3. We then soldered the Vin, GND, and V out of the regulator to the dot board.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/1*aV7NuIRUQ5SwB-jjbWS5mg.png" /><figcaption>Figure 3</figcaption></figure><p>4. We then solder the two capacitors, respectively. We need to solder the 10UF capacitor by connecting it with the input pin of the regulator and connect the 0.1UF capacitor to the output pin of the voltage regulator, as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/134/1*yV3FDNVsFTiSl6JtCz4TkQ.png" /><figcaption>Figure 4</figcaption></figure><p>5. Here we solder the positive pin of 10UF to the input pin of the regulator and the negative pin of the capacitor to the GND pin of the regulator. Also, we soldered the positive pin of 0.1UF to the output pin of the regulator and the negative pin to the GND of the regulator.</p><p>6. We then solder the terminal connectors to the dot board in order to provide voltage in and out of the circuit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*lib6bx66RnUe46HX41r-SQ.png" /><figcaption>Figure 5</figcaption></figure><p>7. We take an output from the input pin of the voltage regulator to one terminal of the terminal connector and also connect the GND of the regulator to the other terminal of the terminal connector, which is the 12V input terminal of the circuit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*BoenAD-7_gFIAaBl0OjJAg.png" /><figcaption>Figure 6</figcaption></figure><p>8. Also, we take an output from the output pin of the regulator and solder it to one terminal of the terminal connector and the GND of the regulator to the other pin of the regulator, which provides the output voltage of 5V from the relevant terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*holcqif6EeSHRZB-qNxsOw.png" /><figcaption>Figure 7</figcaption></figure><p>Results: <a href="https://youtube.com/shorts/i3YnsG0TDO0?feature=share">https://youtube.com/shorts/i3YnsG0TDO0?feature=share</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f744972ecf2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Up counter with LED’s]]></title>
            <link>https://medium.com/@jinalkaherath/up-counter-with-leds-68068f498ad3?source=rss-3468fa76366------2</link>
            <guid isPermaLink="false">https://medium.com/p/68068f498ad3</guid>
            <dc:creator><![CDATA[Jinalka Herath]]></dc:creator>
            <pubDate>Tue, 14 Nov 2023 01:38:21 GMT</pubDate>
            <atom:updated>2023-11-14T01:38:21.810Z</atom:updated>
            <content:encoded><![CDATA[<p>The binary up counter is programmed using the GPIO pins of the STM32, where the GPIO pins are configured as the outputs, and the output of each pin can be set to 0 or 1. To implement the binary up counter through STM 32, we write the program according to the code that sets the output of the GPIO pins in the sequence that represents the binary numbers. The binary up counter is also used to count a variety of things, such as the times the button is pressed and the amount of time the program is executed.</p><p><strong>Methodology</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*EBqtH9QiLO_fVVRitYGOGA.png" /><figcaption>Figure 1</figcaption></figure><p>Ø As shown in the above figure 1, we need to connect STM 32 with the ST-LINK first.</p><p>· GND of STM32 — GND of ST Link</p><p>· SWCLK of STM32 — SWDCK of ST-Link</p><p>· SWDIO of STM32 — SWDIO of ST-Link</p><p>· 3V3 of STM32–3V3 of ST-Link</p><p>Ø Then connect eight LEDs on the breadboard with the use of 220 OHM resistors, as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*DwrvMmDOXSa3BQ848LW08w.png" /><figcaption>Figure 2</figcaption></figure><p>Ø Then connect the eight LEDs with the GPIO pins of the STM32 and start connecting the GPIO pins from GPIO0 to GPIO7, as shown in the below figure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*0i7FEB0sMOgHkQ4I4a_fnw.png" /><figcaption>Figure 3</figcaption></figure><p>Ø Go to File and open a new STM 32 file. As the new file is created, it will start initializing as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*iXRvJahKHuZkboqL_ab3Vg.png" /><figcaption>Figure 4</figcaption></figure><p>Ø Then select the type of microcontroller that needs to be used by typing the model in the space provided.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*vMqfw6d0q83zi2o5ynub4w.png" /><figcaption>Figure 5</figcaption></figure><p>Ø Then we provide a name for the file and finish the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*g9q0rkdowSjHzhO1LRgsRg.png" /><figcaption>Figure 6</figcaption></figure><p>Ø Then provide the GPIO pins for the LED by selecting from PA0 to PA7 and assigning the relevant GPIO pin. Also, set the GPIO pins as HIGH</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*59iMx0XoYs6Gzxvta5hUuw.png" /><figcaption>Figure 7</figcaption></figure><p>Ø Then save and compile the pin-out configuration and enter the code as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*KB1GxeKgauZSl2mHv96duw.png" /><figcaption>Figure 8</figcaption></figure><p>Select the while loop and enter the code as follows in order for the LED to work as a binary-up counter.</p><p>Ø After all the edits are done in the code, press the hammer button to check for errors. If the code is compiled properly, there will be no errors displayed, and it will be displayed as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*CFGgWcUjToG64XB588UiHw.png" /><figcaption>Figure 9</figcaption></figure><p>Ø Then upload the code to the microcontroller and observe the output through the LED.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*9pkg57o-H-_B99bdntb2lw.png" /><figcaption>Figure 10</figcaption></figure><p>source code: <a href="https://github.com/JinalkaHerath/Up-counter-with-LED-s.git">https://github.com/JinalkaHerath/Up-counter-with-LED-s.git</a></p><p>Results can be viewed: <a href="https://youtu.be/EuPVbAKIyT8">https://youtu.be/EuPVbAKIyT8</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68068f498ad3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[INTERFACING OLED DISPLAY WITH STM 32 AND CUBE IDE]]></title>
            <link>https://medium.com/@jinalkaherath/interfacing-oled-display-with-stm-32-and-cube-ide-7695509e046c?source=rss-3468fa76366------2</link>
            <guid isPermaLink="false">https://medium.com/p/7695509e046c</guid>
            <category><![CDATA[oled-with-stm32]]></category>
            <category><![CDATA[oled-display]]></category>
            <category><![CDATA[oled]]></category>
            <dc:creator><![CDATA[Jinalka Herath]]></dc:creator>
            <pubDate>Wed, 08 Nov 2023 02:09:23 GMT</pubDate>
            <atom:updated>2023-11-10T08:53:26.857Z</atom:updated>
            <content:encoded><![CDATA[<p>In our application, we use the communication protocol I2C in interfacing the OLED display with STM32. I used the SSD 1306 OLED display type which matches my requirements in interfacing with STM32. OLED display could be connected with the microcontroller with the help of I2C or SPI communication. We need to refer to the datasheet of STM32 when connecting the OLED display with the STM32. If we consider the pin-out diagram of STM 32 we could distinguish that we need to connect the I2C display to the pins PB8, PB9, GND, and 3V3. Here we connect the GND pin of the display with the GND pin of the board, VCC pin of the display to the 3V3 of the board, SDA Pin of the display to the SDA pin of the board, and the SCL pin of the display to the SCL pin of the display.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*fKf_rdKp49_aGblVB14hrg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*SRgBDROypEs5flv0l_TlkA.png" /></figure><p>If we refer to the data sheet of STM32F103C8T6 we could also observe that the SCL and SDA pins should be connected to PB8 and PB9. The purpose of SCL pin is used to synchronizes the data transfers in a certain clock line through the I2C bus. SCL acts as the serial clock line in data transfer. SCL has certain standards when interfacing with I2C.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*1ivL01Za04gScHEq_SvzXA.png" /></figure><p><strong>Methodology</strong></p><p>Components needed: 1. STM32 (Blue pill)</p><p>2. STLINK — V2</p><p>3. Breadboard</p><p>4. OLED display</p><p>5. Jumper wires</p><p>Method</p><p>1. Connect the <strong>GND PIN</strong> of the OLED to the <strong>GND</strong> PIN of the STM 32</p><p>2. Connect the<strong> VCC</strong> of OLED to <strong>3.3V</strong> of STM 32</p><p>3. Connect the <strong>SCL</strong> pin of OLED to<strong> B6</strong> of STM 32</p><p>4. Connect the <strong>SDA</strong> pin of OLED to <strong>B7</strong> of STM 32</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/332/1*Cu5q5HKtQHR3ESDTkb7YlA.png" /></figure><p>5. Setup the settings by selecting the correct type of microcontroller and setting up the settings as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*_QeQnLfx6zT116di9-1ceg.png" /></figure><p>6.Go to System Core select SYS and then select the SERIAL WIRE and time source as SYS TICK</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*29wepzrtBAyoFNbvXtRh0g.png" /></figure><p>7. Go to Connectivity select I2C1 and select I2C change the setting of I2C SPEED MODE TO Fast Speed</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*sNk3upuO7i8u61yVOlg0Ag.png" /></figure><p>8. Insert the libraries given below in the necessary folder ( Libraries are attached below ).</p><p>· Insert font. h to Core &gt; Inc</p><p>· Insert ssd1306.h to core &gt;INC</p><p>· Insert font.c to Core &gt; SRC</p><p>· Insert ssd1306.c to core &gt;SRC</p><p>9. Compile and check for errors and upload it to the board by changing debugger settings to OpenOCD (If the code has compiled properly it won’t show any errors).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/541/1*T8ToAoEbv1nhNQW9H0Y3Dw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7695509e046c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GPS Tracker]]></title>
            <link>https://medium.com/@jinalkaherath/gps-tracker-507f5329c3a7?source=rss-3468fa76366------2</link>
            <guid isPermaLink="false">https://medium.com/p/507f5329c3a7</guid>
            <category><![CDATA[gps-tracking-device]]></category>
            <category><![CDATA[gps-tracker]]></category>
            <category><![CDATA[gps-tracking-system]]></category>
            <dc:creator><![CDATA[Jinalka Herath]]></dc:creator>
            <pubDate>Wed, 08 Nov 2023 01:50:39 GMT</pubDate>
            <atom:updated>2023-11-10T08:45:58.197Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction</strong></p><p>The GPS tracker that I made was made using the ATMEGA328P-PU and Ublox NEO-6M GPS Module. This PCB was built in order to track the geographical location of any object or person using GPS technology. Here the ATMEGA328P-PU acts as the CPU of the GPS tracker while the Ublox NEO-6M GPS is used to provide and receive signals from the GPS satellites in order to determine the location. This system was made in order to track the location of a golf cart that is used on a golf track in order to know the location of the golf cart.</p><p>First I decide on the list of components needed</p><ol><li>Capacitor 100nF</li><li>1oK ohm resistor</li><li>ATMEGA328P-PU</li><li>22pF capacitor</li><li>crystal 16MHz</li><li>12Vdc power supply</li><li>Neo 6M GPS module</li><li>L7805</li></ol><p><strong>ATMGEGA328P-PU chip Pin Out</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*n7BK56W57INJm21U0SECsg.png" /><figcaption>Figure 1</figcaption></figure><p><strong>Methodology</strong></p><ol><li>First, open a new project in EasyEDA then start drawing the schematic as follows</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*9caqWIr6HkcU9TSW1_eGlA.png" /><figcaption>Figure 1</figcaption></figure><p>2. First place the components that you need to draw the schematic and place it in the window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*RfasHqLsXsUhoA_sOjLTlg.png" /><figcaption>Figure 2</figcaption></figure><p>3. Place the ATMEGA328P-PU and Ublox NEO-6M GPS Module in the window and then select the relevant capacitors and 16MHz oscillator and connect the lines.</p><p>Ø First establish the connection between the NEO 6M module and the ATMEGA328P-PU</p><p>Ø Then connect the connections with respect to the oscillator and the capacitors as shown in the above figure.</p><p>Ø Here we have used 22PF two capacitors, 100UF two capacitors, and 1UF capacitor.</p><p>Ø In order to regulate the power we have used the L7805 voltage regulator that is used to convert from 12V to 5V.</p><p>Ø We then establish the connections with the ATMEGA328P-PU as shown in the below figure.</p><p>Ø We have used a 100UF capacitor in order to reduce the noise of the circuit.</p><p>4. We then connect the GSM module by connecting the following pins:</p><p>· RX of GSM to TX of ATMEGA328PU</p><p>· TX of GSM to RX of ATMEGA328PU</p><p>· GND of GSM to GND of ATMEGA328PU</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/1*lH8bAFQSj16NSOWdbTIuIQ.png" /><figcaption>Figure 3</figcaption></figure><p>After all the routings are done the PCB will be displayed as follows</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*VbTbSQ66u3p76xt3_49Gug.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=507f5329c3a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DC MOTOR PWM CONTROLLED THROUGH MATLAB & C200]]></title>
            <link>https://medium.com/@jinalkaherath/dc-motor-pwm-controlled-through-matlab-c200-b3d2971b28b3?source=rss-3468fa76366------2</link>
            <guid isPermaLink="false">https://medium.com/p/b3d2971b28b3</guid>
            <dc:creator><![CDATA[Jinalka Herath]]></dc:creator>
            <pubDate>Tue, 07 Nov 2023 15:08:46 GMT</pubDate>
            <atom:updated>2023-11-08T15:02:04.170Z</atom:updated>
            <content:encoded><![CDATA[<p>DC motors are used in various applications, including robotics, automation, and automotive systems. They control speed, direction, and pulse width modulation (PWM), which switches power supplied to the motor. In this practical, MATLAB and C200 microcontrollers are used to control the DC motor using PWM. MATLAB serves as the controlling environment, while C200 executes motor control logic in real-time. The MATLAB con trolling abilities and C200 PWM generation abilities can be developed using motor control algorithms. Code Composer Studio is used to interface the DC motor with MATLAB, and the F28379D Launchpad is used for real-time motor control tasks. The F28379D Launchpad provides a user-friendly platform for code development, debugging, and optimization. These tools enable greater flexibility in developing and controlling motor control solutions for various motor types and application requirements.</p><h4>METHODOLOGY</h4><ol><li>First, connect the motor driver controller pins of L298N to the C2000 as follows:</li></ol><p>▪ Connect the IN1 to pin 79</p><p>▪ Connect the IN2 to pin 80</p><p>▪ ENA to GPIO 0 (PIN 40)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*CGDMJUU8hR5zdJAGTaiu4g.png" /><figcaption>Figure 1</figcaption></figure><p>2. Connect the power supply of the C2000 and the motor driver circuit</p><p>▪ Connect the GND of L298N to the GND of C2000</p><p>▪ Also take another output from the GND of the L298N to the negative terminal of the power supply.</p><p>▪ Connect the 12V to the positive terminal of the power supply.</p><p>3. Connect the encoder to the C2000</p><p>▪ Connect the encoder channel A to GPIO105 (pin9)</p><p>▪ Connect the encoder channel B to GPIO104(pin 10)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*hYkAo-MqYLikNHgVdwzhCg.png" /><figcaption>Figure 2</figcaption></figure><p>4. We then set up MATLAB in order to provide the commands for C2000 to run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*0IVwDIED82b4ytma2_PO7A.png" /><figcaption>Figure 3</figcaption></figure><p>5. First, we insert an epwm block by searching in the C2000 block as shown in the above figure.</p><p>6. We then need to set some settings in order to set the epwm.</p><p>▪ Set the Timer period unit — seconds</p><p>▪ Timer period — 0.0001</p><p>▪ Under the timer window</p><p>▪ Enable epwm1A</p><p>▪ Set CMPA units — Percentages</p><p>▪ Specify CMPA VIA — Input port</p><p>▪ Set the constant to epwm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*ph6RkuVHw8VZv-VrSr245A.png" /><figcaption>Figure 4</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*dyhWyJRrKXrF0phd4vzmBQ.png" /><figcaption>Figure 5</figcaption></figure><p>7. The epwm window will be displayed as above when all the configurations are done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*Ihj60QAQ1EMUGEOIhS488A.png" /><figcaption>Figure 6</figcaption></figure><p>8. In order to provide the input pins to the motor driver we set to digital output pins.</p><p>▪ Set the pins GPIO6 to one digital output</p><p>▪ Set the pins GPIO7 to one digital output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*xx0beWbchO0bNCp7Q_r5hA.png" /><figcaption>Figure 7</figcaption></figure><p>9. We need to get the current reading of the motor for this we use the encoder reading.</p><p>▪ We first select the eqep block</p><p>▪ Set the sample time — -1</p><p>▪ Enable software initialization</p><p>▪ Set initialization — 2147483848</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*gzieM_77MxpNrYDIZAYklQ.png" /><figcaption>Figure 8</figcaption></figure><p>10. We then add a data type conversion to convert a single datatype to double. (Set data type to double).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*aOXQK5CRGq0IRwfyd05uDA.png" /><figcaption>Figure 9</figcaption></figure><p>11. We then add a rate transition block to make the speed low</p><p>Set rate transition output sampling time — 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*BHgaN-t4PGpS6RkZNaXcDA.png" /><figcaption>Figure 10</figcaption></figure><p>➢ We then use a gain to convert the value to 1/922.</p><p>➢ We then place a discrete derivative to convert the position.</p><p>➢ Another gain is placed to convert the value to RPM by multiplying by 60.</p><p>➢ To convert the speed controller to the potentiometer.</p><p>➢ WE then open ADC block</p><p>▪ Set ADC MODULE — A</p><p>▪ ADC Resolution — 12-bit</p><p>▪ Sample time — -1</p><p>▪ Data type — Double</p><p>▪ Conversion channel- ADCIN0</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*vf0P2I3As0K1KeXhWDMxIQ.png" /><figcaption>Figure 11</figcaption></figure><p>12. To convert the value from 0–100</p><p>Gain = 100/4092</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*1JQlFgJxGvCoDRXwILQ7PA.png" /><figcaption>Figure 12</figcaption></figure><p>13. We then place the above block to the Epwm block as below.Insert a gain in the following position</p><p>Gain = (1/270) *100</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ZpTdJg9XEQfFmePtfdp1dg.png" /><figcaption>Figure 13</figcaption></figure><p>14. In order to provide the input to the controller we need to place a discrete conversion</p><p>▪ Proportional- 1</p><p>▪ Integral — 0</p><p>▪ Go to saturation and set to +100 to -100</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*oqnTNdfVJ4YtDXNgivhZ2g.png" /><figcaption>Figure 14</figcaption></figure><p>15. We use a MATLAB function and change the condition as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*5zOPlOiRZsr0MxM2rc33aw.png" /><figcaption>Figure 15</figcaption></figure><p>16. We create subsystems of each and every block as required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*oXjy4VEtVRwizgcmqN4p4Q.png" /><figcaption>Figure 16</figcaption></figure><p>17. We then set the connections between all the blocks and follow. We place the displays in order to read the output as follows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*-c7kFcMr4BHGVBTjcV9hcQ.png" /><figcaption>Figure 17</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3d2971b28b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automated Coconut Stove Cooker]]></title>
            <link>https://medium.com/@jinalkaherath/automated-coconut-stove-cooker-130857115bf3?source=rss-3468fa76366------2</link>
            <guid isPermaLink="false">https://medium.com/p/130857115bf3</guid>
            <dc:creator><![CDATA[Jinalka Herath]]></dc:creator>
            <pubDate>Tue, 07 Nov 2023 14:08:50 GMT</pubDate>
            <atom:updated>2023-11-08T14:15:53.348Z</atom:updated>
            <content:encoded><![CDATA[<p>This system is been used to control the speed of the fan in the coconut stove cooker. Previously the coconut stove fan was controlled manually to increase the heat but through this system, the fan could automatically control its speed itself. We use the Temperature sensor (DHT 11) to detect the temperature of the stove and Wi-Fi module. Connecting through Wi-Fi I can control the speed of the fan in an emergency by Connecting the fan through the URL to the phone. I chose this project to ease the process of coconut stoves where with the help of this process we could control the fan through the phone and also the fan will automatically adjust its speed according to the temperature. With the help of the system, the fan can automatically adjust itself and will automatically operate according to the temperature. DHT 11 sensor is highly reliable and also consists of long-term stability. The high-performance 8-bit controller is connected. He also includes a resistive element and a wet NTC temperature measuring device. It also has excellent quality, fast response, and anti-interference ability. Calibration is stored in OTP program memory. Some specifications of this sensor are it has a supply voltage of 5V, temperature range of 0–50 ‘c, and humidity of 20% — 90%. A relay is an electrical switch that is being operated using an electromagnet. The electromagnet is activated by a low-power signal from the microcontroller. It is used in control panels, manufacturing, and building automation to control the power along with switching smaller current values in the control circuit.</p><p><strong>Hardware required :</strong></p><ol><li>DHT 11 (Temperature Sensor)</li></ol><p>2. Breadboard</p><p>3. Jumper wires</p><p>4. 12V DC fan</p><p>5. 3.7V 18650 * 3 Batteries</p><p>6. Relay</p><p>7. ESP8266</p><p><strong>Methodology</strong></p><p>We connect the ESP 32 to the breadboard and then we connect the fan using the relay also power the fan using 3*3.7V batteries. We connect the fan and batteries with ESP32 using the D3 pin of ESP32. We also connect the DHT 11 sensor to the breadboard and connect it with ESP32 the D4 pin. We then enter the code into ESP32 to run the process. The process will work as the fan will be on if the temperature is below 30 c and as the system has reached above 30 c the fan will be off.  Relay is been used in the system to let the current flow in or flow out of the system where 3.3v is controlled by relay to ESP32.  Here we control the fan at a temperature of 30 c because we need to on the fan when the temperature of the cooker is lower to do that, we select a temperature of 30 c for n the fan so that the stove can operate without any hassle. We use three 18650 (3* 3.7V 18650) batteries to gain a voltage of 12V. Also, to control the fan I used the Remote XY app to on off the fan using the smartphone or the computer. So, the user can control the fan through the smartphone without going near it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*PGR7UoE2mTFGhYBHGUzVyw.png" /><figcaption>Figure 1</figcaption></figure><h3>Program</h3><p>First, we install the Arduino IDE to the computer and we then start building the circuit a schematic diagram of the circuit is designed first using fritzing so that it will be easy to make the circuit without hassle. We then connect the fan to the relay and the relay is been connected to the ESP32 using the D3 pin and the ground pin. We then run the code in the Arduino IDE and we first install the libraries of DHT11, ESP 32 library, and also the Remote XY library. We also define the pins first at the start of the Arduino and also the libraries used. Then we upload the code to the Arduino and first, we compile the code and then we upload the code to the ESp32. After the code is successfully uploaded the system will start to run.</p><h3>Testing Methods</h3><p>I tested it with the coconut stove cooker and I could distinguish that as the temperature of the cooker reduced the fan started to run and it could increase the fire of the stove as shown in the figure below. We also could turn off the fan using the Remote XY app where the consumer of this product could on or off the fan when it’s required even if he doesn’t want to stay until the DHT 11 does the controlling job of the fan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*EwQhPYG0sGlm9qlJ8qH5fw.png" /><figcaption>Figure 2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*Qnl-gj2w_0oMls3iV4yneQ.png" /><figcaption>Figure 3</figcaption></figure><p>Source Code :<a href="https://github.com/JinalkaHerath/Automated-Coconut-Stove-Cooker.git">https://github.com/JinalkaHerath/Automated-Coconut-Stove-Cooker.git</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=130857115bf3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>