<?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:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Sakirullahi OP]]></title><description><![CDATA[Thoughts, stories and ideas.]]></description><link>http://sakirop.com/</link><generator>Ghost 0.11</generator><lastBuildDate>Mon, 23 Mar 2026 13:42:59 GMT</lastBuildDate><atom:link href="http://sakirop.com/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Install and Configure Gearman Job server for PHP on Ubuntu 16.04]]></title><description><![CDATA[<p>Gearman is great framework for doing job scheduling, load balancing and call functions of other languages. Greaman can do forground jobs, background jobs, and parallel execution of multiple tasks to speed up the execution. So gearman act as nervous sytem for distributed systems. Learn more about Gearman here.</p>

<p>This article</p>]]></description><link>http://sakirop.com/untitled-3/</link><guid isPermaLink="false">960c85ca-a470-4868-badb-23eda08b35fb</guid><dc:creator><![CDATA[SAKIRULLAHI OP]]></dc:creator><pubDate>Thu, 30 Aug 2018 04:15:42 GMT</pubDate><content:encoded><![CDATA[<p>Gearman is great framework for doing job scheduling, load balancing and call functions of other languages. Greaman can do forground jobs, background jobs, and parallel execution of multiple tasks to speed up the execution. So gearman act as nervous sytem for distributed systems. Learn more about Gearman here.</p>

<p>This article describes how to configre Gearman for PHP on Ubuntu 16.04.</p>

<p>Install Apache</p>

<p>To run our PHP code, we need a server. PHP is supported by many webserves. Here we are using the popular Apache webserver.</p>

<p>If you have already installed Apache, skip this step.</p>

<p>sudo apt-get update <br>
sudo apt-get install apache2</p>

<p>Set Global ServerName to Suppress Syntax Warnings</p>

<p>Check if there any syntax erros in apache configuration</p>

<p>sudo apache2ctl configtest </p>

<p>If you get following output</p>

<p>Output</p>

<p>AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message <br>
Syntax OK <br>
Open up the main configuration file with your text edit:</p>

<p>sudo nano /etc/apache2/apache2.conf</p>

<p>Inside, at the bottom of the file, add a ServerName directive, pointing to your primary domain name. If you do not have a domain name associated with your server, you can use your server's public IP address.</p>

<p>If you don't know your server's IP address, skip down to the section on how to find your server's public IP address to find it.</p>

<p>/etc/apache2/apache2.conf</p>

<p>. . .
ServerName server<em>domain</em>or_IP <br>
Save and close the file when you are finished.</p>

<p>Next, check for syntax errors by typing:</p>

<p>sudo apache2ctl configtest</p>

<p>Since we added the global ServerName directive, all you should see is:</p>

<p>Output</p>

<p>Syntax OK <br>
Restart Apache to implement your changes:</p>

<p>sudo systemctl restart apache2</p>

<p>Adjust the Firewall to Allow Web Traffic <br>
Next, assuming that you have followed the initial server setup instructions to enable the UFW firewall, make sure that your firewall allows HTTP and HTTPS traffic. You can make sure that UFW has an application profile for Apache like so:</p>

<p>sudo ufw app list</p>

<p>Output</p>

<p>Available applications: <br>
  Apache
  Apache Full
  Apache Secure
  OpenSSH
If you look at the Apache Full profile, it should show that it enables traffic to ports 80 and 443:</p>

<p>sudo ufw app info "Apache Full"</p>

<p>Output</p>

<p>Profile: Apache Full <br>
Title: Web Server (HTTP,HTTPS) <br>
Description: Apache v2 is the next generation of the omnipresent Apache web <br>
server.</p>

<p>Ports: <br>
  80,443/tcp
Allow incoming traffic for this profile:</p>

<p>sudo ufw allow in "Apache Full"</p>

<p>You can do a spot check right away to verify that everything went as planned by visiting your server's public IP address in your web browser (see the note under the next heading to find out what your public IP address is if you do not have this information already):</p>

<p><a href="http://your">http://your</a><em>server</em>IP_address <br>
You will see the default Ubuntu 16.04 Apache web page, which is there for informational and testing purposes. It should look something like this:</p>

<p>Ubuntu 16.04 Apache default</p>

<p>If you see this page, then your web server is now correctly installed and accessible through your firewall.</p>

<p>How To Find your Server's Public IP Address <br>
If you do not know what your server's public IP address is, there are a number of ways you can find it. Usually, this is the address you use to connect to your server through SSH.</p>

<p>From the command line, you can find this a few ways. First, you can use the iproute2 tools to get your address by typing this:</p>

<p>ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'</p>

<p>This will give you two or three lines back. They are all correct addresses, but your computer may only be able to use one of them, so feel free to try each one.</p>

<p>An alternative method is to use the curl utility to contact an outside party to tell you how it sees your server. You can do this by asking a specific server what your IP address is:</p>

<p>sudo apt-get install curl <br>
curl <a href="http://icanhazip.com">http://icanhazip.com</a></p>

<p>Regardless of the method you use to get your IP address, you can type it into your web browser's address bar to get to your server.</p>

<p>Step 2: Install MySQL <br>
Now that we have our web server up and running, it is time to install MySQL. MySQL is a database management system. Basically, it will organize and provide access to databases where our site can store information.</p>

<p>Again, we can use apt to acquire and install our software. This time, we'll also install some other "helper" packages that will assist us in getting our components to communicate with each other:</p>

<p>sudo apt-get install mysql-server</p>

<p>Note: In this case, you do not have to run sudo apt-get update prior to the command. This is because we recently ran it in the commands above to install Apache. The package index on our computer should already be up-to-date.</p>

<p>Again, you will be shown a list of the packages that will be installed, along with the amount of disk space they'll take up. Enter Y to continue.</p>

<p>During the installation, your server will ask you to select and confirm a password for the MySQL "root" user. This is an administrative account in MySQL that has increased privileges. Think of it as being similar to the root account for the server itself (the one you are configuring now is a MySQL-specific account, however). Make sure this is a strong, unique password, and do not leave it blank.</p>

<p>When the installation is complete, we want to run a simple security script that will remove some dangerous defaults and lock down access to our database system a little bit. Start the interactive script by running:</p>

<p>sudo mysql<em>secure</em>installation</p>

<p>You will be asked to enter the password you set for the MySQL root account. Next, you will be asked if you want to configure the VALIDATE PASSWORD PLUGIN.</p>

<p>Warning: Enabling this feature is something of a judgment call. If enabled, passwords which don't match the specified criteria will be rejected by MySQL with an error. This will cause issues if you use a weak password in conjunction with software which automatically configures MySQL user credentials, such as the Ubuntu packages for phpMyAdmin. It is safe to leave validation disabled, but you should always use strong, unique passwords for database credentials.</p>

<p>Answer y for yes, or anything else to continue without enabling.</p>

<p>VALIDATE PASSWORD PLUGIN can be used to test passwords <br>
and improve security. It checks the strength of password <br>
and allows the users to set only those passwords which are <br>
secure enough. Would you like to setup VALIDATE PASSWORD plugin?</p>

<p>Press y|Y for Yes, any other key for No: <br>
You'll be asked to select a level of password validation. Keep in mind that if you enter 2, for the strongest level, you will receive errors when attempting to set any password which does not contain numbers, upper and lowercase letters, and special characters, or which is based on common dictionary words.</p>

<p>There are three levels of password validation policy:</p>

<p>LOW    Length >= 8 <br>
MEDIUM Length >= 8, numeric, mixed case, and special characters <br>
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file</p>

<p>Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 1 <br>
If you enabled password validation, you'll be shown a password strength for the existing root password, and asked you if you want to change that password. If you are happy with your current password, enter nfor "no" at the prompt:</p>

<p>Using existing password for root.</p>

<p>Estimated strength of the password: 100 <br>
Change the password for root ? ((Press y|Y for Yes, any other key for No) : n <br>
For the rest of the questions, you should press Y and hit the Enter key at each prompt. This will remove some anonymous users and the test database, disable remote root logins, and load these new rules so that MySQL immediately respects the changes we have made.</p>

<p>At this point, your database system is now set up and we can move on.</p>

<p>Step 3: Install PHP <br>
Ubuntu 16.04 comes with PHP7 as the standard, so there are no PHP5 packages. But Greaman has no support for PHP7. So we have to add PPA to get those packages.</p>

<p>Remove all the stock php packages</p>

<p>List installed php packages with dpkg -l | grep php| awk '{print $2}' |tr "\n" " " then remove unneeded packages with sudo aptitude purge your<em>packages</em>here or if you want to directly remove them all use :</p>

<p>sudo aptitude purge <code>dpkg -l | grep php| awk '{print $2}' |tr "\n" " "</code> <br>
Add the PPA</p>

<p>sudo add-apt-repository ppa:ondrej/php <br>
Install your PHP Version</p>

<p>sudo apt-get update <br>
sudo apt-get install php5.6 <br>
Verify your version</p>

<p>sudo php -v <br>
Install Required PHP5.6 Modules </p>

<p>sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-cli libapache2-mod-php5.6  php-pear php5.6-dev</p>

<p>Step 4: Install Gearman <br>
sudo apt-get install gearman-job-server</p>

<p>sudo apt-get install libgearman-dev</p>

<p>sudo apt-get install libgearman7</p>

<p>Step 5: Install Gearman PHP extension using PECL <br>
sudo pecl install gearman</p>

<p>edit /etc/php/5.6/cli/php.ini and   /etc/php/5.6/apache2/php.ini</p>

<p>and add extension="gearman.so" at the end of file.</p>

<p>Then restart apache </p>

<p>sudo service apache2 restart</p>

<p>Now test gearman installtion by </p>

<p>php gearman_version.php</p>

<p>if it returns version No. then installation is correct.</p>

<p>Step 6: Try examples <br>
Now try this examples at <a href="http://gearman.org/getting-started/#gearman-php-extension">http://gearman.org/getting-started/#gearman-php-extension</a></p>

<p>Step 7: Configure worker to run background using supervisrod <br>
This sections needs to be updated. To Do - learn about upstart and supervisrod. Use following with caution</p>

<p>Now configure php workers to run in background using supervisord</p>

<p><a href="http://stackoverflow.com/questions/8217848/running-gearman-workers-in-the-backgroundhttp://supervisord.org/installing.html">http://stackoverflow.com/questions/8217848/running-gearman-workers-in-the-backgroundhttp://supervisord.org/installing.html</a></p>

<p><a href="http://stackoverflow.com/questions/5518724/constantly-running-gearman-worker">http://stackoverflow.com/questions/5518724/constantly-running-gearman-worker</a></p>

<p>See </p>

<p><a href="https://gist.github.com/droidlabour/96febc0c37ba1a370b26">https://gist.github.com/droidlabour/96febc0c37ba1a370b26</a></p>

<p><a href="http://stackoverflow.com/questions/2036654/run-php-script-as-daemon-process">http://stackoverflow.com/questions/2036654/run-php-script-as-daemon-process</a></p>

<p><a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-manage-supervisor-on-ubuntu-and-debian-vps">https://www.digitalocean.com/community/tutorials/how-to-install-and-manage-supervisor-on-ubuntu-and-debian-vps</a></p>

<p>for reference</p>

<p>Step 5 (optional): Setup PhpMyadmi <br>
<a href="https://www.digitalocean.com/community/articles/how-to-install-and-secure-phpmyadmin-on-ubuntu-12-04">https://www.digitalocean.com/community/articles/how-to-install-and-secure-phpmyadmin-on-ubuntu-12-04</a></p>

<p>References</p>

<ol>
<li><p><a href="https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04">https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04</a></p></li>
<li><p><a href="http://stackoverflow.com/questions/36788873/package-php5-have-no-installation-candidate-ubuntu-16-04">http://stackoverflow.com/questions/36788873/package-php5-have-no-installation-candidate-ubuntu-16-04</a></p></li>
<li><p><a href="http://gearman.org/">http://gearman.org/</a></p></li>
<li><p><a href="http://masnun.com/2011/09/30/installing-and-getting-started-with-gearman.html">http://masnun.com/2011/09/30/installing-and-getting-started-with-gearman.html</a></p></li>
</ol>]]></content:encoded></item><item><title><![CDATA[NodeMCU Programming using Arduino IDE]]></title><description><![CDATA[<p>As I mentioned in one my of previous posts about <a href="http://sakirop.com/rfid-reader-rdm6300-avoid-multiple-reading-of-same-card/">RDM6300</a>, I have built an RFID based access control system for the makerspace where I work. To build this project, I chose NodeMCU as micro controller and as a server since we want to monitor our system remotely. For wireless</p>]]></description><link>http://sakirop.com/nodemcu-programming-using-arduino-ide/</link><guid isPermaLink="false">9e757a6b-4720-4676-b634-6bfbb66c7f1d</guid><category><![CDATA[NodeMCU]]></category><category><![CDATA[Arduino]]></category><category><![CDATA[NodeMCU programming]]></category><category><![CDATA[Arduino IDE]]></category><category><![CDATA[NodeMCU LED Blink]]></category><dc:creator><![CDATA[SAKIRULLAHI OP]]></dc:creator><pubDate>Sat, 04 Aug 2018 12:52:01 GMT</pubDate><media:content url="http://sakirop.com/content/images/2018/08/NodeMCU-on-Arduino-IDE.png" medium="image"/><content:encoded><![CDATA[<img src="http://sakirop.com/content/images/2018/08/NodeMCU-on-Arduino-IDE.png" alt="NodeMCU Programming using Arduino IDE"><p>As I mentioned in one my of previous posts about <a href="http://sakirop.com/rfid-reader-rdm6300-avoid-multiple-reading-of-same-card/">RDM6300</a>, I have built an RFID based access control system for the makerspace where I work. To build this project, I chose NodeMCU as micro controller and as a server since we want to monitor our system remotely. For wireless connectivity, I can interface ESP8266 with Arduino. But in the sense of price and easiness it's NodeMCU is better suited for WiFi or Cloud connectivity projects.</p>

<p><strong>What is NodeMCU ?</strong></p>

<p>NodeMCU is a open-source firmware based on ESP8266 WiFi-soc, that helps you to prototype your IOT products. There is a wide variety of development kits available based on NodeMCU firmware. For more information on ESP8266 and interfacing with Arduino, checkout this article <a href="http://sakirop.com/esp8266-interfacing-with-arduino-uno/">ESP8266 INTERFACING WITH ARDUINO UNO</a>.</p>

<p>When we look at features of NodeMCU, it has small form factor and comes with GPIO pins to which you can connect sensors, and input/output devices required for your project. <em>Open-source, Interactive, Programmable, Low cost, Simple, Smart, WI-FI enabled</em> - this is what they described in NodeMCU official <a href="http://nodemcu.com">website</a>.</p>

<p>It's easy program NodeMCU if you are familiar with Arduino already, but prior experience with Arduino is not mandatory. There are many other ways you can program NodeMCU using Lua, python, JavaScript etc. Here I am going with Arduino IDE for that purpose. </p>

<p><strong>Steps</strong></p>

<ol>
<li>Install Arduino IDE  </li>
<li>Configure board manager to recognize NodeMCU  </li>
<li>Write sample program  </li>
<li>Upload program to NodeMCU</li>
</ol>

<p>So, let me explain each steps in detail. </p>

<p><strong>Install Arduino IDE</strong>
<img src="http://sakirop.com/content/images/2018/08/Download-Arduino-IDE-1-1.svg" alt="NodeMCU Programming using Arduino IDE"></p>

<p>Go to <a href="https://www.arduino.cc/en/Main/Software">Arduino website</a> adn download and install Arduino software that suits your operating system.</p>

<p><strong>Configure board manager to recognize NodeMCU</strong></p>

<p>Open Aarduino IDE. By defualt, Arduino IDE don't comes with a support for NodeMCU. We have to configure Arduino IDE for third party development tools or boards to program using Arduino IDE. In order to do that, </p>

<ol>
<li>Select File >> Preferences from the menu. Where you can see a label named <em>Additional board manager URLs:</em> next to a text box. Put <code>http://arduino.esp8266.com/stable/package_esp8266com_index.json</code> in that text text box and click OK button.</li>
</ol>

<p><img src="http://sakirop.com/content/images/2018/08/additional-board-manager-urls.png" alt="NodeMCU Programming using Arduino IDE"></p>

<ol>
<li>Select Tools >> Board >> Board Manager from the menu. It will take a little to load the board details. When it's done, search esp8266 or NodeMCU on the search box. Then something shown below  will appear. Click on install, this will install necessary files to work with NodeMCU in Arduino IDE. Once the download is complete, close the Board manager window. </li>
</ol>

<p><img src="http://sakirop.com/content/images/2018/08/Board-Manger.png" alt="NodeMCU Programming using Arduino IDE"></p>

<ol>
<li><p>To verify ESP8266 or NodeMCU board is configured correctly, go to Tools >> Board >> NodeMCU 1.0 (ESP 12E Module). If necessary files are not downloaded completely, you can't see NodeMCU 1.0 entry in Boards list.</p></li>
<li><p>Now connect NodeMCU to your computer using USB cable.</p></li>
<li><p>Go to Tools >> Port. Select port of connected NodeMCU.</p></li>
</ol>

<p><strong>Write sample program</strong></p>

<p>To make sure your NodeMCU is working prefectly with Arduino IDE, let's try a sample blink program which is already in the Arduino IDE. </p>

<ol>
<li>Go to File >> Examples >> ESP8266 >> Blink.</li>
</ol>

<p>It will look like below screen shot.</p>

<p><img src="http://sakirop.com/content/images/2018/08/Arduino-NodeMCU-Blink.png" alt="NodeMCU Programming using Arduino IDE"></p>

<p><strong>Upload program to NodeMCU</strong></p>

<p>Now it's time to upload the blink program to NodeMCU hardware. Make sure NodeMCU is connected, correct Board and Port is elected. Then click on upload button. It will take few seconds to finish the uploading. If it get uploaded without any errors, then LED in the NodeMCU will start blinking.</p>

<p>Congratulations! You have completed your first NodeMCU programming. Now explore more exciting possibilities you can try this little amazing hardware.</p>]]></content:encoded></item><item><title><![CDATA[Motorized Scissors using DC BO Motor]]></title><description><![CDATA[This is a simple tutorial on how to build your own motorized battery operated scissors for hobby projects or scissors automation projects.]]></description><link>http://sakirop.com/motorized-scissors-using-bo-motor/</link><guid isPermaLink="false">6d0acad6-4f2b-482e-a53f-c676a27e9f2c</guid><category><![CDATA[Motorized scissors]]></category><category><![CDATA[automated scissors]]></category><category><![CDATA[automated scissor cutting]]></category><category><![CDATA[battery powered scissors]]></category><category><![CDATA[automated ribbon cutting]]></category><dc:creator><![CDATA[SAKIRULLAHI OP]]></dc:creator><pubDate>Thu, 02 Aug 2018 11:04:06 GMT</pubDate><media:content url="http://sakirop.com/content/images/2018/08/IMG_20180801_170826-1.jpg" medium="image"/><content:encoded><![CDATA[<img src="http://sakirop.com/content/images/2018/08/IMG_20180801_170826-1.jpg" alt="Motorized Scissors using DC BO Motor"><p>What about if we can operate scissor using a motor and battery? Cool, Isn't it. Here I will share a simple way to build motorized scissors. But why this motorized scissors? That's a good question. For me, this was an essential requirement to Automate Ribbon Cutting process of Inauguration of our maker-space. One of my acquaintance come with this idea to automate ribbon cutting, and then I agreed to give a try. Watch the working video given below and you will get a better idea about motorized scissors.</p>

<p><strong>Working Video</strong></p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/aBQh8mYls5A" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

<p><img src="http://sakirop.com/content/images/2018/08/motorized-scissors.jpg" alt="Motorized Scissors using DC BO Motor">
<img src="http://sakirop.com/content/images/2018/08/IMG_20180801_170826.jpg" alt="Motorized Scissors using DC BO Motor">
<img src="http://sakirop.com/content/images/2018/08/IMG_20180801_170756.jpg" alt="Motorized Scissors using DC BO Motor"></p>

<p><strong>Components</strong></p>

<ol>
<li>BO Motor with Wheel (<a href="http://amzn.in/fm9uD1i">http://amzn.in/fm9uD1i</a>)  </li>
<li>Scissors  </li>
<li>Strong bond glue - Araldite, Super Glue etc  </li>
<li>Strong thing iron road  </li>
<li>9v battery</li>
</ol>

<p><strong>How to Build - Steps</strong></p>

<p>Arrange the components listed above. </p>

<ol>
<li>Make a small hole in the plastic handle of scissors and in the wheel body as shown in the images using Drilling machine. Here I used 2mm drill bit. Choose a drill bit that suits the diameter of your iron road.  </li>
<li>Fix one handle of scissors on top of BO motor as shown in pictures using a strong adhesive like Super Glue or Araldite.  </li>
<li>Take the iron road and bend both sides 90 degrees and connect the Schorrs handle and wheel. Then try to rotate the wheel gently. If the scissor handle is moving with it, you are done. Sometimes the length of the iron road is little longer so that the teeth of scissor will not come close. In that situation, what you have to do is bend the iron road a little to adjust its effective length (See the 2nd and 3rd pictures).  </li>
<li>Now you are all set to fly. Connect a 9v battery to the motor and you will have a motorized scissor with you. You can use this to cut papers, cloths or other materials which is suitable for the used scissors. As part of the user experience, you can connect a switch between the positive side of battery and motor, so that you can operate the scissors easily.</li>
</ol>

<p>A BO Motor is a DC motor with gear setup and operated by battery. The gear setup is to increase the torque of the motor. These type of motors are mainly used in DIY robot vehicles. BO motors are available in different specifications.</p>

<p><strong>Learnings</strong></p>

<ol>
<li>How to use Araldite Adhesive. Previously I have used Araldite for bonding, but I misunderstood it as a weak adhesive. Becuase Araldite takes time to make a strong between materials. But I expected a strong bond using this in a shorter time. After watching a video on how to use Araldite, I understood that it requires some time to settle the bond.</li>
</ol>

<p>TBC...</p>]]></content:encoded></item><item><title><![CDATA[RFID Reader RDM6300 - Avoid Multiple Reading of Same Tag]]></title><description><![CDATA[<p>Recently I was working on an RFID access control system for Makerspace where I am working. I have used Arduino Uno and RDM6300 for prototyping. You may wonder why I used RDM6300 instead of popular RC522 reader module. Students who study in the campus were already issued ID cards with</p>]]></description><link>http://sakirop.com/rfid-reader-rdm6300-avoid-multiple-reading-of-same-card/</link><guid isPermaLink="false">07f36c72-19bf-4573-bf30-b2fb372903ab</guid><category><![CDATA[Arduino RFID]]></category><category><![CDATA[RDM6300]]></category><category><![CDATA[RDM6300 Multi read]]></category><category><![CDATA[RDM6300 not working]]></category><category><![CDATA[RDM6300 issue]]></category><category><![CDATA[RDM6300 single read]]></category><category><![CDATA[NodeMCU]]></category><category><![CDATA[NodeMCU RFID]]></category><category><![CDATA[125Khz RFID]]></category><dc:creator><![CDATA[SAKIRULLAHI OP]]></dc:creator><pubDate>Thu, 02 Aug 2018 10:10:31 GMT</pubDate><media:content url="http://sakirop.com/content/images/2018/08/rdm6300-Arduino-1.jpg" medium="image"/><content:encoded><![CDATA[<img src="http://sakirop.com/content/images/2018/08/rdm6300-Arduino-1.jpg" alt="RFID Reader RDM6300 - Avoid Multiple Reading of Same Tag"><p>Recently I was working on an RFID access control system for Makerspace where I am working. I have used Arduino Uno and RDM6300 for prototyping. You may wonder why I used RDM6300 instead of popular RC522 reader module. Students who study in the campus were already issued ID cards with RFID tags of 125KHz frequency. So, RC522 is not an option as a reader, because RC522 is 13.56 MHz Reader. </p>

<p><img src="http://sakirop.com/content/images/2018/08/rdm6300-Arduino.jpg" alt="RFID Reader RDM6300 - Avoid Multiple Reading of Same Tag"></p>

<p><img src="http://sakirop.com/content/images/2018/08/Rdm6300-Arduino-Closeup.jpg" alt="RFID Reader RDM6300 - Avoid Multiple Reading of Same Tag"></p>

<p>For 125KHz tags, we can either use RDM630 or RDM6300 as reader module. Both have the same pin layouts. But RDM630 is superior in functionality and little costlier. I ordered RDM6300 from Amazon without aware of its multi-read behaviour. That is RDM6300 will read the same tag continuously if it's put near the reader for a long time. While RDM630 will read the same tag only once. So, when I use the output of this reader to trigger a hardware like an opening door if the tag is authorised, it will trigger multiple times if the card placed near the reader for a while.</p>

<p>To tackle this issue, I have tried several ways like clearing input buffer, set up a delay etc. But none of them gave me the perfect solution. The problem with Serial input buffer is that we don't have control over it and Arduino doesn't provide a way to clear input serial buffer. </p>

<p>So, I finally come up with a solution for this. I managed the triggering process completely in software part rather than depending on hardware Serial communication. What I did is that I have stored the previous tag information in a variable called <code>previous_tag</code> and compared it with currently read tag. If they are not matching, then we can trigger the hardware or door. And when there is no serial communication happening, I will reset this <code>previous_tag</code> to zero. This solution is working perfectly for me to control the door using RDM6300 RFID reader module.</p>

<p><strong>Connection</strong></p>

<p>RDM6300 5V - Arduino 5V <br>
RDM6300 GND - Arduino GND <br>
RDM6300 TX - Arduino PIN 2 <br>
Connect antenna in the antenna pins of reader <br>
Arduino PIN8 -  LED Positive leg <br>
Arduino GND - LED negative leg</p>

<p><strong>Code</strong></p>

<p>This is my tweaked version of code originally posted in this <a href="https://www.mschoeffler.de/2018/01/05/arduino-tutorial-how-to-use-the-rdm630-rdm6300-rfid-reader/">website</a> </p>

<pre><code>#include &lt;SoftwareSerial.h&gt;
const int BUFFER_SIZE = 14; // RFID DATA FRAME FORMAT: 1byte head (value: 2), 10byte data (2byte version + 8byte tag), 2byte checksum, 1byte tail (value: 3)
const int DATA_SIZE = 10; // 10byte data (2byte version + 8byte tag)
const int DATA_VERSION_SIZE = 2; // 2byte version (actual meaning of these two bytes may vary)
const int DATA_TAG_SIZE = 8; // 8byte tag
const int CHECKSUM_SIZE = 2; // 2byte checksum
SoftwareSerial ssrfid = SoftwareSerial(2,3); 
uint8_t buffer[BUFFER_SIZE]; // used to store an incoming data frame 
int buffer_index = 0;
unsigned long previous_tag = 0L;
void setup() {
  pinMode(8,OUTPUT); //led pin
 Serial.begin(9600); 

 ssrfid.begin(9600);
 ssrfid.listen(); 

 Serial.println("INIT DONE");
}
void loop() {
  if (ssrfid.available() &gt; 0){
    bool call_extract_tag = false;

    int ssvalue = ssrfid.read(); // read 
    if (ssvalue == -1) { // no data was read
      return;
    }
    if (ssvalue == 2) { // RDM630/RDM6300 found a tag =&gt; tag incoming 
      buffer_index = 0;
    } else if (ssvalue == 3) { // tag has been fully transmitted       
      call_extract_tag = true; // extract tag at the end of the function call
    }
    if (buffer_index &gt;= BUFFER_SIZE) { // checking for a buffer overflow (It's very unlikely that an buffer overflow comes up!)
      Serial.println("Error: Buffer overflow detected!");
      return;
    }

    buffer[buffer_index++] = ssvalue; // everything is alright =&gt; copy current value to buffer
    if (call_extract_tag == true) {
      if (buffer_index == BUFFER_SIZE) {
        unsigned tag = extract_tag();
        Serial.println(tag);
        if(previous_tag == tag){
//          Serial.println("Same tag ===================");  
    }
    else{
</code></pre>

<p>//put the triggering code here
          digitalWrite(8,1);
          delay(1000);
          digitalWrite(8,0);
          //Serial.println(previous<em>tag);
          //Serial.println(tag);
          previous</em>tag = tag;
        }</p>

<pre><code>  } else { // something is wrong... start again looking for preamble (value: 2)
    buffer_index = 0;
    return;
  }
}    
}    
 else{
//    Serial.println("NO Cards detected ++++++++++++++++++++++++++++++++++");
previous_tag = 0L; // reset previous tag 
  }
}
unsigned extract_tag() {
uint8_t msg_head = buffer[0];
uint8_t *msg_data = buffer + 1; // 10 byte =&gt; data contains 2byte version + 8byte tag
uint8_t *msg_data_version = msg_data;
uint8_t *msg_data_tag = msg_data + 2;
uint8_t *msg_checksum = buffer + 11; // 2 byte
uint8_t msg_tail = buffer[13];
// print message that was sent from RDM630/RDM6300
Serial.println("--------");
Serial.print("Message-Head: ");
Serial.println(msg_head);
Serial.println("Message-Data (HEX): ");
for (int i = 0; i &lt; DATA_VERSION_SIZE; ++i) {
  Serial.print(char(msg_data_version[i]));
}
Serial.println(" (version)");
for (int i = 0; i &lt; DATA_TAG_SIZE; ++i) {
  Serial.print(char(msg_data_tag[i]));
}
Serial.println(" (tag)");
Serial.print("Message-Checksum (HEX): ");
for (int i = 0; i &lt; CHECKSUM_SIZE; ++i) {
  Serial.print(char(msg_checksum[i]));
}
Serial.println("");
Serial.print("Message-Tail: ");
Serial.println(msg_tail);
Serial.println("--");
long tag = hexstr_to_value(msg_data_tag, DATA_TAG_SIZE);
Serial.print("Extracted Tag: ");
Serial.println(tag);
long checksum = 0;
for (int i = 0; i &lt; DATA_SIZE; i+= CHECKSUM_SIZE) {
  long val = hexstr_to_value(msg_data + i, CHECKSUM_SIZE);
  checksum ^= val;
}
Serial.print("Extracted Checksum (HEX): ");
Serial.print(checksum, HEX);
if (checksum == hexstr_to_value(msg_checksum, CHECKSUM_SIZE)) { // compare calculated checksum to retrieved checksum
  Serial.print(" (OK)"); // calculated checksum corresponds to transmitted checksum!
} else {
  Serial.print(" (NOT OK)"); // checksums do not match
}
Serial.println("");
Serial.println("--------");
return tag;
}
long hexstr_to_value(char *str, unsigned int length) { // converts a     hexadecimal value (encoded as ASCII string) to a numeric value
  char* copy = malloc((sizeof(char) * length) + 1); 
  memcpy(copy, str, sizeof(char) * length);
  copy[length] = '\0'; 
  // the variable "copy" is a copy of the parameter "str". "copy" has an additional '\0' element to make sure that "str" is null-terminated.
  long value = strtol(copy, NULL, 16);  // strtol converts a null-terminated string to a long value
  free(copy); // clean up 
 return value;
}
</code></pre>

<p>`</p>

<p>This is a working demonstration of single read of tag using RDM6300.</p>

<iframe width="560" height="315" src="https://www.youtube.com/embed/8Wt_ltnFRjU" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>]]></content:encoded></item><item><title><![CDATA[ESP8266 INTERFACING WITH ARDUINO UNO]]></title><description><![CDATA[<p><strong>OVERVIEW</strong></p>

<p>This is simple article on how to connect ESP8266 chip with Arduino Micro controller development board. The ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller capability produced by Chinese manufacturer Espressif Systems. The low price and easy to use features made ESP8266 popular among</p>]]></description><link>http://sakirop.com/esp8266-interfacing-with-arduino-uno/</link><guid isPermaLink="false">c7f721d6-18f8-4810-83a0-d4a622fff71b</guid><dc:creator><![CDATA[SAKIRULLAHI OP]]></dc:creator><pubDate>Tue, 18 Jul 2017 11:19:33 GMT</pubDate><media:content url="http://sakirop.com/content/images/2018/08/arduino---esp8266-1.png" medium="image"/><content:encoded><![CDATA[<img src="http://sakirop.com/content/images/2018/08/arduino---esp8266-1.png" alt="ESP8266 INTERFACING WITH ARDUINO UNO"><p><strong>OVERVIEW</strong></p>

<p>This is simple article on how to connect ESP8266 chip with Arduino Micro controller development board. The ESP8266 is a low-cost Wi-Fi microchip with full TCP/IP stack and microcontroller capability produced by Chinese manufacturer Espressif Systems. The low price and easy to use features made ESP8266 popular among hardware hackers. It has two programmable GPIO pins and one RX and TX pins each.</p>

<p>Connecting ESP8266 adds WiFi capability to Arduino, So that we can control Arduino over WiFi, build web server etc. ESP8266 has its on micro controller itself, but with limited capabilities. Now, Let's look at how to connect this with Arduino UNO.  </p>

<p><strong>COMPONENTS</strong></p>

<ol>
<li>ARTDUINO UNO  </li>
<li>ESP8266  </li>
<li>BREADBOARD  </li>
<li>JUMPER WIRES  </li>
<li>12V AC ADAPTER</li>
</ol>

<p><strong>ESP8266 PINOUT DIAGRAM</strong></p>

<p><img src="http://zeflo.com/wp-content/uploads/2014/09/esp8266_pinout_h-569x236.png" alt="ESP8266 INTERFACING WITH ARDUINO UNO"></p>

<p><strong>WIRING</strong></p>

<p><strong>UNO --- ESP8266</strong> <br>
RX ----- RX <br>
TX ----- TX <br>
GND --- GND <br>
3.3V --- VCC <br>
3.3V --- CH_PD</p>

<p><strong>STEPS</strong></p>

<ol>
<li>Do connection as above.  </li>
<li>Open serial monitor in Arduino IDE and choose <strong>CR &amp; NL</strong> and <strong>9600</strong> as baud rate.  </li>
<li>Type <strong>AT</strong> in serial monitor and send. It will return <strong>OK</strong> on success.  </li>
<li>Now try some Example codes given in Arduino IDE and hack around it. Happy hacking :)</li>
</ol>

<p><em>If you have any questions, please comment below.</em></p>

<p><strong>REFERENCE</strong> </p>

<ol>
<li><a href="https://forum.arduino.cc/index.php?topic=283043.0">Connect to ESP8266 ONLY using Arduino Uno</a></li>
</ol>]]></content:encoded></item><item><title><![CDATA[HC-05 Bluetooth Module Renaming]]></title><description><![CDATA[<h2 id="connectiondiagram">Connection Diagram  </h2>

<p><img src="https://cdn.instructables.com/FM8/W4A2/HKZAVRT9/FM8W4A2HKZAVRT9.MEDIUM.jpg?width=614" alt="Connection Diagram"></p>

<h2 id="wiring">WIRING  </h2>

<p>HC-05 GND --- Arduino GND Pin <br>
HC-05 VCC (5V) --- Arduino 5V <br>
HC-05 TX --- Arduino Pin 10 (soft RX) <br>
HC-05 RX --- Arduino Pin11 (soft TX) <br>
HC-05 Key (PIN 34) --- Arduino Pin 9</p>

<h2 id="arduinocode">Arduino Code  </h2>

<pre><code>#include &lt;SoftwareSerial.h&gt;
SoftwareSerial BTSerial(10, 11); // RX</code></pre>]]></description><link>http://sakirop.com/hc-05-renaming/</link><guid isPermaLink="false">68b9c733-0ae7-4cd6-bee6-520fdae98d65</guid><category><![CDATA[HC 05]]></category><category><![CDATA[Arduino RFID]]></category><category><![CDATA[HC05 Renaming]]></category><dc:creator><![CDATA[SAKIRULLAHI OP]]></dc:creator><pubDate>Mon, 17 Jul 2017 09:32:45 GMT</pubDate><media:content url="https://cdn.instructables.com/FM8/W4A2/HKZAVRT9/FM8W4A2HKZAVRT9.MEDIUM.jpg?width=614" medium="image"/><content:encoded><![CDATA[<h2 id="connectiondiagram">Connection Diagram  </h2>

<img src="https://cdn.instructables.com/FM8/W4A2/HKZAVRT9/FM8W4A2HKZAVRT9.MEDIUM.jpg?width=614" alt="HC-05 Bluetooth Module Renaming"><p><img src="https://cdn.instructables.com/FM8/W4A2/HKZAVRT9/FM8W4A2HKZAVRT9.MEDIUM.jpg?width=614" alt="HC-05 Bluetooth Module Renaming"></p>

<h2 id="wiring">WIRING  </h2>

<p>HC-05 GND --- Arduino GND Pin <br>
HC-05 VCC (5V) --- Arduino 5V <br>
HC-05 TX --- Arduino Pin 10 (soft RX) <br>
HC-05 RX --- Arduino Pin11 (soft TX) <br>
HC-05 Key (PIN 34) --- Arduino Pin 9</p>

<h2 id="arduinocode">Arduino Code  </h2>

<pre><code>#include &lt;SoftwareSerial.h&gt;
SoftwareSerial BTSerial(10, 11); // RX | TX``

void setup()
{
  pinMode(9, OUTPUT);  // this pin will pull the HC-05 pin 34 (key pin) HIGH to switch module to AT mode
  digitalWrite(9, HIGH);
  Serial.begin(9600);
  Serial.println("Enter AT commands:");
  BTSerial.begin(38400);  // HC-05 default speed in AT command more
}

void loop()
{

  // Keep reading from HC-05 and send to Arduino Serial Monitor
  if (BTSerial.available())
    Serial.write(BTSerial.read());

  // Keep reading from Arduino Serial Monitor and send to HC-05
  if (Serial.available())
    BTSerial.write(Serial.read());
}
</code></pre>

<h2 id="steps">STEPS  </h2>

<ol>
<li>Do connection as per diagram.  </li>
<li>Burn the above code to arduino.  </li>
<li>Open Arduino serial monitor.  </li>
<li>Select <strong>Both NL &amp; CR</strong> option right-bottom part of serial monitor.  </li>
<li>Type <strong>AT+ROLE=1</strong> and press send, It will return OK on success.  </li>
<li>Type <strong>AT+NAME=newname</strong> to change device name.  </li>
<li>Type <strong>AT+NAME?</strong> to test device name.  </li>
<li>Type <strong>AT+ROLE=0</strong> to change to slave mode again.  </li>
<li>Done.  </li>
</ol>

<p><strong><em>NOTE:</em></strong> 
If you use <strong>AT+ORGL</strong> command, your bluetooth module will restore to default settings, so the baud rate, device name, password all will reset. The baud rate of most of modules are 34800. So after resetting to default config, you should use 34800 as baud rate in your Arduino code instead of 9600. </p>

<h2 id="reference">Reference:  </h2>

<ul>
<li>HC-05 DOcumentation : <a href="http://www.electronicaestudio.com/docs/istd016A.pdf">http://www.electronicaestudio.com/docs/istd016A.pdf</a></li>
<li>Instructable : <a href="http://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/">http://www.instructables.com/id/Modify-The-HC-05-Bluetooth-Module-Defaults-Using-A/</a></li>
</ul>]]></content:encoded></item><item><title><![CDATA[Memory Palace]]></title><description><![CDATA[<p><img src="https://blog.artofmemory.com/files/2011/03/Emma-Willard-1846-temple.jpg" alt="Memory Palace">
The memory palace is an interesting technique used to remember simple to complex list of items efficiently and easily. The idea behind this technique is to make a imaginary connection or links between the objects that you want to remember. If it's numbers that you want to remember, then convert/</p>]]></description><link>http://sakirop.com/untitled/</link><guid isPermaLink="false">f0c4daab-dc7e-4b5c-bce6-294b9db33b73</guid><category><![CDATA[Memory palace]]></category><category><![CDATA[Improve memory]]></category><category><![CDATA[memory techniques]]></category><category><![CDATA[10X memory]]></category><dc:creator><![CDATA[SAKIRULLAHI OP]]></dc:creator><pubDate>Sat, 03 Jun 2017 13:36:45 GMT</pubDate><media:content url="https://blog.artofmemory.com/files/2011/03/Emma-Willard-1846-temple.jpg" medium="image"/><content:encoded><![CDATA[<img src="https://blog.artofmemory.com/files/2011/03/Emma-Willard-1846-temple.jpg" alt="Memory Palace"><p><img src="https://blog.artofmemory.com/files/2011/03/Emma-Willard-1846-temple.jpg" alt="Memory Palace">
The memory palace is an interesting technique used to remember simple to complex list of items efficiently and easily. The idea behind this technique is to make a imaginary connection or links between the objects that you want to remember. If it's numbers that you want to remember, then convert/map that numbers in to some visual objects. Then create a story around those objects in imaginary palace. Next time when you want to remember those objects in the same order, you can just take a simple walk through the memory palace. You can easily remember the the objects in the same order easily by doing a just walk. This works. </p>

<p>This works because our visual memory is more powerful than verbal memory. So, next time when you go grocery shopping, just create a story of potatoes and onions instead of feeding in your phone. At the first the time, it may take some time. But when you practice it, you will master it.</p>

<p>Ref : <a href="https://www.youtube.com/watch?v=0nFkQ4cQhME">How to memorize fast and easily</a></p>]]></content:encoded></item></channel></rss>