Simple Home DIY Projects for Embedded Hobbyists

Hi Friends! Hope you’re well today. I’ll welcome you on board. In this post, I’ll walk you through How a Hobbyist Can Work on Electronic Projects in America.

From smartphones to security systems and appliances to advanced automation equipment, electronics seem to engulf every aspect of life. And with the recent advancement in technology, this trend will continue to make our lives easy and better for years on end. BUT… before you can take part in the development of innovative and advanced electronic machinery, you need to get your hands dirty with DIY electronic projects. These small and easy-to-handle projects give you confidence that you can do better and put your deliberate effort to delight the lives of people with your intellect.

If you’re just starting, we suggest you visit North America Hot Searched Electronic Platform which houses scores of electronic components that you can use in your electronic projects. 

Curious to know more about how a hobbyist can work on electronic projects in America?

Keep reading.

Where To Buy?
No.ComponentsDistributorLink To Buy
1Arduino NanoAmazonBuy Now

 How a Hobbyist Can Work On Electronic Projects In America?

Electronic devices are not cheap, however, there is a catch. Some small electronic devices and electrical projects you find online can be made in homes with a handful of tools and electrical components. There are some ready-made small kits and electrical modules like microcontrollers and Arduino boards that you can use in your electronic projects and develop a mini home-made electronic device.

In the following, I’m going to discuss some DIY projects that you can work on as a starter. No big setup. No advanced equipment is required. All you need to know is some basic computer skills and the right components to build something amazing from scratch.  

1: Liquid Level Indicator

A liquid level indicator is a simple electronic project used to identify the current level of the liquid. It is widely used in a range of applications like irrigation control, fuel tank level, cooling tower, and level gauging in pumps. 

Components Used

The following are some components used in this project.

  • 3 PNP A1015 transistors

  • 3 LEDs

  • 9V battery

  • Breadboard

  • Battery Clips

  • Probes

  • Connecting Wires

  • PVC tubing

The following figure shows the circuit diagram of the project.

How it Works

The circuit shows the signal by lighting up the LED whenever a tank reaches a certain level. The tank is divided into 3 levels: Low, Medium, and Full, based on the liquid capacity of the tank. Similarly, three LEDs are included to indicate a certain level where Red LED shows the Low level, Yellow shows the Medium level and Green shows the Full level. The transistor base is connected with the copper or aluminum wire that acts as a probe. 

Each transistor's base receives an electrical connection to 9V DC through water and the desired probe indicating the liquid level is started to rise. Consequently, this causes the transistors to conduct, causing LEDs to illuminate and show the level of liquid.


2: Beep Circuit

A beep circuit is a very handy electronic device mainly used for generating a quick sound in emergencies in places like fire brigade stations, police stations, hospitals, and factory areas for smoke detection. Devices like security and alarm systems use this circuit to send alert warnings of the emergency. 

Components Used

  • 1KΩ, 1.2KΩ, 470Ω Resisters

  • NPN 2N4401 Transistors

  • LED

  • 9V Battery

  • 2-input NAND Gate

  • Connecting Wires

  • Breadboard

  • Battery Clips

The following figure shows the circuit diagram of the Beep Circuit.

How It Works

The output at the pin4 IC continuously goes up and down based on the 2 NAND gates that are wired as a-stable multi-vibrator. This setup switches the 2N4401 transistor ON & OFF which serves as a driving force for the piezoelectric buzzer. In turn, the buzzer produces a beep sound triggering the LED continuously. 

3: LED Flash Light

This is a simple and cheap circuit. LEDs are widely used to produce durable light with low power. This circuit consists of two AAA cells that are connected in series producing 3V in total. It is enough to generate high-power illumination with an input current of just 20mA. 

Components Used

  • 2 AAA cells (1.5V each)

  • Push button

  • LED

  • Connecting Wires

The following figure shows the diagram of the LED Flash Light Circuit.

How it Works

In this figure, the LED is connected with the positive and negative terminals of the 3V battery using two cells. A push button is connected in series between the battery and the LED. When you push the button, it will instantly complete the circuit, allowing the charge to pass through LED and, in turn, illuminating it. 

4: Metal Detector Circuit

Metal detector circuits, as the name suggests, are used to detect the existence of any metal. These devices identify the change of magnetic field which is directly related to the distance of metal objects. They are used for a range of purposes like security screening and detecting the traces of metals in food products. 

Components Used

  • PVC Tubing

  • NPN BC548 Transistor

  • LM7806 Voltage Regulator

  • 10uF/16V Electrolyt ic Capacitor

  • 100pF, 10pF Ceramic Capacitor

  • Resistors

  • 6V Battery

  • Breadboard

  • Connecting Wires

The following figure shows the circuit diagram of the metal detector circuit.

How It Works

The circuit is made of old radio and a single BC548 transistor. The AM radio produces a hissing sound when you place this circuit in the vicinity of any metal object, indicating the presence of metal within a range. The L1 indicates 60 turns of enameled copper wire that is wired on a 1cm PVC tube. The 6V battery is used to power up the circuit.

5: Fire Alarm Circuit

Fire alarm electrical device is commonly used in factories to detect the presence of fire. When a fire breaks out in a place, the circuit instantly identifies the smoke produced by the fire, triggering an alarm sound to warn people about it within range. 

Components Used 

The following components are used in this circuit.

  • The device is equipped with LDR to detect smoke

  • IC UM 66 acts as a tone generator

  • IC 7805 used to run a tone generator 

  • TDA 2003 IC is an alarm system that acts as an amplifier to give signals to the speakers 

  • 9V battery that serves as a power source

  • Resistors

  • Capacitors

  • Breadboard

  • Connecting Wires

The following figure shows the circuit diagram of the fire alarm circuit.

6: Heartbeat Sensor With Arduino

Sensing the heartbeat is crucial for patients and athletes to identify the current condition of the heart. This way they can do preventive maintenance of the heart to ward off potential diseases. These sensors can be used in chest strips, smartphones, and wristwatches to monitor the heart rate.

Components Used

  • Arduino Uno

  • 16x2 LCDs

  • Push Button 

  • Connecting Wires 

  • 10KΩ Potentiometer 

  • Heartbeat Sensor Module with Probe 

  • Breadboard 

  • 330Ω Resistor 

Working Principle

A method that measures changes in blood volume in an organ is called photoplethysmography . This method tracks variations in the brightness of the light entering the organ. The Heartbeat Sensor operates based on this idea.

An IR LED is commonly used as the light source in the sensor. LDR, photodiode, and photoresistor can be used as photodetectors. 

The light source and photodetector can be arranged in two ways:

Reflective Sensor: In this setting, the detector and light source are next to one another. To read the heartbeat rate, the patient holds their finger in front of the sensor.

Transmissive Sensor: In this arrangement, the patient’s finger is placed between the receiver and transmitter, where the detector and source light face each other. 

The following figure shows the diagram of the heartbeat sensor.

7: Wireless Doorbell

Wireless doorbell is commonly used in shops, hospitals, factories, offices, and garages. 

This doorbell uses an RF module and hence comes with a wide range compared to wired or Wi-Fi doorbells. 

Components Used

  • 434 MHz RF Transmitter Module

  • 434 MHz RF Receiver Module

  • Arduino UNO

  • 750 KΩ Resistor

  • HT – 12D Decoder IC

  • HT – 12E Encoder IC

  • Push button

  • 9V Power Supply

  • Buzzer

  • Breadboard

  • Connecting Wires

How It Works

The circuit comes with Arduino Uno and an RF module. The Arduino Uno is mainly used to analyze the data. The RF module is applied for the development of wireless communication. 

A wireless doorbell system can be powered by batteries or by connecting to the home's main electrical supply. Wireless doorbell installation is simple since no wiring is required. For the receiver, only a power outlet will do.

The following figure shows the circuit diagram of the wireless doorbell.

8: Hand Wash Timer

We are all aware of how coronavirus rattled the entire world. Apart from wearing masks outside, washing hands was crucial to prevent the wrath of the virus. Since when you don’t wash your hands and touch your face or food, the virus is likely to spread to people around you. This is where the handwash timer comes in handy. 

Components Used

  • Arduino Nano

  • Ultrasonic Sensor HC-SR04

  • Three LEDs: Red, Blue, Green

  • Breadboard

  • Connecting Wires

Working Principle

It is a simple electronic project where Arduino is the brain of the countdown timer. We’ll attach the Arduino with 6 LEDs and an ultrasonic distance sensor. 

With the help of the distance sensor, the Arduino transmits ultrasonic sound waves and measures the amount of time it takes for the sound waves to be reflected back to the sensor. It calculates the distance to whatever appears in front of it using the current time. In turn, the Arduino continuously reads the sensor while witnessing your hand come within 20 centimeters. 

The Arduino turns on the red LED and waits for you to wash your hands with water and soap for four seconds as soon as it senses movement within 20 centimeters. The 20-second countdown then begins. The five blue LEDs eventually begin to illuminate one by one over 20 seconds.

Turning up the green LED will indicate that you have washed your hands for a considerable amount of time, at which point you can rinse the soap off.

The following figure shows the circuit diagram of the handwash timer.


9: Rain Alarm

Rain Alarm is a nifty electronic project to detect the presence of rain. It will turn on the buzzer when its sensors detect rainwater.

Components Used

  • BC 547 Transistor

  • 100 Ohm Resistor

  • Home Fabricated Water Sensor 

  • 9V Battery

  • Piezo Buzzer

  • Breadboard

  • Connecting Wires

The following figure shows the Rain Alarm Circuit Diagram.

How It Works

Raindrops that bridge over the screw tips make up the sensing element. When the drops fall on the screw tips, it allows a tiny electrical current to pass through the metal and turn on the transistor's base. The transistor then begins to conduct and increases the conductivity across its collector/emitter terminals.

In turn, the connected buzzer gets turned ON, giving the signals to the concerned authority to take appropriate action to deal with the rainwater. 

Key Considerations While Working on the Projects

Hope you have got enough information about some simple and easy-to-handle electronic projects to give you hands-on experience in dealing with electrical circuits and components. But there are some key considerations that you need to follow that will help you to successfully take your project from start to finish to execution. 

  • Make sure the contact between the soldering iron and the component doesn’t last longer than 1 sec. Otherwise, it will hurt the efficiency of the component, or worse, can completely damage the product.

  • Always pay special heed to the positive and negative terminals of the components while making connections. 

  • Install the main ICs and modules like microcontrollers at the center of the whole circuit. This will help to evenly manage the connections with the relevant electrical components.

  • Make a tight connection between the circuit and the components. Loose connection makes affect the working of the final project. 

  • Read the manuals that come with ICs or electronic modules. This will help you have a better understanding of the product and what you can do to avoid damage.

That’s all for today. Hope you’ve enjoyed reading this article. If you’re unsure or have any queries, you can ask me in the section below. I’d love to help you the best way I can. Thank you for reading the article.

Top Online Software used for PCB Designing

Hi Folks! Hope you’re well today. Happy to see you around. In this post, I’ll walk you through Top Online Software Used for PCB Designing.

PCB manufacturing starts from the simple layout design. If your design is free from errors, it will not only save you tons of time and money but also accelerate the production process. You’ll find scores of PCB design software out there. Some are better than others. 

So how do you keep up? 

This is a difficult task, in fact. Hence we’ve compiled the list of 10 best online software for PCB designing that will help you streamline your design process and get your boards ready for manufacturing. 

Keep reading.

Top Online Software used for PCB Designing

Know that if certain software is good for one project it doesn’t it will be equally handy for all electronic projects. Therefore we are giving you tons of options to pick from. Some are free designing tools and others are paid based on the features included in the software. So choose your pick wisely.

  1. Fusion 360

Fusion 360 is a unified software platform for electronics, engineering, design, and manufacturing. It combines CAD, CAM, CAE, and PCB design in a single tool, offering a flexible environment to monitor product performance and test your designs before the manufacturing process even begins.

Fusion 360 is a cloud-based tool connecting your entire product development process into a single platform and allowing you to interact with other team members from anywhere in the world. Not only is it handy for electrical engineers, but it also offers design solutions to mechanical engineers, industrial designers, machinists, hobbyists, and startups. You can start with a free trial and get a yearly subscription for only $545 per year. 

Moreover, you can get familiar with the software with the video tutorials and self-guided courses available on the website. And get access to the technical staff that contains industry professionals ready to solve your design issues.

  1. Altium Designer

Altium Designer is a powerful and intuitive PCB design software that offers a unified design experience, allowing electrical engineers to view every tiny detail of the design process from idea to execution. The tool comes with a sleek and clean interface, empowering designers to access all design tools in one place to limit the possibility of errors.

From schematic to PCB layout to design documentation, the tool makes every process easy and hassle-free. Plus, the software offers seamless integration with other ECAD/MCAD tools including PTC Creo Parametric, SolidWorks, Autodesk Fusion 360, and Autodesk Inventor. This means you can effortlessly collaborate with mechanical engineers for different design requirements without heavy file exchanges. 

Altium Designer allows a cloud-based environment, permitting easy collaboration with other team members remotely, so you can get feedback on your design and instantly remove issues, and exchange data whenever and wherever required.

  1. OrCAD

Speed up your design process with OrCAD PCB Software which offers scalable PCB design solutions to create designs as you like better. The company keeps updating the product with future design possibilities to ensure the best design solution for electrical engineers. The program features a range of technologies including schematic capture, PCB editing and routing, librarian tools, auto-routing, signal integrity, and more.

Get familiar with brilliant and spontaneous etch editing and placement capabilities to maximize your productivity. Additionally, with constraint management, you can make sure your final design resonates with certain requirements like length rules, net, spacing, and more. 

A worldwide network of Cadence Channel Partners (VARs) sells and supports this software and you can fill up the form online to get an instant quote based on your design requirements. The product includes OrCAD PCB designer, OrCAD PSpice Designer, OrCAD Sigrity ERC, and OrCAD Capture CIS.

  1. DipTrace

Backed with thousands of users worldwide, DipTrace is an intuitive schematic and PCB design software that offers economical and powerful design solutions to electrical engineers and hobbyists.

The program comes with an up-to-date components library that houses more than 160,000 components and 22,000+ patterns developed based on IPC-7351 Standard. Schematic capture is an advanced tool that features multi-sheet and multi-level hierarchical schematics. Using pattern and components editors you can design new components with custom templates. 

Another innovative design tool is the pattern generator that automatically creates footprints and 3D models. Exchange your files with other 2D/3D CAD tools like Altinum or OrCAD. The import and export facility allows you to easily convert your schematic to PCB and revert to the same file format. Get high-speed signals and 3D previews from your PCB layout. No matter the stage you are in during your development process, you can analyze it on screen and form an instant decision to make your final decision an ultimate success. 

Start with a 30-day free trial and then choose from a range of paid plans that start with 300 pins and 2 signal layers to unlimited pins and unlimited layers.

  1. Eagle 

This tool has been in practice for quite a while now and is still used by big electronic companies, hence providing an easy development process for end users. Eagle is an EDA (electronic design automation) software that is built from the ground up that offers tools for MCAD, true 3D modeling, collaboration, documentation, simulation, and manufacturing. The program allows electrical engineers to effortlessly work on schematic diagrams, components placement, and PCB routing.

Eagle collaborates with Fusion 360 to offer an unparalleled experience for data management, and mechanical and PCB design, streamlining the product development process for everyone to contribute with endless possibilities. Compared to other software, this program comes with a simple interface, where you don’t get inundated by the scores of tools, menus, and buttons. At the time of writing this article, Eagle offers paid plan for $545 per year, however, you can get in touch with the sales team to learn more about the financing options. 

  1. KiCAD EDA

Streamline your design process with KiCAD EDA – an open-source platform to meet your design needs. From basic schematic to complex designs, the tool automates the design process to maximize your productivity and turn your imagination into reality. The official library houses tons of thousands of symbols to pick from or gives you the ability to create your custom symbols.

Moreover, you can verify your design with both electrical rules checker and an integrated SPICE simulator. Features like excellent visualization and a powerful interactive router ease your layout tasks with better control over the design. KiCad's 3D Viewer is a remarkable addition to the product that empowers you to examine the mechanical structure and visualize your finished product. Present your work with a built-in raytracer that features customizable lighting to develop realistic images. The program is compatible with a range of operating systems that you can select from the website. However, if your system is not listed on the mentioned OS, you can submit a merge request to get a product that resonates with your operating system settings. 

  1. PCB Artist

Incorporated with a controlled autorouter and multi-page schematic, PCB Artist offers easy-to-use design solutions to electronic engineers. It features a components library with more than 500,000 parts allowing you to design your PCB with advanced components. The neat and sleek interface allows everyone to create circuit boards with little to no design knowledge. Even a beginner can get familiar with the tool with little effort.

With free live chat support, you can get technical support for your design needs. PCB Artist is committed to delivering flawless services to a range of organizations including small businesses, enterprises, non-profits, govt. and small businesses. Guides and tutorials are available to help you get a hold of the software and dig into designing the most complex parts. 

PCBWay – Manufacturing House

After all this grind and drill, your PCB design is ready. You have carefully created Gerber and BOM files with the final ready-to-use board in mind. Now comes the manufacturing part. And you have tons of options to pick from. To keep you covered, we are describing one of the finest PCB manufacturing houses – PCBWay.

PCBWay is a China-based company that offers a range of services from basic PCB manufacturing, SMD stencil, and PCB assembly to 3D printing and CNC machining. What makes it unique from the competitors? Good question. The quality service at an economical price with brilliant customer support keeps this company above the rest. 

They have a team of expert professionals that don’t compromise on quality and make sure every customer is heard, validated, and valued. No matter the product needs, they will help you and treat you like a part of the development stage so you never feel left out in the process.

And the best part – once you become a part of their community and become a regular customer, they give you a discount with every order. Moreover, you can invite friends with the referral link to join the company and can enjoy a 5% commission on each order. You’ll Beans as a reward for every purchase which will help you get parts from the PCBWay online shop. Additionally, you can share your projects on the website and engage a wider audience, and get acquainted with like-minded people. 

  • Neat Interface 

It all starts with the neat and straightforward website interface that is flooded with information about the company and what they offer. Get familiar with the services they provide with a single click. No back-and-forth run of pages that make you overwhelmed with unnecessary information. You can click PCB Instant Quote option on the front page and start filling out the form with the parameters and the requirement of the final circuit board. 

  • PCBA (printed circuit board assembly) Service

Some people are not adept at installing the components on the board. This is where PCBA service comes in handy. Once you click the instant quote option and scroll down you’ll see the Assembly service which gives you flexible options to either allow PCBWay to source components or you can provide them for the installation on the manufactured board.

  • CNC Machining and 3D Printing Service

PCBWay has established its name in the electronic industry with brilliant service and quality products. This time they have taken one step further. They have recently introduced CNC machining and 3D printing service to satisfy their clients with 3D modeling needs. To get those services, you can pick from the range of materials you want your product to be made from. 3D printing can manufacture parts within hours all the while maintaining accuracy and quality. 

  • Technical Support

Technical support is readily available. If you struggle to make the final decision for your finished product, they will guide you with technical complications so you can get your desired product without errors. Once you upload the Gerber and production files, they will thoroughly review them before confirming the order, so you can fix issues in advance to speed up the production process. 

Final Thoughts

Hope you get familiar with the features of the PCB software mentioned above. 

It is wise to get the trial version of the software before going for the paid option. This way you can make an educated decision if this is what you’re looking for.

Once you successfully make your design, it’s time to get a manufacturing service to get your board in real time. And in our opinion, PCBWay is a decent choice to meet your manufacturing needs and properly execute your electronic projects.

That’s all for today. I’m positive that you’ve enjoyed reading this article. If you have any questions, you can ask me in the section below. I’d love to help you the best way I can. Thank you for reading the post. 

What is Neural Network?

Hello Learners! Welcome to the next lecture on deep learning. We have read the detailed introduction to deep learning and are moving forward with the introduction of the neural network. I am excited to tell you about the neural network because of the interesting and fantastic applications of neural networks in real life. Here are the topics of today that will be covered in this lecture:

  • What do we mean by the neural network?

  • How can we know about the structure of the neural network?

  • What are the basic types of neural networks?

  • What are some applications of these networks?

  • Give an example of a case where we are implementing neural networks.

Artificial intelligence has numerous features that make it special and magical in different ways, and we will be exploring many of them in different ways in this course. So, first of all, let us start with the introduction.

Neural Network

Have you ever observed that your favorite videos are shown to you on Facebook or other social media platforms? Or does the advertisement for the product you are searching for pop up when using the phone applications? All of these are because of the artificial intelligence of the system that is running in the backend of the app and we have discussed it many times before. 

To understand well about the neural network, let us discuss the inspiration and the model that has resulted in the formation of the neural network. We all have the idea of the neural network of the human brain. We are the best creation because of the complex and the best brain that calculates, estimate, and predict the results of the repeating processes in a better way. The same is the case with the neural network of computer systems. We have discussed the basic structure of the neural network many times but now, it's time to know about the structure of the neural network. 

Structure of Neural Network

I always wonder how the answering software and apps such as Siri reply to us accurately and without any delay. The answer to this question was found in the workings and architecture of the network working behind this beautiful voice. I do not want to start the biology class here, but for proper understanding, I have to discuss the process when we hear a voice and understand it through the brain.

When we hear a sound in the surroundings, it is first caught by the ear, and this raw audio is acting as an input for the nerve of the ear. These nerves then pass this signal to the next layers that in return, pass these signals further to the next layers.

The layer makes the result more refined and accurate. Finally, the last layer reaches the brain where the brain makes the decision to respond. The same process is used in the neural network. This statement will be clear to you how it works, but for that, you have to know about the seven types of neural networks.

  1. Feed Forward Neural Network

  2. Recurrent Neural Network

  3. Radial Basis Function (RBF) Neural Network

  4. Convolution Neural Network

  5. Modular Neural Network

  6. Kohonen Self-organizing Neural Network

  7. Multi-Layer Perception

Feed Forward Neural Network

Let me start with the very basic type of neural network so that you may understand it slowly and gradually. The workings of this network are related to its name. The motion of the information or the nerves is unidirectional, and the process is ended in the output. In this type, there is no way to move a neural nerve backwards and train the previous layer. The basic application of this type of network is found in face recognition and related projects, people who are interested in the applications such as speech recognition prefer to choose this type of network to avoid the complexity.

 Radial Basis Function (RBF) Neural Network

This layer includes the radial function. The working of this function will be clearer when you know about the structure of this layer. Usually, this network has two layers:

  • Hidden Layer

  • Output Layer

The radial function is present in the hidden layer. The function is proved helpful in reasonable interpolation during the process in which the data is fitted into the layers. The layer works by measuring the distance of the nerve from the distance of the central part of the network. For the best implementation, this network checks for all types of data points and groups similar data points. In this way, this type of network can be used to make the systems such as power restoration. 

Recurrent Neural Network

As you can guess from the name of this network, it has the ability to recur. It is my favourite type of neural network because it learns from the previous layer, and the data is used to predict the output in a precise way. This is one of the main layers, and its work has been discussed many times in this tutorial.

Contrary to the first type of neural network that we have discussed before, the information can be recurred or moved to the previous layer. Here are some important points about this layer:

  • The first layer is a simple feed-forward layer. In other words, it can not move to the previous layer. 

  • Each layer transmits the data to the next layer unidirectional in the first phase. 

  • If during the transmission of data, the layer is predicting inaccurate results then it is the responsibility of the network to learn by repeating the saving of data. 

  • The main building block of this network is the process of saving the data into the memory and then working automatically to get accurate results. 

  • It is widely used in the text to speech conversations.

Convolution Neural Network

Now coming towards an important type of neural network that has a scope worldwide and engineers are working day and night in this field because of the interesting and beneficial applications of this network. Before going deep into the definition of this network, I must clarify what exactly a convolution is. It is the process of filtering the results in a way that can be used to enable activation. The filtering mechanism is repeating and therefore, it yields the perfect results all the time. Usually, it is used in image processing, natural language processing, and similar tasks because it breaks the image into parts and then represents the results according to the choice of the user. It is one of the classical techniques that are used for different purposes when people are working on images, videos, or other related projects. For example, if you want to find the edges or details of the images to replace or edit them in a better way, then this technique will be helpful all the time because, through it, you can play with the images and the components of the images as we are using the pixels for our purpose. If these things seem difficult or complex to you at the moment, do not worry, because all the things will be cleared with the passage of time.

Modular Neural Network

Modularity is considered the basic building block of the neural network. It is the process of dividing complex tasks into different modules or parts and solving them individually so that in the end, the results may be combined together and, finally, we get the accurate ending. It is a faster way of working. You can understand well by considering the example of the human brain, which is divided into the left and right sides and, therefore, can work simultaneously. There are different tasks that are assigned to each part and they work best in their duties.

Kohonen Self-organizing Neural Network

Random input vectors are fed into a discrete map of neurons. Dimensions and planes are other names for vectors. Its applications include recognizing patterns in data, such as in medical analysis.

Multi-Layer Perception

Here, I am now discussing the type of network that has more than one hidden layer. It is a little bit complex, but if you have an idea of the cases discussed before, you will easily understand this one. The purpose of using this network is to provide the type of data that is not linearly separable. There are several functions that can be used while working on this network. The interesting thing about this network is, it consists of a non-linear activation function for work.

Here n is the number of the last layer, which can be from 0 to any number according to the complexity of the network. A more useful network contains more layers and in return, is more useful usually.  

Example of Recurrent Neural Network

At the moment, I want to discuss an example of this network because it has a slightly different type of work, and I hope that with the help of this example, you will get the concept of what I am trying to teach you, Consider the case where we want to talk to the personal assistance in our divide and on the practical implementation, it is a simple task of few seconds yet at the backend, there is a long procedure that is being followed so that you may get the required results. Here is a simple sentence that is to be asked of the personal assistant. 

The first step of the network is to divide the whole sentence into words so that these can be scanned easily. 

We all know that each word has a specific pattern of sound, and therefore, the word is then sampled into the discrete sound waves. Let me revise that "discrete sound signals are the ones that consists of discontinuous points. We get the results in the following form.

Now, it is the time when the system further divides the single word into a single alphabet. As you can see in the image given above, each alphabet has a specific amplitude. In this way, the values of different alphabets are obtained and this data is then stored in the array. 

In the next step, the whole data obtained is then fed into the input layer of the network and here the working of recurrent neural network stars. By passing through the input layer, each weight of the alphabet is assigned to the interconnection between the input layer and the hidden layer of the network. At this moment, we need a transfer function that is calculated with the help of the following formula:

In the hidden layers, the weights get assigned to the hidden layers. This process continues for all types of layers, and as we know, the output of the first layer is used as the input by the second layer, and this process continues until the last layer. But keep in mind, this process is only for the hidden layers.

While using speech recognition with the help of the neural network, we use different types of terms, and some of them are :

  1. Acoustic model

  2. Lexicon

By the same token, there are different types of exits. I am not going to explain these terms right now because it is unnecessary to discuss them at the moment. 

In the end, we are reaching the conclusion that neural networks are amazing to learn and interesting to understand while working with deep learning. You will get all the necessary information about these networks in this course. We started with the basic introduction of the neural network and saw the structure of the network in detail. Moreover, we found the types of neural networks in detail and all the basic networks are discussed here so that you may compare well why we are using these networks and what type of network will be best for you for learning and training. We suggest feed-forward neural networks for basic use, and you will see the reason behind this suggestion in our coming lecture. Till then, you have to search for other networks; if you find any, discuss them with us. In the next lecture, you will learn about deep learning and neural networks, so stay tuned with us.

Getting Started with Deep Learning

Hello students, welcome to the second tutorial on deep learning in the first one, we have learned the simplest but basic introduction of deep learning to have a solid base about what we are actually going to do with deep learning. In the present lecture, we will take this to the advanced level and will learn the introduction with the intention of learning more and more about the introduction and understanding what we want to learn and how will we implement the concepts easily. So, here is a quick glance at the concepts that will be cleared today:

  • What do we mean by Deep learning?

  • What is the structure of calculation in neural networks?

  • How can you examine the Neural Networks?

  • What are some platforms of deep learning?

  • Why did we choose TensorFlow?

  • How can you work with TensorFlow?

Deep Learning as the Sub-branch of AI

As we have said earlier, artificial intelligence is the field that works to take the tasks and work of the human being from the computer that is, the computer act like the human. Computers are expected to think. It is a revolutionary branch of science that deals with the feeding of the intelligence of a human being in the computer for the welfare of mankind and with the passage of time, it is proving itself successful in the real world. With the advancement and enhancement of the complexity of artificial intelligence, the field is divided into different branches therefore, AI has a branch named machine learning and then it is subdivided into deep learning. The main focus of this course is deep learning therefore, we describe it in detail. 

Calculations in Neural Network

All this discussion was to tell you about the basics and the important introduction of deep learning and if it is still not clear to you then do not worry because by getting the information about it throughout the series you will start practising, things will be cleared here. 

We have seen the discussion about the neural network before but it was just related to the concept of the weights in the neural network. In the present tutorial, you are going to see another concept about the neural network and the proper working on these networks will be started in the coming sessions.

The neural network is just like the multiple layers of the human brain that contain the input layer where the data is fed in different ways according to the requirement of the network. Moreover, the multiple layers are responsible for the proper training process again and again in such a way that every second layer is more mature and accurate than the first one and in this way, the last one has the most accurate data among the others and this is then fed into the output layer where we can get the results. All these processes occur in a sequence while we are working on the neural network and it is listed below:

In the first step, the product is calculated by keeping the weight of each channel and the value of the input in mind. 

  • The sum of all the products obtained is then calculated and this is called the weighted sum of the layers. 

  • In the next step, the bias of added to the resultant calculation according to the estimation of the neural network.

  • In the final step, the sum is then subjected to the particular function that is named the activation function. 

Working of Neural Network 

As we have mentioned the steps, we know that it is not clear that much now in your mind therefore, we are discussing an example of this. By keeping all the steps in mind, we are now working on the practical application of working on a neural network.

We are considering the example in which the 28*28 pixel of an image is observed for its shape. Each pixel is considered as the input for the neurons of the first layer. 

The first step is then calculated by using the formula given below:

x1*w1 + x2*w2 + b1

We have taken the simple text example but added the process of each layer with the product of corresponding weight occurs till you reach the last layer. The next step here is calculated as:

Φ(x1* w1 + x2*w2 + b1)

Here the Φ sign indicates the presence of the activation function as mentioned above in the steps. Now, these steps are performed again and again according to the complexity of the task and training until all the inner layers are calculated well and the results are reached by the output layer and we get the results. An interesting thing here is the presence of a single neuron in the last layer that contain the result of the calculation to be shown as the output. The detail of how the neural network work will be discussed in the next tutorials. For now, just understand the outputs. 

Platforms for Deep Learning

It seems that you are now ready to move forward. Till now, you were learning what is deep learning and why it is useful but now, you are going to learn how can you use deep learning for different tasks. If you are a programmer you must know that there are different platforms that provide the platform for the compilation ad working of the programming language and these are specific to the limited programming languages.

For deep learning, there are certain platforms that are used worldwide and the most important one will be disused here:

TensorFlow

TensorFlow is one of the most powerful platforms specially designed for machine learning and deep learning and it is a free source software library. Although it is a multi-purpose platform it has special features that are used to train machine learning and deep learning projects. You can have an idea of its popularity by the fact that it is presented by the google brain team and it contains the perfect functionality. 

DL4J

The full form of DL4J is Deep Learning For You and as you can guess, it is specialized for deep learning and is written in java for the java virtual machine. Many people prefer this library because of its lightweight and specific design for deep learning.

Torch

If you are wondering if we are talking about a device then it is not true. Torch is an open-source library for deep learning and it provides the algorithm for the working of deep learning projects.

Keras

It is the API that is written in the TensorFlow deep learning platform. It is used for the best practice and experience for deep learning experts. The purpose of using this API is to have a clean, easy, and more reusable result of the code in less time. You will see this with the help of examples in the next sessions. 

Why Choosing TensorFlow

As you can guess, we have chosen TensorFlow for our tutorial and lectures because of some important reasons that we’ll share with you. For these classes, I have tested a lot of software that was specially designed for deep learning as I have mentioned some of them. Yet, I found TensorFlow most suitable for our task and therefore, I want to tell you the core reasons behind this choice.

Easy to Built the Models

You will see that the training and other phases depend upon different models this is super easy to do with the help of TensorFlow. The main reason is, it provides multi-level models so that the one that suits you best will be present for you all the time according to the complexity and working of your project. As we have mentioned earlier, the Keras API is used with TensorFlow therefore, the high-level performance of both of them results in marvelous projects.

Easiest Production in Machine Learning Anywhere

In machine learning and related branches such as deep learning, production is made easiest with the help of the fantastic performance of TensorFlow. It always provides the perfect path towards production and results. It also allows us to have the independence of using different languages and platforms and therefore, it attracts a large audience towards itself. 

A Powerful Tool for Experimentation

What is more important in research than perfect experimentation? Tensorflow is always here for the multiple types of experimentation and research options so that you may test your project in different ways and get the best results through a single software. The advantage of the presence of multiple APIs and the availability of handling several languages makes it best for experimentation.

Another advantage of choosing it for the tutorial is, it supports powerful add-on libraries and interesting models, therefore, it will become easy for us to experiment more and explain the results in a different way to approach all types of students. 

These are some highlighted points that attracted us towards this software but overall, it has a lot in it and you will understand the points when you will see all of them in action in this series, We will be working totally on the TensorFlow and will discuss each and every step in detail without skipping any single step. The practical performance of each step will lead you to move forward with more interest and to understand each concept, we will use different examples. Yet, I have an idea that more explanation makes the discussion confusing so there will be a balance in the explanation.

Working With TensorFlow

As we have described before, TensorFlow is introduced by the google brain team and it was closely collaborating with the machine learning research organization.

TensorFlow is the software library that works in the collaboration with some other libraries for the best implementations of deep learning projects and you will see its work and projects in detail soon when we will move forward in this series. There are different libraries that are important to attach with the TensorFlow when we try to make it ready for the working of deep learning. Some of them are listed below:

  • Python package Index

  • Django

  • Scipy

  • Numpy

Following are the steps that are used to work on the TensorFlow. Yet, keep in mind, these steps vary according to the need of the time and type of the project.

  • Import the libraries in TensorFlow.

  • Assign paths of data sets. It is important to provide the path to column variables as well. 

  • Create the test and train data and for this, use the Pandas library.

  • In the next step, the shape of the test and train data is printed. 

  • For the training data sheet, the data type is printed for each column. 

  • Set the label column values of the data.

  • You have to cunt the total number of unique values related to the datasheets.

  • Add features for the different types of variables. 

  • Built the relationship for the features with a bucket. 

  • Add features for the proper definition of the features. 

  • Train and evaluate the model. 

  • Predict the model and set the output to the test set. 

Do not worry if these steps are new to you or if they are confusing for you at the moment, you will see the detail of them in the coming future. Moreover, Some of these steps may be different for different people because coding is a vast area and therefore, it has multiple ways to work in a different environments. So, today we learnt several concepts through this single lecture. We have revised and added some other information in the introduction of deep learning, We also have a discussion about neural networks and saw it working. Moreover, the platforms of deep learning were discussed here out of which, we chose the tensor flow and the reason for this choice was also explained well with the help of different points. In the end, we saw the brief procedure to train and predict the project and you will see all these concepts in action in the coming lectures so stay tuned with us.

Introduction to Deep Learning

Hello friends, I hope you all are having fun. Today, we are bringing you one of the most advanced and trending courses named "Deep Learning". Today, I am sharing the first tutorial, so we will discuss the basic Introduction to Deep Learning, and in my upcoming lectures, we will explore complex concepts related to it. Deep Learning has an extensive range of applications and trends and is normally used in advanced research. So, no matter which field you belong to, you can easily understand all the details with simple reading and practicing. So without any further delay, let me show you the topics that we are going to cover today:

  • What is deep learning?
  • What are artificial intelligence and machine learning?
  • Working with deep learning using neural networks.
  • Trends in deep learning.
  • Deep learning as a career.

So, let's get started:

What is Deep Learning?

  • Deep Learning is a branch of machine learning, that enables machines to think like a human brain, by using neural networks.
  • Using Deep Learning techniques, machines get smart and recognize the pattern from the data already saved/fed in the database and then use this data for the prediction of future results.
  • So, we can say that the deep learning neural network has the ability to learn from the previous results and predict the behavior of the network.
  • Deep learning algorithms have multiple layers to analyze the millions of data points.
  • An automatic Driverless car is an excellent real-life application of Deep Learning.

Deep Learning is considered a branch of Machine Learning which itself comes under Artificial Intelligence. So, let's have a look at these two cornerstone concepts in the computing world:

What is Artificial Intelligence?

Artificial intelligence or AI is the science/engineering behind the creation of intelligent machines, particularly intelligent computer programs. It enables computers to understand human intelligence and behave like it. AI has a broader expertise and does not have to limit itself to biologically observable methods as in deep learning.

It is a field that combines the computer and the robust data set to solve the problems of life. Moreover, it is important here to mention the definition of machine learning:

What is Machine Learning?

Machine learning is the branch of artificial intelligence, it learns from the experience and data fed into it and works intelligently on its own without the instruction of the human being. For instance, the news feed that arises on Facebook is directed by machine learning on the data so the content of the user’s choice appears every time when they scroll Facebook. As you put more and more data into the machine, it will learn in a better way to provide intelligent results.

Deep Learning Working Principle

Deep learning uses neural network techniques to analyze the data. The best way to describe the neural network is to relate it to the cells of the brain. A neural network is the layers of nodes much like the network in our brain and all these nodes are connected to each other either directly or indirectly. Neural Network has multiple layers to refine the output and it gets deeper as the number of layers increases.

Deep Learning vs. Human Brain

In the human brain, each neuron is able to receive hundreds or thousands of signals from the other neurons and selects signals based on priority. Similarly, in deep learning networks, the signals travel from node to node according to the weight assigned to them. In this way, the neurons with the heavyweight have more effect on the adjacent layer. This process flows through all the layers and the final layer compiles the weight of the resultant and produces the output.

The human brain learns from its experience i.e. as you get old, you get wiser. Similarly, deep learning has the ability to learn from its mistakes and keeps on evolving.

The process of network formation and its working is so complex that it requires powerful machines and computers to perform complex mathematical operations and calculations. Even if you have a powerful tool and computer, it takes weeks to train the neurons.

Another thing that is important to mention here is that neural network works on binary numbers only. So, when the data is being processed, it classifies the answers as a series of binary numbers and performs highly complex calculations. Face recognition is the best example in this regard because in this process, the machine examines the edges and lines of the face to be recognized and it also saves the information of more significant facial parts.

Layers in Deep Learning

Understanding the layers in deep learning is important to get an idea of the complex structure of deep learning neural networks. The neurons in the deep learning architecture are not scattered but are arranged in a civilized format in different layers. These layers are broadly classified into three groups:

  1. Input layer
  2. Hidden layers
  3. Output layer

The working of each neural network in deep learning depends on the arrangement and structure of these layers. Here is a general overview of each layer:

Input Layer

This is the first layer of the neural network and takes the information in the form of raw data. The data may be in the form of text, values, images, or other formats and may be arranged in large datasets. This layer takes the data and applies processing to make it ready for the hidden layers. Every neural network can have one or many input layers.

Hidden Layer

The main processing of data occurs in the hidden layers of the neural networks. These are crucial layers because they provide the processing necessary to learn the complex relationship between the input feature layer and the required output layer.

There are a great number of neurons in the hidden layers, and the number of hidden layers varies according to the complexity of the task and the type of neural network. These layers perform operations such as improved accuracy, feature extraction, representation learning, etc.

Output Layer

These are the final layers responsible for the production of the network’s predictions. A neural network may have one or more output layers, and the activation function of the network depends on the type of problem to be solved in the network. One such example is the softmax activation function, which divides the output according to the probability distribution over different classes.

Training of Deep Learning Process

To understand well, usually, the example of object or person recognition is explained to the students. Let's say, we want to recognize or detect a cat in the picture. We know that different races of cats do not look alike. Some of them are fluffy, some are short, and some are thin in appearance. By the same token, the different angles of the images of the same cat will not be the same and the computer may be confused to recognize these cases. Therefore, the training process includes the amount of light and the shadow of the object in the observation.

In order to train a deep-learning machine to recognize a cat, the following main procedures are included:

  • Using several pictures of cats of different races from different angles.
  • Using the pictures of the other objects that are not cats and telling the network the information about these.
  • Labeling all the images and commanding the compiler to save their data.
  • Feeding all the data into the neural network and compiling the results.
  • The final layer compiles the disconnected results such as the hair type, size, features of the face, etc.
  • Once all the data is fed into the network, the results are then compared with the human-generated labels.
  • If both labels give the same results, the neural network is then considered as trained.
  • On the other hand, if the results are not the same, then the weights are calculated again and the training process is repeated.
  • The process of repeating the adjustments is known as supervised learning, and it occurs even when the neural networks are not explicitly told what "makes" a cat. They must learn on their own and recognize patterns in data over time.

Deep Learning Applications

In the modern computing world, deep learning has a wide range of applications in almost every field. We have mentioned a few examples in our above discussion i.e. Facebook newsfeed and driverless cars. Let's have a look at a few other services utilizing deep learning techniques:

Digital Assistance 

Digital assistants i.e. voice recognition, facial recognition, text-to-speech conversion, voice-to-text conversion, language translation, plagiarism checker etc. are using deep learning techniques to recognize the voice or to process languages. Grammarly, Copyscape, Ahrefs etc. are a few real-life examples using Deep Learning techniques.

Safe Banking

Paypal is using deep learning to prevent fraud and illegal transactions. This is one of the most common examples of the banking facility that I am mentioning here otherwise, there are different applications in security and privacy that are connected to deep learning. 

Object Recognition

Some object recognition applications such as CamFind allow the user to use pictures of the objects and with the help of mobile vision technology, these apps can easily understand what type of objects have been captured.

Self-driven Cars

Another major application of deep learning is the self-driven car that will not only be able to minus the need for drivers in the car but are also able to avoid traffic jams and road accidents. It is an important topic and most companies are working day and night in deep learning to get the perfect results.

Future Prediction and Deep Learning 

As we have said earlier, deep learning is the process of training the computer like humans, therefore, people are working best to train the machine so they can easily examine trends and predict future outcomes such as stock marketing and weather prediction. Isn't it helpful that your computer or the assistant tells you about the stock marketing rates and predicts the best option to be picked for your investments? 

Medical Assistance

In the medical field, where doctors and experts are working hard to save the lives of people, there is no need to explain the importance of technologies such as deep learning that can predict and control the values in body changes and suggest the best remedy and solution of the problem being observed.

Careers in Deep Learning 

Once you have read about the application and the working process of deep learning, you must be thinking if it is the future, why choose deep learning as your career? Let me tell you, if you excel in deep learning, the future is yours. The careers in deep learning are not yet declared but in the coming few years, you are going to see tremendous exposure to deep learning and related subjects and if you are an expert in it, you will be in demand all the time because it is coming with the endless opportunities. Machine learning engineers are in high demand because neither data scientists nor software engineers possess the necessary skills.

To fill the void, the role of machine learning engineer has evolved. According to experts, the deep learning developer will be one of the most highly paid ones in the future. I hope, in the future, almost all fields will require the involvement of deep learning in their network to work easily and to get more and more efficient work without the involvement of human beings. In simple words, with the help of a neural network, we are replacing human beings with machines and these machines will be more accurate.

So in this way, we have introduced you to the amazing and interesting sub-branch of machine learning that is connected to artificial intelligence. We have seen the working and procedures of deep learning and to understand well, we have seen the examples of deep learning processes. Moreover, the trends and techniques discussed related to deep learning where we have seen that most popular apps and websites are using deep learning to make their platforms more user-friendly and exciting. In the end, we saw the careers and professions of deep learning for the motivation of the students. I know at this step, you will have many questions in your mind but do not worry because I am going to explain everything without skipping a single concept and will learn new things with you while explaining to you. So stay with us for more interesting lectures.

Social Distancing Detector with OpenCV in Raspberry Pi 4

During the era of Covid-19, social distancing has proven to be an efficient method of reducing the spread of contagious viruses. It is recommended that people avoid close contact as much as possible because of the potential for disease transmission. Many public spaces, including workplaces, banks, bus terminals, train stations, etc., struggle with the issue of keeping a safe distance.

The previous guide covered the steps necessary to connect the PCF8591 ADC/DAC Analog Digital Converter Module to a Raspberry Pi 4. On our Terminal, we saw the results displayed as integers. We dug deeper into the topic, figuring out exactly how the ADC produces its output signals. In this article, however, we will use OpenCV and a Raspberry Pi to create a system that can detect when people are trying to avoid eye contact with one another. We will employ the YOLO version 3 Object Recognition Algorithm's weights to implement the Deep Neural Networks component. Compared to other controllers, the Raspberry Pi always comes out as the best option for image processing tasks. Previous efforts utilizing Raspberry Pi for advanced image processing included a face recognition application.


Where To Buy?
No.ComponentsDistributorLink To Buy
1Jumper WiresAmazonBuy Now
2PCF8591AmazonBuy Now
3Raspberry Pi 4AmazonBuy Now

Components 

  • Raspberry Pi 4

Only a Raspberry pi 4 having OpenCV pre-installed will do for this purpose. Digital image processing is handled with OpenCV. Digital Image Processing is often used for people counting, facial identification, and detecting objects in images.

YOLO

The savvy YOLO (You Only Look Once) Convolution neural networks (CNN) in real-time Object Detection are invaluable. The most recent version of YOLO, YOLOv3, is a fast and accurate object identification algorithm that can identify eighty distinct types of objects in both still and moving media. The algorithm first runs a unique neural net over the entire image before breaking it up into areas and computing border boxes and probability for each. The YOLO base model has a 45 fps real-time frame rate for processing photos. Compared to other detection approaches, such as SSD and R-CNN, the YOLO model is superior.

In the past, computers relied on input devices like keyboards and mice; today, they can also analyze data from visual sources like photos and videos. Computer Vision is a computer's (or a machine's) capacity to read and interpret graphic data. Computing vision has advanced to the point that it can now evaluate the nature of people and objects and even read their emotions. This is feasible because of deep learning and artificial intelligence, which allow an algorithm to learn from examples like recognizing relevant features in an unlabeled image. The technology has matured to the point where it can be employed in critical infrastructure protection, hotel management, and online banking payment portals.

OpenCV is the most widely used computer vision library. It is a free and open-source Intel cross-platform library that may be used with any OS, including Windows, Mac OS X, and Linux. This will make it possible for OpenCV to function on a mobile device like a Pi, which will have a wide range of applications. Let's dive in, then.

Setup of OpenCV on a Raspberry Pi 4

OpenCV and its prerequisites won't run without updating the Raspberry Pi to the latest version. To install the most recent software for your Raspberry Pi, type in the following commands:

sudo apt-get update

Then, use the scripts below to set up the prerequisites on your RPi so you can install OpenCV.

sudo apt-get install libhdf5-dev -y 

sudo apt-get install libhdf5-serial-dev –y 

sudo apt-get install libatlas-base-dev –y 

sudo apt-get install libjasper-dev -y 

sudo apt-get install libqtgui4 –y

sudo apt-get install libqt4-test –y

Finally, run the following lines to install OpenCV on your Raspberry Pi.

pip3 install OpenCV-contrib-python==4.1.0.25

Setting up Opencv using Cmake

OpenCV's installation on a Raspberry Pi can be nerve-wracking because it takes a long time, and there's a good possibility you'll make a mistake. Given my own experiences with this, I've tried to make this lesson as straightforward and helpful as possible so that you won't have to go through the same things I did. Even though OpenCV 4.0.1 had been out for three months when I started writing this lesson, I decided to use the older version (4.0.0) because of some issues with compiling the newer version.

This approach involves retrieving OpenCV's source package and compiling it on a Raspberry Pi with the help of CMake. Installing OpenCV in a virtual environment allows users to run many versions of Python and OpenCV on the same computer. But I'm not going to do that since I'd rather keep this essay brief and because I don't anticipate that it will be required any time soon.

Step 1: Before we get started, let's ensure that our system is up to date by executing the command below:

sudo apt-get update && sudo apt-get upgrade

If there are updated packages, they should be downloaded and installed automatically. There is a 15-20 minute wait time for the process to complete.

Step 2: We must now update the apt-get package to download CMake.

sudo apt-get update

Step 3: When we've finished updating apt-get, we can use the following command to retrieve the CMake package and put it in place on our machine.

sudo apt-get install build-essential cmake unzip pkg-config

When installing CMake, your screen should look similar to the one below.

Step 4: Then, use the following command to set up Python 3's development headers:

sudo apt-get install python3-dev

Since it was pre-installed on mine, the screen looks like this.

Step 5: The following action would be to obtain the OpenCV archive from GitHub. Here's the command you may use to replicate the effect:

wget -O opencv.zip https://github.com/opencv/opencv/archive/4.0.0.zip

You can see that we are collecting version 4.0.0 right now.

Step 6: The OpenCV contrib contains various python pre-built packages that will make our development efforts more efficient. Therefore, let's also download that with the command that is identical to the one shown below.

wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.0.0.zip

The "OpenCV-4.0.0" and "OpenCV-contrib-4.0.0" zip files should now be in your home directory. If you need to know for sure, you may always go ahead and check it out.

Step 7: Let's extract OpenCV-4.0.0 from its.zip archive with the following command.

unzip opencv.zip

Step 8: Extraction of OpenCV contrib-4.0.0 via the command line is identical.

unzip opencv_contrib.zip

Step 9: OpenCV cannot function without NumPy. Follow the command below to begin the installation.

pip install numpy

Step 10: In our new setup, the home directory would now contain two folders: OpenCV-4.0.0 and OpenCV contrib-4.0.0. Next, we'll make a new directory inside OpenCV-4.0.0 named "build" to perform the actual compilation of the Opencv library. The steps needed to achieve the same result are detailed below.

cd~/opencv

mkdir build

cd build

Step 11: OpenCV's CMake process must now be initiated. In this section, we specify the requirements for compiling OpenCV. Verify that "/OpenCV-4.0.0/build" is in your path. Then, paste the lines below into the Terminal.

cmake -D CMAKE_BUILD_TYPE=RELEASE \

    -D CMAKE_INSTALL_PREFIX=/usr/local \

    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-4.0.0/modules \

    -D ENABLE_NEON=ON \

    -D ENABLE_VFPV3=ON \

    -D BUILD_TESTS=OFF \

    -D WITH_TBB=OFF \

    -D INSTALL_PYTHON_EXAMPLES=OFF \

    -D BUILD_EXAMPLES=OFF ..

Hopefully, the configuration will proceed without a hitch, and you'll see "Configuring done" and "Generating done" in the output.

If you encounter an issue during this procedure, check to see if the correct path was entered and if the "OpenCV-4.0.0" and "OpenCV contrib-4.0.0" directories exist in the root directory path.

Step 12: This is the most comprehensive process that needs to be completed. Using the following command, you can compile OpenCV, but only if you are in the "/OpenCV-4.0.0/build" directory.

Make –j4

Using this method, you may initiate the OpenCV compilation process and view the status in percentage terms as it unfolds. After three to four hours, you will see a completed build screen.

The command "make -j4" utilizes all four processor cores when compiling OpenCV. Some people may feel impatient waiting for a 99% success rate, but eventually, it will be worth it.

After waiting an hour, I had to cancel the process and rebuild it with "make -j1," which did the trick. It is advisable first to use make j4 since that will utilize all four of pi's cores, and then use make j1, as make j4 will complete most of the compilation.

Step 13: If you are at this point, congratulations. You have made it through the entire procedure with flying colors. The final action is to run the following command to install libopecv.

sudo apt-get install libopencv-dev python-OpenCV

Step 14: Finally, a little python script can be run to verify that the library was successfully installed. Try "import cv2" in Python, as demonstrated below. You shouldn't get any error message when you do this.

Completing the Raspberry Pi Software Installation of Necessary Additional Packages

Let's get the necessary packages set up on the Raspberry Pi before we begin writing the code for the social distance detector.

Installing imutils

utils are designed to simplify the use of OpenCV for standard image processing tasks like translating, rotating, resizing, skeletonizing, and presenting pictures via Matplotlib. If you want to get the imutils, type in the following command:

pip3 install imutils

A Breakdown of the Program

The complete code may be found at the bottom of the page. In this section, we'll walk you through the most crucial parts of the code so you can understand it better. All the necessary libraries for this project should be imported at the beginning of the code.

import numpy as np

import cv2

import imutils

import os

import time

Distances between objects or points in a video frame can be determined with the Check() function. The two things in the picture are represented by the a and b points. The Euclidean distance is determined using these two positions as the starting and ending points.

def Check(a,  b):

    dist = ((a[0] - b[0]) ** 2 + 550 / ((a[1] + b[1]) / 2) * (a[1] - b[1]) ** 2) ** 0.5

    calibration = (a[1] + b[1]) / 2     

    if 0 < dist < 0.25 * calibration:

        return True

    else:

        return False

The YOLO weights, configuration file, and COCO names file all have specific locations that can be set in the setup function. The os.path module is everything you need to do ordinary things with pathnames. The os.path.join() sub-module intelligently combines two or more path components. cv2.dnn.read The net is reloaded with the saved weights using the netfromdarknet() function. Once the weights have been loaded, the network layers can be extracted using the getLayerNames model.

def Setup(yolo):

    global neural_net, ln, LABELS

    weights = os.path.sep.join([yolo, "yolov3.weights"])

    config = os.path.sep.join([yolo, "yolov3.cfg"])

    labelsPath = os.path.sep.join([yolo, "coco.names"])

    LABELS = open(labelsPath).read().strip().split("\n") 

    neural_net = cv2.dnn.readNetFromDarknet(config, weights)

    ln = neural_net.getLayerNames()

    ln = [ln[i[0] - 1] for i in neural_net.getUnconnectedOutLayers()]

In the image processing section, we extract a still image from the video and analyze it to find the distance between the people in the crowd. The function's first two lines specify an empty string for both the width and height of the video frame. To process many images simultaneously, we utilized the cv2.dnn.blobFromImage() method in the following line. The blob function adjusts a frame's Mean, Scale, and Channel.

(H, W) = (None, None)

    frame = image.copy()

    if W is None or H is None:

        (H, W) = frame.shape[:2]

    blob = cv2.dnn.blobFromImage(frame, 1 / 255.0, (416, 416), swapRB=True, crop=False)

    neural_net.setInput(blob)

    starttime = time.time()

    layerOutputs = neural_net.forward(ln)

YOLO's layer outputs are numerical values. With these numbers, we may determine which objects belong to which classes with greater precision. To identify persons, we iterate over all layerOutputs and assign the "person" class label to each. Each detection generates a bounding box whose output includes the coordinates of the detection's center on X and Y as well as its width and height.

            scores = detection[5:]

            maxi_class = np.argmax(scores)

            confidence = scores[maxi_class]

            if LABELS[maxi_class] == "person":

                if confidence > 0.5:

                    box = detection[0:4] * np.array([W, H, W, H])

                    (centerX, centerY, width, height) = box.astype("int")

                    x = int(centerX - (width / 2))

                    y = int(centerY - (height / 2))

                    outline.append([x, y, int(width), int(height)])

                    confidences.append(float(confidence))

Then, determine how far apart the middle of the active box is from the centers of all other boxes. If the rectangles overlap only a little, set the value to "true."

for i in range(len(center)):

            for j in range(len(center)):

                close = Check(center[i], center[j])

                if close:

                    pairs.append([center[i], center[j]])

                    status[i] = True

                    status[j] = True

        index = 0

In the following lines, we'll use the model's box dimensions to create a square around the individual and evaluate whether or not they are in a secure area. If there is little space between the boxes, the box's color will be red; otherwise, it will be green.

            (x, y) = (outline[i][0], outline[i][1])

            (w, h) = (outline[i][2], outline[i][3])

            if status[index] == True:

                cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 0, 150), 2)

            elif status[index] == False:

                cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)

Now we're inside the iteration function, where we're reading each film frame and analyzing it to determine how far apart the people are.

ret, frame = cap.read()

    if not ret:

        break

    current_img = frame.copy()

    current_img = imutils.resize(current_img, width=480)

    video = current_img.shape

    frameno += 1

    if(frameno%2 == 0 or frameno == 1):

        Setup(yolo)

        ImageProcess(current_img)

        Frame = processedImg

In the following lines, we'll utilize the opname-defined cv2.VideoWriter() function to save the output video to the provided place.

if create is None:

            fourcc = cv2.VideoWriter_fourcc(*'XVID')

            create = cv2.VideoWriter(opname, fourcc, 30, (Frame.shape[1], Frame.shape[0]), True)

    create.write(Frame)

Testing the program

When satisfied with your code, launch a terminal on your Pi and go to the directory where you kept it. The following folder structure is recommended for storing the code, Yolo framework, and demonstration video.

The yoloV3 directory is downloadable from the;

https://pjreddie.com/media/files/yolov3.weights

videos from:

https://www.pexels.com/search/videos/pedestrians/

Finally, paste the Python scripts provided below into the same folder as the one displayed above. The following command must be run once you've entered the project directory:

python3 detector.py

I applied this code to a sample video I found on pexels, and the results were interesting. The frame rate was terrible, and the film played back in almost 11 minutes.

Changing line 98 from cv2.VideoCapture(input) to cv2.VideoCapture(0) allows you to test the code without needing a video. Follow these steps to utilize OpenCV on a Raspberry Pi to identify inappropriate social distances.

Complete code

import numpy as np

import cv2

import imutils

import os

import time

def Check(a,  b):

    dist = ((a[0] - b[0]) ** 2 + 550 / ((a[1] + b[1]) / 2) * (a[1] - b[1]) ** 2) ** 0.5

    calibration = (a[1] + b[1]) / 2       

    if 0 < dist < 0.25 * calibration:

        return True

    else:

        return False

def Setup(yolo):

    global net, ln, LABELS

    weights = os.path.sep.join([yolo, "yolov3.weights"])

    config = os.path.sep.join([yolo, "yolov3.cfg"])

    labelsPath = os.path.sep.join([yolo, "coco.names"])

    LABELS = open(labelsPath).read().strip().split("\n")  

    net = cv2.dnn.readNetFromDarknet(config, weights)

    ln = net.getLayerNames()

    ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()]

def ImageProcess(image):

    global processedImg

    (H, W) = (None, None)

    frame = image.copy()

    if W is None or H is None:

        (H, W) = frame.shape[:2]

    blob = cv2.dnn.blobFromImage(frame, 1 / 255.0, (416, 416), swapRB=True, crop=False)

    net.setInput(blob)

    starttime = time.time()

    layerOutputs = net.forward(ln)

    stoptime = time.time()

    print("Video is Getting Processed at {:.4f} seconds per frame".format((stoptime-starttime))) 

    confidences = []

    outline = []

    for output in layerOutputs:

        for detection in output:

            scores = detection[5:]

            maxi_class = np.argmax(scores)

            confidence = scores[maxi_class]

            if LABELS[maxi_class] == "person":

                if confidence > 0.5:

                    box = detection[0:4] * np.array([W, H, W, H])

                    (centerX, centerY, width, height) = box.astype("int")

                    x = int(centerX - (width / 2))

                    y = int(centerY - (height / 2))

                    outline.append([x, y, int(width), int(height)])

                    confidences.append(float(confidence))

    box_line = cv2.dnn.NMSBoxes(outline, confidences, 0.5, 0.3)

    if len(box_line) > 0:

        flat_box = box_line.flatten()

        pairs = []

        center = []

        status = [] 

        for i in flat_box:

            (x, y) = (outline[i][0], outline[i][1])

            (w, h) = (outline[i][2], outline[i][3])

            center.append([int(x + w / 2), int(y + h / 2)])

            status.append(False)

        for i in range(len(center)):

            for j in range(len(center)):

                close = Check(center[i], center[j])

                if close:

                    pairs.append([center[i], center[j]])

                    status[i] = True

                    status[j] = True

        index = 0

        for i in flat_box:

            (x, y) = (outline[i][0], outline[i][1])

            (w, h) = (outline[i][2], outline[i][3])

            if status[index] == True:

                cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 0, 150), 2)

            elif status[index] == False:

                cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)

            index += 1

        for h in pairs:

            cv2.line(frame, tuple(h[0]), tuple(h[1]), (0, 0, 255), 2)

    processedImg = frame.copy()

create = None

frameno = 0

filename = "newVideo.mp4"

yolo = "yolov3/"

opname = "output2.avi"

cap = cv2.VideoCapture(filename)

time1 = time.time()

while(True):

    ret, frame = cap.read()

    if not ret:

        break

    current_img = frame.copy()

    current_img = imutils.resize(current_img, width=480)

    video = current_img.shape

    frameno += 1

    if(frameno%2 == 0 or frameno == 1):

        Setup(yolo)

        ImageProcess(current_img)

        Frame = processedImg

        cv2.imshow("Image", Frame)

        if create is None:

            fourcc = cv2.VideoWriter_fourcc(*'XVID')

            create = cv2.VideoWriter(opname, fourcc, 30, (Frame.shape[1], Frame.shape[0]), True)

    create.write(Frame)

    if cv2.waitKey(1) & 0xFF == ord('s'):

        break

time2 = time.time()

print("Completed. Total Time Taken: {} minutes".format((time2-time1)/60))

cap.release()

cv2.destroyAllWindows()

Why is Social Distancing Detection helpful?

  1. Convincing Workers

Since 41% of workers won't return to their desks until they feel comfortable, installing social distancing detection is an excellent approach to reassure them that the situation has been rectified. People without fevers can still be contagious; hence this solution is preferable to thermal imaging cameras.

  1. Space Utilization

Using the detection program, you can find out which places in the workplace are the most popular. As a result, you'll have all the information you need to implement the best precautions.

  1. The Practice of Keeping Tabs and Taking Measures

The software can also be connected to security video systems outside the workplace, such as in a factory where workers are frequently close to one another. To be able to keep an eye on the office atmosphere and single out those whose personal space is too close to others.

  1. Tracking the Queues

Queue monitoring is a valuable addition to security cameras for businesses in retail, healthcare, and other sectors, where waiting in line is unnecessary. As a result, the cameras will be able to monitor and recognize whether or not people are following the social distance requirements. The system can be configured to function with automatic barricades and digital billboards to provide real-time alerts and health and security information.

Consequences of Isolation

The adverse effects of social isolation include the following:

  • Its efficacy decreases when mosquitoes, infected food or water, or other vectors are predominantly responsible for spreading disease.

  • If a person isn't used to being in a social setting, they may become lonely and depressed.

  • Productivity drops, and other benefits of interacting with other people are lost.

Conclusion

This tutorial showed us how to build a social distance detection system. This technology makes use of AI and deep learning to analyze visual data. Incorporating computer vision allows for accurate distance calculations between people. A red box will appear around any group that violates the minimum acceptable threshold value. The system's designers used previously shot footage of a busy roadway to build their algorithm. The system can determine an approximation of the distance between individuals. In social interactions, there are two types of space between people: the "Safe" and "Unsafe" distances. In addition, it shows labels according to item detection and classification. The classifier may be utilized to create real-time applications and put into practice live video streams. During pandemics, this technology can be combined with CCTV to keep an eye on the public. Since it is practical to conduct such screening of the mass population, they are routinely implemented in high-traffic areas such as airports, bus terminals, markets, streets, shopping mall entrances, campuses, and even workplaces and restaurants. Keeping an eye on the distance between two people allows us to ensure sufficient space is maintained between them.

First Article Inspection: Everything You Need to Know

What is a First Article Inspection?

First article inspections, originally developed for the aerospace and defense industries, are now being used as best practices in other industries. They are an effective way to ensure that the manufacturing process produces an output that meets design specifications. First article inspection helps reduce production delays and waste.

First article inspection is an integral part of the AS9145 process. It is also part of the APQP/PPAP (Advance Product Quality Planning/Production Planning and Control) approval process. The first article inspection report summarizes the design and manufacturing process of the part, including specification requirements, raw materials and associated sub-assemblies.

First article inspections are performed to ensure that the supplier's manufacturing process meets the design specifications. They can be completed by the supplier or the purchaser.

First article inspection is typically performed by obtaining part dimensions using a CMM (computerized measuring machine). Afterwards, the dimensions are compared to the original design. This allows the buyer to identify potential problems early. First part inspection can also be used to detect errors in the operator's process.

FAI works best when used in conjunction with a supplier who has experience in manufacturing precision parts. The advantage of using FAI is that it reduces the number of defects generated in the first place, thus saving money on rework.

First article inspections are also useful in industries where expensive materials cannot be reworked. They are particularly important in the aerospace industry, where accuracy is critical. They help ensure that the characteristics of all components are taken into account. First-part inspections also ensure repeatability of the manufacturing process.

How Do You Do a First Article Inspection?

First article inspection is an important part of the quality control program. It ensures a consistent manufacturing process and guarantees product specifications. It can also help you save money.

First article inspection is a quality control process often used by manufacturers of small, complex parts. It involves using a coordinate measuring machine (CMM) to compare manufactured parts to specifications. The results of the inspection are usually recorded in a first article inspection report.

First article inspection is critical because it provides an objective measurement of the manufacturing process and helps determine if the product meets customer specifications. It is usually completed by the supplier or an approved subcontractor. First article inspections are beneficial to a wide range of industries. They are particularly useful in industries with stringent specifications and requirements. For example, first article inspection is an important part of quality control in the aerospace industry.

FAI is also a useful quality control tool when expensive materials are used. It can confirm that the product is of sufficient material quality and cannot be reworked.

The first article inspection process can be automated. A process can be created that automatically sends the form to the approver. This helps eliminate errors and ensures that no important information is missed. It can also help develop standard operating procedures.

FAI is beneficial because it can reveal problems that are not visible during mass production. It can also reveal changes in operator processes. First article inspection can also help you determine if adjustments need to be made to the manufacturing process.

What is the Difference Between PPAP and FAI?

PPAP (Production Part Approval Process) is a collection of documents used to validate a manufacturer's manufacturing process. It is used to help manufacturers meet customer requirements for product quality and safety. It is a risk identification process that helps reduce revisions while ensuring a repeatable process. It is overseen by the International Aerospace Quality Group.

The PPAP contains a list of test results, manufacturing process details, and quality control plans. PPAP submissions are created collaboratively between the customer and the supplier. The customer must certify the supplier.

Manufacturing industries such as the automotive and aerospace industries use PPAP processes. The checklist identifies the information needed for each stage of the new product introduction process. It also includes a PFMEA, process flow diagram and gauge R&R that must be provided by the supplier to prove that the raw materials meet the customer's specifications.

FAI(First article inspection) is a critical step in the manufacturing process. It checks design and manufacturing documentation to ensure that the process is repeatable and that the product meets the customer's specifications. It also ensures that the supplier's manufacturing process is appropriate for the part.

FAI is also used to verify that external special handling steps have been performed by the supplier. It should be performed after tooling changes, repairs, or design changes. It should occur after the manufacturing process has been stable for a period of time.

After adding a new supplier to the manufacturing process, the supplier must perform a FAI. It would be advantageous to manufacture a sample unit for the customer for evaluation purposes.

The Importance of a First Article Inspection

Performing a first article inspection is an important step in delivering the goods the buyer needs. It helps the manufacturer determine if they are producing the correct parts to specification. Buyers can also confirm that the manufacturer understands their design during the first inspection. It helps reduce manufacturing delays and waste.

Product inspection is performed first before the mass production process begins. These inspections can be performed on parts made by different suppliers or using various equipment or methods of manufacturing. In addition, they are used in the aerospace and defense industries. These are some of the industries that can benefit from the use of first article inspection.

The first article inspection report is an objective proof that the part meets the specifications. It includes dimensional and cavity measurements. The report also summarizes quality control checks. It also includes a table of inspection requirements that includes balloon numbers, associated tolerances and specifications.

First-part inspections are critical in a wide range of industries. They are especially important for manufacturers of small, complex parts with tight tolerances. These inspections are necessary because problems are identified early in the manufacturing process, saving money and time.

If a supplier is responsible for producing large quantities, quality control procedures must be in place. Each product must be manufactured to the specifications provided by the customer. It is more expensive to find problems later in the manufacturing process.

First article inspection services allow suppliers to identify problems before mass production. This saves money because it identifies problems earlier and reduces downtime in the correction process.

First article inspection is performed by qualified personnel who use Coordinate Measuring Machines (CMMs) to inspect manufactured parts. Coordinate measuring machines are the most accurate measuring instruments used in quality control. They are also used to inspect parts that are difficult or time-consuming to inspect.

First article inspection is usually performed at the beginning of a production run. First-part inspection is not required for second and third production runs. However, for new orders, a first article inspection report may be required in some cases. It can also be done by an approved subcontractor.

Companies supplying to government agencies or other regulated industries must be more careful in their manufacturing processes. They must also be more stringent in the quality of their materials. FAI helps them meet these requirements. The process also ensures that all requirements are met and reduces the potential for costly errors.

The cost of first article inspection is usually very low. In major cities in China, India and Vietnam, it typically costs about $299 per person-day. However, additional travel costs may be incurred in other regions. FAI costs must be included in the total project cost.

Many manufacturers in industries such as automotive, aerospace and medical devices use First Article Inspection reports. These reports are very detailed and contain information about the quality of the part manufacturing process.

When Should First Article Inspection Be Performed?

First article inspection is a critical quality control step. It helps ensure that the product meets design specifications. It clarifies expectations and saves time and money by identifying problems early. First article inspection also has advantages in highly regulated industries. First article inspection reports are often used in such industries to ensure that products meet engineering design specifications.

Several steps are required to perform a first article inspection. Depending on the needs of the buyer and supplier, first article inspection can be performed for a variety of reasons. Many industries use first article inspection, including aerospace, automotive and medical devices. It can also be used for purchase orders and procurement planning.

Suppliers and buyers must work together to ensure that the product meets all requirements when performing first article inspection. When a part does not meet specifications, it is usually the supplier's fault. The supplier may need to modify the design or manufacturing process.

Purchase orders, purchase planning and manufacturing can all benefit from first article inspection. Each parameter and step of the manufacturing process should be verified in a report. An automated workflow can generate a first article inspection report. The report can then be automatically sent to the approver.

First article inspection is a quality control process that occurs prior to the start of the batch manufacturing process. It is an objective measurement of the manufacturing process and helps to confirm compliance with engineering design specifications. It also helps to eliminate waste, confirm safety requirements and reduce costs.

What is CNC Machining? | Definition, Processes, Types & Components

Hi Guys! Hope you’re well today. Happy to see you around. In this post, I’ll walk you through What is CNC Machining? It’s Definition, Processes & Types & Components.

CNC (computer numerical control) machining has been around for a while. It is a manufacturing process where machine tools are guided and controlled by computer software. High efficiency and better control make this process ahead of the manual handling of the tools. CNC manufacturing is done by sophisticated, complex machines that guarantee the formation of the final product with high precision and accuracy. Different CNC machines are used to treat different parts, however, each machine makes use of computer-guided software to precisely dictate and handle the machine tools. It is worth noting that the CNC systems are dynamic in nature which means new prompts can be included in the pre-existing code which is edited and programmed by the programmers.

Curious to learn everything about CNC machining?

Well, you’ve come to the right place.

Keep reading. 

Definition

CNC machining is a process that involves the automatic control of machine tools through a computer to shape the material into the required form. During this process, machining equipment like latches, routers, mills, grinders, and drills... run in accordance with computer instructions. After setting up the machine and loading the program into it, the procedure is automatic and doesn't require any human involvement. To create several items with the same accuracy and precision, the production cycle repeats itself to produce the desired shapes. The parts can typically be produced and supplied in a matter of days, saving both money and time. The most cost-effective method for creating unique parts from metal materials is CNC machining.

Don’t get confused between CNC machining and 3D printing. They are different even though both are used to create distinctive shapes. In the subtractive process of CNC machining, the material is taken out of the workpiece to create a certain shape. On the other side, an additive method is used in 3D printing to add material to make precise objects.

Processes in CNC Machining

A vast variety of materials including plastics, metals, composites, wood, foam, and glass, can be machined using CNC technology. The basic goal of this method, sometimes referred to as digital manufacturing, is to produce items that are uniformly precise and accurate.

There are four fundamental processes in CNC machining. A 3D model of the object is first created using CAD software. The second stage involves converting the digital CAD file data into a CNC program, sometimes referred to as G-code. Setting up the machine for the desired actions is the third phase. Finally, machine tools automatically operate on the workpiece to remove material and turn the workpiece into the appropriate shape, 

Find below each process one by one. 

  1. 3D CAD Model Design Creation

The CNC machining process begins with the 3D solid part design. Utilizing CAD software, where the technical details of the pieces are established, 3D modeling is carried out. Notably, when developing 3D items, designers and manufacturers must take the capabilities of CNC machines and their tools into account.

Most tools are typically cylindrical and can only be used to create curved corner portions. As a result, the design process has a limited range of part geometries. The ability of the machine to hold the workpiece and the material's characteristics, such as the maximum part size, the minimum part thickness, and the complexity of the interior features, also play a role in the CNC machining process.

The 3D model of the solid part is produced by CAD software, and it is exported in the STEP or IGES CNC-compatible file format.

  1. Conversion of CAD File

A CAM (computer-aided manufacturing) program processes the created 3D CAD file to extract the part information and produce programming code known as G-code. This code specifies the operations carried out on the solid material to produce the special portion. The timing of the tool movement, the depth of the cut, the path the tool follows when it is turned on and off, and other instructions are applied to the tools in this area to remove material from the solid workpiece and produce the desired shape.

The worker feeds the G-code into the machine after converting the CAD file.

  1. Getting Ready Machine Set-up

Before the employee applies the program to the tools, the machine needs to be set up properly. This entails tightly holding the workpiece using the spindles of the machine. The overall machining process will be impacted if the holding device fails to keep the material in place. Therefore, ensure that machine spindles operate precisely with no space for error.

Additionally, make sure the appropriate instruments, such as drill bits or end mills, are attached properly. Once the machine is configured, the employee uses the G-code that is provided to carry out the basic tasks programmed into it.

  1. Execution of Machine Activities

This is what we have done so far. We have created the CAD file and converted it into G-code. Then make the setup. 

Now the real process begins. 

In this stage, the worker initiates the computer program that enables the tools to conduct specific operations on the solid material. To create specific shapes, extra material is eliminated from the workpiece. Plastic consumer goods, simple wooden decorations, steel aerospace parts, and intricate metal automobile parts can all be produced with CNC machining.

A variety of industries including agriculture, construction, aerospace, and more use CNC machining – a digital production technique. The technique includes numerous computer-controlled automatic machining operations. The following mechanical processes are frequently used in CNC machining:

  • Drilling

  • Milling

  • Turning

As the name suggests, drilling is the technique of making several cylindrical holes in the workpiece. The drill is used in this process parallel to the workpiece. The drill bit revolves while exerting pressure vertically on the workpiece plane when the operator runs the program. The drill bit produces holes with a diameter equal to its width. You can choose from a variety of drill bits to treat the material's surface. Using specific work-holding devices and machine settings, you can do angular drilling operations in addition to vertical drilling operations.

Multi-point cutting tools are used during the milling process to trim away excess material from the workpiece. The milling process is separated into two primary stages based on operational capabilities. The first is face milling, in which the tool carves solid material from shallow, flat surfaces. The second method is called peripheral milling, and it involves making deep slots and threads in a solid workpiece using a tool.

Turning is a type of CNC machining where the material is removed and the required shape is formed using single-point cutting tools. For turning operations, where the cutting tool is applied linearly to the solid rotating object, CNC lathe machines are employed. The turning process creates slots and taper threads.

Types of CNC Machining

Hope you’ve got a brief idea of what CNC machining is all about. In this section, we’ll discuss the types of CNC Machining. 

In particular, CNC machining is divided into 5 different types that are performed on 5 different types of machines.

The main aim of every machine is to reduce human input and make the process automatic with instructions from the computer. CNC machines are preferred over non-programmable machines since they can produce parts in volumes in less time with better precision and accuracy. 

Read on to find out the five types of CNC machines and how they work. 

  1. CNC Lathe and Turning Machines

CNC lathe and turning machines are mainly known for their ability to rotate objects during the machining process. These machines feed their cutting tools around the revolving bar stock in a linear motion, removing material from the circumference until the required diameter is achieved. One of the key benefits is that they can easily position the X, Y, or Z axes while doing a variety of jobs. These axes allow the machine to move the component as per its geometry.

The desired internal and external features of the object can be formed using these machines including reamed holes, drilled holes, threads, tappers, taping, broaches, and bores. 

CNC Lathe Machine is divided into four main parts:

  • Main Spindle

  • Guide Way

  • Chuck

  • Headstock 

The main spindle is composed of a spindle drive system and spindle assembly. The CNC machine tool comes with some moving parts including chuck, gears, motors, etc. Moreover, the spindle assembly also includes the C-axis drive that is mainly used to position the material.

Guide way ensures the smooth cutting process by allowing the tool to move vertically and horizontally. 

Attached to the main spindle, a chuck is used to tightly grip the object to be machined. Both the workpiece and chuck rotate with the help of the spindle. 

The headstock, which houses the primary motor, is used to hold the main spindle, to which the chuck is attached.

  1. CNC Milling Machines 

CNC milling machines come with a range of cutting tools that move along one or more axes with the main purpose to remove extra material from the object. In the CNC milling machine process, the workpiece remains stationary while the machine rotates the cutting tools that form the material into the desired shape.

These machines are used in scores of industries including FMC manufacturing, oil drilling, automobile, shipping, aerospace, and precision engineering sectors. 

The more advanced CNC milling machines, also known as CNC Machining Centers, are capable to perform along multiple axes. The precision and accuracy of these machines can be achieved with pallet changers, innovative coolant systems, automatic tool changers, and advanced software. 

How it Works?

The CNC milling process starts with mounting the part to be machined on the top of the machine table. You can use a vice or fixture to hold the workpiece in place or you can clamp it directly on the table. 

After that, the spindle (moving part) with the cutting tool is either positioned vertically or horizontally. In that setup, the tool can begin cutting and shaping operations at various X, Y, and Z positions on the workpiece. While doing so, the table may either fix, mount, or move the workpiece in a linear direction toward the spindle containing the cutting tool. As a result, the material will be removed to achieve the appropriate shape for the machined object.

  1. CNC Laser Machines

These machines use high-power, focused laser beams to accurately cut, mark or engrave a material to produce desired shapes. The sophisticated design and operation of these machines perform the machining process without errors while creating small holes and complex shapes. 

CNC laser cutting machines are mainly divided into three types.

  • CNC CO2 laser cutter

  • CNC crystal laser cutter

  • CNC fiber laser cutter

CNC CO2 laser cutters exhibit high power output capability and high efficiency, hence most commonly used to make custom shapes.

CNC crystal laser cutters show high laser power compared to CO2 laser cutters, thus allowing you to cut and shape thicker metal materials. In these cutters, the laser beam is made of crystals like neodymium-doped yttrium ortho-vanadate (Nd:YVO) or neodymium-doped yttrium aluminum garnet (Nd:YAG).

The CNC fiber cutters use a bank of diodes to produce a laser beam where fiber optic cable is used to eject the laser beam. In particular, for materials with a thickness of less than 5 mm, fiber laser cutters enable a quicker and more precise cutting process than CO2 laser cutters.

How does it work?

The CNC laser cutting process is slightly different from the conventional CNC machining process since it doesn’t involve direct contact with the workpiece, hence a thermal-based process. The laser cutting tool contains a laser head that houses a nozzle and laser cutting lens. 

The nozzle projects a high-intensity laser beam on the component to be machined, melting and cutting the extra material from the component to form the required shape. Once the material is removed, the compressed gas is applied through the same nozzle to cool the lens and extract the vaporized metal from the workpiece. 

  1. CNC Electrical Discharge Machines (EDM)

The EDM, also known as spark machining or spark eroding, makes use of highly controlled electrical sparks to shape the material into the required form. Again, this is a non-traditional, precision machining method used to manipulate the material. The electric sparks produced in this process are near 8000º C to 12000º C. This process is typically employed for creating deep cuts and sharp corners that are otherwise impossible to achieve from the CNC milling and CNC turning process.

In this process, the machine is designed to emit an electrical discharge from the electrode wire that generates a great deal of heat and a component is positioned underneath the electrode wire (up to 21,000 degrees Fahrenheit). To generate the required shape, the material is melted or washed away with liquid.

EDM is mainly divided into three types:

  • Die sinking EDM

  • Wire EDM

  • Hole drilling EDM

In die-sinking EDM, graphite or copper electrodes are used while an electric spark is induced between the electrode and the part to be machined. It is the best method to produce parts with intricate cavities. Sometimes it’s difficult to create sharp internal corners with regular CNC machining. This is where Die sinking EDM comes in handy.

Wire EDM is best suited for creating extrusion dies. The mechanism is the same as die sinking, however, in wire EDM, fine electrically charged wire is used instead of a die. This charged wire also works as an electrode and is very thin, with a diameter ranging from 0.05mm to 0.35mm. This process is used for creating incredibly precise cuts.

Hole Drilling EDM, as the name suggests, is employed to create holes. The basic principle is the same as die sinking, however, the cut is created through a pulsing cylindrical electrode. This technique has been essential for the development of high-temperature turbine blades because it enables the production of extremely complex cooling channels inside the turbine blades.

  1. CNC Plasma Cutting Machines

Plasma cutting machines are another type of CNC machine used to precisely shape the workpiece. These machines use high-powered plasma (electronically-ionized gas) torch that is controlled and guided by the computer. 

How it Works

The plasma torch is gas-powered and comes with temperatures up to 50,000 degrees Fahrenheit. The high-temperature plasma strikes the material and instantly melts it, creating deep cuts with better control and accuracy. The materials that can be treated through plasma machines include copper, brass, aluminum, stainless steel, and steel. They all are electrically conductive materials which is the basic requirement for machining through plasma cutting machines.

Plasma-cutting systems offer fast cutting speeds and throughput along with a cheap cost per millimeter of material cut. These high-definition systems remove the need for secondary procedures on processed parts.

Furthermore, CNC plasma cutting is a remarkable option for applications in both large-scale enterprises and tiny hobbyist shops due to its fast speed and high accuracy.

Components of CNC Machine

The CNC Machine features 12 common components as below:

1: The Input Device

The part programming data is applied through input devices. The input devices are mainly divided into three common types:

  • Punch tape readers
  • Magnetic tape readers
  • Computers connected via RS-232-C

2: Machine Control Unit

This is the main part of the system, also known as the brain of the machine. The MCU is responsible for controlling all machine operations. Its main purpose is to decode the instructions provided by the programmer through the computer. The auxiliary control activities are all performed through this unit, like tool change, spindle on/off, and applying coolant. 

It provides the axis speed order to the amplifier circuit powering the spindle mechanism. It receives feedback signals showing the position and speed of each drive axis.

3: Machine Tools

A CNC machine tool comes with a sliding table and a spindle to control position and speed. 

The machine can work around the X, Y, and Z axis which mainly handle the movement of the tables, while the Z axis is used to manage the spindle.

4: Bed

The Bed is composed of hard material like cast iron and is responsible for carrying all the machine weight, making sure each machine part stays in place when the machining operation is performed over the unit. 

5: Head Stock

One of the main components is the headstock, where the workpiece to be machined is fixed. A headstock also houses the electric motor that powers the main spindle.

6: Tailstock quill

The tailstock quill is used to place the workpiece between the headstock and tailstock.

7: The Tailstock 

This part offers more grip to the workpiece during operations like turning, threading, and noodling.

8: Chuck

The chuck is used to give space for fixing the tool and is mounted on the main spindle.

9: Pedal

Pedal, also known as Footswitch, can open and close the chuck to grip the workpiece. 

10: Display Unit

The display unit is a monitor that constantly shows important information, programs, and instructions on the screen. 

11: The Drive System

The drive system of the CNC machine features an amplifier circuit, lead screw, and ball drive motors. The MCU plays a key role in providing the signals to the amplifier circuit.  When the control signals are amplified, they turn on the drive motors. 

12: Feedback System 

A feedback system, also known as a measuring system, is equipped with transducers that are the sensors of the machine. These motion and position sensors continuously monitor the movement and location of the cutting tool, making sure the tool properly cuts as per the instructions given by the computer. This feedback system runs in a loop, continuously comparing the response signals with the reference signals and adjusting the tool movement and location accordingly. 

Elements of CNC Machine

The CNC machine comes with the following elements:

  • Program

  • Tape Reader

  • Mini-computer

  • Servo system

  • CNC machine tool

      Program

      The keyboard is used to enter the program into the computer. The program is the code used to guide and control the machine's functions. The common CNC codes include: G code, N code, F code, XYZ code. 

      Tape Reader

      The tape reader serves as a storage device for the machine. It stores the code to be performed on the machine tools. The programmer can edit the code stored in this device.

      Mini Computer

      This is also known as the machine control unit. It is mainly used to decode the program information and decide the spindle speed, start and stop the coolant, turn on/off the machine spindle, control the feed rate, and change the workpiece and a few other instructions to properly handle the tools as per requirements. Mini Computer exhibits diagnostic software that identifies the overall health of the machine and adjusts the machine's activities accordingly. 

      Servo System

      This system is directly connected with the feedback mechanism that receives the control signals and sets the output as per requirement. 

      Servo system features:

      • Servo Motors

      • Feedback devices

      • Ball screws

      CNC Machine 

      This is the entire machine unit where the workpiece is machined and the final product is obtained after the machine operation. 

      Difference between CNC and NC Machines

      The NC stands for numerical control. It is also an automatic manufacturing process but here the programs are in numeric, alphanumeric, or binary language. The NC machine has no computer and no feedback system and is less sophisticated than CNC machines. A special inserting device is used in NC machines that store the main program. 

      CNC machines guarantee the production of parts with high precision and accuracy, while on the other hand, NC machines don’t produce parts with fine quality.  

      In CNC machines operation parameters can be changed while NC machine doesn’t allow you to change parameters. 

      The NC machine doesn’t run in a continuous loop to produce parts with the same accuracy while the CNC machine can run repeatedly to produce scores of parts with similar specifications. 

      CNC machines are costly compared to NC machines and also the maintenance cost is very high.

      Moreover, once the machine is set up and the program is fed into the CNC machine, a single person can perform a range of tasks. This is not the case with the NC machine. More labor is required to do each task, hence more labor cost and more time-consuming.

      Industrial applications

      CNC systems are used in a range of industrial applications. A few common industries include:

      • Electrical discharge machining

      • Metal fabrication

      • Automotive

      • Agriculture

      • Electronics

      • Manufacturing

      From higher flexibility and repeatability to consistent quality and increased productivity, these machines provide some key benefits over traditional machines.   

      Conclusion

      There is no denying that CNC machines are the future of the manufacturing industry. 

      With the advancement in technology, companies are creating more space for automatic technology that involves minimum input and delivers maximum output. 

      CNC machines, no doubt, require more initial costs for setup and maintenance compared to the traditional manufacturing process. However, once the machine system is properly installed, it reduces human involvement and requires less time and cost to produce more parts with similar properties. 

      If you’re still using traditional methods to produce parts, it’s about time you consider CNC machining in your industry. The sooner you make a shift, the better.

      That’s all for today. Hope you’ve enjoyed reading this article. I’d love to hear your valuable input regarding CNC machining. And if you have experienced this process before, share your insights in the section below. Until next time. Take Care.

      How to use MATLAB Operators?

      Hello learners welcome to the next tutorial on MATLAB where we are learning about this excellent environment in detail without skipping anything. Last time, you have seen the data types and their detail through practical implementation and this time, you will get information about the operators used in MATLAB and the text-related information in an efficient way. By the end of this lecture, you will be able to answer the following questions:

      • What are the operators and can we use operators in MATLAB?

      • How can you implement the arithmetic operators in your MATLAB?

      • What is the significance of the relational operator?

      • What is the detail of the logical operators in MATLAB?

      • What are bit-wise operators?

      • How can you give a brief introduction to the short circuit operators?

      All of these are important questions not only in programming in the MATLAB language but this is also related to other mathematics and related fields. In order to understand well, I’ll suggest you open your MATLAB software and practice every case on your own because it is super easy to work with the operators in MATLAB even if you are new to this programming environment. 

      Introduction to Operators in MATLAB

      An operator is a symbol that instructs the compiler to perform numerical or logical operations. MATLAB is designed to work primarily with whole matrices and arrays. As a result, MATLAB functions can operate on both scalar and non-scalar data. For a detailed introduction, have a look at the statement given next:

      "The term operator refers to a symbol in computer programming and mathematics that is used to perform specific logical and mathematical operations. It can also be defined as a personification of an action."

      So, we can say, you have used the operators knowingly or unknowingly hundred or thousands of times in different software and today, we are just relating all the procedures to MATLAB and will learn what can we do with these operators. 

      As we have used the basic operations on the matrix many times so, we will be more involved in a little advanced example this time. 

      Using Operators in MATLAB

      The procedure to use different operators is somehow the same as in the real life when we use them in our notebook in mathematics or related subjects. Basically, we divide the operators in MATLAB into the following categories:

      • Arithmetic operators

      • Relational operators

      • Logical operators

      • Bitwise operators

      All of these will be discussed in detail and we believe that most of them are known to you so for your practice, we will have more focus on the examples of each case. In addition, you can also make your own matrices and arrays in addition to my example to have fine practice and it is also fun.

      Arithmetic Operator

      The first and the easiest operator is, as you can guess, the arithmetic operation in which we use the basic operations of mathematics through these operators and therefore, this will be easy for you to understand. But here, the new thing is, the arithmetic operations are categorized into two classes:

      • Matrix arithmetic operators

      • Array arithmetic operators

       The introduction of both of these are self-explanatory but when we talk about the difference between them, we come to know that if the operator is applied to the matrix then it is the matrix arithmetic operation and vice versa. Another point that differentiates between these two is, we use array arithmetic operation, then we use a dot between the symbols of the array to highlight the procedure. The detail of each operator is now given below:

      Addition Operator

      As you can guess, this operator is denoted by a plus sign between the two values to be added and it is the simplest and most frequently used operator. The condition is applied on this operator according to which, both the values (either in MATLAB or simple additional values) must be of the same size if they both are vectors otherwise, if one quantity is a scaler, then it will be added to every member of the matrix. 

      Subtraction Operator

      The subtraction operator is the same as the subtraction in the real world done by us. It also follows the same condition as the additional operation. But you must know, it also includes the negative values in it because many times, the larger value is subtracted from the smaller one we get the negative values in matrices or arrays.

      Matrix Multiplication Operator

      Here comes a slightly different operator than the simple arithmetic operation of the daily world. We can use this operator if and only if the number of rows of one matrix is equal to the other to be multiplied. Otherwise, the same as the other operators, the results are impossible to get. 

      If A and B are two matrices then C, which is the resultant of the multiplication can get as

      C=A*B

      The reason why we are checking the formula of this operation will be clear to you when you will read the next section. 

      Array Multiplication Operator

      There is a bit of difference between this operator and the one discussed before. In this case, each and every element is multiplied by the corresponding element of the other. It is denoted by the dot between the signs of the matrices. 

      If we take the same example as given above, we will denote the array multiplication as:

      C=A.*B

      Matrix Right Division

      The right division of the matrix can be explained well with the help of the example that if A and B are two metrics then their right division is obtained by the following expression:

      C=B/A=B*inv(A)

      Array Right Division

      Just like the array multiplication, the array right division method includes the dot sign between the arrays and we can understand this concept while looking at the expression given next:

      C=B./A

      Matrix Left Division

      Let’s say that if A is the nth order matrix and B is a single column metric then their division, denoted by C=A\B is equivalent to CA=B.

      Array Left Division

      In this type of MATLAB operatorA.B is the matrix with elements B(i,j) a(I,j), where A and B must be the same size.

      Power of the Matrix

      The power of the Matrix is obtained when each Element in the matrix is multiplied by itself equal to the number of the power written just at the upper right corner of the matrix. You can perform this operation by using the A^n sign where n is the power of the matrix.

      Transpose of the Matrix

      You know the transpose of the matrix and its procedure. But in MATLAB, it's more simple and you can easily get the transpose of the Matrix by Using the A’ command where the A is a matrix. 

      Relational Operations in MATLAB

      A relational operator determines the relationship between each element and two arrays. If a relation exists, the value is returned as true or false.

      The operator returns an array of the same size with the values true or false depending on the outcome of an operation. These operators can operate on both scalar and non-scalar data:

      1. < is called Less than

      2. <= is called less than equal to

      3. > is the sign of greater than

      4. >= is a sign greater than or equal to

      5. == can be stated as equal to

      6. ~= refers to not equal to

      Logical Operations in MATLAB 

      The logical operations are somehow different from the first two types. In these types of operations, only two possibilities are there. Either you get 0 or 1. We hope you are aware of the boolean expressions and by connecting the discussion with them, we get the idea that:

      "The logical operations in MATLAB follow the logic of the boolean operations and therefore, the results in such calculations are always either 0 or 1 and therefore, we get the true or false conclusion."

      If we talk purely about MATLAB, we come to know that there are three types of logical operators and functions listed below:

      1. Element-wise logical operations

      2. Bit-wise logical operations

      3. Short circuit logical operations

      Element-Wise Logical Operations

      These are the operations that take the elements of all the cases and perform the procedures separately. Three types of procedures are listed in this type and operators used for different processes are & (AND), |(OR), and ~ (NOT). Moreover, XOR operation is also included in the same category. This will be clear when you will see the representation and the quick revision of the results related to these operators. Suppose we have two elements with the following values:

      X=[0 1 1 0 1];

      Y= [1 1 0 0 1];

      Then, the result of each element-wise logical operation will be:

      Operator Name

      Symbol

      Description

      Result

      AND

      &

      It gives the value 1 only if both the elements are one, otherwise gives zero. 

      X & Y= 01001

      OR

      |

      It gives the value 1 every time when any of the elements are one, otherwise gives zero. 

      X | Y = 11101

      NOT

      It gives the opposite result all the time and it is a unary operation. 

      ~X = 10010

      XOR

      It gives the value 1 every time when the elements have the same value. If they have opposite values, then it is always zero.

      X⊕Y=xor(X,Y)=10100

      One thing that has been noticed here is, as we said earlier, the values in the logical functions are always 0 and 1 therefore, we have also used only these two numbers in the elements and got the results with the same results.

      I hope you now have the best idea about the calculations. Let’s move towards the next type.

      Bit-Wise Operator

      The bit-wise operation, as the name suggests itself, is used when there is a need of bit by bit calculations. Same as in the previous case, the functions are shown with the help of signs and by looking at the table explained below, you can get an idea of the working of each operator.

      P

      Q

      P & Q

      P | Q

      P ^ Q

      0

      0

      0

      0

      0

      0

      1

      0

      1

      1

      1

      1

      1

      1

      0

      1

      0

      0

      1

      1

      Matlab provides the following bitwise operators: 

      • bit and (a,b) – Bitwise AND (integers a and b).

      • Bitmap (a) – It is used to bitwise the compliment of a.

      • Bitget (a , pos) – Get bit at a specified position, in the array a

      • Bitset (a , pos) – set bit at a specified location of a

      • bitShift (a,k) – It is used to get the equivalent results as multiplied by 2k. Therefore, if k is negative, it shifts right, on contrary to this, if k is positive, it shifts to the left position.

      • bitor(a, b) – The operation of this operation is Bit-wise XOR of integers a and b

        Short Circuit Operator

        In addition to the general operator describe before, we have some more interesting operators as well. The operators listed below perform AND and OR operations on logical expressions, including scalar values. They are short-circuiting operators because their second operand is calculated only when the first operand does not fully determine the output.

        &&

        It gives the value of 1 only if both operators give the result 1 otherwise it is zero.

        ||

        It gives the value 1 if either or both inputs are one. We get the contrary results otherwise. 

        Trus, we have seen a lot of operators today that are helpful to understand the introduction of the operators in MATLAB. Many of these have the same symbol and representation of the operators and results. We have seen arithmetic operators, relational, logical, bit-wise, and short circuit operators. It is important to mention here that other operators such as set operators are also included in this learning but I have not mentioned them because these are less known and less used operators in MATLAB. We’ll discuss them in some other tutorial. For now, it is enough to have this information and your homework is to perform all the remaining operators that I have not shown you in MATLAB.

        How to use Data Types in MATLAB?

        Hey geeks, welcome to the next tutorial about MATLAB software and language. In this series, we have been working on MATLAB with the basic information and in the previous lecture, we worked deeply with the workspace window and learned about the functions and variables that are commonly used when we are dealing with the data in the command prompt. In the present lecture, we are dealing with the data types in MATLAB. This is related to the command prompt window but the reason why I have arranged this lecture after the workspace practice is, there will be different steps where the usage of the workspace will be included. Other details will be cleared when you will take this lecture yet, have a look at the list of content that will be included in this tutorial:

        • Introduction to the data types.

        • What are some important data types that we will use in MATLAB coding?

        • What is meant by the numeric and text data types?

        • How can we make tables in MATLAB?

        • Why data types are important in programming?

        • How can you say that different programming languages have different data types?

        What are Data Types

        In almost every programming language, the data types are the important topics and these do not end with a single lecture, but knowingly or unknowingly, you have been using these data types in the practice of your MATLAB codes. So, first of all, I am going to provide you with the proper definition of data types:

        In programming, a data type is a classification that specifies what type of value a variable has and what mathematical, relational, or logical operations can be performed on it without causing an error.

        If this definition seems difficult to you then do not worry, all the details will be clear to you when you will see the example of each of its types. When you use any type of data in your programming language, it is not of the same type but varies according to your needs and requirements. There are several data types but we will discuss the basic and most important in this lecture so we may elaborate on each and every type effectively. But before going into the examples, I am dividing the whole languages into two main classes:

        1. Strongly typed programming languages

        2. Weakly typed programming languages

        Both of them have different ways of implementation, so have a look at them.

        Strongly Typed Programming Language

        Strongly types data types are the ones in which there is a restriction of using the particular variable is used according to its data type. You must know, MATLAB is a strongly typed programming language because you can not connect irrelevant data types together in it but you have to use the same data type all the time when connecting two or more together. 

        Let us have an example. We have seen the concatenation process in the previous lecture where two digits may have the arithmetic operation if they belong to the same class that is the same data type. So, if you try to connect an integer with the string, it will throw an error. 

        Weakly Typed Programming Languages

        The weakly typed data type, contrary to the first case, can be used in an easy way because there is the independence to use the different data types together with the help of any operation. It happens in only a few programming languages and it is not relevant to our MATLAB so I am not explaining it more. 

        List of Data Types in MATLAB 

        Finally, I am going to describe the detail of almost all the data types that you are going to use in the MATLAB throughout your course and with the help of this knowledge, you will be able to use these data types according to your needs and at the final result, you will code in the best way. So, have a look at the detail of each data type. 

        Numeric Types

        The first and most basic type that we all know is the numeric type. Here, if you are new to programming, I must mention that numerics also has different classes in it and two of them are:

        1. Integer

        2. Floating Points

        3. Single

        4. Double

        Integers: 

        The numbers that mostly we use in our daily life are integers we have read the definition of integer in our begging classes that these are whole numbers ranging from positive infinity to negative infinity but we are mentioning here the definition because I want to make sure you use the code without any confusion.

        Floating Points:

        The floating points are the numeric types that contain the part, less than one in them, in addition to the whole number. This portion is then added in the form of points. To memorise well, you can think that every integer has zero additional points than a whole number and the floating point digits additional to that whole number. 

        Single:

        It is the array of single precision numbers that occupies less memory because it just stores the first digit after the point. Basically, it is the subclass of the floating number and is less accurate than the other case that we are discussing next. It is less likely to choose and if the user is not using scientific information, then they use the single integer to fix less memory for their data type. For instance, the result of the calculation will only be shown just after one point such as 12.3 only.

        Double:

        It is also the class of the floating point that stores more memory than the single data type. It is more accurate because it can store the two numbers after the floating point. For example, if you choose the double floating point, it will provide you with the results as 12.34. The numbers having a value more then this will require to be saved int eh data type of character or string according to the length of the number.

        IntX numbers:

        These are the interesting types of data in which users may get the integer type of his/her own choice. There are different int X numbers where the X varies from 8 to 64. So, by applying the numbers 8, 16, and 64 with the X separately, you can fix the memory space of your own choice where you can easily declare the variables. 

        For example, if you want to declare the variable of the size 8 bits, you will write the following command: 

        int8(value)

        It will create a space of 127 numbers. The total size of this 8 bits data is one byte and it occupies the space to accommodate 0 to 127 numbers. By default, if you do not specify, it is the unsigned data that starts from 0 to 127. 

        If you want the numbers with the same memory size but the ones that include the negative sign as well, you can do so by changing the command to:

        uint8(value)

        Now, I am writing both these commands in the command prompt and with the help of the workspace window, you can compare the values stored in both these cases.

        Similarly, you can check for the int16 and int64 as well and the workspace window will tell you about the detail of each and every case with the signed and unsigned value. 

        If you do not want to use the workspace window, you can find the details of your data type with the help of whos command that we have learned in the past lecture.

        So in this way, it becomes easy to search and get the results of details of any kind you want about the particular data type. 

        Class of The Data Type

        It is time to tell you about a useful and simple command to get the class of the data type easily if you do not remember the size or data type of your variable. So, the syntax to do so is:

        class(variable)

        Where the variable amy be any data type, this keyword will help us to find its class.

        Keep in mind, the A varialbe was declared by you before using this class keyword otherwise, you will ge tthe error.

        Text Data Type

        When using the text in the code in any way, you have to use the alphabet, as expected. But, you must know that there are also two types of text data types that are, the same as the numeric type, have a slight difference between them and we use them according to the need of time. Here are these two:

        1. Character  type data

        2. Sring type data

        CharacterText:

        The character type data is used when we want to declare the variable of the text with relatively less memory space. In simple words, when we want to declare a single alphabet or small sentences, we use the character. The declaration for the characters is as follows:

        A=’Tom’

        Where the single quotation tells the compiler that we want the space for the character text.

        String Text: 

        The string text, as you can expect, has more memory space than the character. These concepts are discussed in the last lecture so I am not going to give you unnecessary details and examples.

        Tables

        Row and column variables are present in the table. Each variable can have different data types and sizes, but they must all have the same number of rows. A variety of functions are used to access data in order to create, edit, and read table data.

        Syntax

        A=table(column1,column2,....,column(n))

        Here, you can easily declare the column's name and after that, you can enter the data according to your choice.

        Structure Data Type

        Data containers are used in the structure to group related data and their types, which are referred to as fields. Fields can hold any type of data. The dot notation is used to access data in structures.

        Why We Use Data Types in Programming?

        We know you have an idea that data types are important in programming languages yet, I always use the explanation of the importance of the topic that is being discussed. 

        • The data types are used to occupy a specific amount of the data according to the need of the user. For example, there is no need to reserve the memory space equal to the string data when you need only the data of a single integer. In this way, the program runs slowly and this problem is unbearable if you have a large data in the program or have a slow system than required. 

        • The data types make the code more organized and clean. 

        • With the help of data types, the path of the program is more clear that how the flow is being used from start to end when you are programming your code. 

        • The readability of the program is enhanced with the help of clearly defined data types. 

        Data Types in Different Programming Languages

        It is an interesting question that must be cleared when dealing with programming languages. We know you have a basic knowledge of programming languages and therefore, I am not explaining from the scratch. But, you must know that it is not necessary that all the programming languages are based upon the same data types. Usually, the code of the programming language is distinguished by its data types and the keywords that we use with the specific syntax.

        Hence, it was a detailed lecture on the data structure where we learned a lot about the data types and we have learned a lot of infprmation in differnet ways. All the work was practiacally performed but if you find that something that needs implementation, you should practice it by yourself as your homework. We had a lot of discussion related to the different case where we use some special keywords to find the type or the relation of different data types. Hence, you can now designed you codes according to the required data type. Stay with us for more interesting tutorials. 

        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