Basic knowledge of machining

Datum.

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.

1. Design datum.

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.

2. Process datum.

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.

Installation of workpieces.

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"] Design & Engineering Verification[/caption]

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.

  1. The operation of keeping the positioning position of the workpiece in the machining process after positioning is called clamping. The device in the fixture that keeps the positioning position of the workpiece in the machining process is called the clamping device.
  2. The clamping device should meet the following requirements: when clamping, the positioning of the workpiece should not be destroyed; after clamping, the position of the workpiece in the machining process should not change, and the clamping should be accurate, safe and reliable; the clamping action is fast, easy to operate and labor-saving; the structure is simple and easy to manufacture.
  3. matters needing attention when clamping: the clamping force should be appropriate, too much will cause deformation of the workpiece, and too small will cause displacement in the machining process and destroy the positioning of the workpiece.
 

Mechanical concept of roughness

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"] Engineering Tolerances[/caption]

Roughness representation.

There are 3 kinds of surface roughness height parameters:

  1. Arithmetic mean deviation of contours Ra.

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.

  1. Micro-roughness 10-point height Rz.

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.

  1. Maximum height of contour Ry.

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 influence of Roughness on the performance of parts.

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.

Cutting fluid.

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.

Everything You Need to Know About MIG Welding

What Is MIG Welding?

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.

Mig Welding Equipment

The MIG welding equipment you'll need includes:

Torch

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.

Gas Cylinder

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.

Welder’s Helmet

Protects your eyes from any spark produced by friction during MIG welding processes such as spatter creation during stick electrode usage.

Welding wire

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.

MIG Welder Settings

You can adjust these settings to improve the quality of your weld or reduce the amount of heat you apply to the weld.

Welding Wire Diameter

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.

Feed Speed

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.

With the Right Equipment, You Can Get Started on Some Solid Metalwork

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:

  • You can start with instructional videos on Youtube; many makers have uploaded videos that walk new welders step-by-step. The most famous one is *How To Weld Like A Pro - Using Gas Metal Arc Welding (Mig)*, by the YouTube channel OneMinuteUkeleleLessons.
  • Consider finding an experienced professional welder who's willing to teach you one-on-one. Most welders are happy with any excuse to talk shop! They'll give you tips that you couldn't find even in the most detailed book.
  • Take a course at your local community college or trade school. This could be an excellent way of getting basic hands-on experience in ideal conditions before moving on to more difficult tasks.

MIG Welding Frequently Asked Questions

Can You Use a TIG Welder as a MIG welder?

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.

How does a flux core welder work?

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

Does a MIG welder need gas?

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.

Introduction to Molecular Ions

Hello friends, in the previous tutorial we learned about ions and now I am coming up with a new article Molecular ion. In this article, we will discuss the formation of molecular ions. When we discuss molecular ions many types of questions arise in our minds. I hope after reading this article you can answer these questions which are given below:

  • What are molecular ions?
  • How many types of molecular ions?
  • How molecular ions are formed?
  • Why is NH4 + not a molecular ion? Give a reason.
  • Which type of molecular ions structure exists etc.?
  • Which example is suitable for molecular ions or not?

Discovery

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 :

Molecular Ion:

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.

Molecule:

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

  • H2O (water)
  • N2 (nitrogen)
  • O3 (ozone)
  • CaO (calcium oxide)

Difference between molecules and molecular ions:

Ion:

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-

Difference between ions and molecular ions

Molecular compounds

  • When an atom of two or more elements share electrons a molecular compound is formed
  • It is also known as covalent compounds.
  • In molecular compounds, the ambivalent bond is formed when atoms shared their electron pair.

Molecule ___gain/lose electron _______ molecular ion

  • Types of Molecular ion:

There are two types of molecular ions:

  • Cationic molecular ion

They have charged positive ions because they lost the electron from the molecules.

For Example :

CH4+

  • Anionic molecular ion

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.

Rules of writing:

  • In the naming of molecular ions, caution is written first and the anion is written in second no.
  • Ion is written in the bracket if the formula unit contains two or more of the same polyAtomic ion with subscript written outside the bracket.

How molecular ions are formed?

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.

  • Features of formation of molecular ion:

There are important features that tell us how an electron is removed from bond pair:

  • Electrons are easily removed from non_bonded pairs as compared to bonded pairs.
  • Because bonded pairs are at lower energy levels and most localized as compared to non_bonded pairs.
  • It is most difficult to lose electrons from bonded pairs.

The most important thing here arises is that,

Is Ammonium ion (NH4+ ) a molecular ion?

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.

Is ozone a molecule?

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.

Identification of molecular ions:

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)

What is the molecular mass?

The total atomic mass of all elements present in a molecule is equal to that of a particular substance known as molecular mass.

How can we measure the molecular mass?

We can measure the molecular mass of the molecule by using the following steps which are given below:

  • First of all, we define the formula of a molecule.
  • We find out how many atoms are present in a molecule.
  • Then we multiply the atomic weight of an element by the number of atoms.
  • Similarly, the same process applies to all elements in a molecule.

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

What is the formula mass?

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:

Intermolecular forces are electrostatic attractive forces between permanently or temporarily charged chemical species. They include

  • Van Der Waals forces (attractive forces)
  • Dipole-dipole forces
  • Ion_ion forces
  • Hydrogen bonding

Van Der Waals forces:

These forces are responsible for the formation of molecular ions.

Ion _ dipole forces:

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:

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:

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 do you determine the 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

The Molecular Ion (M?) Peak:

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

Important Facts:

By using molecular ions we can determine the following facts:

  • Determination of the molecular mass.
  • Structure of a compound
  • Kinds of bond
  • Kinds of atoms

The most important question is what molecular ions how they are formed.

Significance/Applications:

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.

Interfacing of DHT11 with Raspberry Pi Pico

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

DHT11 Sensor

 

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.

DHT11 Vs DHT22

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.

Software and Hardware components required

The software and hardware components required to interface the DHT sensor with the Raspberry Pi Pico board are:

  • Raspberry Pi Pico development board
  • DHT11 sensor
  • A resistor (10K)
  • Connecting wires
  • Breadboard
  • Data cable
  • Thonny IDE

Fig. Required Components (hardware)

DHT11 Pin-out

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

Interfacing DHT11 with Raspberry Pi Pico module

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

Programming

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.

  • The first task while writing the MicroPython code for the DHT11 interfacing is importing the necessary classes and modules. Firstly we are importing the Pin class from the machine The Pin class is used to access the Raspberry Pi Pico’s GPIO pins to interface the data pin of DHT11 sensor module.
  • Next we are importing the utime module to add delay when required.
  • The third module we are importing is the dht module which is responsible for reading the temperature and humidity data from the sensor module.

Fig. 5 importing necessary library files

  • Next we are declaring a ‘pin’ object. This object represents the GPIO pin number to which the data pin of DHT11 is to be connected and also the mode of the GPIO pin. Here we are using GPIO_0 of the Pico board and the pin is configured at imput.

Fig. 6 declaring the ‘pin’ object

  • We are using a while loop to continuously read and print the sensor reading (temperature and humidity).
  • The sampling rate of DHT11 sensor is 1 second. So before reading the data from DHT sensor a minimum delay of 1 second is required. Here we are adding a delay of 2 second.
  • The temperature observed using ‘dht_input.temperaure’ The respective data is store inside ‘temp’ variable and then printed using print() command.
  • Similarly, for humidity the data is observed using ‘dht_input.humidity’ The respective data is stored inside ‘humidity’ variable and printed using the print() command.

Fig. 7 Main loop

Main program (main.py)

# 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

  • Paste the below attached code into the new program and save the program to similar location where the main program is saved.

DHT library (dht.py)

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.

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

Conclusion

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.

Introduction to Ions

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.

Brief description of an Ion

What is an ion?

Definition

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.

A short view over term atom.

Atom

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.

Different types of an ion

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).

What is a cation?

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.

  • It has been seen that the formation of cation is an endothermic reaction.

What does mean by term Endothermic?

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.

Why it is an endothermic reaction let’s allow me to explain:

  • Cation is formed when an isolated atom loses one or more electrons from its valance shell. As we know that there is the existence of a strong force of attraction in an atom. Due to this force of attraction nucleus strongly attract the valance electron, to remove an electron from a strong grip of the nucleus a sufficient amount of energy is required. This sufficient amount of energy is given to the electron which energies it and helps it to kick off from the strong field of the nucleus. As soon as the electron removes from the nucleus field it left behind a positive charge. Which is named cation. That’s why the formation of cations is an endothermic process.

Ionization energy:

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.

  • If we compare a cation with a parent atom by their size we concluded that A Cation is smaller than the parent atom. Why does this so happen?

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.

How does a cation Represent symbolically and what charge does it constitute?

  • It possesses a positive charge and suffix (ium) is used for cation. Such as Hydronium (H+)

What is Anion?

  • Secondly when an atom has more electrons than the number of protons then the charged atom is referred to as an Anion or negatively charged ion. In other words, we can also say that an anion is formed when an isolated atom gains an electron.
  • It has been seen that the formation of anion is an exothermic process.

What is meant by the word Exothermic?

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.

  • Size of an anion is always greater than the parent atom. As we see that during the formation of an anion one or more electrons are added to the atom. This extra addition of electrons increases the electron-electron repulsion in the valance shell of an atom which results in an extension of the electronic cloud. Due to an increase in some electrons in the outermost shell, the pull of nuclear on valance electron also Decreases. That’s why the size of an anion is always greater than the parent atom.

How does a cation Represent symbolically and what charge does it constitute?

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.

Ionic bond and ionic compound:

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.

Classification of Ions:

Depending upon the type of atom from which an ion is formed we can classify it as a monoatomic, diatomic, or polyatomic ion.

Mono-atomic 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;

  • Aluminum cation is represented by the empirical formula Al?³.
  • Proton is a commonly known caption of the hydrogen atom. This hydrogen caption is denoted by H ?¹
  • Another example of a mono-atomic ion is manganese cation which is represented by the formula Mn ?². It also can form Mn ?³ and Mn ?4.

Illustration of monoatomic anion:

  • Common example of a uni-negative ion is the fluoride ion which is represented by Fl ?¹.
  • Along with this other examples are chloride ion, bromide ion, iodide ion, sulfide ion represented by chemical formula Cl?¹,

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.

Di-atomic ion:

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? ².

Polyatomic ion:

When an ion is made from more than one type of atom then it is referred to as a polyatomic or molecular ion.

Illustration of polyatomic cation:

Here below there are some common examples are provided;

  • H3O? is the chemical formula of hydronium cation.
  • Hg2?² is a mercurous cation.
  • NH?4 is the chemical formula of ammonium cation.

Illustration of polyatomic anion

  • A nitrate ion is a common example of a polyatomic anion. It is represented by the chemical formula NO3?.
  • Cr2O3? is the chemical formula of chromium oxide anion.
  • Another example of a polyatomic anion is the Sulfate ion which is represented by the chemical formula SO4?².

Ways one can create an ion;

There are several techniques one can use to create an ion. Here I explain two methods;

  • Spontaneous collision
  • Chemical interaction

Spontaneous collision:

  • We can create an ion from a spontaneous collision. Byword spontaneous means an event occurs without any apparent external cause. Collision is a process in which two bodies violently interact with each other. Through spontaneous collision among molecules of the liquid, an electron or group of electrons may be knocked off from an atom resulting in the formation of an ion. This ion is positively charged. Along with a positively charged ion, a free electron is also formed. This type of ionization is commonly named physical ionization. The free-electron that comes into the process during the collision may stick to itself or another atom resulting in the formation of a negatively charged ion.

Chemical interaction

  • One can create an electron through another process which is commonly known as “ chemical interaction”. For example when we dissolve an ionic compound in any form of a solvent such as water. The atom that comprises salt undergoes the process of separation to form a negatively charged anion & positively charged cation. A common example one can see to understand this process is the dissolving of common salt (sodium chloride) in water. When sodium chloride is dissolved in water then NaCl disassociates into positive sodium cation and negative chlorine anion.

Here Na+ represent positive cation ionic specie. And Cl- represent anionic specie.

  • Another process that can be carried out for the formation of ions is the passage of direct current from a dissolved solution which can conduct. As the current is passed through the solution the liquid molecules break and positive and negative ions are formed.

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.

Introduction to Atoms

Hello, friends today we will discuss the basic concept of chemistry it is our first tutorial series in which we will discuss:

  1. Atom
  2. Molecule
  3. Ion
  4. Molecular ion

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.

Atom

Definitions

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

From molecule;

Hydrogen (H2)

  • It has two atoms.

Nitrogen (N3)

  • It has three atoms

From elements;

Helium(He)

  • It has two electron

Properties

We discuss different properties of atoms like:

Atomic no:

The no of protons present in the nucleus of an element is called atomic number Or nuclear charge no.

. Its symbol is Z.

  • Always a whole no
  • No effect of neurons on atomic no.
  • Always give a smaller value than atomic mass.

Examples

  1. Carbon has 6 protons in its nucleus so its atomic no is Z=6
  2. Sodium has 11 protons .so Z= 11

Atomic mass

The sum of the numbers of neutrons and protons in the nucleus of an atom is called atomic mass or mass no.

  • It is represented by A and calculated as A=Z+n
  • Where n is no of neutrons and Z is no of protons
  • It always is greater than atomic no.
  • It is affected by the addition of neutrons.

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.

Atomic size.

  • We can not measure the size of an atom because atoms have no boundaries and they are very tiny, so can assume spherically
  • It decreases if the atomic no is decreased from left to right in a period.
  • In groups, atomic size gradually increases from top to bottom.

Atomic radius

The distance between the nucleus and the outermost orbit of the electrons of an atom is called atomic radius or atomic radii.

Relative atomic mass

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)

Atomic mass unit

The atomic mass unit or Dalton is defined as the one-twelfth of the mass of a carbon atom.

  • It is also called Dalton.
  • Its symbol is amu.

Interactions between atoms ( bonds)

Types of bonds

  • Ionic bond
  • Covalent bond
  • Dative covalent bond
  • Metallic bond

Ionic bond:

This type of bond is formed by the complete transfer of an electron from one atom to another.

Example

  • Only valence electrons( electrons in the last shell) can take part in ionic bonding while others are not.
  • In ionic bond formation, heat is released.

Covalent bond:

In this type of bond, electrons are mutually shared between two atoms.

Types

  1. Single covalent bond
  2. Double covalent bond
  3. Triple covalent bond
  4. Metallic bond

Single e covalent bond:

In which one bond pair of electrons is formed by the contribution of an electron by each bonded atom.

  • Indicated by a single line

Double covalent bond:

In which two bond pair is formed by the contribution of electron pair from each atom.

  • Indicated by double lines

Triple covalent bond:

In which three bond pairs are formed by the contributions of three electrons from each bonded atom.

  • It is indicated by three lines.
  • Each bonded atom attains octet by sharing of bond pair of electrons and attaining the nearest noble gas configuration.

Dative covalent or coordinate covalent bond:

A bond is formed between the electron pair donor and the electron pair acceptor.

  • The atom which invests a pair of electrons is called a donator.
  • The atom that receives that electron pair is called the acceptor.
  • Those valence electrons that are not taking part in bonding and available on an atom like the one available on nitrogen in ammonia.

Example:

Polar covalent bond:

Those covalent bonds in which hetero atom takes part and one attracts the bond pair of an electron more strongly than the other.

None polar covalent bond:

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.

Predominantly covalent:

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.

Evolutionary history of the atom

Timeline: 400 BC.

Scientist: Democritus

Theory of universe:

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.

  • Atom is made from matter and can not be seen by the necked eye.
  • Between atoms, there is a space.
  • Atoms are in the form of a solid-state.
  • There is no internal structure in an atom.
  • Every atom has a different shape, size, and weight.

Timeline:1800s

Scientist: Jhon Dalton

  • The first person presents an atomic model of the behavior of the theory of the behavior of atoms consisting of small particles.
  • Atoms cannot change their shape and are indestructible.
  • By the weight of atoms, their elements can be characterized.
  • Atoms combined to firm a compound.

Timeline: 1890s.

Scientist: Thomson

J.JThomson was a physicist who use cathode ray tube technology to discover electrons.

  • In this tube, the air has been sucked out.
  • An electric charge travels from cathode to anode
  • Florescent gas light up the whole tube and the charge in it is invisible. When a charge hits the beam, a dot will appear on the screen.
  • A beam of light travel in a straight line in a fluorescent tube.
  • Each coil has a specific charge on a deflection.
  • From a negative coil, the charge would defect away as Thomson shows.
  • So he formed that charge this a negative charge.

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.

Thomson’s atomic model

Using her prediction, he discovered what an atom looks like?

  • His model was named plum pudding model his name.
  • Each atom has a spherical shape and is inserted with positively charged fluid. He says it sticky jam part of a pudding.
  • In this fluid, corpuscles (electrons) are the negatively charged particles suspended. He compared it to plum in the pudding.
  • The movement of these electrons is not discovered by Thomson.

Timeline: 1910’s.

Scientist: Ernest Rutherford

Sir Rutherford made a famous gold foil experiment and proved the Thomson atomic model.

  • He fired positively charged alpha particles at a gold foil.
  • He estimated the deflection came out the other side.
  • Every particle has not been deflected. Every particle would deflect back in all the ways.
  • He assumed that the center of the foil must be positive. He called his nucleus.

Rutherford's Atomic model

  • The nucleus consists of positively charged particles.
  • The electrons revolve around the nucleus.
  • He faces one problem: Why nucleus can’t attract the electrons?
  • He compared the atom with a mini solar system in which electrons revolve around the nucleus in a fixed orbit due to this he called his planetary 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.

Bohr's atomic model:

  • Electrons have fixed energy and size in orbits of the nucleus.
  • The energy of an electron depends on the orbit in which the electron revolves.
  • Electrons fill the lower orbit first.
  • If the first energy level(orbit) is filled then the next will began to fill.
  • When an electron moves from one orbit to another, the radiation process occurs.

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.

Schrodinger’s atomic model(Aka the cloud model)

  • An electron would not revolve in a fixed orbit.
  • We can find out where it likely is.
  • Energy level depends upon the type of probability of orbit described by Bohr.

Facts

What is not an atom?

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.

Why does an atom react?

Atoms react for attaining the nearest noble gas configuration and become more stable by following the duplet or octet rule.

Why the shape of the atom is spherical?

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.

Why the revolving electron does not fall into the nucleus?

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.

Why neutrons are neutral and do they exist in the nucleus?

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.

Why carbon 12 is used in the references of all atomic mass units?

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

Raspberry Pi Pico Dual Core Programming with MicroPython

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

Raspberry Pi Pico Dual Core

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.

Core0 and Core1 communication

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

Software and Hardware components required

  • Raspberry Pi Pico development board
  • Thonny IDE
  • Data cable
  • Connecting wires
  • Breadboard
  • LEDs

Programming

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.

  • The first task while writing a code is importing necessary libraries. Here we are importing three libraries, “machine”, “utime” and “_thread”.
  • utime library provides the access to internal clock of raspberry Pi Pico module which is further used to add delay when required.
  • _thread library is responsible for implementing the threading function provided by “Raspberry Pi Pico” community.
  • As we are using a dual core processor and accessing both the cores simultaneously means we are using two threads (one thread from each core). This _thread module allows a user to work with multiple threads and also allow them to share global data space.
  • For more details on _thread module follow the given link: https://docs.python.org/3.5/library/_thread.html#module-_thread

Fig. 3 Importing necessary libraries

  • Semaphores or Simple locks are provided with “_thread” module which is responsible for synchronization between multiple threads. The allocate_lock() function provided with _thread module is responsible for returning a new lock object.
  • Here we are declaring a “spLock”

Fig. 4 declaring thread lock object

  • Next, we are creating a function where we are assigning the task to core_1.
  • The “spLock.acquire()” function “acquires the thread lock without any optional argument”. The reason for using the this “acquire()” function is to make sure that only one thread of execution is acquiring the lock at a time until the lock is released for other thread. Here we using the “print()” command as a task assigned or to be executed by core_1 along with a delay of 0.5sec or 500us.
  • Next, is the release() command, which is used to release the lock acquired earlier. So that other threads can execute their respective tasks.
  • The task assigned to core_1 will be executed continuously because it is written in “while loop”.

Fig. 5 Task for Core_1

  • The function core1_task() defined earlier which is containing the task assigned to core_1 will be passed as an argument inside start_new_thread() function. As per the official documentation from python.org, this function is responsible for “starting a new thread and returning its identifier”. The thread will execute the assigned function (as an argument). The tread will automatically exit when the function returns. We can even assign more than one argument in this “-thread.start_new_thread()” function.

Fig. 6 Core_1 thread

  • As we mentioned earlier, Raspberry Pi Pico uses core_0 as default a core for processing purpose. So here we do no need to use the _thread.start_new_thread() function to start a new thread for Core_0. Core_0 will automatically start a thread for code execution. But we still need to call the acquire(a lock) and then release functions, just to ensure only thread is acquiring the lock at a time. Here again we are using the print() command to print a message from core_0 like we did in case of Core_1.

Fig. 7 Task for default core (core_0)

Code

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()

  • Copy the above code and paste in your Thonny IDE window.
  • Save the code either on Raspberry Pi Pico or your computer and once it is successfully saved click on the ‘Run’ icon to run the code.
  • Now go to Shell section to check the result. If the Shell is not enabled then go to View >> Shell and check ‘Shell’.
  • Now in the shell section you should see the message printed from both the cores.

Fig. 8 Enabling Shell

Result

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.

  • Most of the instructions are similar to the previous example with some additional ones. Here we are importing one more library ‘Pin’ (along with the previous ones) to access the GPIO pins of raspberry Pi Pico module.

Fig.10 importing necessary libraries

Fig. 11 declaring led objects

  • Next task is assigning the task for each core. Core_1 is assigned to make the led_1 (GPIO_14) to toggle along with printing the given message.

Fig. 12 Toggling LED with core_1

  • Core_0, which is the default one is assigned to make the led_0 (i.e., GPIO_15) toggle with a delay of 0.5sec. Rest of the programming instructions are similar to the previous example code so we are not explaining them again.

Fig. 13 toggling LED with core_0

Code

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()

Result

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)

Conclusion

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.

Role of IoTA in Industrial IoT- Industry 4

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.

Understanding IoTA- how it's different from blockchain

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

  • Fujitsu
  • Samsung
  • Telekom
  • Volkswagen

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.

Why is IoTA 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.

  • Able to cater to the entire IoT market
  • Already has successful partnerships
  • Battle-tested products

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.

Key Benefits of IoTA

The following are the significant benefits that IoTA provides.

Tangle properties

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.

Lean system

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.

Fairness

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.

Cost-effective

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.

Open-source

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.

Industrial use cases of IoTA

There is a wide range of Industrial use cases of IoTA. We have discussed the most popular ones below.

Mobility

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.

Supply chain

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.

Healthcare

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.

Smart energy

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.

Industrial IoT

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.

Closing thoughts

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.

How to Use a Raspberry pi as a VPN Server

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.ComponentsDistributorLink To Buy
1Raspberry Pi 4AmazonBuy Now

What is Pi VPN?

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.

How can we choose a VPN service provider?

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.

Preparation for Pi VPN

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:

Activate the secure shell server and then restart your Pi

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.

Connect to the Raspberry Pi

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.

Update Raspbian for Pi VPN

Begin by obtaining a list of the most recent applications. Using the command: you can see if any installed programs are up to date.

Set a static IP address

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.

How can we figure out Raspbian’s firewall?

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:

Choose an encryption

During configuring the Raspberry virtual private network, you will select the level of encryption. What you need to remember is the following:

  • Generally, 2048-bit encryption is the best for download and streaming. However, 4096-bit is ideal for emailing and browsing, giving better security.

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.

Timing out during lengthy procedures

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.

Installing Pi, the virtual private network

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.

Launch the installer

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.

The Pi VPN installer

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.

Set up an encryption

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.

Installing the final piece

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.

Setup of the Pi Virtual private network GUI

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.

Preparing to install the GUI for Pi VPN

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.

Updating the web configuration

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.

Obtaining and installing the GUI for Pi VPN

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.

Connect to Pi virtual private network GUI

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.

Establish outbound virtual private network connection

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.

Outbound VPN with IPVanish

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:

Establish the IPVanish connection

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.

Update the routing table of the Raspberry Pi

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.

Keep your DNS requests safe and secure

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.

Connect to 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.

How can we connect to the virtual private network automatically?

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:

Pi VPN router settings

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.

VPN port forwarding

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.

Conclusion

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.

Ideal diode vs practical Diode

Hello, Students here I am present to cover an article on a series of Electronic devices and circuit theory. The foremost article of this series is Ideal diode vs practical diode. I try to elaborate on basic to modern theory related to the diode. This component act as fundamental to many important circuit devices such as rectifiers, transformers, etc. The question which we cover in this article are;

  • What is a diode?
  • How a diode is formed? Which methodology manufacturer utilized while the formation of the diode?
  • What is the concept of doping and PN junction in diode theory?
  • How does a Diode work?
  • What type of biasing allows a diode to conduct? Under which situation of biasing diode offers a restriction while conducting?
  • Upon which characteristics do we categorize the diode as an ideal diode and practical diode?
  • Which factor makes a diode ideal? And how practical diode is different from an ideal diode?

Along with these questions, numerous questions may arise in your mind related to diode because it is a very vast concept in circuit theory. If you want to know the answer to these questions, keep sticking with our article. The best step taken by our platform for the easiness of our readers is to provide two things in a single platform. A short video of this article is also tried to cover on our YouTube channel. You may visit. The link is given at end of the article.

What is a diode?

A diode is a two-terminal device that worked as a one-way conductor. A diode may assume as a simple solid-state component. This solid-state component is formed when the intrinsic semiconductor such as germanium or silicon Crystal is grown in such a way that one end is doped with pentavalent and the other end is doped with a trivalent impurity. It is also referred to as PN-junction Diode. Here word doped comes from techniques of doping which is used during the manufacturing of diode.

Doping

The process of adding an impurity to an intrinsic semiconductor I.e germanium and silicon. Semiconductors are those materials whose conductivity lies between a conductor ( good to conduct electricity) and an insulator ( bad to conduct electricity). To enhance the conducting capacity of semiconductors they are doped with different Impurities. Here the word impurity is used for those elements which are doped to pure semiconductor, after they are doped the germanium or silicon Crystal no longer remains pure.

Which element is used for doping?

Basically, elements from a fifth and third group of the periodic tables are commonly used in this process. Which refer to as pentavalent impurity (5the group) and trivalent impurity. Byword pentavalent means there are five electrons present in the outermost shell they lose one electron to complete their Octate and to become stable. That’s why these impurities are also named Donor impurity examples of such impurity are phosphorus, bismuth, etc. When we add such impurity to a semiconductor then N-type material is formed. Trivalent are those which have 3 electrons in the outermost shell and they need 1 electron to become stable due to this reason they are also named acceptor impurities. Examples of such impurities are Aluminum, Boron, etc. When they are doped with pure semiconductors then P-type material is formed.

How a diode is formed?

When intrinsic semiconductors is doped with two different Impurities then a junction is formed which I explain you in video of our Engineering prove t channel and I try to explain this also in my article;

When an N-type material is combined with P-type material then a PN junction is formed. In N-type material, there is the availability of a large number of free electrons which act as a majority charge carrier and holes act as minority charge Carriers. While in P-Type materials the doped material belongs to a trivalent group, they need 1 more electron to complete their covalent bond tendency. To complete one hole an electron jump from one shell to another. This creates another hole in the second shell which results in more than holes these holes act as majority charge carrier and electrons act as a minority charge carriers in P-Types material. As soon as these material are combine electrons from the N-side start to attract toward holes in P-side where they both diffuse and as soon as electron diffuse in the P-side this leave behind a positive ion and holes from the P-side move toward N-side and leave behind a negative ion result information depletion layer where there is lack of Carrier but still, there is the availability of negative and positive ions. This creates a natural potential difference between the two sides, thus forming a junction which refer to as PN-junction. Given below energy diagram and other pictorial representation helps to understand my concept.

Symbolic representation of a PN junction diode.

Symbolically a diode is represented as follows: Here N-side of the diode acts as the cathode and the P-side of the diode act as the anode. Current flow in direction to the arrow. There is a positive charge on the p-side and a negative charge on N-side.

How diode works

Under which biasing diode conduct and which biasing make diode poor to Conduct?

Biasing;

Biasing is a process in which to obtain the desire mode of operation we apply potential to both sides of the diode. This potential also helped us to control the width of the depletion layer.

Forward Biasing;

As shown in figure when biasing is applied in such a way that we provide the positive potential to cathode or P-Side of diode which makes it positive and negative potential of battery is connected with N-side of diode this makes the N-side more negative than P-side. This meets the necessary condition for a diode to conduct. This allows the flow of charges with little opposition almost negligible along with the depletion layer which reduces its width. Once a diode starts to conduct, there is slight opposition faced by carriers. This opposition is a referee to as bulk resistance. It combines the resistance of N-type and p-type. Its value is a most 5 ohm or less.

R(B)= R(N) + R(P)

As the value of R(B) is very low therefore there is little voltage drop across the resistance. Thus negligible in circuitry calculations. When the diode conduct fully the forward voltage becomes greater than the barrier potential. Typically the value of barrier potential or forward voltage for silicon and germanium are;

V(f) =0.7V for silicon

V(f)= 0.3V for germanium

Thus we can drive a diode to conduct by making the N-side more negative than the P-side of a diode.

Reverse Bias

When the potential is applied in such a way that the N-side is connected to positive terminal and P-side of diode is connected to the negative terminal of the battery then no electron and hole move through the junction they attracted toward their own attached pole side of the battery thus enhancing the width of depletion layer, junction current becomes reduces to zero. This means that there is large opposition faced by carriers in reverse biasing. However, there is a small few Milliampere current drawn in reverse biased condition due to some thermal agitation process which causes electron and hole pair combination. We can set a reverse biased condition by applying a potential to the N-side such that it drives more positively than the P-side of diode.

The conclusion which we drawn from these two biasing methods is;

Under forward biased conditions n-type is more negative then p-type, depletion layer width, junction Resistance are at minimum value. And device current is at peak value. Under reverse bias every situation becomes reversed p-type is more negative than the n-side. The width of the depletion layer increase and junction resistance meet to peak value we can say it becomes infinite and the device current become negligibly zero.

Want are the characteristics that make a diode ideal?

Ideal diode act as switch. There might be two possibilities which we attain while studying ideal diode. One is open switch and other is close switch. Let’s put a through back on some characteristics which a switch possess:

Ideal diode have following properties, which I also explain in my video whose link is given below of our article source.

Ideal diode can acts as a good conductor and good insulator under varying biasing schemes.

Under reverse biased condition it act as open switch;

In such situation a diode have;
  • Infinite Resistance
  • There is no flow of current across the junction. And diode acts as prefect insulator.
  • All voltage dropped across terminal component.

Under forward biased diode act as close switch

which have following properties;

  • Zero forward resistance
  • Maximum current is dream from diode. AMD Diode acts as perfect conductor.
  • No voltage drop across the components.

Characteristics curve of ideal diode

Now consider a characteristics algorithm for an ideal diode;

Characteristics curve of a circuit is the curve which is dream between the current and voltage to explain the manner in which device work under different situation.

Forward voltage is measured along positive x- axis and reverse voltage along negative x-axis. Similarly forward current and reverse current are measured along positive y-axis and negative y-axis respectively. 1st quadrant represent the forward bias region and 3rd quadrant represent reverse biased operating system. For vertical line in forward bias region the value of forward voltage increases with increase in forward voltage. For horizontal line in reverse bias mode we see that value of reverse current remains at zero level no matter what the value of reverse voltage. This implies diode act as perfect Insulator or open switch under reverse bias condition.

Now we discuss

how practical diode is different from ideal diode and what characteristics it posses?

(a) A practical diode can’t act as a perfect conductor and perfect insulator.

(b)Under reverse bias conditions there are a few milli-ampere current flows. Its value is very low. Now the question is why its Draws a small amount of current when reverse biased, it might be due to some thermal agitation process. Let’s try to explain this query. Consider the characteristics curve of the diode in both situations ideal and practical. in an ideal diode under reverse bias, the curve starts from the origin and there is no reverse current. And knee voltage is zero. Byword knee voltage we consider a point on the current-voltage curve at which there is a sudden increase or decrease of current. When a reverse voltage is increased beyond a limit then a breakdown occurs. Which break the electron-hole pair, and provides us a flow of free charge carrier due to this reason a small current is drawn even under reverse condition for practical diode due to electron-hole pair recombination. The value of knee voltage for silicon PN-junction is 0.7 V.

( c) In an ideal diode under forward biasing there is no voltage drop. While in practical diode there is a finite voltage drop across the terminal component whose value is different for silicon and germanium PN-junction.

(d) Piratical diode offers some finite Resistance under forward biasing which can’t be ignored and under reverse biased conditions there is no infinite Resistance.

The result we obtained about the Practical diode are:

(a) As Long as the knee voltage is not reached, the diode current is zero.

(b) When the knee voltage is achieved the diode begins to work and draws forward current.

Comparison between characteristics curve of ideal diode and practical diode

Lastly, there is an observable difference between the characteristics curve of both diodes.

In an ideal diode for forward biasing the forward current is maximum and the voltage drop is zero. And under reverse conditions no matter what’s the voltage, the reverse current is zero.

While in practical diode under forwarding biased, no current is drawn until the knee voltage that is 0.7 V is reached. Once this voltage is reached and the diode start to conduct the value of knee voltage is approximately equal to forward voltage I.e 0.7 regardless of the value of forwarding current.

The comparison between voltage and current values calculated in both diodes is summarized in below pictorial representation.

Some other considerations which we should make while dealing with practical diode are;

  • Peak reverse voltage
  • Average forward current
  • Forward power dissipation

This is the article from the series of electronic devices and circuit theory. I hope this material might be helpful for you. If you have any queries you may mention your problem in the comment section. Thanks to All.

Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir