<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pius</title>
    <description>The latest articles on DEV Community by Pius (@pius171).</description>
    <link>https://dev.to/pius171</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F846966%2Fe6216091-2202-4743-8380-386206a3aca7.png</url>
      <title>DEV Community: Pius</title>
      <link>https://dev.to/pius171</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pius171"/>
    <language>en</language>
    <item>
      <title>PIATRON: Arduino and Web-based food counting system</title>
      <dc:creator>Pius</dc:creator>
      <pubDate>Thu, 31 Aug 2023 11:09:58 +0000</pubDate>
      <link>https://dev.to/pius171/piatron-mcf</link>
      <guid>https://dev.to/pius171/piatron-mcf</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_PGi4bGq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ryqcci5lvs7riayb95lx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_PGi4bGq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ryqcci5lvs7riayb95lx.png" alt="The team" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On July 7th, 2023, we started our SIWES 1 program, my group was assigned to build a food monitoring system for the school cafeteria. Usually, when students or staff come to the cafeteria they might get there and see that their food is not available, our task was to help students, staff and other personnel in the school know the amount of each food available for sale at any given moment. After speaking with the school cafeteria staff and our assigned mentors we came up with a solution. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First, the amount of food available will have to be uploaded to a database. We achieved this via two methods.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One: building a mass scale to measure the mass of food produced and estimating the number of portions of food being weighed, which is then uploaded to our database. For our database, we decided to use Firebase Realtime Database.&lt;/p&gt;

&lt;p&gt;Two: manually inputting the number of portions via a web page&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Secondly, a device is provided to the food vendors, allowing them to deduct the quantity of food as it is sold using the provided interface. This interface utilizes a tap-and-go system, designed to minimize the time spent on deducting sold food items. As deductions are made, the database is automatically updated.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Technologies used/ Topics covered
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Arduino framework&lt;/li&gt;
&lt;li&gt;Arduino C/C++&lt;/li&gt;
&lt;li&gt;Bluetooth classic via HC-05 Bluetooth module&lt;/li&gt;
&lt;li&gt;Soldering&lt;/li&gt;
&lt;li&gt;Wheatstone bridge&lt;/li&gt;
&lt;li&gt;Stress and Strain principles&lt;/li&gt;
&lt;li&gt;&lt;a href="https://en.wikipedia.org/wiki/Floor_and_ceiling_functions"&gt;Floor functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://kodular.io"&gt;Kodular&lt;/a&gt; Low-code development platform&lt;/li&gt;
&lt;li&gt;HTML,CSS,JavaScript&lt;/li&gt;
&lt;li&gt;Firebase&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Materials used
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;- Arduino Nano&lt;/li&gt;
&lt;li&gt;-Perspex for enclosure&lt;/li&gt;
&lt;li&gt;-Bolts and nuts&lt;/li&gt;
&lt;li&gt;-L shaped rivets&lt;/li&gt;
&lt;li&gt;- 20kg load cell&lt;/li&gt;
&lt;li&gt;-HX711 24bit ADC amplifier &lt;/li&gt;
&lt;li&gt;-some wires&lt;/li&gt;
&lt;li&gt;-Jumper cables&lt;/li&gt;
&lt;li&gt;-HC-05 Bluetooth module&lt;/li&gt;
&lt;li&gt;-Female headers&lt;/li&gt;
&lt;li&gt;-Male headers&lt;/li&gt;
&lt;li&gt;-Micro USB breakout board&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The load cell
&lt;/h2&gt;

&lt;p&gt;The load cell is made of an aluminium bar and 4 strain gauges. A holder is perforated on the aluminium bar so that when force is applied to the rod, most of the stress will be around the perforated area. At the loci where the rod is perforated the 4 strain gauges are placed. This is the ensure that the strain gauge gets the most of the strain applied on the rod. &lt;/p&gt;

&lt;p&gt;When the strain gauges detect any strain, their resistance change, so in order to change their changes in resistance to change in voltage, the four strain gauges are connected in a Wheatstone bridge style&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mboYstfy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3uimdsyxwna6q2qkcqb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mboYstfy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e3uimdsyxwna6q2qkcqb.png" alt="Wheastone bridge" width="800" height="435"&gt;&lt;/a&gt;&lt;br&gt;
(Electronoobs, 2020)&lt;/p&gt;

&lt;p&gt;However, the voltage change is very small, so we use the HX711 24-bit ADC amplifier to amplify the voltage, which is then fed to the MCU to perform the required calculation to get the weight of an object&lt;/p&gt;
&lt;h2&gt;
  
  
  The Mass scale
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--haam2qEv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cik39ld7dzxutuqgvsz2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--haam2qEv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cik39ld7dzxutuqgvsz2.png" alt="Image description" width="800" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The mass scale, as the name implies, is designed to measure the mass of food placed on it. To accomplish this, we utilized a 20kg load cell in conjunction with the HX711 24-bit ADC amplifier for precise mass measurement. The measured mass is then transmitted to the mobile app via Bluetooth, employing the HC-05 Bluetooth module. Below is the schematic diagram illustrating the circuit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cL-xIve2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdto8oo5o29n9ijqbijd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cL-xIve2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xdto8oo5o29n9ijqbijd.png" alt="Schematic diagram of mass scale" width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ObpyJSYQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/on645ovocoxjl435a7z2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ObpyJSYQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/on645ovocoxjl435a7z2.png" alt="The circuit" width="608" height="497"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To access the design file use this &lt;a href="https://a360.co/46bFO4h"&gt;link&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  The mobile app
&lt;/h2&gt;

&lt;p&gt;The mobile app gets the mass of the food via Bluetooth from the mass scale, estimates the number of portions and posts it in the database.&lt;/p&gt;

&lt;p&gt;When a user first launches the app, the user will be greeted with the login page&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C1IrglGQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pbn3k93pzp0tqyceupn8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C1IrglGQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pbn3k93pzp0tqyceupn8.png" alt="Login page" width="287" height="641"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After the login is successful, the user will then enter the main app page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g7lH1K4L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tns7ioww4m8o4oz2j1op.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g7lH1K4L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tns7ioww4m8o4oz2j1op.jpg" alt="app page" width="540" height="1204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To connect to the mass scale, the user will have to click on the Bluetooth Icon to activate a list picker with a list of all paired Bluetooth devices. &lt;em&gt;Note: if you have not paired with the mass scale beforehand, pair with it in your mobile phone Bluetooth settings, as it can't be done from the app&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vj6wwQJy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lgigy5b4b19gjqul2ffr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vj6wwQJy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lgigy5b4b19gjqul2ffr.jpg" alt="list of paired bluetooth devices" width="540" height="1204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;select the mass scale, its name on the list is H-C-2010-06-01 and wait for it connect. When connected, the "not connected" text will change to "CONNECTED"&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rTr2A2jM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/azqon0n9xpx71eunhqsc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rTr2A2jM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/azqon0n9xpx71eunhqsc.jpg" alt="connected" width="540" height="1204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now that the device is connected when a load is placed upon it you should see the mass in gram on the mobile app.&lt;/p&gt;

&lt;p&gt;(image of app showing mass)&lt;/p&gt;

&lt;p&gt;To upload food quantity using the weight sensor you have to select the location the food is going to &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G3mZiCtB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ik50bv4ixz9pxc6f1wa.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G3mZiCtB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ik50bv4ixz9pxc6f1wa.jpg" alt="select location" width="540" height="1204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and then you select the food you are weighing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Rv_-wq0X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4kd3ka5dri4rhmm44jrv.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Rv_-wq0X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4kd3ka5dri4rhmm44jrv.jpg" alt="select food" width="540" height="1204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then you click the estimate portion button to estimate the amount of food portions in what is being weighed this is done using the mass per portion for the particular food being weighed. Sometimes the results for the calculation return decimals, so a floor function is used to convert it to the greatest integer less than the decimal number obtained. So if the estimated portions was 10.7 portions this means you will see 10 portions on the app and that is what will be sent to the database&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QMW2XzcU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xqad0v2v9l3j48l9qil4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QMW2XzcU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xqad0v2v9l3j48l9qil4.png" alt="Image when estimate button is pressed" width="448" height="998"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The undo button is used to reverse a previous update sent to the database, while the TARE button is used to reset the measurement to zero on weighing scales. The TARE function subtracts the current weight of the container, or any additional load placed on the scale, ensuring that only the net weight of the desired substance is displayed. This is particularly useful when measuring ingredients in cooking or obtaining accurate weight readings in various industrial and laboratory applications. The TARE button essentially "zeroes out" the scale, allowing you to work with precise measurements without needing to account for the weight of the container or other items.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Web Application
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pZS3AAlg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62p50gazmihbq9fe6nta.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pZS3AAlg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62p50gazmihbq9fe6nta.png" alt="Home page" width="800" height="400"&gt;&lt;/a&gt;&lt;br&gt;
The image above is the home page of the web application where all food is available in the cafeteria, with their quantities at various locations shown. Anyone can access this page. The admin page houses all administrative functions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create, edit and delete a food&lt;/li&gt;
&lt;li&gt;Get production and sales report&lt;/li&gt;
&lt;li&gt;Create a food timetable/Menu&lt;/li&gt;
&lt;li&gt;Get sales report&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To button to access the admin page is at the top right corner of the page named Admin.&lt;/p&gt;
&lt;h3&gt;
  
  
  The Admin dashboard
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--L_qmfGqu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sqlf6d7m12tijnlwwizf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--L_qmfGqu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sqlf6d7m12tijnlwwizf.png" alt="Admin dashboard" width="800" height="455"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The admin dashboard is the command-and-control centre for the cafeteria staff. For the staff to access this page, they have to log in with the cafeteria email and pin which is sent to them every morning. The admin page boasts many features such as;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The dashboard which when clicked shows; the statistics of the day’s data such as the total food quantity sold, total income, total order received, the most demanded product and the least demanded product. It also contains a create menu button at the top right corner of the page which allows the user to create a menu for the day based on different preset menu groups. A reset button can also be found there, this button resets the quantity of items produced and sold to zero thereby making the quantity available zero. Product data displays the various food items as they are being sold at various locations in the order in which they are entering. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Home nav link on the sidebar takes the user to the index page that displays the menu for the day.&lt;br&gt;
.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The generate report page displays a search box where a user enters a date in the format year – month – date, and on clicking on the generate report button, the user gets a downloaded pdf report of the report for that day.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h4&gt;
  
  
  Create Menu/Timetable
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--keEB-0Eo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fazmyqmy5hdq2w5wce41.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--keEB-0Eo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fazmyqmy5hdq2w5wce41.png" alt="Create menu" width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Above is the create menu modal that pops when the create menu is clicked. It allows the user to create a new menu group, which is a combination of food items stored together under a group name to be used later in creating the menu for the day. This is to make creating the menu for the day easy and efficient.&lt;/p&gt;
&lt;h4&gt;
  
  
  Add new food
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--I9I5P3S0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/traynak7n8bfpfw02yqd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I9I5P3S0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/traynak7n8bfpfw02yqd.png" alt="Add new food" width="800" height="348"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To add a new food click the add new food item nav link which opens a modal with a form that collects information about the new food you want to create, after the form is filled the food is created and stored in the database.&lt;/p&gt;
&lt;h4&gt;
  
  
  Sales Page
&lt;/h4&gt;

&lt;p&gt;The sales page is used by the staff selling food at the counter, anytime food is sold the staff at the counter click on the amount of food sold, and this immediately updates the database real-time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1gXfXVGC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j7ti0s10cq9dwitqiasx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1gXfXVGC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j7ti0s10cq9dwitqiasx.png" alt="Sales page" width="800" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The sales page is accessed via the admin dashboard. Click on the &lt;strong&gt;INCOME&lt;/strong&gt; nav link and select the location where the food is being sold, you will then be greeted with a page showing the food available in that area. The page is designed in such a way that it would take minimal effort and time to deduct food quantities, the staff selling the food just has to tap on the number of the item sold and this is immediately deducted from the database.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FrHi3y3C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovq55a4b6a1c8upsknzk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FrHi3y3C--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ovq55a4b6a1c8upsknzk.png" alt="Image description" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I and my team members presented the project on the exhibition day and it worked amazingly well here is a video of us during the fabrication process.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/BfClN_kzvBE"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;To access the code for the mass-scale check my &lt;a href="https://github.com/Pius171/PIATRON-Automated-Food-Counter-Mass-Scale.git"&gt;GitHub repository&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In summary, our journey to create a food monitoring system for the school cafeteria was a rewarding experience that showcased the power of technology to solve real-world problems. By combining hardware innovation with software development, we've laid the foundation for a more efficient and user-friendly cafeteria experience. Our project reflects our commitment to using technology to improve everyday processes, and we look forward to future opportunities to make a positive impact through innovation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Meet the team
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/pius-ndukwu-75b07a1b9/"&gt;Pius&lt;/a&gt; (Embedded Systems Developer): Pius is a visionary embedded software developer, driven by an unwavering passion to revolutionize the embedded system landscape in Nigeria. From his formative high school days to his current endeavours, he has consistently displayed an innate talent for crafting ingenious embedded software solutions. His skill set encompasses not only cutting-edge embedded software development but also exceptional communication, seamless teamwork, astute critical thinking, and a strong entrepreneurial spirit.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/onyedika-igwe-823491225/"&gt;Igwe&lt;/a&gt; (Head of Design): Igwe is an aspiring control systems Engineer currently studying Electrical engineering at Pan-Atlantic University. He has had many experiences with design from software UI designs to hardware CADs. He embodies a number of problem-solving skills such as logical reasoning and critical thinking.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/al-hameen-mohammed/"&gt;Al-Hameen Mohammed&lt;/a&gt; (Project Manager): Al-Hameen Mohammed is a talented web developer on a mission to craft exceptional online experiences. With a solid foundation in web development technologies, he brings websites to life through his coding expertise. Al-Hameen's journey in web development started with a strong passion for creating visually appealing and user-friendly websites. He excels in front-end and back-end development, mastering languages such as HTML, CSS, JavaScript, and various frameworks. Al-Hameen is dedicated to delivering responsive, efficient, and interactive web solutions, making him a valuable asset in the world of web development.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/paul-avbenake-271290105/"&gt;Dr. Paul Onoriode Avbenake&lt;/a&gt; (Mentor):Dr. Paul Onoriode Avbenake is a faculty member at The School of Science and Technology, at Pan-Atlantic University. He obtained his B.Sc. in Chemical Engineering from The University of Lagos and M.S.C in the same field from Ahmadu Bello University (ABU), Zaria. His research interests are Catalysis, Energy, Waste management, Mathematical simulation, and Water harvesting. He has published several journal articles and contributed various book chapters with international publishers as well as presented his research at several international conferences. He is equally a registered COREN, NSChE, and a member of the African Membrane Society (AMS).&lt;/p&gt;

&lt;p&gt;Dr Agholor joined Pan-Atlantic University in 2016 as a member of the SMSS faculty of the School of Management and Social Sciences where he taught Leadership and Elements of Management. In October 2020, he became the pioneer dean of the School of Science and Technology.&lt;/p&gt;

&lt;p&gt;Prior to joining Pan-Atlantic University, he had been a co-creator and later Director of a social enterprise, the Institute for Industrial Technology (IIT), which has become a reference institution in the development of middle-level technical manpower for the industrial sector of the economy. He is a member of the IIT governing council. He has over 15 years of management experience in the non-profit sector.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/darlingtonagholor/"&gt;Dr. Agholor Darlington&lt;/a&gt;(Mentor): Dr. Agholor graduated in Mechanical Engineering, and later obtained an MSc in Industrial Engineering, both at the University of Ibadan and then a Doctorate in Industrial Management at the University of Navarre, Spain.&lt;/p&gt;

&lt;p&gt;His current research is in mentoring and competency development.&lt;/p&gt;

&lt;h2&gt;
  
  
  Contributions
&lt;/h2&gt;

&lt;p&gt;Al-hameen built the web application for the automated food counter, drew out the team project plan, and participated in the fabrication of the mass scale. Igwe created the CAD designs for the mass scale, the web application designs, designed the company’s logo, participated in the fabrication of the mass scale, and designed the manual for our product. Pius procured the materials needed, wrote the code for the embedded system, designed and built the electrical circuit, participated in the fabrication of the mass scale, and wrote this article. Our mentors, Dr. Paul Onoriode Avbenake and Dr. Agholor Darlington provided invaluable guidance and expertise throughout our journey, helping us transform our vision into a successful reality.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>arduino</category>
      <category>frontend</category>
      <category>firebase</category>
    </item>
    <item>
      <title>Getting Started with Tasmota and Introduction to Tasmota Templates</title>
      <dc:creator>Pius</dc:creator>
      <pubDate>Wed, 14 Sep 2022 15:00:13 +0000</pubDate>
      <link>https://dev.to/pius171/getting-started-with-tasmota-and-introduction-to-tasmota-templates-3p44</link>
      <guid>https://dev.to/pius171/getting-started-with-tasmota-and-introduction-to-tasmota-templates-3p44</guid>
      <description>&lt;h2&gt;
  
  
  What is Tasmota?
&lt;/h2&gt;

&lt;p&gt;Tasmota is an open-source firmware created by Theo Arends for smart home devices using the ESP wifi chip. Tasmota is very common and is compatible with various smart home platforms such as TUYA, Google Home, Home assistant etc. In the course of this article, you will be introduced to Tasmota and its most basic functionality, templates and how to create your own template.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Tasmota to your ESP WiFi chip
&lt;/h2&gt;

&lt;p&gt;For this article, I will be using the node MCU ESP8266 chip. First, we will have to download the firmware. Here are the links to download the Tasmota firmware.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://drive.google.com/uc?export=download&amp;amp;id=1f3-QKQrIE3AC1qu4HVPNiGXSrWKsczbJ" rel="noopener noreferrer"&gt;Tasmota.bin&lt;/a&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://drive.google.com/uc?export=download&amp;amp;id=1INBGJufvj8Sx-KFV7OHEL4J81rnQwbRy" rel="noopener noreferrer"&gt;Tasmota IR&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://drive.google.com/uc?export=download&amp;amp;id=1vouIxSx3odEYwV7P6RZx2or3fcwFsBzN" rel="noopener noreferrer"&gt;Tasmota Display&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To download the .bin file directly from tasmota click &lt;a href="http://ota.tasmota.com/tasmota/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are several ways to install Tasmota to your esp board but my favourite way is to use esptool, to use esptool you need python installed on your computer. After installing python open your computer terminal and type in &lt;/p&gt;

&lt;p&gt;&lt;code&gt;pip3 install esptool&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After the installation type in the following command in the terminal&lt;/p&gt;

&lt;p&gt;&lt;code&gt;esptool.py --port [com port] erase_flash&lt;/code&gt; this is to erase the flash memory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;esptool.py --port [com port] write_flash -fs 4MB -fm dout 0x0 [location of .bin file]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;replace the part labelled com port with the com port your board is connected to and the part &lt;em&gt;location of .bin file&lt;/em&gt; to the location of the .bin file. &lt;br&gt;
Yours should look something like this if you use Linux&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;esptool.py --port /dev/ttyUSB0 write_flash -fs 4MB -fm dout 0x0 /home/pius/Documents/tasmota/tasmota.bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For more information on flashing tastmota to esp boards visit &lt;a href="https://tasmota.github.io/docs/Getting-Started/#flashing" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tasmota Setup
&lt;/h2&gt;

&lt;p&gt;After installing Tasmota to your board, go to the wifi settings on your laptop or mobile phone, you should see a WiFi device named tasmota.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F704bwlyhij5s6j178ilx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F704bwlyhij5s6j178ilx.png" alt="Tasmota WiFi"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Connect to it and a config page should pop up on your screen, if you don't see a pop up, plug your board to your PC if it not already plugged in and open up Arduino IDE or any serial terminal. Open the serial monitor in Arduino and chose 115200 baud rate, then connect to your board and press the reset button on your micro controller board, you should see the the IP address on the serial terminal. Like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9q4xac8mofjg9odxb2rc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9q4xac8mofjg9odxb2rc.png" alt="Arduino Serial Terminal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After gaining access to the config page input your router's credentials and click save.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6fb4ykh1dwe7t7pmg6c3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6fb4ykh1dwe7t7pmg6c3.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the connection is successful, you should see a new IP address on the serial terminal. connect back to your router and type in that IP address in your browser. If the setup was successful you should be greeted with a page like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx927elba50l9mpoahxj0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx927elba50l9mpoahxj0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tasmota Templates
&lt;/h2&gt;

&lt;p&gt;Normally when using ESP8266 you would have to write code to make it do stuff for you,but with Tasmota templates you just have to set certain parameters and you are good to go.&lt;/p&gt;

&lt;p&gt;To get started, on the home page click on Configuration and then Configure templates. You should have something like this on your screen. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5fsgkz9nvdg062aq57q3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5fsgkz9nvdg062aq57q3.png" alt="Configure templates"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the &lt;em&gt;name&lt;/em&gt; text-box you can put any name you want, in the  &lt;em&gt;based on&lt;/em&gt; drop-down, you are to choose a device in which your template will be based on, but for this article we would use &lt;strong&gt;Generic&lt;/strong&gt;. If you click on any of the drop-downs for any GPIOs you would see things like buttons, Led, PWM etc. The scope of this article will only be covering buttons, Leds and relays.&lt;/p&gt;

&lt;h3&gt;
  
  
  Buttons
&lt;/h3&gt;

&lt;p&gt;Buttons are simply physical inputs, so if I wanted to control the onboard LED connected to GPIO2 via the  flash button connected to GPIO0 on the ESP8266, my template configuration would be like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7720jockhc2kasrd1sa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo7720jockhc2kasrd1sa.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the image, you can see I choose button 1 and led 1, this means that if you want a particular input to control an output, in this case our LED, the led and the button must have corresponding numbers. The same applies to relays also. After selecting the correct button and led click on &lt;em&gt;save&lt;/em&gt; to save the template, but we aren't done yet, we still have to activate our template. After the template has been saved you should a button &lt;em&gt;main menu&lt;/em&gt; click on it to go back to the home page. In the home page click on configure and then click on configure other. If you followed the steps correctly you should see be seeing this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbpra1ekxgkr7ytrigwid.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbpra1ekxgkr7ytrigwid.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;check the activate box in the template section to activate your template and click save&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6x5gmxbct3njxmbegnfk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6x5gmxbct3njxmbegnfk.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now when you are back at the home page press the GPIO0(flash button on your ESP8266, the onboard led should toggle.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/BdirjxhbKZc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Relay
&lt;/h3&gt;

&lt;p&gt;Relays works the same way as buttons but they are virtual; If you choose a relay instead of a button a virtual button will appear on the home page which we can use to toggle an led. Set up your template like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft6gzqffbuvospmu7y2ve.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft6gzqffbuvospmu7y2ve.png" alt="set up relays"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;then when you go to the home page, you should have something like this&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fghwlg6ws42xbgxzd5u9r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fghwlg6ws42xbgxzd5u9r.png" alt="virtual button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is a video demonstration&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/Zi1TfDyssds"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;for more information on Tasmota templates click &lt;a href="https://tasmota.github.io/docs/Templates/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Tasmota pre-built templates
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Making things easy is hard &lt;em&gt;ted nelson&lt;/em&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Someone put in a lot of hard work to create a repository containing various templates for esp8266 based smart devices, so we have a bank of ready-to-use templates to make using Tasmota easier. To access the site click &lt;a href="https://templates.blakadder.com/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. Let me walk you through on how to use the pre-built templates.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;On the site click on development boards&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Scroll to Adafruit HUZZAH ESP8266 Development Board and click on it&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy the configuration from the web page &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvmgu13tzlngprvuv44lt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvmgu13tzlngprvuv44lt.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then go back to the config web page of Tasmota and navigate to &lt;em&gt;configure other&lt;/em&gt; and paste the configuration you copied into the template text box and click save.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftacm8cic0uz1fgwga13y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftacm8cic0uz1fgwga13y.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now when you press the GPIO 0 (flash button) on the ESP8266 the LED will toggle.&lt;/p&gt;

&lt;p&gt;You can apply this same steps to other templates in the repository.&lt;/p&gt;

&lt;p&gt;Tasmota makes it very easy to build a home automation system without code, imagine turning your regular home into a smart home without writing a single line of code or starting a business with it. So try out Tasmota today and thanks for reading.&lt;/p&gt;

</description>
      <category>esp8266</category>
      <category>iot</category>
      <category>beginners</category>
    </item>
    <item>
      <title>ESP8266 WiFi range extender Arduino</title>
      <dc:creator>Pius</dc:creator>
      <pubDate>Mon, 01 Aug 2022 12:11:00 +0000</pubDate>
      <link>https://dev.to/pius171/esp8266-wifi-range-extender-arduino-31jc</link>
      <guid>https://dev.to/pius171/esp8266-wifi-range-extender-arduino-31jc</guid>
      <description>&lt;p&gt;My mum has a portable WiFi device which is most time in her room, so the WiFi doesn't get to the living room and that's a problem but I love to solve problems so i did some &lt;em&gt;googling&lt;/em&gt; and I found a GitHub repository for an ESP8266 repeater by martin-ger,the repo had a binary file for the repeater so I just flashed it into my esp8266 using &lt;em&gt;esptool&lt;/em&gt; and it worked like magic. Click &lt;a href="https://github.com/martin-ger/esp_wifi_repeater"&gt;here&lt;/a&gt; to access the repository; however, there were some problems I had with this repeater(extender):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The web ui interface can't scan for WiFi networks so I don't know when I am in the range of the router unless I use the serial interface.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Debugging can be carried out by noting the rate at which the led is blinking, but there a catch, the led state when it is connected to the router and when my phone connects to it as an access point is the same, so i get confused because I can't tell if is connected to the router or if my phone is connected to it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Due to this, I decided to build mine and fortunately Arduino had an &lt;a href="https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/RangeExtender-NAPT/RangeExtender-NAPT.ino"&gt;example&lt;/a&gt; for a WiFi range extender, so i Just added a WiFi manager and viola you have a WiFi range extender. Here are some feature of my WiFi range extender:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Scan for networks (refresh page to scan)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;WiFi manger via web ui&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;led indicator for debugging &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Reset button to return to factory setting&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Yup! that all there is to it. I built this extender to meet my own need and I hope it is able to meet your needs for this reason I can't say my WiFi extender is better than martin-ger esp-repeater which is packed with features such as automesh, mqtt, web config interface,CLI, WPA2 Enterprise Config,TCP/IP Config etc.&lt;/p&gt;

&lt;p&gt;Enough about martin-ger esp-repeater let come back to my WiFi extender😥️.&lt;/p&gt;

&lt;h2&gt;
  
  
  Uploading the code
&lt;/h2&gt;

&lt;p&gt;You can get the code from my &lt;a href="https://github.com/Pius171/esp8266-wifi-extender"&gt;GitHub repository&lt;/a&gt;. You can either flash your esp8266 with the bin file or you can edit the .ino file as you please ( I will be sure to look up any pull requests) and upload to your board.&lt;/p&gt;

&lt;h3&gt;
  
  
  flashing with esptool
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;first install esptool&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;pip3 install esptool&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Erase flash&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;esptool.py --port /dev/ttyUSB0 erase_flash&lt;/code&gt;&lt;br&gt;
if you are using windows change /dev/ttyUSB0 to the COM port your esp8266 is connected to.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Upload bin file&lt;/strong&gt;&lt;br&gt;
run this on the terminal&lt;br&gt;
&lt;code&gt;esptool.py --port /dev/ttyUSB0 write_flash -fs 4MB -fm dout 0x0 [bin file location]&lt;/code&gt;&lt;br&gt;
Do not include the bracket in the terminal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Speed test
&lt;/h2&gt;

&lt;p&gt;Before we go into the nitty-gritty of this article, look at the speed test.&lt;br&gt;
There is roughly an 80% speed drop 😥️😥️😥️. Yes that's a lot&lt;/p&gt;

&lt;p&gt;Here is my router speed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--axcd0ni1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tkh632r5534393lcb0v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--axcd0ni1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8tkh632r5534393lcb0v.png" alt="router speed test" width="880" height="742"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the extender speed&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Bsfu56ec--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ui89twkk342j6qfpv74.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Bsfu56ec--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3ui89twkk342j6qfpv74.png" alt="router speed" width="698" height="737"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I repeated this test twice which gave me roughly 80% speed drop. The good thing is that there is no speed drop when you add more extenders.&lt;/p&gt;

&lt;h2&gt;
  
  
  Debugging with blinking rate
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Led blinking every second - config file does not exist and web portal is active.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Led blinking every 200ms - connection is successful and repeater is ready to run.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Led stays off - there is a problem with the repeater.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Led stays on(no blinking) - trying to connect to router.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setting things up from the web interface
&lt;/h2&gt;

&lt;p&gt;The default IP address for the device is 192.168.4.1 (you can always check the IP address on the serial monitor), during the first run of the device the config file( a file containing the details of the router to connect to) does not exist, so it starts the web server ( the led blinks every one second to indicate this), the default name for the device is Pius_Electronics_extender0001 connect to the WiFi network and type in the IP address in your browser the web page will greet you.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5S2vCbfG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7v1iiozqoatcbt7gniin.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5S2vCbfG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7v1iiozqoatcbt7gniin.png" alt="Image" width="543" height="377"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click on the scan button to scan for the network select the network(router) you want to connect to input the password(router's password) and type in the name you wish the extender to have in the text box labelled AP name and click submit. The extender will have the same password as the connected router. If the led starts blinking at a fast rate (200ms) this means the connection is successful, you can now connect to the extender and use it..&lt;/p&gt;

&lt;h2&gt;
  
  
  Auto-mesh
&lt;/h2&gt;

&lt;p&gt;The extender does not support auto mesh, but a workaround will be to connect consecutive extenders to each other i.e connect extender2 to extender1, extender3 to extender2, extender4 to extender3 and so on depending on how many extenders you need. If you have a better method you came to make a pull request to my &lt;a href="https://github.com/Pius171/esp8266-wifi-extender"&gt;GitHub repository&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So if you are okay with an 80% speed drop, you can try out this extender. Thank you so much for reading.&lt;/p&gt;

</description>
      <category>arduino</category>
      <category>programming</category>
      <category>github</category>
      <category>esp8266</category>
    </item>
    <item>
      <title>Micropython OneSignal Library</title>
      <dc:creator>Pius</dc:creator>
      <pubDate>Wed, 27 Apr 2022 23:21:50 +0000</pubDate>
      <link>https://dev.to/pius171/micropython-onesignal-library-e9f</link>
      <guid>https://dev.to/pius171/micropython-onesignal-library-e9f</guid>
      <description>&lt;p&gt;I learnt python a few years back, I just couldn’t find anything to do with it. Funny right? There are a lot of things you can do with python, but I am especially particular about python in hardware and I do not have a raspberry pi computer laying around (their prices have been increasing lately). Then I found out about micropython, which allows me to write python code for low memory devices such as Espressif ESP8266 and ESP32 (they are my favourite boards, leave your favourite board in the comment section so I can check them out). Then boom! my micropython journey started, after some months of polishing my python skills, I decided to put it to the test by building a library for Onesignal services, which I use a lot. A noob as I am, I desperately searched for a OneSignal library for the Arduino framework but couldn’t find one, so I had to learn to make requests with Arduino, which gave me a lot of experience in making requests, python is relatively easy to write so I decided to create the library for micropython as a way to give back to the embedded community. I plan on writing one for Arduino in nearest future.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing the library
&lt;/h2&gt;

&lt;p&gt;I plan on making it possible to install via &lt;a href="https://docs.micropython.org/en/latest/reference/packages.html" rel="noopener noreferrer"&gt;‘upip’&lt;/a&gt; later on, but for now, you can just download it from my GitHub &lt;a href="https://github.com/Pius171/Micropython-Onesignal-library-" rel="noopener noreferrer"&gt;repo&lt;/a&gt;. The library also runs on the regular big python.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding the OneSignal Library to the file system
&lt;/h2&gt;

&lt;p&gt;I am using Thonny ide, so I will be explaining using Thonny.&lt;br&gt;
Open the onesignal.py file in Thonny, go to file and click “save as”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvmyspns16q3nnhb10jzv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvmyspns16q3nnhb10jzv.png" alt="saving library to to filesystem"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then click on "micropython device" and type in the name of the library as “Onesignal.py” and click save.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn5i05g04asr54c9ypxsl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn5i05g04asr54c9ypxsl.png" alt="Saving to micropython device"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Sending push notifications
&lt;/h2&gt;

&lt;p&gt;Firstly we have to import the Notifier object from the library&lt;br&gt;
&lt;code&gt;from Onesignal import Notifier&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then create an object with the class&lt;br&gt;
&lt;code&gt;notifier= Notifier("APP ID","API KEY","en")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;OneSignal has a thing called segments, which allows you to group your subscribers into various categories; thereby allowing you to send notifications to a certain group of people.&lt;br&gt;
To send a “hello” message to all your subscribers, the code will look like this.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;notifier.notify_segment("Subscribed Users","hello") # send to a particular segment&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To read more on Onesignal segments click &lt;a href="https://documentation.onesignal.com/docs/segmentation" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Let's assume you build a facial recognition device for your home which notifies everyone in your family when there is someone at the door, but you want only you to get notified when your girlfriend is at the door, this can be done using OneSignal “player ids”.&lt;/p&gt;

&lt;p&gt;OneSignal attributes to each of your subscribers a specific “player id”, which is unique to each subscriber and can be used to send notifications to a specific subscriber. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;notifier.notify_user("your player id", "hi Pius, Jessica is at the door")# send to a specific user&lt;/code&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Sending text messages
&lt;/h2&gt;

&lt;p&gt;Before sending text messages, you will have to create a Onesignal text message app, I would not be going over that in this article but here is a &lt;a href="https://documentation.onesignal.com/docs/sms-quickstart" rel="noopener noreferrer"&gt;link&lt;/a&gt; on how to set this up.&lt;/p&gt;

&lt;p&gt;After you have created your app, you will need to find your app ID and API key, you can find this in your messaging app by clicking on settings and then keys &amp;amp; IDs&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq0b1lvz2omgr3bszljpy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq0b1lvz2omgr3bszljpy.png" alt="how to get keys &amp;amp; IDs"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sending a message&lt;br&gt;
First, we need to import the SMS_Messenger class from the library&lt;/p&gt;

&lt;p&gt;&lt;code&gt;from Onesignal import  SMS_Messenger&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create an object of the class, with your App ID, API key, Twilio phone number, senders name and language.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;messenger =SMS_Messenger (
"Zbe1d80b-1234-5678-91f2-f27cc107e112",
"ABCDEFGHIJKLMNOpqrstuvwxyzbjtenarsjcdutavdkats",
["Twilio phone number"],
 "sender's name",
 "en"
  )

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Send text message&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;br&gt;
messenger.send_text("Hello",["recipient phone number"]) # make sure phone number is added to your onesignal subscribers&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
Sending mails&lt;br&gt;
First, we import the mailer class&lt;br&gt;
&lt;code&gt;from Onesignal import  Mailer&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create and object of class Mailer, with your app ID, API key and language&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mailer=Mailer(
"Zbe1d80b-1234-5678-91f2-f27cc107e112",
"ABCDEFGHIJKLMNOpqrstuvwxyzbjtenarsjcdutavdkats",
"en")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create variables to hold the subject and body of your mail&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;subject= "cat facts"
body= "&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;Welcome to Cat Facts&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;h1&amp;gt;Welcome to Cat Facts&amp;lt;h1&amp;gt;
&amp;lt;h4&amp;gt;Learn more about everyone's favorite furry companions!&amp;lt;/h4&amp;gt;
&amp;lt;hr/&amp;gt;
&amp;lt;p&amp;gt;Hi Nick,&amp;lt;/p&amp;gt;
&amp;lt;p&amp;gt;Thanks for subscribing to Cat Facts! We can't wait to surprise you with funny details about your favorite animal.&amp;lt;/p&amp;gt;
&amp;lt;h5&amp;gt;Today's Cat Fact (March 27)&amp;lt;/h5&amp;gt;
&amp;lt;p&amp;gt;In tigers and tabbies, the middle of the tongue is covered in backward-pointing spines, used for breaking off and gripping meat.&amp;lt;/p&amp;gt;
&amp;lt;a href='https://catfac.ts/welcome'&amp;gt;Show me more Cat Facts&amp;lt;/a&amp;gt;
&amp;lt;hr/&amp;gt;&amp;lt;p&amp;gt;&amp;lt;small&amp;gt;(c) 2018 Cat Facts, inc&amp;lt;/small&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;&amp;lt;small&amp;gt;&amp;lt;a href='[unsubscribe_url]'&amp;gt;Unsubscribe&amp;lt;/a&amp;gt;&amp;lt;/small&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then we send an email using the “send” function in the Mailer class&lt;/p&gt;

&lt;p&gt;To send an email using player id, use this line of code&lt;br&gt;
&lt;code&gt;mailer.send_mail(body,subject,"6392d41a-b776-4c7b-as20-cd58t32y3a96")&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To send an email to a subscriber via their email address us this line of code&lt;br&gt;
&lt;code&gt;mailer.send_mail(body,subject,emails=["janedoe@gmail.com"])&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Thank you for reading my article. If you are interested in the Arduino version of the Onesignal library follow me so you can get notified when I post it. I also recommend you create issues and pull requests on the GitHub repo if you find anything in the code that can be improved. Thanks again.&lt;/p&gt;

</description>
      <category>python</category>
      <category>onesignal</category>
      <category>micropython</category>
    </item>
  </channel>
</rss>
