First, we will design a database for our website, then we will design the RFID circuit for scanning the student cards and displaying present students on the webpage, and finally, we will design the website that we will use to display the attendees of a class.
| Where To Buy? | ||||
|---|---|---|---|---|
| No. | Components | Distributor | Link To Buy | |
| 1 | Breadboard | Amazon | Buy Now | |
| 2 | Jumper Wires | Amazon | Buy Now | |
| 3 | LCD 16x2 | Amazon | Buy Now | |
| 4 | LCD 16x2 | Amazon | Buy Now | |
| 5 | Raspberry Pi 4 | Amazon | Buy Now | |
Additionally, the Database server offers a DBMS that can be queried and connected to and can integrate with a wide range of platforms. High-volume production environments are no problem for this software. The server's connection, speed, and encryption make it a good choice for accessing the database.
There are clients and servers for MySQL. This system contains a SQL server with many threads that support a wide range of back ends, utility programs, and application programming interfaces.
We'll walk through the process of installing MySQL on the RPi in this part. The RFID kit's database resides on this server, and we'll utilize it to store the system's signed users.
There are a few steps before we can begin installing MySQL on a Raspberry Pi. There are two ways to accomplish this.
sudo apt update
sudo apt upgrade
Installing the server software is the next step.
Here's how to get MySQL running on the RPi using the command below:
sudo apt install MariaDB-server
Having installed MySQL on the Raspberry Pi, we'll need to protect it by creating a passcode for the "root" account.
If you don't specify a password for your MySQL server, you can access it without authentication.
Using this command, you may begin safeguarding MySQL.
sudo mysql_secure_installation
Follow the on-screen instructions to set a passcode for the root account and safeguard your MySQL database.
To ensure a more secured installation, select "Y" for all yes/no questions.
Remove elements that make it easy for anyone to access the database.
We may need that password to access the server and set up the database and user for applications like PHPMyAdmin.
For now, you can use this command if you wish to access the Rpi's MySQL server and begin making database modifications.
sudo MySQL –u root -p
To access MySQL, you'll need to enter the root user's password, which you created in Step 3.
Note: Typing text will not appear while typing, as it does in typical Linux password prompts.
Create, edit, and remove databases with MYSQL commands now available. Additionally, you can create, edit, and delete users from inside this interface and provide them access to various databases.
After typing "quit;" into MySQL's user interface, you can exit the command line by pressing the ESC key.
Pressing CTRL + D will also exit the MYSQL command line.
You may proceed to the next step now that you've successfully installed MySQL. In the next few sections, we'll discuss how to get the most out of our database.
The command prompt program MySQL must be restarted before we can proceed with creating a username and database on the RPi.
The MySQL command prompt can be accessed by typing the following command. After creating the "root" user, you will be asked for the password.
To get things started, run the command to create a MySQL database.
The code to create a database is "CREATE DATABASE", and then the name we like to give it.
This database would be referred to as "rfidcardsdb" in this example.
To get started, we'll need to create a MySQL user. The command below can be used to create this new user.
"rfidreader" and "password" will be the username and password for this example. Take care to change these when making your own.
create user “rfidreader" @localhost identified by "password."
We can now offer the user full access to the database after it has been built.
Thanks to this command, " "rfidreader" will now have access to all tables in our "rfidcardsdb" database.
grant all on rfidcardsdb.* to "rfidreader" identified by "password."
We have to flush the permission table to complete our database and user set up one last time. You cannot grant access to the database without flushing your privilege table.
The command below can be used to accomplish this.
Now we have our database configured, and now the next step is to set up our RFID circuit and begin authenticating users. Enter the “Exit” command to close the database configuration process.
An RFID reader reads the tag's data when a Rfid card is attached to a certain object. An RFID tag communicates with a reader via radio waves.
In theory, RFID is comparable to bar codes in that it uses radio frequency identification. While a reader's line of sight to the RFID tag is preferable, it is not required to be directly scanned by the reader. You can't read an RFID tag that is more than three feet away from the reader. To quickly scan a large number of objects, the RFID tech is used, and this makes it possible to identify a specific product rapidly and effortlessly, even if it is sandwiched between several other things.
There are major parts to Cards and tags: an IC that holds the unique identifier value and a copper wire that serves as the antenna:
Another coil of copper wire can be found inside the RFID card reader. When current passes through this coil, it generates a magnetic field. The magnetic flux from the reader creates a current within the wire coil whenever the card is swiped near the reader. This amount of current can power the inbuilt IC of the Card. The reader then reads the card's unique identifying number. For further processing, the card reader transmits the card's unique identification number to the controller or CPU, such as the Raspberry Pi.
Connect the reader to the Raspberry the following way:
use the code spi bcm2835 to see if it is displayed in the terminal.
lsmod | grep spi
SPI must be enabled in the setup for spi bcm2835 to appear (see above). Make sure that RPi is running the most recent software.
Make use of the python module.
sudo apt-get install python
The RFID RC522 can be interacted with using the Library SPI Py, found on your RPi.
cd ~
git clone https://github.com/lthiery/SPI-Py.git
cd ~/SPI-Py
sudo python setup.py install
cd ~
git clone https://github.com/pimylifeup/MFRC522-python.git
To test if the system is functioning correctly, let's write a small program:
cd ~/
sudo nano test.py
now copy the following the code into the editor
import RPi.GPIO as GPIO
import sys
sys.path.append('/home/pi/MFRC522-python')
from mfrc522 import SimpleMFRC522
reader = SimpleMFRC522()
print("Hold a tag near the reader")
try:
id, text = reader.read()
print(id)
print(text)
finally:
GPIO.cleanup()
Here we will write a short python code to register users whenever they swipe a new card on the RFID card reader. First, create a file named addcard.py.
copy the following code.
import pymysql
import cv2
from mfrc522 import SimpleMFRC522
import RPi.GPIO as GPIO
import drivers
display = drivers.Lcd()
display.lcd_display_string('Scan your', 1)
display.lcd_display_string('card', 2)
reader = SimpleMFRC522()
reader = SimpleMFRC522()
id, text = reader.read()
display = drivers.Lcd()
display.lcd_display_string('Type your name', 1)
display.lcd_display_string('in the terminal', 2)
user_id = input("user name?")
# put serial_no uppercase just in case
serial_no = '{}'.format(id)
# open an sql session
sql_con = pymysql.connect(host='localhost', user='rfidreader', passwd='password', db='rfidcardsdb')
sqlcursor = sql_con.cursor()
# first thing is to check if the card exist
sql_request = 'SELECT card_id,user_id,serial_no,valid FROM cardtbl WHERE serial_no = "' + serial_no + '"'
count = sqlcursor.execute(sql_request)
if count > 0:
print("Error! RFID card {} already in database".format(serial_no))
display = drivers.Lcd()
display.lcd_display_string('The card is', 1)
display.lcd_display_string('already registered', 2)
T = sqlcursor.fetchone()
print(T)
else:
sql_insert = 'INSERT INTO cardtbl (serial_no,user_id,valid) ' + \
'values("{}","{}","1")'.format(serial_no, user_id)
count = sqlcursor.execute(sql_insert)
if count > 0:
sql_con.commit()
# let's check it just in case
count = sqlcursor.execute(sql_request)
if count > 0:
print("RFID card {} inserted to database".format(serial_no))
T = sqlcursor.fetchone()
print(T)
display = drivers.Lcd()
display.lcd_display_string('Congratulations', 1)
display.lcd_display_string('You are registered', 2)
GPIO.cleanup()
The program starts by asking the user to scan the card.
Then it connects to the database using the pymysql.connect function.
If we enter our name successfully, the program inserts our details in the database, and a congratulations message is displayed to show that we are registered.
Using the LCD command library, you can:
sudo apt install git
cd /home/pi/
git clone https://github.com/the-raspberry-pi-guy/lcd.git
cd lcd/
sudo ./install.sh
After installation is complete, try running one of the program files
cd /home/pi/lcd/
Next, we will install the mfrc522 library, which the RFID card reader uses. This will enable us to read the card number for authentication. We will use:
Pip install mfrc522
Next, we will import the RPI.GPIO library enables us to utilize the raspberry pi pins to power the RFID card and the LCD screen.
Import RPi.GPIO
We will also import the drivers for our LCD screen. The LCD screen used here is the I2C 16 * 2 LCD.
Import drivers
Then we will import DateTime for logging the time the user has swiped the card into the system.
Import DateTime
In order to read the card using the rfid card, we will use the following code:
reader = SimpleMFRC522()
display = drivers.Lcd()
display.lcd_display_string('Hello Please', 1)
display.lcd_display_string('Scan Your ID', 2)
try:
id, text = reader.read()
print(id)
display.lcd_clear()
finally:
GPIO.cleanup()
The LCD is divided into two rows, 1 and 2. To display text in the first row, we use:
Display.lcd_display_string(“string”,1)
And 2 to display in the second row.
After scanning the card, we will connect to the database we created earlier and search whether the scanned card is in the database or not.
If the query is successful, we can display if the card is in the database; if not, we can proceed, then the user needs to register the card.
If the user is registered, the system saves the logs, the username and the time the card was swapped in a text file located in the/var/www/html root directory of the apache server.
Note that you will need to be a superuser to create the data.txt file in the apache root directory. For this, we will use the following command in the Html folder:
Sudo touch data.txt
Then we will have to change the access privileges of this data.txt file to use the program to write the log data. For this, we will use the following code:
Sudo chmod 777 –R data.txt
The next step will be to display this data on a webpage to simulate an online attendance register. The code for the RFID card can be found below.
#! /usr/bin/env python
# Import necessary libraries for communication and display use
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522
import pymysql
import drivers
import os
import numpy as np
import datetime
# read the card using the rfid card
reader = SimpleMFRC522()
display = drivers.Lcd()
display.lcd_display_string('Hello Please', 1)
display.lcd_display_string('Scan Your ID', 2)
try:
id, text = reader.read()
print(id)
display.lcd_clear()
# Load the driver and set it to "display"
# If you use something from the driver library use the "display." prefix first
try:
sql_con = pymysql.connect(host='localhost', user='rfidreader', passwd='password', db='rfidcardsdb')
sqlcursor = sql_con.cursor()
# first thing is to check if the card exist
cardnumber = '{}'.format(id)
sql_request = 'SELECT user_id FROM cardtbl WHERE serial_no = "' + cardnumber + '"'
now = datetime.datetime.now()
print("Current date and time: ")
print(str(now))
count = sqlcursor.execute(sql_request)
if count > 0:
print("already in database")
T = sqlcursor.fetchone()
print(T)
for i in T:
print(i)
file = open("/var/www/html/data.txt","a")
file.write(i +" Logged at "+ str(now) + "\n")
file.close()
display.lcd_display_string(i, 1)
display.lcd_display_string('Logged In', 2)
else:
display.lcd_clear()
display.lcd_display_string(“Please register”, 1)
display.lcd_display_string(cardnumber,2)
except KeyboardInterrupt:
# If there is a KeyboardInterrupt (when you press ctrl+c), exit the program and cleanup
print("Cleaning up!")
display.lcd_clear()
finally:
GPIO.cleanup()
Now we are going to design a simple website with Html that we are going to display the information of the attending students of a class, and to do this, we will have to install a local server in our raspberry pi.
Web, database, and mail servers all run on various server software. Each of these programs can access and utilize files located on a physical server.
A web server's main responsibility is to provide internet users access to various websites. It serves as a bridge between a server and a client machine to accomplish this. Each time a user makes a request, it retrieves data from the server and posts it to the web.
A web server's largest issue is to simultaneously serve many web users, each of whom requests a separate page.
For internet users, convert them to Html pages and offer them in the browser. Whenever you hear the term "webserver," consider the device in charge of ensuring successful communication in a network of computers.
Among its responsibilities is establishing a link between a server and a client's web browser (such as Chrome to send and receive data (client-server structure). As a result, the Apache software can be used on any platform, from Microsoft to Unix.
Visitors to your website, such as those who wish to view your homepage or "About Us" page, request files from your server via their browser, and Apache returns the required files in a response (text, images, etc.).
Using HTTP, the client and server exchange data with the Apache webserver, ensuring that the connection is safe and stable.
Because of its open-source foundation, Apache promotes a great deal of customization. As a result, web developers and end-users can customize the source code to fit the needs of their respective websites.
Additional server-side functionality can be enabled or disabled using Apache's numerous modules. Encryption, password authentication, and other capabilities are all available as Apache modules.
To begin, use the following code to upgrade the Pi package list.
sudo apt-get update
sudo apt-get upgrade
After that, set up the Apache2 package.
sudo apt install apache2 -y
That concludes our discussion. You can get your Raspberry Pi configured with a server in just two easy steps.
Type the code below to see if the server is up and functioning.
sudo service apache2 status
You can now verify that Apache is operating by entering your Raspberry Pi's IP address into an internet browser and seeing a simple page like this.
Use the following command in the console of your Raspberry Pi to discover your IP.
hostname-i
Only your home network and not the internet can access the server. You'll need to configure your router's port forwarding to allow this server to be accessed from any location. Our blog will not be discussing this topic.
The standard web page on the Raspberry Pi, as depicted above, is nothing more than an HTML file. First, we will generate our first Html document and develop a website.
Let's start by locating the Html document on the Raspbian system. You can do this by typing the following code in the command line.
cd /var/www/html
To see a complete listing of the items in this folder, run the following command.
ls -al
The root account possesses the index.html file; therefore, you'll see every file in the folder.
As a result, to make changes to this file, you must first change the file's ownership to your own. The username "pi" is indeed the default for the Raspberry Pi.
sudo chown pi: index.html
To view the changes you've made, all you have to do is reload your browser after saving the file.
Here, we'll begin to teach you the fundamentals of HTML.
To begin a new page, edit the index.html file and remove everything inside it using the command below.
sudo nano index.html
Alternatively, we can use a code editor to open the index.html file and edit it. We will use VS code editor that you can easily install in raspberry pi using the preferences then recommended software button.
You must first learn about HTML tags, which are a fundamental part of HTML. A web page's content can be formatted in various ways by using tags.
There are often two tags used for this purpose: the opening and closing tags. The material inside these tags behaves according to what these tags say.
The p> tag, for example, is used to add paragraphs of text to the website.
<p>The engineering projects</p>
Web pages can be made more user-friendly by using buttons, which can be activated anytime a user clicks on them.
<button>Manual Refresh</button>
<button>Sort By First Name</button>
<button>Sort By last Name</button>
A typical HTML document is organized as follows:
Let us create the page that we will use in this project.
<html>
<head>
</head>
<body>
<div id="pageDiv">
<p> The engineering projects</p>
<button type="button" id="refreshNames">Manual Refresh</button><br/>
<button type="button" id="firstSort">Sort By First Name</button><br/>
<button type="button" id="lastSort">Sort By Last Name</button>
<div id="namesFromFile">
</div>
</div>
</body>
</html>
<!DOCTYPE html>: HTML documents are identified by this tag. This does not necessitate the use of a closing tag.
<html>: This tag ensures that the material inside will meet all of the requirements for HTML. There is a /html> tag at the end of this.
</head>: It contains data about the website, but when you view it in a browser, you won't be able to see anything.
A metadata tag in the head tag can be used to set default character encoding in your website, for instance. This has a /head> tag at the end of it.
<head>
<meta charset="utf-8">
</head>
Also, you can have a title tag inside the head tag. This tag sets the title of your web page and has a closing </title> tag.
<head>
<meta charset="utf-8">
<title> My website </title>
</head>
<body>: The primary focus of the website page is included within this tag. Everything on a web page is usually contained within body tags once you've opened it. This has a /body> tag at the end of it. Many other tags can be found in this body tag, but we'll focus on the ones you need to get started with your first web page.
We will go ahead and style our webpage using CSS with the lines of codes below;
<head>
<!--
body {
width:100%;
background:#ccc;
color:#000;
text-align:left;
margin:0
;padding:10px
;font:16px/18pxArial;
}
button {
width:160px;
margin:0 0 10px;}
#pageDiv {
width:160px;
margin:20px auto;
padding:20px;
background:#ddd;
color:#000;
}
#namesFromFile {
margin:20px 0 0;
padding:10px;
background:#fff;
color:#000;
border:1px solid #000;
border-radius:10px;
}
-->
</style>
</head>
The style tags is a cascading style sheet syntax that lets developers style the webpages however they prefer.
You can add images to your web page by using the <img> tag. It is also a void element and doesn’t have a closing tag. It takes the following format
<img src="URL of image location">
For example, let’s add an image of the Seeeduino XIAO
<p>The Engineering projects</p>
<img src="https://www.theengineeringprojects.com/wp-content/uploads/2022/04/TEP-Logo.png">
Reload the browser to see the changes
This is the last step of this project, and we will implement a program that reads our data.txt file from the apache root directory and display it on the webpage that we designed. Since we already have our webpage up and running, we will use the javascript programming language to implement this function of displaying the log list on the webpage. All changes that we are about to implement will be done in the index.html file; therefore, open it in the visual studio code editor.
JavaScript is a dynamic computer programming language. It is lightweight and most commonly used as a part of web pages, whose implementations allow client-side scripts to interact with the user and make dynamic pages. It is an interpreted programming language with object-oriented capabilities.
One of the major strengths of JavaScript is that it does not require expensive development tools. You can start with a simple text editor such as Notepad.
Well, javascript as mentioned earlier is a very easy to use language that simply requires us to put the script tags inside the html tags.
<script> script program </script>
<header>
<script>
Here goes our javascript program
</script>
</header>
The javascript code first opens the data.txt file, then it reads all the contents form that file. Then it uses the xmlHttpRequest function to display the contents on the webpage. The buttons on the webpage activate different functions in the code.For instance manual refresh activates:
function refreshNamesFromFile(){
var namesNode=document.getElementById("namesFromFile");
while(namesNode.firstChild)
{ namesNode.removeChild(namesNode.firstChild);
}
getNameFile();
}
This function reads the content of the data.txt
The sort by buttons activate the sort function to sort the logged users either by first name or last name. The function that gets activated by these buttons is:
function sortByName(e)
{ var i=0, el, sortEl=[], namesNode=document.getElementById("namesFromFile"), sortMethod, evt, evtSrc, oP;
evt=e||event;
evtSrc=evt.target||evt.srcElement;
sortMethod=(evtSrc.id==="firstSort")?"first":"last";
while(el=namesNode.getElementsByTagName("P").item(i++)){
sortEl[i-1]=[el.innerHTML.split(" ")[0],el.innerHTML.split(" ")[1]];
}
sortEl.sort(function(a,b){
var x=a[0].toLowerCase(), y=b[0].toLowerCase(), s=a[1].toLowerCase(), t=b[1].toLowerCase();
if(sortMethod==="first"){
return x<y?-1:x>y?1:s<t?-1:s>t?1:0;
}
else{
return s<t?-1:s>t?1:x<y?-1:x>y?1:0;
}
});
while(namesNode.firstChild){
namesNode.removeChild(namesNode.firstChild);
}
for(i=0;i<sortEl.length;i++){
oP=document.createElement("P");
namesNode.appendChild(oP).appendChild(document.createTextNode(sortEl[i][0]+" "+sortEl[i][1]));
namesNode.appendChild(document.createTextNode("\r\n"));
//insert tests -> for style/format
if(sortEl[i][0]==="John"){
oP.style.color="#f00";
}
if(sortEl[i][0]==="Sue")
{ oP.style.color="#0c0";
oP.style.fontWeight="bold";
}
}
}
Automated attendance systems are excessively time-consuming and sophisticated in the current environment. It is possible to strengthen company ethics and work culture by using an effective smart attendance management system. Employees will only have to complete the registration process once, and images get saved in the system's database. The automated attendance system uses a computerized real-time image of a person's face to identify them. The database is updated frequently, and its findings are accurate in a user interactive state because each employee's presence is recorded.
Smart attendance systems have several advantages, including the following:
Students in elementary, secondary, and postsecondary institutions can utilize this system to keep track of their attendance. It can also keep track of workers' schedules in the workplace. Instead of using a traditional method, it uses RFID tags on ID cards to quickly and securely track each person.
1) Real-time tracking – Keeping track of staff attendance using mobile devices and desktops is possible.
2)Decreased errors – A computerized attendance system can provide reliable information with minimal human intervention, reducing the likelihood of human error and freeing up staff time.
3) Management of enormous data – It is possible to manage and organize enormous amounts of data precisely in the db.
4) Improve authentications and security – A smart system has been implemented to protect the privacy and security of the user's data.
5) Reports – Employee log-ins and log-outs can be tracked, attendance-based compensation calculated, the absent list may be viewed and required actions are taken, and employee personal information can be accessed.
This tutorial taught us to build a smart RFID card authentication project from scratch. We also learned how to set up an apache server and design a circuit for the RFID and the LCD screen. To increase your raspberry programming skills, you can proceed to building a more complex system with this code for example implementing face detection that automatically starts the authentication process once the student faces the camera or implement a student log out whenever the student leaves the system. In the following tutorial, we will learn how to build a smart security system using facial recognition.
Parts are composed of a number of surfaces, each surface has a certain size and mutual position requirements. The requirements of the relative position between the surfaces of the parts include two aspects: the dimensional accuracy of the distance between the surfaces and the relative position accuracy (such as axes, parallelism, verticality and circular runout, etc.).
The study of the relative position relationship between the part surfaces can not be separated from the datum, and the position of the part surface can not be determined without a clear datum. In its general sense, the datum is the point, line and surface on the part on which the position of other points, lines and surfaces are determined. According to its different functions, the benchmark can be divided into two categories: design benchmark and process benchmark.
A datum is a point, line, or surface from which measurements are made. In the case of the piston, the design datum refers to the centerline of the piston and the centerline of the pinhole.
The datum used by parts in the process of machining like turning and assembly is called process datum. According to different uses, the processed datum is divided into positioning datum, measuring datum and assembly datum.
1) Positioning datum: The datum is the point of reference from which all other measurements are taken. When positioning the datum, it is important to take into account the size and shape of the workpiece, as well as the type of machining operation being performed. According to the different positioning elements, the most commonly used are the following two categories:
Automatic centering positioning: such as three-claw chuck positioning.
To make a positioning sleeve, such as a stop plate, into a positioning sleeve.
Others are positioned in the V-shaped frame, positioned in the semicircular hole, and so on.
2) measuring datum: A measuring datum is a physical reference point used to take measurements. The datum provides a starting point from which all other measurements are taken. without a measuring datum, it would be difficult to take accurate measurements.
3) Assembly datum: the datum used to determine the position of the part in the assembly or product during assembly, called assembly datum.
In order to produce a surface that meets the specified technical requirements on a certain part of the workpiece, the workpiece must occupy a correct position relative to the tool on the machine tool before machining. This process is often referred to as the "positioning" of the artifact. After the workpiece is positioned, due to the action of cutting force, gravity and so on, a certain mechanism should be used to "clamp" the workpiece so that its determined position remains unchanged. The process of holding the workpiece in the correct position on the machine tool and clamping the workpiece is called "installation".
The quality of workpiece installation is an important issue in machining, which not only directly affects the machining accuracy, the speed and stability of workpiece installation, but also affects the productivity. In order to ensure the relative position accuracy between the machined surface and its design datum, the design datum of the machined surface should occupy a correct position relative to the machine tool when the workpiece is installed. For example, in the precision turning ring groove process, in order to ensure the circular run out of the ring groove bottom diameter and the skirt axis, the design basis of the workpiece must be coincident with the axis line of the machine tool spindle.
[caption id="attachment_171666" align="aligncenter" width="800"]When machining parts on different machine tools, there are different installation methods. The installation methods can be summarized as direct alignment method, marking alignment method and fixture installation method.
The main results are as follows:
1) when using this method, the correct position of the workpiece on the machine tool is obtained through a series of attempts. The specific way is to install the workpiece directly on the machine tool, use the dial meter or the needle on the needle plate, visually correct the correct position of the workpiece, and correct it at the same time until it meets the requirements.
The positioning accuracy and speed of direct alignment depend on the accuracy of alignment, the method of alignment, the tools of alignment and the technical level of workers. Its disadvantage is that it takes more time, the productivity is low, and it has to be operated on the basis of experience and requires high skills of workers, so it is only used in single-piece and small batch production. Such as hard to imitate the shape of the alignment belongs to the direct alignment method. .
2) the method of line alignment this method is a method of using a needle on a machine tool to correct the workpiece according to the line drawn on the blank or semi-finished product, so that it can get the correct position. It is obvious that this method requires an additional marking process. The drawn line itself has a certain width, and there is a marking error when marking, and there is also an observation error when correcting the position of the workpiece, so this method is mostly used in the rough machining of small batch production, low blank precision, and large workpieces that are not suitable for the use of fixtures. For example, the determination of the pin hole position of the two-stroke product is to use the marking method of the indexing head to correct it.
3) fixture installation method: the process equipment used to clamp the workpiece and make it occupy the correct position is called machine tool fixture. The fixture is an additional device of the machine tool, and its position relative to the tool on the machine tool has been adjusted in advance before the workpiece is installed, so it is no longer necessary to find the correct position one by one when machining a batch of workpieces, which can ensure the technical requirements of machining, which saves both labor and trouble. It is an efficient positioning method and is widely used in batch and mass production. Our current piston processing is the fixture installation method used.
Surface roughness is a measure of the irregularities in the surface of a material. It can be caused by a variety of factors, including manufacturing defects, wear and tear, and environmental exposure. Surface roughness can have a significant impact on the performance of a material, as it can affect its resistance to wear, corrosion, and other forms of damage. The term "roughness" refers to both the size and frequency of the irregularities on the surface of a material. The size of the irregularities is typically measured in micrometers or nanometers, while the frequency is typically measured in cycles per inch (CPI).
Surface roughness can also be characterized by its wavelength, which is the average distance between adjacent peaks or troughs. The most common method of measuring surface roughness is with a profilometer, which uses a stylus to trace the contours of the surface and generate a profile. The profile is then analyzed to determine the roughness parameters.
[caption id="attachment_171667" align="aligncenter" width="800"]There are 3 kinds of surface roughness height parameters:
Within the sampling length, the arithmetic mean of the absolute distance between the point on the contour line along the measuring direction (Y direction) and the baseline.
It refers to the sum of the average peak height of the five maximum contours and the average valley depth of the five maximum contours within the sampling length.
The distance between the top line of the highest peak and the bottom line of the lowest valley within the sampling length.
Nowadays, Ra is mainly used in the general machinery manufacturing industry.
The surface quality of the machined workpiece directly affects the physical, chemical and mechanical properties of the machined workpiece, and the working performance, reliability and service life of the product depend to a large extent on the surface quality of the main parts. Generally speaking, the surface quality requirements of important or key parts are higher than ordinary parts, because the parts with good surface quality will greatly improve their wear resistance, corrosion resistance and fatigue resistance.
Surface roughness is an important consideration in many engineering applications, as it can have a significant impact on the performance of a component or system. For example, surface roughness can affect the tribological properties of a material, such as its friction and wear resistance. It can also affect the ability of a material to resist corrosion and other forms of damage.
In addition, surface roughness can influence the optical properties of a material, such as its reflectivity and transmittance. Surface roughness is also a concern in many manufacturing processes, as it can cause defects in the finished product. For example, surface roughness can cause problems with adhesion, machining, and metallurgy. Surface roughness can also make it difficult to achieve desired tolerances in manufacturing processes. As a result, surface roughness is an important factor to consider in the design and manufacture of components and systems.
There are many ways to reduce surface roughness, including using methods such as honing, grinding, lapping, and polishing. In addition, surface treatments such as electroplating, ion implantation, and vapor deposition can also be used to improve the surface smoothness of the material.
1) the function of cutting fluid.
Cooling effect: the cutting heat can take away a large amount of cutting heat, improve the heat dissipation conditions, and reduce the temperature of the tool and the workpiece, thus prolonging the service life of the tool and preventing the dimensional error caused by thermal deformation of the workpiece.
Lubrication: the cutting fluid can penetrate between the workpiece and the tool, forming a thin adsorption film in the tiny gap between the chip and the tool, reducing the friction coefficient, so it can reduce the friction between the chip and the workpiece, reducing the cutting force and cutting heat, reduce the tool wear and improve the surface quality of the workpiece, which is especially important for finishing and lubrication.
Cleaning function: the tiny chips produced in the cleaning process are easy to adhere to the workpiece and the tool, especially when drilling deep holes and twisted holes, the chips are easy to block in the chip-holding groove, affecting the surface roughness of the workpiece and the service life of the tool. The use of cutting fluid can wash away the chips quickly, so that the cutting can be carried out smoothly.
2) types: there are two kinds of common cutting fluids.
Emulsion: mainly plays a cooling role, emulsion is made by diluting emulsified oil with 15-20 times water, this kind of cutting fluid has high specific heat, low viscosity, good fluidity and can absorb a lot of heat. This kind of cutting fluid is mainly used to cool tools and workpieces, improve tool life and reduce thermal deformation. The emulsion contains more water and has poor lubrication and antirust function.
Cutting oil: the main component of cutting oil is mineral oil, this kind of cutting fluid has low specific heat, high viscosity and poor fluidity, and mainly plays the role of lubrication. Mineral oil with low viscosity is commonly used, such as engine oil, light diesel oil, kerosene and so on.
MIG welding is the process of joining metal parts by melting the base metal and fusing it with a filler metal. The name is derived from the phrase "Metal Inert Gas," which is commonly used. The process involves using an arc between an electrode and the workpiece, which melts the base metal and fuses it with the filler metal.
Mig welding is an extremely versatile process that can be used to create virtually any shape or configuration of the welded joint. You can also use it for many different metals, including low carbon steel, stainless steel, and aluminum alloys.
The MIG welding equipment you'll need includes:
The torch supplies the heat needed to melt the wire. It has a handle, an on/off trigger, and a tip where the wire feeds. The torch also has an air regulator that controls how much oxygen is mixed with natural gas going into the burner head (the part of the torch where you attach your wire). You need to use this setting depending on what type of metal you're working with.
This holds the compressed gas used as fuel for the welding process. Welding torch to combust inside and heats up when activated by pressing down on your trigger switch or button. You'll also see these bottles or tanks. Still, they're all essentially identical in function—they vary slightly in size based on their gas capacity.
Protects your eyes from any spark produced by friction during MIG welding processes such as spatter creation during stick electrode usage.
The thickness of welding wire is measured in thousands of an inch (thou) or mils. The most common sizes of welding wire are as follows: 22-gauge (0.023"), 24-gauge (0.024"), 26-gauge (0.025"), and 28-gauge (0.028")
The gauge refers to the thickness of the wire and the higher the number, the thinner it is and the less heat it can take before melting or burning out on you when you're trying to weld with it.
You can adjust these settings to improve the quality of your weld or reduce the amount of heat you apply to the weld.
This controls how much material is deposited in each pass and determines how much heat will be required to melt it. A smaller diameter wire requires less energy and produces a cleaner weld, but it also requires more passes to build up a good bead.
This is how quickly you move through the molten pool when welding; too fast and you'll get porosity; too slow and it may take longer than necessary for each pass due to poor cooling.
MIG welding is a great way to get started in welding. It's really easy, and it's safe for beginners. You can use Mig welding for various projects, including light steelwork, ironmongery, and aluminum.
Mig welders are versatile, meaning they can handle almost any metal you want to weld with their different settings. They also include gas supplies that provide the shielding gas needed during the process, which makes them good value for money compared with other welder types.
Mig welding is a skill that anyone can pick up with only a little time and practice. If you're interested in learning how to weld but don't know where to begin, here are a few options:
Yes, you can use a TIG welder as a MIG welder. If your TIG welder has adjustable amperage, you can follow the steps listed above. TIG welders tend to have higher amperage settings than MIG welders, but they still require the same power as a MIG welder. Since a TIG welder is more versatile, it's worth investing in one if you're regularly using welding equipment or want more control over your project.
The machine uses a hollow wire and is filled with flux. Flux is the material that covers the weld and protects it from contamination when welding. You can use a flux core welder outdoors because the wind doesn't affect the weld because of the flux inside the wire. A flux core welder can also be used indoors with no gas if the welding material thickness is 1/2" or less. It isn't recommended to use Flux Core Welding for thinner materials on higher amperage settings, as there will be too much spatter and smoke
This is a common question, and the answer is: yes, but it depends on the type of wire you are using. Flux core wire doesn't need shielding gas, while solid welding wire does need shielding gas.
The type of work you do will determine whether you need a machine that uses shielding gas or flux core wire. For example, if you are working outdoors or inside with wind, you can use flux core wire since it does not require an external gas cylinder.
In 1794, molecules were considered a minute particles according to the French. Latin used vogue words for molecules until the late 18th century. Molecules have evolved as the knowledge of the structure of the molecule that retains their composition and Chemical properties according to the earlier definition was less precise. This concept breaks down because most rocks, salts, and metals are composed of a huge crystalline network of chemical bonded atoms or ions.
It reveals the existence of strong chemical bonding between the atoms of molecules in ionic form.
We are searching for many years on molecular ions, including helium hydride ion, the first molecular ion we discovered that was formed in the Universe by a chemical bond. We detect it in the laboratory by inserting a medium. It was first seen in a planetary nebula named NGC 7027 using the GREAT spectrometer aboard the Stratospheric Observatory for Infrared Astronomy.
I will make this topic very easy for beginners.
So first of all we see its overview :
By gaining and losing electrons of an atom, the molecular ion is formed
The second name of the molecular ion is also known as polyatomic ion which is formed in radical cation by a covalent bond by sharing more than one electron.
It is an example of a radical cation.
An electron is a light particle as compared to a proton.
it is the smallest unit of a substance and is formed by the combination of atoms.
It may contain one or more atoms.
Some examples of molecules are
ion is formed by the gaining and losing of electrons of an atom.
For Example :
To understand this topic we see the example of sodium chloride NaCl.
Na+, Cl-
Molecule ___gain/lose electron _______ molecular ion
There are two types of molecular ions:
They have charged positive ions because they lost the electron from the molecules.
For Example :
CH4+
They have charged negative ions because they absorb the electron from the molecules.
For Example :
O2-I
The main differences between cationic and anionic molecular ions are categorized in the following table:
NOTE:
Cationic molecular ions are abundant in nature as compared to the Anionic molecular ions.
These cations and anions are formed by the bombardment of high-energy particles such as electron beams in the form of alpha particles or X_rays. These rays or radiation knocked out the electron from gas molecules resulting in the formation of Cationic molecular ions.
Simply we can say that it is formed by the ionization of the molecules.
For Example :
N2 + 1e- ___x_rays/alpha rays______N2-1 (molecular anion)
CO ___alpha/x_rays_____ CO+ + 1e-1 (molecular cation)
Explanation :
In the first example, we deal with a nitrogen molecule in which it gains one electron in the presence of a beam of X_rays or alpha rays radiation and becomes a molecular anion. Molecular anions are less abundant in nature. To understand this topic we take the example of bags and clothes. If you put the clothes in a bag, if the bag is almost full then it is difficult to put more clothes in bags. This is the same logic apply to molecular anions.
That's why it is less abundant.
In the second example, we release electrons from CO, in the presence of X_rays then we format molecular cation because it is easier to remove electrons from more than one.
It is very abundant in nature.
There are important features that tell us how an electron is removed from bond pair:
The most important thing here arises is that,
The ammonium ion is not a molecular ion due to its formation through the coordinate covalent bond between ammonia (NH3) and hydrogen ion (H+).
Because nitrogen of ammonia has electron lone_pair it can donate electrons to hydrogen ions resulting in the formation of ammonium ion by dative bond or co_ordinate covalent bond.
Hence, ammonium ion (NH4+) is not formed by the gain or loss of electrons. Therefore it is not a molecular ion.
NH4+ is a poly-atomic ion.
Ozone is also a molecule that is bound by three atoms of oxygen. Which is symbolically represented by O3.
Its layer protects our environment or atmosphere from harmful ultraviolet rays which are emitted by the sun.
If molecules have any species of the charge they will be molecular ions if we remove the charge from the molecule then it is simply a molecule, not a molecular ion.
CH4+ (molecular ion)
CH4 (Molecule not a molecular ion)
The total atomic mass of all elements present in a molecule is equal to that of a particular substance known as molecular mass.
We can measure the molecular mass of the molecule by using the following steps which are given below:
Example:
See the example of calcium oxide (CaO).
Sum up all the values we obtain,
CaO = 1*40(atomic mass of calcium) + 1*16(atomic mass of oxygen)
= 56 g_mol-1
The sum of the atomic mass of all the elements present in a formula unit of a substance is called formula mass.
For Example :
The formula mass of NaCl is 58.5 atomic mass.
Which type of force exists in molecular ions formation?
Intermolecular forces are electrostatic attractive forces between permanently or temporarily charged chemical species. They include
These forces are responsible for the formation of molecular ions.
Dipole-dipole or an ion-dipole force is an attractive force that resultantly comes from the electrostatic attraction between an ion and a neutral molecule that has a dipole.
A positive molecular ion (cation) attracts the partially negative end of a neutral polar molecule.
A negative molecular ion (anion) attracts the partially positive end of a neutral polar molecule.
Ion_ion forces are also known as ionic bonding. It is easy to understand this force is present between two oppositely charged ions. This force is not considered an intermolecular force but this force is helping us to understand this bonding.
A suitable example for this case is table salt, NaCl.
Hydrogen bonding also plays a vital role in the formation of molecular ions. This force is stronger than all types of forces. Its best example is water in the formation of molecular ions.
how to find the relative formula mass by using a molecular ion?
In mass spectroscopy, an electron is released from the molecule; then as a result we obtain a radical cation called the molecular ion (symbols: M•+, M+).
The molecules which removed the electrons resultantly gain molecular ions currently obtained the highest energy electrons
We describe the molecular ion peak by using a graph:
In this peak, we can describe the relative formula mass (relative molecular mass) of an organic compound from its mass spectrum. It also gives us high-resolution mass spectra that can be able to find out the molecular formula for a compound.
In the mass spectrum, the ion which has the greatest m/z value is treated like a molecular ion. Some ionic compounds have mass spectra that don't contain a molecular ion peak because all the molecular ions break into fragments.
By the end of this article, you will be able to find out
By using molecular ions we can determine the following facts:
The most important question is what molecular ions how they are formed.
Molecular ions obtained from the natural products on decomposition give information about the structure of the molecule.
I Hope, I cover all aspects of the molecular ions. It is the last topic of our first tutorial. If you want these trusting topics simply, give me good feedback for better results. If you have any questions, put them in the comment section. I will reply to you as soon as possible. Our next tutorial series is coming soon. Our platform tries to give the best and in trusting topics that clear your all concept. Thanks.
Hello readers, I hope you all are enjoying our Raspberry Pi Pico programming series. In our previous tutorials, we learned how to access Raspberry Pi Pico’s GPIO pins for both input as well as output operations. For demonstration, we used LED as an output component and a push button as an input component.
Now let’s learn how to interface sensor modules with the Raspberry Pi Pico module. So, in this tutorial, we will learn how to interface the DHT11 sensor with the Raspberry Pi Pico module and fetch the observed data (from its surrounding) using the MicroPython programming language.
Before writing the code for interfacing and fetching the data from the respective sensor, let’s first have a look at the working operation, features and properties of the DHT sensor.
Fig. 1 Raspberry Pi Pico and DHT11 modules
The DHT11 sensor (also known as a temperature and humidity sensor) is a sensor module that measures humidity and temperature in its immediate environment. The ambient temperature and humidity of a given area are monitored by this sensor module. The sensor is made up of an NTC (negative temperature co-efficient) temperature sensor and a resistive type humidity sensor. An 8-bit microcontroller is also built into the sensor module. The microcontroller converts analogue to digital and outputs a digital signal through the single wire protocol.
The following are some of the DHT11 sensor's technical specifications:
Table:1 DHT11 technical specifications
DHT11 sensors can also be used to create a wired sensor system with up to 20 meters of cable.
A DHT sensor is mostly used in weather monitoring systems and for research purposes. Although we have satellites to provide the status of weather conditions but, the data provided by satellites represent a larger area. In the case of research applications, the satellite provided data is not sufficient so in such applications, we need to use sensor modules like DHT.
To measure temperature and humidity, two DHT modules (DHT11 and DHT22) are available in the market. Both of the DHT11 and DHt22 modules, serves the same purpose, but they have different specifications. The DHT22 sensor, for example, has a wider range of humidity and temperature sensitivity. The temperature sensitivity of DHT22 ranges from -40 to 80°C with +-0.5°C tolerance and on the other hand, the temperature sensitivity of the DHT11 sensor ranges from 0 to 50°C with +-2°C tolerance.
Similarly, the humidity sensitivity of the DHT22 sensor ranges from 0 to100% with +-2% tolerance and for DHT11 the humidity sensitivity rages between 20 to 90% with +-5% tolerance. Similarly other properties like resolution, sampling time etc are better in the DHT22 sensor module than in DHT11. But the only disadvantage or drawback of the DHT22 sensor module is its cost. The DHT22 is costlier than DHT11 sensor module. So you can use any of the modules as per your requirements and resources.
The software and hardware components required to interface the DHT sensor with the Raspberry Pi Pico board are:
Fig. Required Components (hardware)
DHT11 is a three pin module and the pins include ‘+Ve’ for 3.3V, ‘-Ve’ for ground and the third one is ‘OUT’ for data output.
Fig. 3 DHT11 Pin-out
The connection for interfacing the DHT11 and Pico modules are shown in table 1. There are basically three pins in DHT11 sensor as discussed earlier. Two pins are to power up the DHT11 module i.e., VCC and ground and these two pins are connected to the 3.3V and GND pins of the Pico board. The third pin i.e., ‘OUT’ is used to provide data input to the Raspberry Pi Pico board. The data (‘OUT’) pin can be connected to any of the GPIO pins of the pico board. So here we are using GPIO_0 pin for data input.
Table 2 Interfacing DHT11 with Raspberry Pi Pico
Fig. 4 Interfacing DHT11 with Pico board circuit
The development environment we are using is Thonny IDE, to program the Raspberry Pi Pico board for accessing the dual core feature with MicroPython programming language.
So, before writing the MicroPython program user need to install the respective development environment to compile and upload the MicroPython program into the Pico board.
We already published a tutorial on how to install and access Thonny IDE for Raspberry Pi Pico programming using MicroPython programming language. Follow our previous tutorial, to install Thonny IDE for raspberry pi pico programming.
Let’s write the MicroPython program to interface the DHT sensor with the Raspberry Pi Pico module and fetch the temperature and humidity data observed with the DHT11 sensor.
Fig. 5 importing necessary library files
Fig. 6 declaring the ‘pin’ object
Fig. 7 Main loop
# importing necessary library files
from machine import Pin
import utime
from dht import DHT11, InvalidChecksum
while True:
utime.sleep(2) # adding delay of 2 seconds
pin = Pin(0, Pin.OUT, Pin.PULL_DOWN) # declaring pin object
dht_input = DHT11(pin) # defing the sensor pin
temp = (dht_input.temperature) # reading temperature
humidity = (dht_input.humidity) # reading humidity
print("temp(°C): {}".format(dht_input.temperature))
print("humidity(%): {}".format(dht_input.humidity))
You can use the above code as it is. But before compiling the code make sure you have uploaded the dht.py library file to your system/Raspberry pi pico module.
To upload the dht.py file into your system/pico board, go to File >> New, as shown below:
Fig. 8 create a new program
import array
import micropython
import utime
from machine import Pin
from micropython import const
class InvalidChecksum(Exception):
pass
class InvalidPulseCount(Exception):
pass
MAX_UNCHANGED = const(100)
MIN_INTERVAL_US = const(200000)
HIGH_LEVEL = const(50)
EXPECTED_PULSES = const(84)
class DHT11:
_temperature: float
_humidity: float
def __init__(self, pin):
self._pin = pin
self._last_measure = utime.ticks_us()
self._temperature = -1
self._humidity = -1
def measure(self):
current_ticks = utime.ticks_us()
if utime.ticks_diff(current_ticks, self._last_measure) < MIN_INTERVAL_US and (
self._temperature > -1 or self._humidity > -1
):
# Less than a second since last read, which is too soon according
# to the datasheet
return
self._send_init_signal()
pulses = self._capture_pulses()
buffer = self._convert_pulses_to_buffer(pulses)
self._verify_checksum(buffer)
self._humidity = buffer[0] + buffer[1] / 10
self._temperature = buffer[2] + buffer[3] / 10
self._last_measure = utime.ticks_us()
@property
def humidity(self):
self.measure()
return self._humidity
@property
def temperature(self):
self.measure()
return self._temperature
def _send_init_signal(self):
self._pin.init(Pin.OUT, Pin.PULL_DOWN)
self._pin.value(1)
utime.sleep_ms(50)
self._pin.value(0)
utime.sleep_ms(18)
@micropython.native
def _capture_pulses(self):
pin = self._pin
pin.init(Pin.IN, Pin.PULL_UP)
val = 1
idx = 0
transitions = bytearray(EXPECTED_PULSES)
unchanged = 0
timestamp = utime.ticks_us()
while unchanged < MAX_UNCHANGED:
if val != pin.value():
if idx >= EXPECTED_PULSES:
raise InvalidPulseCount(
"Got more than {} pulses".format(EXPECTED_PULSES)
)
now = utime.ticks_us()
transitions[idx] = now - timestamp
timestamp = now
idx += 1
val = 1 - val
unchanged = 0
else:
unchanged += 1
pin.init(Pin.OUT, Pin.PULL_DOWN)
if idx != EXPECTED_PULSES:
raise InvalidPulseCount(
"Expected {} but got {} pulses".format(EXPECTED_PULSES, idx)
)
return transitions[4:]
def _convert_pulses_to_buffer(self, pulses):
"""Convert a list of 80 pulses into a 5 byte buffer
The resulting 5 bytes in the buffer will be:
0: Integral relative humidity data
1: Decimal relative humidity data
2: Integral temperature data
3: Decimal temperature data
4: Checksum
"""
# Convert the pulses to 40 bits
binary = 0
for idx in range(0, len(pulses), 2):
binary = binary << 1 | int(pulses[idx] > HIGH_LEVEL)
# Split into 5 bytes
buffer = array.array("B")
for shift in range(4, -1, -1):
buffer.append(binary >> shift * 8 & 0xFF)
return buffer
def _verify_checksum(self, buffer):
# Calculate checksum
checksum = 0
for buf in buffer[0:4]:
checksum += buf
if checksum & 0xFF != buffer[4]:
raise InvalidChecksum()
Once both the main.py and dht.py are saved successfully we are ready to run the program. Click on the Run icon to test the interfacing setup and check the respective results.
To see the sensor reading (temperature and humidity) observed with DHT11 sensor and Pico module we can either interface some peripheral device like LCD display or OLEDs. But for now we are just printing the sensor reading on Shell. We will create another tutorial for interfacing a peripheral display device with Raspberry Pi Pico module.
The sensor readings observed with DHT11 sensor are printed on the Shell. Image of the observed temperature and humidity values is attached below:
Fig. 9 DHT11 output
In this tutorial, we learned how to interface a peripheral sensor with the Raspberry Pi Pico module to observe temperature and humidity and display the data on Shell. This concludes the tutorial. I hope you found this of some help and also hope to see you soon with a new tutorial on the Raspberry Pi Pico programming series.
Hello, students here in our previous tutorial we study molecules and now I am with a new topic “Ion” which might be possible for some of my readers this article seems to be new, and some of my readers may be familiar with this term. But no matter whether we know or not, in my article I try to cover all aspects of this term. Many questions arise in your mind such as you may think;
What is an ion?
How ions are formed?
What are the different types of an ion?
What methodology is utilized for assigning charge to an ion?
What are examples of an ion?
Which methods are used for the creation of an ion?
If my readers want to know the answers to these questions, hold copies and pencils in your hand and stick to my article till the end.
An atom or group of atoms that brings a positive or negative electric charge as a conclusion of including lost or achieved one or more electrons
Or
A charged subatomic particle (such as a free electron)
By the word an Ion, it's not wrong to say that it is the type of chemical species which may hold two types of charges with some magnitude. These charges may be positive or negative with some magnitude. Those atoms or molecules that have unequal net charges associated with them simply say that charges on them are not involved in a factor of zeros, we use the term an ion for such types of atoms.
As this term is the basis of chemistry everyone is familiar with this term. For understanding the article in a better way I explain it. Atom is the smallest component that constitutes the property of an element. An atom has a heavy central Part which is known as the nucleus. In the nucleus, two types of charges are present one is a proton carrying a positive charge and the other is a neutron neutral particle. Overall there is a positive charge in the nucleus. Around the nucleus, there are several circular orbits in which electrons keep moving the nucleus. In each orbit, electrons feel a nuclear pull that restricts their motion in a circular orbit.
Back to our statement that ions have a non-zero net charge. By non-zero net charges, it concluded that may an atom have more protons ( sub particle of an atom that consists of a positive charge. These charges are present inside a nucleus) than several electrons ( sub particle of an atom constituting a negative charge and present outside the nucleus, keep in motion in orbits around the nucleus) or secondly, maybe there are a greater number of electrons than the number of protons in their atomic or molecular structure. Thus we can say that a charged atom or molecule is named an ion. It is charged because we see that the number of protons and electrons is unequal.
Two conditions of inequality of charges between sub-particles of an atom are mentioned. Depending upon these two conditions we can categorize an ion into two different types either positive ion (cation) or negative ion(Anion).
According to the first condition, when the number of protons is greater than the number of the electron in an atom, then the atomic structure is knowns to be positively charged. Such positively charged atoms are known as cations or positively charged ions. The charge on a cation depends upon the tendency of an atom to lose electrons from the shell. If one electron is removed then the charge is +1, if two electrons are removed from the shell then the cationic charge is +2 as illustrated in the given below example.
The word endothermic means heat absorbing. Endothermic reactions or processes are those in which there is a need for absorption of heat to carry out the reaction.
The amount of energy that is required to pull out an electron from the valance shell of an atom is named ionization energy. An example is given below to illustrate the above statement:
Here 496 KJ/mole energy is required to form positive cation sodium from an isolated sodium atom.
When a positive cation is formed then the number of protons increases as compared to the number of electrons. As one or more electron are removed from the valance shell, there is the removal of the shell from an atom result in an increase in the nuclear pull on the remaining valance electron. That’s why the cation is less than the parent atom by its size.
An exothermic process is a process that occurs with the liberation of heat or energy. An anion or negatively charged ion is formed when an extra electron is gained by an isolated atom, this addition of extra electrons increases the energy of the atom resulting in instability of an atom. To attain stability, as the atom earlier it loses energy in form of heat. Thus the formation of uni-negatively ion is an exothermic process. Given below there is an example mentioned to explain the above statement:
Here when an electron is added to an isolated atom of chlorine, an amount of energy 349 KJ/mole is liberated. Which makes the reaction exothermic reaction.
It possesses a negative charge and the suffix (ide) is used for monoatomic anion and (ate) for the polyatomic anion. Such as hydride and hydrate.
As there is two type of charged ions one is a positively charged cation and the other is a negatively charged anion, due to their opposite polarity an electrostatic force of attraction arises between them. This electrostatic force worked as a driving force in the formation of an ionic bond. When two charges formed an ionic bond then a compound is formed which is named an ionic compound.
Depending upon the type of atom from which an ion is formed we can classify it as a monoatomic, diatomic, or polyatomic ion.
If an ion is formed from one type of atom it is referred to as a monoatomic ion. Examples of monoatomic cation and anion are;
Br? ¹, I ?¹, S ?². As these belong to the 7th group, to complete their outermost shell they always prefer to gain an electron to form an anion.
If from two types of atoms an ion is made then it is referred to as a diatomic ion. An example of a diatomic ion is an Oxide ion denoted by the chemical formula O? ².
When an ion is made from more than one type of atom then it is referred to as a polyatomic or molecular ion.
Here below there are some common examples are provided;
There are several techniques one can use to create an ion. Here I explain two methods;
Here Na+ represent positive cation ionic specie. And Cl- represent anionic specie.
That’s All today. In this article, we learn about ion, its type, and the representation of charges on the ion. I try to explain aspects that make cation and anion quite different from each other. And in last we studied techniques which normally used to create an ion. I hope the given material for the term “Ion” is helpful for your academic requirement. If you have any queries regarding this article. Mention your question in the comment session. In the next tutorial, we will learn about molecular ions. Our platform tries its best to satisfy you. Keep tuned.
Hello, friends today we will discuss the basic concept of chemistry it is our first tutorial series in which we will discuss:
Now in this article, we will discuss atoms. Its definitions, examples, properties, its evolutionary history, and also some important facts in the form of questions.
A tiny particle that cannot be seen with a naked eye so-called atom.
Or
Atom is the lowest unit of matter and is often divided without the discharge of electrically charged particles.
Or
Atom is the introductory structure block of chemistry.
Examples
Hydrogen (H2)
Nitrogen (N3)
Helium(He)
We discuss different properties of atoms like:
The no of protons present in the nucleus of an element is called atomic number Or nuclear charge no.
. Its symbol is Z.
Examples
The sum of the numbers of neutrons and protons in the nucleus of an atom is called atomic mass or mass no.
Example
Sodium has 11 electrons = 11 protons and 12 neutrons in an atom. So its mass no is
A= 11+12= 23
Periodic table
In this table, we can see atomic numbers, atomic mass, and symbols of atoms. Above the symbol is atomic no and below is the atomic mass.
The distance between the nucleus and the outermost orbit of the electrons of an atom is called atomic radius or atomic radii.
The relative mass unit or atomic weight open element is defined as the number of atoms of an element in grams contained in 12 grams of carbon _12(isotope)
The atomic mass unit or Dalton is defined as the one-twelfth of the mass of a carbon atom.
Types of bonds
This type of bond is formed by the complete transfer of an electron from one atom to another.
Example
In this type of bond, electrons are mutually shared between two atoms.
Types
In which one bond pair of electrons is formed by the contribution of an electron by each bonded atom.
In which two bond pair is formed by the contribution of electron pair from each atom.
In which three bond pairs are formed by the contributions of three electrons from each bonded atom.
A bond is formed between the electron pair donor and the electron pair acceptor.
Example:
Those covalent bonds in which hetero atom takes part and one attracts the bond pair of an electron more strongly than the other.
If a covalent bond is constituted in which two similar atoms shared pair of the electron is excited by the both equally. such a type of bond is called a nonpolar covalent bond.
If the electronegativity between two elements is more than 1.7 the bond between them will be predominantly ionic and if it is less than 1.7 the bond between two atoms will be predominantly covalent.
Metallic bond:
A metallic bond is formed due to free electrons.
Timeline: 400 BC.
Scientist: Democritus
A first-person who uses the term atom(mean individual derived from atoms) was a Greek philosopher. He says that if you divided a piece of matter and divide and continue dividing, at any moment reach when you can’t divide it more, that fundamental unit was Democritus called an atom.
Timeline:1800s
Scientist: Jhon Dalton
Timeline: 1890s.
Scientist: Thomson
J.JThomson was a physicist who use cathode ray tube technology to discover electrons.
When he found that negative charge, he did not stop and did a series of experiments, he discover the mass of the electron. He found that the mass of an electron is 1000 times lighter than a hydrogen atom. He made a statement saying that an electron must be inside an atom. Before it, he says the negative charge corpuscles later his name was changed and named as an electron.
Using her prediction, he discovered what an atom looks like?
Timeline: 1910’s.
Scientist: Ernest Rutherford
Sir Rutherford made a famous gold foil experiment and proved the Thomson atomic model.
Timeline:1910’s
Scientist: Neils Bohr
Niels obeys the planetary model but he found some disadvantages. He could answer the Rutherford question
Why electrons do not fall into the nucleus?
He replies with a perfect answer to the question because of his knowledge of quantum physics and energy.
There is a problem with this theory: Electrons could not move in a specific path or orbit.
Timeline:1920’s
Scientist: Erwin Schrodinger
He was a revolutionary physicist and he presented the atomic model by using Heisenberg’s uncertainty principle.
By the definition, atoms are the units of matter, so those are not atoms that do not consist of matter.
Parts of atoms that are not associated with a proton are not atoms.
An electron is not an atom, also neutrons bonded to other neutron is not an atom.
Atoms react for attaining the nearest noble gas configuration and become more stable by following the duplet or octet rule.
We can say that an atom “has the shape of the sphere” because a positively charged nucleus is at the very center, and the negatively charged electrons are distributed around it. The electrons are attracted to the nucleus and repel each other. A nucleus, the mass of neutrons and protons within an atom, arranged itself in a roughly spherical shape.
Electrons revolve in fixed energy levels around the nucleus. It can not befall into the nucleus because electrons do not radiate energy and move in a circular orbit due to necessary centripetal force.
We have an idea from its name, the neutron is the neutron. In other words, the interaction between protons and electrons can cause the formation and destorarion of neutrons. As electrons are negatively charged and protons are positively charged particles. So they cancel each other charge and that’s why neutrons carry no charge and they are neutral. They exist in the nucleus for the stability of nuclei.
At the start, hydrogen is used to measure but it gives a fraction. so it would be changed into oxygen, Scientists used a mixture of natural oxygen but it led to confusion. So again changed the reference and turned it into carbon – 12. We use this because it gives all the atomic mass units in exact no. The reason is the different ratio of the mass of proton and neutron performing the change of nuclei.
I Hope, I cover all aspects of the atom, in the next tutorial we will learn about the molecules. If someone has any questions about the atom I will try to answer them. write it in the comment box. Thanks
Hello readers, I hope your all are doing great. We know that a Raspberry Pi Pico module comes with multiple inbuilt features for example onboard memory, processing units, GPIOs or General Purpose Input Outputs (used to control and receive inputs from various electronic peripherals) etc.
In our previous tutorials, we discussed how to access GPIO pins of the Raspberry Pi Pico module for both input as well as output operations.
In this tutorial, we are going to discuss another important feature of the Raspberry Pi Pico module (RP2040) which is Dual Core Processor. The Pico board features with 133MHz ARM Cortex-M0+, Dual Core Processor. This dual-core feature makes the Pico module capable of multiple thread execution or multithreading.
Now before writing the MicroPython program let’s first understand the concept of the dual-core processor in the Raspberry Pi Pico module.
Fig. 1 raspberry Pi Pico dual-core programming
A core is the basic unit of any processor which is responsible for executing program instructions. A multi core processor comes with the features of executing multiple tasks at a time. Multithreading is the ability of a processing unit to provide multiple threads of execution simultaneously (operating system supported). In multithreading, threads share their resources with each other. So this dual-core processor feature results in increased processing speed.
Raspberry Pi Pico (RP2040) module is having two processing cores, Core0 and Core1. In the default mode of Raspberry Pi Pico program execution, Core_0 executes all the tasks and Core1 remains idle or on standby mode. Using both the cores of RP2040 provides us with two threads of execution and hence a more powerful project with better processing speed.
Both core0 and core1 execute their assigned tasks independent of each other while sharing all the resources like memory space and program code with each other. Sharing the memory location between two cores can create race conditions and hence can cause trouble when mutual memory accessing is not assured. On the other hand, sharing program code with each other (core0 and core1) may sound troublesome but practically it is not. The reason is fetching code is a read instruction that does not create a race condition.
Fig. 2 Core_0 and Core_1 communication
As we mentioned above, sharing memory space with two cores simultaneously can cause race conditions. So, to make the cores to communicate with each other the Raspberry Pi Pico module is featured with two individual ‘First In First Out’ (FIFO) structures. Each core can access only one FIFO structure so both core have their own FIFO structure to write codes which helps in avoiding race condition or writing to the same memory location simultaneously.
You can follow the given link for detailed study on Raspberry Pi Pico: https://www.theengineeringprojects.com/2022/04/getting-started-with-raspberry-pi-pico.html
The development environment we are using is Thonny IDE, to program the Raspberry Pi Pico board for accessing the dual core feature with MicroPython programming language.
So, before writing the MicroPython program user need to install the respective development environment.
We already published a tutorial on how to install and access Thonny IDE for Raspberry Pi Pico programming using MicroPython programming language. You can find the details at the given link address: https://www.theengineeringprojects.com/2022/04/installing-thonny-ide-for-raspberry-pi-pico-programming.html
Now let’ write a MicroPython program with Thonny IDE to access raspberry Pi Pico’s both cores:
In this example code we using just a simple “print()” commands to print the messages from each core for testing purpose.
Fig. 3 Importing necessary libraries
Fig. 4 declaring thread lock object
Fig. 5 Task for Core_1
Fig. 6 Core_1 thread
Fig. 7 Task for default core (core_0)
The MicroPython code with thonny IDE for Raspberry Pi Pico is written below:
import machine
import utime # access internal clock of raspberry Pi Pico
import _thread # to access threading function
spLock = _thread.allocate_lock() # creating semaphore
def core1_task():
while True:
spLock.acquire() # acquiring semaphore lock
print( "message from core_1")
utime.sleep(0.5) # 0.5 sec or 500us delay
spLock.release()
_thread.start_new_thread(core1_task, ())
while True:
spLock.acquire()
print( "message from Core_0 ")
utime.sleep( 0.5)
spLock.release()
Fig. 8 Enabling Shell
The result obtained from the above code is attached below. Where we can see the messages received or executed by both the cores as per the instructions provided in the micropython code.
Fig. 9 output printed on shell
Let’s take another example where we will interface some peripheral LEDs and will toggle those LEDs using different threads of execution or cores.
Fig.10 importing necessary libraries
Fig. 11 declaring led objects
Fig. 12 Toggling LED with core_1
Fig. 13 toggling LED with core_0
from machine import Pin
import utime # access internal clock of raspberry Pi Pico
import _thread # to access threading function
# declaring led object
led_0 = Pin( 14, Pin.OUT ) # led object for core_0
led_1 = Pin( 15, Pin.OUT ) # led object for core_1
spLock = _thread.allocate_lock() # creating semaphore lock
def core1_task():
while True:
spLock.acquire() # acquiring semaphore lock
print( " message from core_1" )
led_1.value( 1)
utime.sleep( 0.5) # 0.5 sec or 500us delay
led_1.value(0)
spLock.release()
_thread.start_new_thread( core1_task, () )
while True:
spLock.acquire()
print( "message from Core_0" )
led_0.value(1)
utime.sleep( 0.5)
led_0.value(0)
spLock.release()
In the results attached below we can that two LEDs are attached with raspberry Pi Pico boar. Green (GPIO14) and Red (GPIO15) LEDs represent the output of Core_1 and Core_0 respectively.
Fig. 14 Core_1 output (GPIO 14)
Fig. 15 Core_0 Output (GPIO15)
In this tutorial, we learned how to access both the cores of the raspberry pi Pico module and to execute task or control peripherals with individual cores. We also learned the concept of threading and multithreading.
This concludes the tutorial. I hope you found this of some help and also hope to see you soon with a new tutorial on raspberry Pi Pico programming.
The Industry 4.0 market size will reach $267.01 billion by 2026. Industry 4.0 depends on the secure, fast, and cost-effective data transfer between IoT devices. IoTA is designed to ensure secure communication between two devices within the IoT(internet of things) framework. Let's have a detailed look at the role of IoTA in industrial IoT.
The terms MIOTA and IoTA together make up the term IoTA. While MIOTA is a cryptocurrency, IoTA is a non-profit foundation. Since its inception in 2015, IoTA has formed joint ventures with firms like
IoTA is technically different from blockchain in terms of the underlying technology. IoTA works on a technology called DAG (directed acyclic graph). Under the DAG technology, two transactions need to be validated to send one transaction. Apart from this, a proof of work needs to be submitted to validate the transaction. You will find a lot of boxes in the figure given below. Each box represents a transaction. This system of boxes is known as an IoTA tangle.
One of the most distinguishing features of the IoTA tangle is that, unlike blockchain, it can work offline. The data can be synchronized later. The ability to work offline happens to be an essential feature to consaider while developing IoT applications. This is because IoT devices often work in scenarios wherein there is no guarantee of a strong internet network.
Now that we have had a look at the basics of IoTA, let's now see why IoTA is important for industry 4.0.
The first industrial revolution was industrialization through water and steam power. The second industrial revolution consisted of mechanization through electricity. The third industrial revolution started with the wide-scale adoption of computers in manufacturing. The fourth industrial revolution will be built on what started in the third industrial revolution.
Products will be produced automatically by machines that will talk with each other. All this will be fuelled by machine learning and data science.
The success of Industry 4.0 relies a lot on IoT devices. The IoT devices need a base layer to connect the different industries.
The base layer should have the following characteristics.
If there is one technology with all these characteristics, it's IoTA. IoTA is a highly scalable technology that enables fast transactions. Unlike blockchain, there are no fees or mining costs with IoTA.
The following are the significant benefits that IoTA provides.
IoTA allows for the secure transmission of data. Data sent through other communication channels only proves that someone sends data. With IoTA, it is possible to ascertain whether the same data was sent to everyone else or not and when the data was sent. This feature of IoTA is important because fraudsters can send one set of data to one person and another set of data to another person. The “Notarization" feature of IoTA can be used to prove that an electronic document existed in a physical form earlier and the document has not been changed since its creation.
IoTA is a system that is designed specifically for IoT devices like sensors. IoTA is an energy-efficient system that can easily participate in a low-energy network. An IoTA system allows nodes with low hardware resources to participate in the IoTA network.
An IoTA system is a fair system as nobody can gain a higher priority in processing by paying more money. Unless the system is congested, all the transactions in an IoTA system are treated equally.
Unlike blockchain, no mining is required in an IoTA system. This makes IoTA transactions feeless. The ability to conduct feeless transactions is an essential feature of the IoTA system as it enables micropayments to be done easily. Using an IoTA system, you can build a machine-to-machine economy and implement consumption-based payments.
The IoTA is an open-source communication protocol. As it is an open-source protocol, everyone can collaborate on the code. Being open-source, the growth of IoTA is exponential as many companies come together in the Tangel EE Working Group and work on solutions for commercial uses.
There is a wide range of Industrial use cases of IoTA. We have discussed the most popular ones below.
Mobility is one area where IoTA can prove helpful. According to research, by 2025, there will be 8 million consumer vehicles that will have self-driving capability.
IoTA tangle allows for secure data transmission between cars and other machines. The vehicles can transact data about weather conditions, traffic congestion and road conditions using IoTA.
IoTA can also enable cars to automatically pay for tolls, parking, battery charging and other services. IoTA makes cars safer and reliable through real-time software updates.
Using IoTA, trucks can do platooning. In platooning, the trucks drive semi-autonomously, with minimum distance between them. Consistent speed creates fuel efficiency and safety, improving the profitability of truck owners.
Around 10% of goods transferred in the global supply chain are fraudulent. The supply chain industry faces trackability, and transparency of goods being transferred is the most prominent issue. IoTA can help resolve these issues.
The logistics companies can keep an immutable and encrypted audit trail of logistical updates with IoTA.
An IoTA-enabled tracking system includes real-time data about weather conditions and geo-location. It also verifies transfer of ownership/custody of goods. Thus, an IoTA-enabled system helps logistics companies improve their trackability and traceability.
IoTA helps healthcare service providers secure patient data. IoTA also helps in democratizing access to healthcare data.
Healthcare researchers can verify the integrity of research data through an IoTA ledger. IoTA can also help companies conduct better pharmaceutical trials. IoTA does this by logging every step and test result of the trial process into the IoTA tangle.
The MAM protocol helps healthcare providers and patients securely exchange patient data.
IoTA can open up doors toward a decentralized peer-to-peer energy trading system.
An IoTA-enabled system can help users to control energy assets remotely. The energy companies can achieve better grid stability and peak shaving through an IoTA-enabled system.
An IoTA-enabled system can provide seamless EV smart charging based on M2M micro-payments.
An IoTA enabled smart factory system securely stores the factory data in an IoTA tangle. The IoTA-enabled factory system stores only the encrypted hash in the tangle, thus creating a tamper-proof audit trail.
Through an IoTA-enabled system, the machine owners can lease out entire production lines to people who want to produce products.
Once the products leave the factory, they automatically become part of the smart supply chain. This way, an IoTA-enabled system brings a significantly higher efficiency into the industry.
Industry 4.0 is the next leap forward in the growth of mankind, and IoTA will play an important role in deciding the future of industry 4.0. Businesses that want to be a part of the industry 4.0 growth story need to leverage the power of IoTA to achieve exponential business growth.
Welcome to the next tutorial of our Raspberry Pi programming course. Our previous tutorial taught us how to use a raspberry pi as a DNS server. We also looked at the benefit of this DNS server. This tutorial will teach us to set up Raspberry pi as a VPN server.
This is an excellent method for increasing your network security and getting access to your local area network from the world wide web, but setting up your VPN server might be a challenge. Pi VPN uses a guided install to turn your Raspberry into a low-cost, high-performance VPN server.
| Where To Buy? | ||||
|---|---|---|---|---|
| No. | Components | Distributor | Link To Buy | |
| 1 | Raspberry Pi 4 | Amazon | Buy Now | |
It is an OpenVPN server optimized for all Raspberry platforms above pi 2. It allows you to access your home network over the internet safely and securely. Smart devices and your network can be connected via a "bridge" created by connecting a Raspberry Pi to your router.
A virtual private network (VPN) is a secure option if you frequently use your router to forward traffic. Anyone can gain access to your network through any of the ports you forward. For maximum network security, use Pi VPN, which only exposes a single port and employs industry-standard encryption algorithms.
Selecting a virtual private network service is critical before you begin this project. It would be best to bear in mind cybersecurity, bandwidth, and delay when making this decision.
Ensure that your Virtual private network supplier doesn't record how you use their services. Nevertheless, speed and delay are critical here.
As a result, we've decided to go with IPVanish in this project. When it comes to network latency and network bandwidth, IPVanish is among the best.
The Raspberry Pi can get the best out of the device with a wired or wireless connection.
Use the Interfacing settings menu to turn on the secure shell service in RPi Settings. The configuration tool can be launched from the Pi menu or with the following command:
You can disconnect your display and switch off your desktop once your Pi hooks to your local network via a secure shell. It's simple to use a program like Putty or the terminal on your Mac to access your RPi.
You will not have to use a monitor to manage your Pi virtual private network server. A Raspberry Pi can be accessed from another device using SSH.
Use the ifconfig command to display your Raspberry IP address before unplugging it from the monitor.
If you configure your Raspberry Pi VPN server on Windows, you should use Putty.
Login to the RPi using the Internet protocol address noted earlier when Putty runs. Check to see if the secure shell is for the connection type. To save this connection to your profile, click the Save button.
You don't need a secure shell client if you're using a Macintosh or Linux computer to install Pi VPN. SSH is in your operating system's terminal, so you don't need to do anything extra.
A security key is saved on your Raspberry Pi the first time you access the raspberry pi. Accept the key and store it on your computer by pressing the Yes option on the screen.
Your password must be entered next. You'll be logged in as Raspberry Pi as long as you haven't changed the default password on your Raspberry
The prompt pi@hostname shows a successful login.
Begin by obtaining a list of the most recent applications. Using the command: you can see if any installed programs are up to date.
When it comes to network services, you will have to locate your RPi, implying that you will set up a static Ip before you begin using the app. Also, modify your hostname at this point. When you get access, you'll notice a difference in the prompt. It's a simple way to distinguish between several Pis, but you can always change your hostname.
To establish a static Ip, you'll have to update the configuration file /etc/dhcpcd.conf. Before opening the file, know your router's Internet protocol address and Domain name system. This data is available using the ifconfig utility.
Take advantage of this command when you're ready to edit its config script:
To find an example of static IP configuration, look for the line with the label Sample static IP config inside the file. Simply remove the example comments and replace your Ip, routers, and gateway with your own to get started.
If you prefer a static IP address, remove the comment from it and replace it with the desired value.
Your custom values should be provided for static IP and DNS.
To alter your hostname, run the command below as superuser to open /etc/hostname in nano:
When finished, use Ctrl+X to close the editor. Then, press Yes to save the changes.
The /etc/hosts file must be edited in the same way. The file editing command is:
Change your hostname from 127.0.0.1 to whatever you've selected. Use the command below to force a reboot of your Raspberry Pi:
You should always change your connection's IP address after restarting your Raspberry Pi to reflect its new static address.
In Linux distributions, firewalls are embedded in kernels and will activate by default in Raspbian. The default setting for a new installation is to leave it unlocked.
There are no restrictions on inbound or outbound packets, and the firewall forwards any requests. Before securing the firewall, make sure it is entirely accessible.
Use iptables -L to see if your firewall protocols match. It's possible to return the firewall to its default settings using the following commands:
During configuring the Raspberry virtual private network, you will select the level of encryption. What you need to remember is the following:
Allowing 4096-bit is enticing for those who stream film or music; however, it will add a significant amount of overhead and slows down your connection significantly. For the most part, we use 2048-bit encryption, which is the industry standard.
You'll inevitably stumble across a peculiarity in a secure shell. For more prolonged operations, if you are using SSH to communicate with the Raspberry, the connection is lost whenever the desktop hibernates. Any pi commands running stop working whenever a secure shell connection is lost; therefore, you must re-enter it.
A screen is an excellent tool for dealing with long SSH processes. One task might be the only focus of your screen sessions. Afterwards, you'll be able to join and disconnect at will and return to your session to see how it progresses.
Once Screen installs, you will need only a handful of commands to get the most out of it. Use apt to install screen utility as a starting point:
Once Screen installs, run it by typing the following command into your terminal window:
Even if nothing has changed, the commands you issue will continue to run even if you disconnect.
Whenever your Raspberry Pi connection stops, simply re-SSH in and type:
If only one secure shell session is open, you'll immediately get reconnected.
The Pi VPN works once you have your Raspberry working. It's the first step in a multi-part installation that will grant you access to Pi's virtual private network backend capability. Setting up an outgoing virtual private network tunnel connection for privacy will be done in the following steps.
Configure the Pi VPN via a command-line utility called curl, which you download from the company's website. You don't even need a browser to use curl to download from the internet.
Pi VPN installs using the following command:
You can obtain the installation package and feed it into bash for execution using this command.
Instantly, the procedure of installation begins. It begins by scanning for any packages that need updating on your system. Your system should be the latest version
to proceed.
Launch the pi VPN installation after meeting a few pre-requisites.
To get the most out of your SSH session, you should use the Pi Virtual private network Installer. We can get started when the Screen changes colour to blue, and an installer notification appears.
Start by pressing Enter to begin the VPN setup procedure.
Static IP addresses are required, and in case you do not have any, you will get a notice. If you have not already done so, head back to the previous section and finish configuring a static IP address.
The Ip that Raspberry Virtual private network detects displays to you. Click the Yes if it is correct.
IP address conflicts display for your attention. Static IP addresses outside the dynamic host configuration protocol range are the safest method of avoiding conflicts with other devices on your network.
To continue, simply press the OK button.
Set the raspberry user, then click the OK to proceed with installing your preferred software.
If you want your Raspberry virtual private network server to get automatic security upgrades, you should select Yes when prompted. Because port forwarding makes your Pi vulnerable to the internet, Pi VPN must be updated.
Make sure you conduct frequent updates manually if you select "No."
After activating automatic updates, it's usual to see the console for some time. You can expect another installation attempt in the next few seconds.
You'll want to use the UDP protocol while setting up a Pi VPN for most circumstances. If you're going to use a VPN subscription service to establish a highly secure two-hop connection, stick with TCP instead of UDP.
The default port you're using for the virtual private network will come in handy later.
UDP uses port 1194 by default, whereas TCP uses port 443. Do not use port 443 when configuring the double-hop virtual private network because it will end up causing a conflict afterwards. Instead, we use TCP port 4430.
Select the encryption type you want at this point. Earlier, we explained why you might choose each option and why you should do so. If you're still undecided, refer back to what we discussed.
Using the space bar, choose the encryption you want to employ and press OK. Streaming video is only possible with 2048-bit encryption.
It may take some time to generate these keys. It will take significantly longer if you're encrypting at a high level. Wait for Pi VPN to produce your server keys.
The Raspberry Virtual private network setup procedure is nearly complete once the server key generates. After a few more stages, you'll be able to establish a connection.
If you do not have a domain Name system account, choose the public IP. In this case, we will need to input your hostname and domain name system account settings as usual if we are using a Dynamic domain name system.
You will need to select a domain name server provider for your virtual private network. Google is recommended to most people because it is free and straightforward. If you're concerned about DNS leakages, OpenDNS offers safe DNS solutions. If you plan to use Pi-hole to handle DNS requests, you may want to select Custom.
The installation will guide you through the process of adding additional users using the command line. Install a web app for managing users in the following phase. Additionally, pivpn add is an option.
Select Yes and restart your Raspberry Pi.
There is a Pi Virtual private network Graphical interface for Pi VPN. Using it simplifies the process of adding new devices and users.
When you add a new user to the VPN, a *.ovpn profile generates. In addition to creating a user account, you may efficiently utilize the Pi Virtual private network GUI to download the profiles.
If you don't want to utilize the Pi Virtual private network GUI, you can use the following to add or delete users.
Adding a repository is necessary if you want the Pi VPN GUI's required software to be easily accessible. Let me show you how.
Edit apt's source list with nano. The directive is:
Add the lines below to the sources. Make a list of everything you can find:
This will inform apt that Raspberry can install packages. Debian stretch repositories do not currently contain some of the required third-party software Pi Virtual private network GUI uses.
It's not good to include a link to a previous build in the sources.list script, even though we currently need it. Once additional software installs, it may interfere with it. Once these software packages install, you can delete the line in the sources.list you just added.
Next, save the changes and exit the Nano application. Then update with the command below:
Once the check is complete, use the following command to install any new or updated packages:
All you have to do now is tell apt about the new repository. The Pi VPN Graphical interface pre-requisites can now install using the command:
When prompted, select "YES" and allow the setup to begin. Before using the Pi Virtual private network GUI, you must change some config files.
Make sure all of your pre-requisite software install before running the apt update.
The Pi Virtual private network GUI relies on an apache server to function effectively as a web application. However, we need to make a few adjustments before the Pi Virtual private network GUI start operating.
To begin, modify the user’s account under which apache executes. It runs as an unsupported account by default; therefore, we need to change it to the user pi. Use the following command to make changes to the Apache configuration file:
Find the line with $(APACHE RUN USER)
To exit and save, use Ctrl+X.
You'll also want to give yourself complete control over the /var directory, where Apache stores all of its web pages. Use the following command to grant pi complete control over the webroot directory:
Run the following command to move to the /var/www/HTML folder:
The raspberry pi should install the Pi Virtual private network Interface from that location.
After troubleshooting, downloading and installing the raspberry virtual private network graphical user interface is a breeze. You only need to use git to check out the project. You've already installed the git software if you've been following along.
Then run the following command from the HTML folder.
The command below will utilize git to copy the Pi Virtual private network GUI project folder into the directory of your apache server so that it is accessible as a web page. With a quick check-in of your browser, you can verify that the installation went smoothly.
You can now launch the Pi Virtual private network GUI from your internet browser and manage Pi Virtual private network users.
Use the Internet address that matches your setup and launch the Pi Virtual private network GUI from your internet browser.
Once a login screen appears, you've successfully connected to the network. For the time being, simply save a link to the Pi Virtual private network GUI for quick access. Setting up an outgoing VPN connection is the next step in protecting your online activity. If you don't want to utilize IPVanish, you may set up your router and add users without signing up for anything.
In the absence of an outbound Virtual private network, all traffic from all connected devices will use the public IP address of the local network to reach the worldwide web. The websites think that you are in the home network whenever you are connected. For example, you may wish to watch Netflix while away from home.
We recommend creating a "double-hop" connection with a VPN service outside the Pi virtual private network for the best results.
VPN connections with two hops allow for complete encryption whenever you access a site using HTTPS. Since the outgoing virtual private network server never notices the request source, the additional security offered by using two tunnels goes far beyond standard Virtual private network solutions.
If your Vpn service provider retains logs, they will not identify the devices from which each specific request was made. This additional layer of anonymity further obscures anything you do online.
Do not bother with this step if all you need is remote access to your local network via Pi's virtual private network. In contrast, if you're looking for safe and anonymous internet access for your mobile device, you can use an outgoing virtual private network connection and Raspberry virtual private network.
Due to its low latency, IPVanish is an excellent choice for establishing a double-hop virtual private network connection, requiring two separate virtual private network servers. Any OpenVPN profile-publishing VPN service will follow the same procedure.
Your VPN service's digital certificate and an autologin profile can be obtained below.
SSH onto your Raspberry Pi VPN server, then use wget to obtain the resources you need from the internet. Take a look at your Pi Virtual private network server and ensure it is online before using these instructions to obtain the data you require:
If you want to access the IPVanish server, you'll need to alter the uniform resource locator in the second field.
Make sure you rename the *.ovpn to use the OpenVPN service when connecting to IPVanish. Only profiles ending in *.conf can be connected to the network. Change the name of the file with the command below to outgoing.conf:
You can easily track two concurrent virtual private connections by renaming each interface.
The connection names will not change to or from between the two interfaces when renaming interfaces. To effectively configure your firewall, you must know the device's name.
If you go into the connection settings for each interface, you can modify the name. There is a *.config file for each OpenVPN connection linked with it. By altering the first few lines of each file, you can rename the network's graphical user interface.
To begin, run the command below to edit the Pi Virtual private network settings:
You should change the first line to:
Add a new line to the following:
Save your modifications by pressing Ctrl+X, then Y. /dev/tun-incoming will be created the next time the Pi Virtual private network is online.
Also, edit the OpenVPN outgoing configuration file.
Modify the first statement and add another at the start of the configuration file like before. In this case, the text should be as follows:
In addition, the outbound Virtual private network will need to be updated as well. Enter your name and password so that the Virtual private network can immediately connect to the server's cert you obtained in the previous stage.
To use the IPVanish server SSL certificate, make the necessary changes to the outgoing.conf file. Replace the word ca with:
Please use the following command to direct IPVanish to the password file we will create shortly: auth-user-pass
In addition, you must instruct your outbound virtual private network connection not to relay Local traffic. Your outgoing.conf file must have the following line added to it to allow access via Pi virtual private network to your home network:
Password files are now generated for use with IPVanish by OpenVPN.
Click Ctrl + X followed by the key to save the changes after entering your password and email address. You should encrypt the file because it holds your login details. With chmod, you can prevent anyone from accessing the password file in the OpenVPN configuration directory:
The root user can modify the password script file, which is the bare minimum level of protection required when keeping your login information in the clear text form.
Your Rpi should be configured correctly for the outgoing Virtual private network to encrypt your internet connection. The static IP address of your Raspberry Pi must be substituted if it is different.
You'll need to update or generate the file below and add some lines. The command is as follows:
Include the following two lines in your script:
We require only one change to the routing table of your Raspberry Pi. We can use incoming and outbound VPN connections simultaneously when you save the adjustments and restart your Raspberry Pi computer.
To ensure that your connection is genuinely safe, you must prevent DNS leaks. Using a Domain name server that isn't part of your virtual private network encrypted network results in a Domain name server leaks. For example, domain name server login and perform a man in the middle attack on your Virtual private network customers.
Forcing all incoming Virtual private network users to utilize the safe Domain name server from your outbound Vpn service provider is the solution.
OpenVPN config file is updated to change your domain name server without reinstalling the Pi Virtual private network. Use the following command to open the config file for editing:
The lines that send the Domain name server to your virtual private network clients are found by scrolling in the file.
When utilizing IPVanish, you need to replace these lines:
To identify the Domain name servers of a different Virtual private network, you'll need to research online. Save the file after editing it. As soon as the OpenVPN server starts up, your Virtual private network clients will connect automatically to secured servers provided by IPVanish.
OpenVPN should not connect automatically to the outbound virtual private network provider unless the connection is tested and verified. Type the following into the Run window:
The virtual private network connection status displays in the text on your screen. If you're having trouble connecting, double-check the outgoing configuration file and ensure your user information is in the password file on different lines. Hit Ctrl + C to exit the VPN once you've established a connection.
After the connection is tested and found to be working, you should automate the startup for your VPN tunnel. You can connect to every connection using OpenVPN by its configuration file name.
This command will edit the OpenVPN global config file, which you'll need to begin.
Undo this line's comments.
Change it to:
Afterwards, save your modifications and reboot your Raspberry virtual private network server:
A virtual private network is a tunnel from the wide-area network to the local area network. Consequently, your router must be configured to accept specific connections. If you have a router that doesn't support port forwarding, you may have to perform this manually.
If you didn't specify a port forward before, no Virtual private network clients would be able to access the network. We have to apply an exception to the security of our router's policies to allow these requests.
To access your router, copy its Internet address into your internet browser.
After logging in, go through the menus and select it from the list to enable port forwarding.
You'll have to remember the port number you previously chose in this process. Additionally, you'll need to know the static IP of your Raspberry Virtual private network server.
When you've completed port forwarding, click Save. VPN users can now access their accounts even if they are not in the local network.
This tutorial taught us to set up Raspberry pi as a virtual private network server. We also learned how to set up port forwarding and improve our network security. In the following tutorial, we will learn how to use a raspberry pi as a DNS server.