How to use pinMode Arduino Command
Hi Friends! Hope you are doing well. In this post, I'll uncover the details on
How to use pinMode Arduino Command. The pinMode defines the Arduino Pins, if they are used as an input or output. The
INPUT_PULLUP is another option achieved by pinMode, that is mainly used to place a virtual pull-up resistor to the input pins.
We have started
Arduino Tutorials for Beginners quite a while now for the newbies, who are really interested to get a hands-on experience with Arduino. Generally, Arduino is known as a Microcontroller, but it is a step ahead of it. The PIC microcontrollers require some basic circuit to start with but Arduino brings revolution in the automation industry by removing the need of developing any basic circuit. Although
Atmega328 is the Microcontroller used in Arduino UNO.
Also, the burner is required to burn the program in
PIC Microcontrollers, while there is no need to connect separate burner with the Arduino - simply plug it with the computer through a USB cable and start playing with it.
In this tutorial, we will thoroughly discuss what is pinMode and how to use it in the Arduino module. Let's jump right in and explore what is this about and everything you need to know.
How to use pinMode in Arduino
- The Arduino Board comes with GPIO (general purpose input output) pins that can be used in two ways i.e. input, output.
- pinMode Arduino Command is used to define the operation of these Input/output pins, there are three types of modes that can be assigned using this command and are named as:
- OUTPUT.
- INPUT.
- INPUT_PULLUP.
- There are 14 digital and 6 analog pins in the module that mainly depend on the pinMode for setting up their mode of operation as an input or output.
- In this post we mainly discuss the Arduino UNO, that is based on ATmega328 microcontroller, however, you can use other modules like Pro Mini, Mega or Leonardo as per your needs and requirements. The pinMode works same in the module no matter what type of Arduino version you are using.
Syntax for pinMode Arduino
Here's the syntax for our pinMode Arduino command:
pinMode(pin#, mode);
where:
- Pin defines the Arduino pin number used.
- There are three types of modes that can be assigned to pins of Arduino, which are:
- OUTPUT
- INPUT
- INPUT_PULLUP
Let's use Pin # 8 of Arduino and assign all possible modes to it:
pinMode(8, OUTPUT);
pinMode(8, INPUT);
pinMode(8, INPUT_PULLUP);
Note:
- It is important to note that, unlike most of the functions used in the C code for Arduino module, this pinMode doesn't store or return any value.
- You have to use any one of these three modes at a time.
Modes of pinMode Arduino
- In the previous section, we have discussed the basic syntax of pinMode, and I hope you have pretty much got the basic idea behind it.
- The only thing worth mentioning here is the difference between INPUT and INPUT_PULLUP.
- So, here's a simple code where I have made Pin # 8 as an INPUT and read its status on Serial Monitor.
int Pin = 8;
int Status = 0;
void setup()
{
Serial.begin(9600);
pinMode(Pin, INPUT);
}
void loop()
{
Status = digitalRead(Pin);
if(Status == HIGH)
{
Serial.println("HIGH");
}
if(Status == LOW)
{
Serial.println("LOW");
}
}
- Let's have a look at the Serial Monitor:
- While taking the above image, Pin # 8 was in open state and we are getting just random values.
- We are getting these random values i.e. HIGH, LOW because our Pin#8 is neither connected to +5V nor GND.
- Arduino seems confused here, and we can remove this confusion by simply changing INPUT to INPUT_PULLUP.
- As we run the Serial Monitor, we will get something shown below:
- You can see how we are getting HIGH value only, while the pin is still in open state.
- We can conclude, when we have nothing on our INPUT pin then INPUT_PULLUP will make the pin HIGH.
Difference between Read and Write
There are two ways to send or receive data. You can either define the pin as an input that helps in reading the data from an external device like sensors. Or you can define pin as an output that helps in writing and sending a command to LEDs, motors or actuators for executing the desired functions.
That's all for today. I hope you have found this post informative as per your needs and requirements and can easily use this pinMode Arduino Command. If you are feeling skeptical or have any question, you can ask me in the comment section below. I'll try and help you according to the best of my expertise. Thanks for reading the article.
How to Install Outdoor Projector for Maximum Effect
Hi Friends! Hope you are doing well. We always strive to keep you updated with valuable information as per your needs and demands so you keep visiting us quite often. Today, I'll uncover the details on
How to Install Outdoor Projector for Maximum Effect.
When you are in the middle of dealing with atrocities of life, you want a break that gives you both pleasure and relaxation at the same time. Putting yourself in a sheer peace differs from person to person, some love to fuel their car up and go for the long drive, other want to relax their muscles a bit and go for some game they love to play and some end up finding new ways of entertainment.
- Thanks to technology that has made things easy more than ever before and turned out to be a solution to almost every problem.
Most of the people, if not all, enjoy to glue with the TV screen and watch their favorite season or the movie they find interesting. Watching a new movie at the cinema is a bit of a whole new experience, but not everyone comes with a bunch of dollars to afford its cost.
What if I tell, you can buy and install your own projector screen and enjoy the feel of cinema right from the comfort of your home. Yes, you heard that right. You can buy an outdoor projector and turn your yard into a full cinema.
Installing a projector is not as easy as it looks and is not as difficult as it sounds. With few instructions beforehand, you can easily install and optimize the projector in your backyard.
How to Install Outdoor Projector for Maximum Effect
There are many things you need to be taken into consideration before picking the right projector that perfectly aligns with your needs. But don't you worry, I have covered everything up for you in the post: the place to pick the economical projector and how to tune it for getting the maximum results.
Temporary Arrangement
You need to put the whole setup at an optimal distance where you can watch the screen at the perfect angle. Figuring out the right projection angle and distance is a real task.
- It is advised to put and adjust the whole set temporarily at first so you can modify its location afterward in case the arrangement doesn't match with your glace.
Cooler or empty packaging boxes are the good pick to design a temporary solution where you can place whole nitty-gritty of the outdoor projector.
- Both the projection angle and distance vary from person to person, and it all depends on your interest. Some love to watch the screen with their neck little bit up with some distance and some like to watch the movie with their neck sitting at the angle of around 45 degrees.
Note: You must have a knack of playing with a bunch of wires while you set up the temporary arrangements because you gotta deal with a lot of them.
Permanent Arrangement
A wooden arrangement is preferable if you need a permanent solution. And an underground PVC pipe is perfect to house the number of wires. It saves you from the haunted look of messy wires and packs them all together in one place.
By following simple steps you can design the permanent arrangement for your projector.
- Make a solid hollow wooden rectangle supporting two three splinters, exposing a flat surface. Also, make sure the final rectangle is a little bit larger than your projector, covering it from both sides.
- Grab the shovel and dig a small ditch for putting the PVC pipe that will contain the wiring to the unit.
- Never forget to cover the PVC pipe with some insulating material. Leaving it open will make it vulnerable to both forecast and birds.
- As I already mentioned, installing your own projector looks hectic at first, but you can do it by yourself. If you are open to spending some dollars to make things easy like a walk in the park, you can hire some handyman to get this task done.
- Now hunt down the perfect place in the yard that you feel comfortable sitting in and design the legs for the whole arrangement that stand fit and support it from all ends, making them titled will keep the whole platform sitting on shaky grounds.
- It is advised to paint the arrangement with the weatherproof material for making the whole platform secure and away from the hassle of nature.
You can
learn more about outdoor projectors if you aim to buy the cost-effective ones. You must do a little bit research before making a final decision and picking a right one. Prior knowledge about projectors can save you a bunch of dollars at the start.
I'm not referring to being tech-geek and getting way too much involved yourself in the overwhelming information spread across the web. But, make sure, you have some information about brightness, resolution and aspect ratio of the projectors and what are the main factors affecting them in the long run.
That's all for today. I hope I have given you a brief overview on how to install the outdoor projector with maximum effect. If you are feeling unsure or have any question, you can ask me in the comment section below. I'd love to help you according to the best of my expertise. You are most welcome to keep us updated with your valuable feedback and suggestion, they help us provide you quality work as per your needs and expectations. Thanks for reading the article.
Enqueue Scripts Files in WordPress Plugin
Hello everyone, I hope you all are fine and having fun with your lives. In today's tutorial, I am gonna show you How to Enqueue Scripts Files in WordPress Plugin. It's the third tutorial in this series of WordPress Plugin Creation. In our previous tutorial, we have seen How to
Add Basic Functions in WordPress Plugin, so now the next thing we need to add is our scripts .js files and style .css files.
As I told you in my previous tutorial that we can add these codes in a single file as well but it will make the file too heavy and complex. But if we divide our code in separate files then it will be quite easily to handle and debug in future. So, let's have a look at How to Enqueue Scripts Files in WordPress Plugin:
Enqueue Scripts Files in WordPress Plugin
- Let's first create a sample .js and .css files.
- So create a new folder in your main folder and rename it to assests.
- In this assets folder, create two files and rename them to:
- Here's the folder and files tree which we have created so far:
- Today, I am not gonna add any code in .js or .css files, we will only include them in our Main PHP File.
- In coming tutorials, we will add codes in these files.
- So, now we have created our files, let's Enqueue Scripts Files in main PHP file.
/* Main class code ends here */
if ( !class_exists( 'NamePluginTEP' ) )
{
class NamePluginTEP
{
public $pluginName;
function __construct()
{
$this -> pluginName = plugin_basename(__FILE__);
}
function activate()
{
require_once plugin_dir_path( __FILE__ ).'inc/Activate.php';
Activate::activatePlugin();
}
function deactivate()
{
require_once plugin_dir_path( __FILE__ ).'inc/Deactivate.php';
Deactivate::deactivatePlugin();
}
function enqueue()
{
wp_enqueue_style ('mypluginstyle', plugins_url('/assets/mystyle.css' , __FILE__));
wp_enqueue_script ('mypluginscript', plugins_url('/assets/myscript.js' , __FILE__));
}
}
$namePluginTEP = new NamePluginTEP();
}
/* Main class code ends here */
- In the above code, you can see I have added a new function named enqueue().
- The method used to include css file is wp_enqueue_style, which is a predefined WordPress method.
- I have provided it with the path of our newly created css file, placed in assets folder.
- Same goes for the js file with a slight change in predefined WordPress method, for script it is wp_enqueue_script.
- We have successfully created the files and then the enqueue function, now we also need to call this function.
- We can call it in the construct function as construct is automatically called on class initialization but it's better to not add much load on the construct function.
- So here's how we are gonna do that:
/* Main class code ends here */
if ( !class_exists( 'NamePluginTEP' ) )
{
class NamePluginTEP
{
public $pluginName;
function __construct()
{
$this -> pluginName = plugin_basename(__FILE__);
}
function activate()
{
require_once plugin_dir_path( __FILE__ ).'inc/Activate.php';
Activate::activatePlugin();
}
function deactivate()
{
require_once plugin_dir_path( __FILE__ ).'inc/Deactivate.php';
Deactivate::deactivatePlugin();
}
public function init_func()
{
add_action('admin_enqueue_scripts' , array($this , 'enqueue') );
}
function enqueue()
{
wp_enqueue_style ('mypluginstyle', plugins_url('/assets/mystyle.css' , __FILE__));
wp_enqueue_script ('mypluginscript', plugins_url('/assets/myscript.js' , __FILE__));
}
}
$namePluginTEP = new NamePluginTEP();
$namePluginTEP -> init_func();
}
/* Main class code ends here */
- You can see in the above code that I have created a new function called init_func() and I have simply called enqueue function there.
- I have highlighted another line at the bottom where I have used the variable having new instance of our class, and then triggered the init_func() method.
- It's like an initialization function so if we need to call some other functions at start, we will simply place them in this init_func().
So, that's how we can easily Enqueue Scripts Files in WordPress Plugin. I hope you guys have enjoyed today's tutorial. In the next tutorial, we are gonna have a look at How to insert custom Links in WordPress Plugin. Till then take care and have fun !!! :)
Introduction to CR2032
Hey Guys! Hope you are doing well. Welcome you onboard. Today, I'll discuss the details on the
Introduction to CR2032 Battery. It is known as a coin cell or button cell that comes in cylindrical form and is mainly used in pocket calculators, wrist watches, artificial cardiac pacemakers, hearing aids, and automobile key-less entry transmitters.
Low self-discharge and an ability to retain a charge for a long time make this device a good pick for high power devices. More often than not, it is called a lithium energizer where high capacity is a major concern. It falls under the category of disposable primary cells, where common cathode material is a silver oxide, manganese dioxide, or carbon monofluoride and common anode materials are zinc or lithium.
In this post, I'll try to cover each and everything related to CR2032, so you don't need to wrestle your mind browsing a whole internet and find all information in one place. Let's jump right in and get down to the major details on this tiny device.
Introduction to CR2032
- CR2032 is a coin cell battery, also known as lithium energizer, that is mainly used in high power devices such as hearing aids, glucose monitors and automobile keyless entry transmitters.
- It provides a long service life to the devices it is incorporated in, allowing them to cover it by making a solid cylindrical shape. It can withstand high temperatures ranging from -22 to 140 F and can hold a bunch of power, enough to retain the charge for almost full 8 years.
- High capacity makes it a good replacement for BR2032, 5004LC, DL2032, and ECR2032.
- It is advised to keep this device away from the hunting eyes of kids, as swallowing it may cause serious injury or death in some cases due to chemical burns.
- Battery compartments are mainly used to keep the device safe and away from the children. These compartments can be shaped using two methods: an external mechanical tool like a screwdriver or coin is needed to unlock the battery compartment or using spare hand by applying two independent movements of the securing mechanism. They are designed in a way that can house a variety of cells where capacities will vary by size.
- The point worth mentioning here is that these Coin Lithium Cells are not interchangeable, however, thickness and diameter can be modified based on the cell designation.
CR2032 Features
Following are the main features of CR2032.
Classification |
Coin Cell Battery or Lithium Energizer |
Product Name |
CR2032 |
Output Voltage |
3V |
Chemical System |
Lithium / Manganese Dioxide (Li/MnO2) |
Capacity |
235 mAh |
Energy Density |
198 milliwatt hr/g |
Weight |
3 gram |
Lithium Content |
0.109 grams |
Self Discharge |
1% / year |
Type |
Non-Rechargeable |
Maximum Operating Temperature |
70 °C |
Minimum Operating Temperature |
-30 °C |
- Some cells made from different chemical compositions are mechanically interchangeable that can directly relate to the voltage stability and service cell life.
- Be careful while selecting the coin cell for a relevant device, wrong selection can severely affect the device performance, resulting in short life or hindrance in the operating process.
CR2032 Dimensions
The following figure shows the dimensions of CR2032.
- The dimensions are given in mm vs inches.
- These dimensions are specific to the CR2032 battery, however, these Coin Cells come in a variety of dimensions and are used as per technical needs and requirements.
CR2032 Applications
CR2032 are used in a wide range of applications and can easily adjust in the hard to reach places due to its smaller size. Following are the major applications of CR2032.
- Wrist-watches
- Toys and games
- Pocket calculators
- Heart-rate monitors
- Artificial cardiac pacemakers
- Glucose monitors
- Implantable cardiac defibrillators
- Hearing aids
- Keyless entry transmitters
That's all for today. I hope I have given you everything you needed to known about CR2032 battery. If you are unsure or have any question, you can comment me in the section below. I'll try and help you according to the best of my knowledge. You are most welcome to feed us with your valuable feedback and suggestions, they keep you in a constant loop and help us provide you quality work as per your demands. Thanks for reading the article.
Add Basic Functions in WordPress Plugin
Hello friends, I hope you all are doing great. In today's tutorial, I am going to show you How to Add Basic Function in WordPress Plugin. In the previous tutorial, we have seen
How to Create a Simple WordPress Plugin, and today we are gonna add some basic functions in it, which are kind of compulsory. You may not find them useful right now but they will come in handy when we will work on complex plugins.
It's the second tutorial in WordPress plugin creation series. If you got into any trouble then ask in comments and I will try my best to resolve them all. So, let's get started with these basic functions and add then in our newly created WordPress plugin:
Add Basic Functions in WordPress Plugin
- As we have already created the class for our wordpress plugin so now its time to add some functions in it.
- The first function we are going to add is the construct function.
- Construct is the default function, which is called by the class on initialization.
- So in simple words, when our plugin will start then construct function will be automatically called.
- Here's our code for the construct function:
/* Main class code starts here */
if ( !class_exists( 'NamePluginTEP' ) )
{
class NamePluginTEP
{
public $pluginName;
function __construct()
{
$this -> pluginName = plugin_basename(__FILE__);
}
}
$namePluginTEP = new NamePluginTEP();
}
/* Main class code ends here */
- We have already seen How to initialize the class NamePluginTEP.
- Inside this class, I have created a new variable named pluginName.
- After that I have added a construct function and this function will be called by default, it's simple object oriented programming.
- Within this construct function, I have used plugin_basename, which will give us the name of our plugin.
- I have saved the name in our variable pluginName.
- We are not gonna use this variable rite now but soon in the coming tutorials.
- The next two functions we are gonna add are Activate and Deactivate.
- These functions will be executed, when you will activate or deactivate your plugin in the WordPress plugin section.
- Here's the code for these two functions:
/* Main class code starts here */
if ( !class_exists( 'NamePluginTEP' ) )
{
class NamePluginTEP
{
public $pluginName;
function __construct(){
$this -> pluginName = plugin_basename(__FILE__);
}
function activate(){
}
function deactivate(){
}
}
$namePluginTEP = new NamePluginTEP();
}
/* Main class code ends here */
register_activation_hook( __File__, array( $namePluginTEP, 'activate') );
register_deactivation_hook( __File__, array( $namePluginTEP, 'deactivate') );
- As you can see in the above code that we have added both of these functions activate and deactivate in our Main Plugin class.
- Now in order to call these functions, we have to use built-in WordPress hooks.
- We have used two hooks, which are:
- register_activation_hook.
- register_deactivation_hook.
- These registration hooks will check the __File__ and then will find the activate/deactivate function in our class.
- Instead of adding all codes in a single PHP file, it's always a better approach to create separate PHP files for each method or routine.
- So, now we are gonna create two more PHP files for Activation and Deactivation and then will call them in our main PHP file.
Creating Activation & Deactivation PHP Files
- Till now, we have just created one Folder named NamePluginTEP and then we have created a php file of the same name, which is actually name of our plugin.
- So, now in this Main Plugin Folder, create a new folder and rename it to inc (short for include).
- In this inc folder, you have to create a two php files, named as:
- Activate.php
- Deactivate.php
- In the Activate.php file, place the below code:
<?php
/*
* @package NamePluginTEP
*/
class Activate
{
public static function activatePlugin()
{
flush_rewrite_rules();
}
}
- In the Deactivate.php file, place the below code:
<?php
/*
* @package NamePluginTEP
*/
class Deactivate
{
public static function deactivatePlugin()
{
flush_rewrite_rules();
}
}
- In both of these files, we have created a new class and then added a public static function.
- We have just used the method flush_rewrite_rules() , which is kind of a refresh and I am not adding any more codes in it.
- Don't worry in coming tutorials, these all are gonna come in handy, rite now we are just building the foundation.
- Now we have to call these functions in our Main PHP File.
- So our main PHP class will be something like that:
<?php
/**
*
* @package NamePluginTEP
*
*/
/*
Plugin Name: NamePluginTEP
Plugin URI: https://www.theengineeringprojects.com/
Author: Syed Zain Nasir
Author URI: https://twitter.com/syedzainnasir
Description: It's our First Simple WordPress Plugin.
Version: 1.0.0
License: GPLv2
*/
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
defined( 'ABSPATH' ) or die( 'We are having an error.' );
/* Main class code starts here */
if ( !class_exists( 'NamePluginTEP' ) )
{
class NamePluginTEP
{
public $pluginName;
function __construct(){
$this -> pluginName = plugin_basename(__FILE__);
}
function activate()
{
require_once plugin_dir_path( __FILE__ ).'inc/Activate.php';
Activate::activatePlugin();
}
function deactivate()
{
require_once plugin_dir_path( __FILE__ ).'inc/Deactivate.php';
Deactivate::deactivatePlugin();
}
}
$namePluginTEP = new NamePluginTEP();
}
/* Main class code ends here */
register_activation_hook( __File__, array( $namePluginTEP, 'activate') );
register_deactivation_hook( __File__, array( $namePluginTEP, 'deactivate') );
- We have just added two lines in both of our activate and deactivate functions.
- This method require_once plugin_dir_path is used to include the Activate.php file for once and we have passed its path.
- In the second line, we have simply called our function Activate::activatePlugin() , static functions can easily be called that way.
- Now activate or deactivate your plugin in WordPress Plugin section but it won't do anything as still we haven't added any remarkable code in it, we are just building the foundation. :P
- But the good thing is it's not crashing or giving any error, that's a good sign. :)
- Here's a screenshot of our WordPress plugin:
- I have activated the plugin but still its not doing anything but it will do something soon. :P
So, that was all for today. I hope you will easily Add these Basic Functions in WordPress Plugin. In the coming tutorial, we are gonna have a look at How to
Enqueue Scripts Files in WordPress Plugin. Till then take care and have fun !!! :)
How to Create a Simple WordPress Plugin
Hello friends, I hope you all are doing great. In today's tutorial, I am gonna show you
How to Create a Simple WordPress Plugin. I am starting this new series on WordPress Plugins and we will cover everything from basics to pro. This WordPress Plugin series is gonna be a long one. As today's our first post, so we are just gonna create a plugin and in later tutorials, we will add different features in it. I will try to cover all the basics but if you got into any trouble then ask in comments and I will try to resolve them out.
I have been working a lot these days on WordPress and have learnt many new things so I thought to share them on my blog. It will be helpful for computer software engineers, as if you have created your own site with WordPress then you must have thought about creating custom WordPress plugins as well. So, let's get started with How to Create a Simple WordPress Plugin:
Note:
- I would recommend you to use xampp and then install WordPress on it and test everything there.
Create a Simple WordPress Plugin
- First of all, what you need to do is, you need to find the wp-config.php file in the root directory of your WordPress installation.
- Open this file and place the below code in it:
define('WP_DEBUG', true);
- It will bring the WordPress in debugging mode and if we got any error while plugin development then we will also get the reason for that error.
- If its already defined and set to False then you need to change it to True.
- Now let's create some files for our first plugin, so open the folder named wp-content in the root WordPress installation.
- In this folder you will find a folder name Plugins, so open it up.
- In Plugins folder, create a new folder and the name of the folder should be the name of your plugin.
- So, I have renamed this new folder to NamePluginTEP as its my plugin name.
- The name of your plugin must have to be unique because if we have the preexisting plugin with the same name then our plugin will not index.
- So make sure your plugin's name must be different.
- Open this folder and now create a new php file with the same name so my file's name will be NamePluginTEP.php.
- For WordPress, it will be the main file of our plugin, it checks the name the file and compares it with name of the folder.
- Now we have to add some code in this php file for basic configuration.
- So place this code in the NamePluginTEP.php file:
<?php
/**
*
* @package NamePluginTEP
*
*/
/*
Plugin Name: NamePluginTEP
Plugin URI: https://www.theengineeringprojects.com/
Author: Syed Zain Nasir
Author URI: https://twitter.com/syedzainnasir
Description: It's our First Simple WordPress Plugin.
Version: 1.0.0
License: GPLv2
*/
?>
- You have to copy and paste the above code as its the defined syntax by WordPress.
- Now save your file and open the plugins page of your WordPress and if everything goes fine then you will get something as shown in below figure:
- You can activate or deactivate this plugin but it's not gonna make any change as its just created and doesn't have any functions in it.
- First of all, we need to secure our plugin so that if someone is accessing our plugin file externally then he can't get it.
- So, we need to add this line just below the copyrights:
defined( 'ABSPATH' ) or die( 'We are having an error.' );
- So, if the user is accessing the file from ABSPATH (absolute path) then its fine otherwise generate an error and exit.
- Now we need to create a new class for our plugin and the name of this class will be the same as our plugin's name:
if ( !class_exists( 'NamePluginTEP' ) )
{
class NamePluginTEP
{
}
$namePluginTEP = new NamePluginTEP();
}
- In the above code, first of all I have placed a check to see if the class already exists. It's a safety precaution.
- If the class doesn't exist, then we have created a new class of the same name.
- After the class, I have simply created a new instance of this class and saved it in a variable starting with small "n" while the class starts with capital "N".
- If you already know php, then it won't be much of an issue for you as it's simple object oriented programming.
- So, now when our plugin is loaded then this class will be initialized.
- Here's the complete php code of our plugin:
<?php
/**
*
* @package NamePluginTEP
*
*/
/*
Plugin Name: NamePluginTEP
Plugin URI: https://www.theengineeringprojects.com/
Author: Syed Zain Nasir
Author URI: https://twitter.com/syedzainnasir
Description: It's our First Simple WordPress Plugin.
Version: 1.0.0
License: GPLv2
*/
/*
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
defined( 'ABSPATH' ) or die( 'We are having an error.' );
if ( !class_exists( 'NamePluginTEP' ) )
{
class NamePluginTEP
{
}
$namePluginTEP = new NamePluginTEP();
}
- Here's our plugin in activate mode and there's no error generated by it:
That was all for today. I hope you can now easily create a simple WordPress plugin. I am not giving any files to download rite now as we have just covered the basics. In the next tutorial, we will have a look at How to
Add Basic Functions in WordPress Plugin. So, will meet you guys in next tutorial. Till then take care and have fun !!! :)
Introduction to IRF3205
Hi Fellas! I am back to give you a daily dose of valuable information. Today, I'll give you a detailed
Introduction to IRF3205. It is an N-Channel HEXFET Power
MOSFET that comes in a TO-220AB package and operates on 55V and 110A. It is mainly used for dynamic dv/dt rating and consumer full bridge applications.
Additionally, it falls under the category of ultra LOW on-resistance devices based on Advanced Process Technology, making it a building block of the electronic applications where fast switching is a major concern.
In this post, I'll cover each and everything related to this transistor, its main features, working, pinout, and applications. Let's get down to the nitty-gritty of this tiny component.
Introduction to IRF3205
- IRF3205 is an N-Channel HEXFET Power MOSFET that is mainly based on Advanced Process Technology and used for fast switching purpose.
- International Rectifier has introduced this device with the aim to generate extremely low on-resistance per silicon area.
- This power MOSFET is known as the voltage controlled device that mainly contains three terminals called:
- The voltage at Gate Terminal is used to handle the conductivity on other two terminals.
- The low thermal resistance and operating temperature around 175°C make this device an ideal choice for commercial industrial applications, providing power dissipation of around 50 watts.
- This Power MOSFET differs from the normal MOSFET, where former comes with gate layered with thick oxide and can experience high input voltage while the later comes with thin gate oxide without the ability to withstand high voltage i.e. applying high voltage will drastically affect the overall performance of the device.
- It features benchmark high package current ratings - appropriate for high power DC motors, power tools, and industrial applications.
IRF3205 Pinout
- IRF3205 Pinout consists of 3 Pins in total.
- All these pins, along with their name & type are shown in below table:
IRF3205 Pinout |
Pin# |
Name |
Symbol |
Type |
Function |
1 |
Gate |
G |
P-Type |
Controls the current between Drain & Source |
2 |
Drain |
D |
N-Type |
Electrons Emitter |
3 |
Source |
S |
N-Type |
Electrons Collector |
- Movement of electrons plays an important role in the current flowing from drain to source terminal.
- The output current is highly dependent on the voltage applied to the gate terminal.
Working
- The gate, source and drain in this MOSFET are analogous to the base, collector, and emitter in the BJT (Bipolar Junction Transistors)
- The source and drain are made up of n-type material while component body and the substrate is made up of p-type material.
- Adding silicon dioxide on the substrate layer gives this device a metal oxide semiconductor construction.
- It is a unipolar device where conduction is carried out by the movement of electrons.
- An insulating layer is inserted in the device that makes gate terminals separated from the entire body. The region between drain and source is called N-channel that is controlled by the voltage present at the gate terminal.
- MOSFET stays ahead of the curve when they are compared to BJT as the former needs no input current to control a large amount of current on remaining two terminals.
- Applying a positive voltage at this MOS structure will change the charge distribution in the semiconductor where holes present under the oxide layer deal with the force, allowing the holes to move downward.
- It is important to note that, the bound negative charges are connected with acceptors atoms that are mainly responsible for flocking the depletion region.
- The electrons, if applied with abundance, will help in increasing the overall channel conductivity, changing the substrate into the N-type material.
IRF3205 Proteus Simulation
- As I have told you earlier, IRF3205 is an N-channel Mosfet used for fast switching, that's why it's an ideal selection for designing H-Bridge.
- I have designed this Proteus Simulation where I have converted DC voltage into AC and if you look at it closely then I have used IRF3205 MOSFET in the H-Bridge:
- Moreover, I have used IRF5210 for the counter P-Type Mostel in H-Bridge.
- If you run your simulation then you will get AC sine wave in your oscilloscope, as shown in below figure:
- You can download this simulation by clicking the below button:
Download Proteus Simulation
IRF3205 Features
- Dynamic dv/dt Rating
- N Channel power MOSFET
- 55V, 110A
- TO-220
- 175°C Operating Temperature
- Fully Avalanche Rated
- Ultra Low On-Resistance
- Advanced Process Technology
- Fast Switching
IFR3205 Absolute Maximum Ratings
Following figures shows the absolute maximum ratings of IRF3205.
- These are the stress ratings that are important for the execution of the electronic circuit. If these stress ratings are exceeded from absolute maximum ratings, they can affect the overall nature and performance of the project, resulting in keeping your project in a total stall.
- Similarly, if these ratings are applied for the maximum period of time above normal operating conditions they can affect the reliability of the device.
- It is preferred to get a hold of these ratings before placing the device in the circuit, making sure if it undergoes the same operating conditions and stress ratings as provided by the manufacturer.
Applications
- Fast switching applications
- Consumer Full-Bridge
- Industrical and Commercial applications
- Full-Bridge
- Push-Pull
That's all for today. I hope I have given you everything you needed to know about IRF3205. If you are unsure or have any question, you can ask me in the comment section below. I'd love to help you in any way I can. Feel free to keep us updated with your valuable feedback and suggestions - they help us provide you quality work as per your needs and requirements. Thanks for reading the article.
Introduction to IRF4905
Hey Guys! Welcome you onboard. Today, I'll discuss the details on the
Introduction to IRF4905. It is a P-Channel HEXFET Power
MOSFET available in a TO-220AB package and is based on Advanced Process Technology. It is mainly used for fast switching purpose, capable of providing ultra-low on-resistance.
This tiny device comes with three terminals called gate, drain and source where the gate terminal is used to control the current on remaining two terminals. The area between source and drain is known as a channel that is widely dependent on the voltage applied to the gate terminal.
In this post, I'll cover each and everything related to this P channel MOSFET, its main features, working, pinout and applications. Let's jump right in and explore everything you need to know.
Introduction to IRF4905
- IRF4905 is a P-Channel HEXFET Power MOSFET available in a TO-220AB package and is based on Advanced Process Technology.
- It comes with three main terminals called drain, gate and source that are analogous to the emitter, base, and collector in the BJT (Bipolar Junction Transistors)
- It is a unipolar device where only one charge carriers i.e. holes are responsible for the current conduction.
- There are two types of MOSFET available for the development of electronic projects i.e. P channel and N channel both make use of single charge carriers where former contain holes as the major charge carriers and later contain electrons as the major charge carriers.
- This device falls under the category of Power MOSFET, different from normal MOSFET, where former contains thick gate oxide that can withstand high input voltage while the later comes with thin gate oxide, making it unable to bear high input voltage.
Working of IRF4905
- In this MOSFET transistor, gate plays a vital role to handle the conductivity in the channel between drain and source. As it is a P-Channel - holes will be responsible for the current conduction.
- In this components, the body and substrate are composed of N-type material while the drain and source are composed of P-type material - Laying out an exact oppositive composition as compared to N-Channel MOSFET.
- Following figure shows the internal construction of IRF4905.
- Applying negative voltage at the gate terminal will move the oxide layer downward in the substrate layer with a strong repulsive force, allowing positive holes to be accumulated around the gate region.
- The negative voltage applied at the gate terminal attracts the holes, helping to produce the p-type conducting channel using n-type substrate material.
IRF4905 Pinout
Following figure shows the pinout of IRF4905.
IRF 4905 Features
- Dynamic dv/dt rating
- Advance Process Technology
- P-Channel
- Fast Switching
- 175 C operating temperature
- Fully Avalanche Rated
- Ultra Low On Resistance
IRF4905 Absolute Maximum Ratings
Following figure shows the absolute maximum ratings of this P-Channel MOSFET.
- These are the stress ratings of this transistor which play a vital role in the execution of the electronic circuit. If these stress ratings are exceeded from absolute maximum ratings, they can affect the overall performance of the project.
- Also, if these ratings are applied for the maximum period of time above normal operating conditions, they can drastically affect the reliability of the device.
- It is advised to check these ratings before placing the device in the circuit in order to avoid any hassle in the future.
Applications
- Commercial and Industrial Applications
- Fast Switching
- Amplification Purpose
That's all for today. I hope you have found this article useful. If you are feeling skeptical or have any question, you can ask me in the comment section below. I'd love to guide you according to the best of my expertise. You are most welcome to feed us with your valuable suggestions - they help us provide you quality work as per your needs and requirements. Thanks for reading the article.
Guide to Writing an Engineering Research Paper
The engineering field is not typically known for its literary style or its compelling prose, in large measure because engineering is better known as an applied field than a theoretical one. Most engineering students expect to spend their time working with mathematical equations and applying these equations to discover engineering solutions rather than researching term papers. But engineering is a discipline with an academic component, and research is an essential element of its academic aspect. In short, if you’re a student in an engineering program, you need to be able to write a great research paper just as much as you need to be able to solve complex mathematical problems.
However, many students in application-based fields like engineering are much more comfortable with numbers than they are with words. Because of this, research papers can be challenging for them. Fortunately, there are a few key steps you can take to make sure your next engineering research paper truly shines.
Guide to Writing an Engineering Research Paper
- Plan your research early: Many students who are less comfortable with research paper writing tend to wait to research as they write, but this creates problems. First, it means that you are wasting time going back and revising each new piece of information rather than starting with a complete understanding of your topic. Second, it also means that you will be scrambling to research as you write, costing you time through inefficiency and redundancy. Instead, the better choice is to start your research process as quickly as possible in order to give yourself time to analyze and digest what you are reading and to develop original ideas about what the research has to say about your topic. Separating the research process from the writing process will help you to develop stronger ideas and prepare for the writing process, making the actual writing of your paper that much faster and more efficient.
- Use only the most current research: While there are some cases where historical articles can be important for understanding the development of an idea, you will want to use current research to support your analysis. Current research keeps you abreast of the latest information in your field. This is especially important because of the changing nature of engineering. New information and new approaches can render older ways of doing things obsolete. You want to ensure that your paper is the strongest it can be, which means that you need to stay current to ensure your paper is on the cutting edge.
- Select data by quality, not by quantity: Many engineering students rightly value numbers and data because this is the raw material used in engineering. However, a research paper is a little different from other types of engineering work. In a research paper, you should focus on high-quality data, not simply the volume of data you can pack into your paper. In a research paper, focusing on the best and most important information is paramount. Extraneous information, redundant data, or irrelevant data don’t make a manuscript stronger, even if they make it longer. They are a distraction and can undercut the power of your main points.
- Discuss the theory, not just the results: Because engineering is an applied discipline, many students minimize or ignore theory in favor of discussing results. While results are important, in a research paper it’s also essential to talk about the methodology and theory used to obtain those results. By explaining the background of a theory and the underpinnings that demonstrate why it is true, you show the reader that you know what you are talking about and have considered the strengths and weaknesses of the approach you have used to obtain your results. It also shows that you have an understanding of the conventions and requirements of academic writing.
- Remember to explain your hypothesis: When you have explained the theories behind your work, you will need to tell the reader what your paper will investigate and what you hope to demonstrate or prove. Outlining the hypothesis is important to make sure that the audience understands why you have chosen to present specific data, and what it all means.
Writing an engineering research paper doesn’t have to be hard! It just takes a little bit of work and a bit of mindfulness about how to employ and deploy research to support and defend your great ideas. Before you know it, you’ll have an excellent engineering research paper! If you still need professional assistance from academic experts in the engineering field, don’t hesitate to address a research paper writing service that will help you immediately with your project.
Introduction to Arduino Due
Hey Fellas! I am back to give you a daily dose of useful information. Today, I'll uncover the details on the
Introduction to Arduino Due. It is a microcontroller board based on Atmel SAM3X8E, 32-Bit ARM microcontroller. It is developed by Arcuino.cc with the intention to provide an easy pathway for the beginners to get a hands-on experience with the module without any prior technical knowledge. You can just plug the device into the computer through a USB cable and start playing with it right away.
Arduino Modules are a step ahead of a single microcontroller. If your project is mainly based on a microcontroller, you need to buy external peripherals and connect them with the controller in order to lay out an automation into your project. Arduino Boards has made things easy more than ever before. Although, more or less, they are known are microcontrollers, they have a leg over them because of built-in peripherals and an ability to perform a number of functions on a single chip. Also, no external burner is required for Arduino, as it comes with a built-in burner. You just have to write and compile the required code into the Arduino Software and burn in the module through a single click on the computer.
In this post, I'll cover each and everything related to Arduino Due i.e. its main features, pinout, pin description, compilers used and applications. Let's get down to the nitty-gritty of this tiny module and explore everything you need to know.
Introduction to Arduino Due
- Arduino Due is a microcontroller board that is mainly based on Atmel SAM3X8E (32-Bit ARM microcontroller). It is a big module as compared to Arduino Nano or Arduino Uno and comes with more number of pins and memory space as compared to them.
- It contains 54 digital that can work both ways: input or output. Out of these digital pins, 12 can be used to generate PWM outputs.
- This module contains everything in bulk required for the automation project including 12 analog inputs, and 4 UARTs serial module.
- I was floored when I came to know this module comes with clock frequency around 84 MHz. Yes, you heard that right. The splendid oscillator will help in processing speed grow skyrocket.
- Two USB ports are available where one is used as a programming USB Port while other is Native USB Port. Don't you worry, I'll make it clear the difference between them. Just follow along.
- Most of the Arduino Boards run at 5 V but this module is an exception that operates at 3.3V. The pins incorporated on the cannot withstand voltage higher than this. Doing so can drastically affect the board performance and can make your pins null and void.
- JTAG is added on the board that is mainly used for testing the physical connection between the onboard pins.
- The Arduino Due can be programmed using a common Arduino Software (IDE), that is compatible with all Arduino boards and can work both ways: online and offline.
- This module incorporates 2 DAC (digital to analog), 2 TWI, a power jack (you can power up the device by connecting it with a computer through USB cable or using this power jack), an SPI header reset button, an erase button and reset button. Bunch of functions, making your task easy.
- As per the voltage constraint, Arduino shields that operate at 5V are not compatible with this Due module. However, the shields that come with Arduino R3 layout work efficiently including Arduino WiFi shield and Ethernet Shield as they operate at 3.3V.
1. Arduino Due Features
You have got a brief overview of the device. I have compiled the main features of this device at one place.
Following table shows the main features of Arduino Due.
Microcontroller |
Atmel SAM3X8E ARM Cortex-M3 |
CPU |
32-Bit |
Digital I/O Pins |
54 |
PWM Output |
12 |
Analog Input |
12 |
Flash Memory (Program Memory) |
512 KB |
SRAM |
96 KB (two banks: 64 KB and 32 KB) |
Operating Voltage |
3.3V |
Input Voltage |
7-12 V |
Manufacturer |
Arduino.cc |
Oscillator |
up to 84 MHz |
Software Used |
Arduino Software (IDE) |
Reset Button |
1 |
Erase Button |
1 |
DAC (Digital to Analog Converter) |
2 |
UART (Serial Communication) |
4 |
SPI Communication |
Yes |
TWI (I2C Communication) |
2 |
Arduino Shield Compatibility |
Yes (that operate at 3.3V) |
USB (2) |
Programming USB (1)
Native USB (1) |
Power Jack |
1 |
JTAG Header |
1 |
DC current for 3.3V |
800mA |
Total DC output current on all I/O lines |
130mA |
2. Arduino Due Pinout
Now, you have got a hold of the main features of this module. In this section, I'll highlight the pinout of the chip.
Following figure shows the pinout of Arduino Due.
- I know it is quite overwhelming and difficult to digest at one glance, but don't you worry I have broken it down in the pin description with images.
3. Arduino Due Pin Description
The function associated with each pin will help you understand the purpose of each pin in the relevant project they can be used for.
Following table shows the description of each pin.
Digital I/O Pins |
54 |
There are 54 digital I/O pins, out of which 12 can be used as PWM outputs. |
Analog Pins |
A0 to A11 |
These pins are used for an analog pins on the board. They are 12 in numbers. |
Digital to Analog Converter |
DAC0, DAC1 |
Two digital to analog converter with 12bit resolution. |
Erase Button |
1 |
Erases the information by holding down this button |
Reset Button |
1 |
Resets the board |
External Interrupts |
Digital I/O Pins |
All 54 pins can be used for generating an external interrupt |
UART |
4 |
Board comes with 4 pairs of TX and RX serial pins for laying out serial communication. These pins include (A9,A8), (D4,D5), (A13,A12), (A11,A10) |
SPI |
Serial Peripheral Communication |
(MOSI, MISO, SCK, RESET) Pin used (A26, A25, A27, Reset) |
TWI |
Two Wire Interface (2 module) |
There are two I2C communication incorporated on the board with pins at A18, A17, B13, B12 |
CAN Interface |
2 |
CAN (Controller Area Network) Interface is used for communication between controllers. Pins include |
Power Source |
+5V, +3.3V, GND and Vin |
+5V- Connected to 5V
+3.3V (Operating Voltage)
Vin- Input Voltage - Connected to +7V to +12V (recommended)
GND - Connected to Ground |
You have got clear about the functions associated with each pin. Now, I'll highlight the functions of each pin with images, making it easy for you to look at the information without much hassle.
Digital I/O Pins
Arduino Due comes with four ports named PORTA, PORTB, PORTC, and PORTD. There are 54 digitals I/O pins. The pins with
PINK color on the pinout mention above are used as digital I/O pins.
Analog Pins
There are 12 analog pins on the board. They are a part of PORTA and PORTB and appear on the board as follow.
USB Ports and Power Jack
There are two USB ports available on the board where one is programming USB port and other is native USB port. Both ports can be used for programming purpose, however, the native port also acts as a USB host for connected peripherals like keyboards and smartphones.
There is one power jack on the board for powering up the device.
UART
There are four UART channels added on the board. They are used for the serial communication with the external devices where TX is the Serial Transmit Pin while RX is the Serial Receive Pin. They appear on the board as follow.
TWI
There are two TWI (Two Wire Interface) modules incorporated on the board, also known as the I2C protocol, and are used to establish the communication between low-speed devices like ADC and DAC converters and microcontrollers. It is a two wire communication and comes with two lines: Serial Clock (SCL) and Serial Data (SDA). The former is a clock signal that is used to synchronize the data transfer between the devices while the later is used to hold the desired data.
PWM Output
Out of 54 digital pins, 12 are used for PWM output. They appear on the board as follow.
JTAG Header
JTAG header is a remarkable addition in the board that most of the board lack in the Arduino Community. It is a common hardware interface that sets a pathway to communicate directly with external chips on a board. It was introduced by the Joint (European) Test Access Group with the intention of testing the physical connections between pins on a chip. It comes with fours pins known as TCK, TMS, TDI, and TDO. This header incorporates on the board as follows.
Reset and Erase button
There is one reset and one erase button is added on the device. Former is used to reset the controller while later is used to erase the stored information on the board. They appear on the board as follow.
Power Source
There are four power sources mentioned as 5V, 3.3V, Vin and Ground. The 3.3V is the operating voltage of each pin while Vin is the input voltage with the recommended voltage range of 7V to 12V. You can power the controller with Vin or 5V. These voltage sources appear on the board as follow.
4. Programming and Communication
- Almost all Arduino Boards can be programmed by Arduino Software called IDE. It is easy to use and a common person with no prior technical can learn the software without much difficulty. It is readily available, just download the software and select the board you aim to work on. As I mentioned earlier, no external burner is required to burn the code into the controller. Arduino software works perfectly with common operating systems like Windows, Linux or MAC.
- This module comes with a bunch of communication protocols to communicate with external devices. The UART is useful for setting up a serial communication. One serial module is okay, right? Wrong. There are four of them, giving you the flexibility to establish serial communication with more than one devices. Serial library in the software is mainly used for the serial communication between board and external devices.
- The Serial Monitor is a remarkable addition in Arduino Software, mainly used for transmitting textual data to or from the board.
- The TX and RX pins incorporate an LED on each pin that flashes as the data is transmitted.
- Two Wire Interface is also included in the device that comes with two lines SDA and SCL. There are two TWI channels available on the board. Arduino Software Wire Libary is used to access the TWI bus.
- Arduino Due comes with a serial peripheral interface (SPI) that plays a vital role in the communication between the microcontroller and other peripheral devices such as shift registers and sensors. There are two pins used for SPI communication i.e. MOSI (Master Output Slave Input) and MISO (Master Input Slave Output). The former is used for receiving the data while later helps in sending data by the microcontroller.
5. Difference between Arduino Due and Arduino Mega
There is a vital difference between both modules in terms of operating voltage, memory space, number of pins and processing speed. Arduino Due can perform the functions with greater pace as compared to Arduino Mega. More powerful built-in peripherals and more memory space put Arduino Due ahead of Mega.
However, there are some limitations. Arduino Due is not compatible with the 3.3V devices, also, SAM3Xchip provides a complex and intimidating interface that can scare the hell of the person who is practicing this module very first time. It is advised to work with a smaller module like
Arduino Uno in the start, and as you get a solid grip on the module, you can move to the complex interface.
6. Arduino Due Applications
Arduino Due is a little bit bulky, covers large space and is used in a wide range of applications where fast processing speed is the end result. Following are the main applications of the board.
- Industrial Automation
- Home and Security Systems
- Virtual Reality Applications
- Android Applications
- GSM Based Projects
- Embedded System
That's all for today. I hope I have given you everything you needed to get started with this module. If you are still living in doubt, you can approach me in the comment section below. I'll guide you the best way I can. Your feedback and suggestions are the piece of nuggets for us, on which we generate and shape our content - so keep that coming. Thanks for reading the article.