Microsoft Azure IoT and Raspberry Pi : Send telemetry data to azure using python

In this video, we’ll see how you can start off with microsoft azure’s IoT hub with raspberry pi. We’ll see how to create an IoT hub in azure and how to send data from raspberry pi to azure iot hub.

The Video is here

The resources for this video are attached, download them here

# Install below packages
'''
sudo pip3 install azure-iot-device
sudo pip3 install azure-iot-hub
sudo pip3 install azure-iothub-service-client
sudo pip3 install azure-iothub-device-client
'''

# Run below on Azure CLI
'''
#### below to add extension
az extension add --name azure-cli-iot-ext

### Below to start device monitor to check incoming telemetry data
az iot hub monitor-events --hub-name YourIoTHubName --device-id MyPythonDevice

'''

# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.

import random
import time

# Using the Python Device SDK for IoT Hub:
#   https://github.com/Azure/azure-iot-sdk-python
# The sample connects to a device-specific MQTT endpoint on your IoT Hub.
from azure.iot.device import IoTHubDeviceClient, Message

# The device connection string to authenticate the device with your IoT hub.
# Using the Azure CLI:
# az iot hub device-identity show-connection-string --hub-name {YourIoTHubName} --device-id MyNodeDevice --output table
CONNECTION_STRING = "HostName=kitflix.azure-devices.net;DeviceId=mypi;SharedAccessKey=LS85/JIIj5ns5X88EDBSmen93n9L0NOoUqlngMKREDI="

# Define the JSON message to send to IoT Hub.
TEMPERATURE = 20.0
HUMIDITY = 60
MSG_TXT = '{{"temperature": {temperature},"humidity": {humidity}}}'

def iothub_client_init():
    # Create an IoT Hub client
    client = IoTHubDeviceClient.create_from_connection_string(CONNECTION_STRING)
    return client

def iothub_client_telemetry_sample_run():

    try:
        client = iothub_client_init()
        print ( "IoT Hub device sending periodic messages, press Ctrl-C to exit" )
        while True:
            # Build the message with simulated telemetry values.
            temperature = TEMPERATURE + (random.random() * 15)
            humidity = HUMIDITY + (random.random() * 20)
            msg_txt_formatted = MSG_TXT.format(temperature=temperature, humidity=humidity)
            message = Message(msg_txt_formatted)

            # Add a custom application property to the message.
            # An IoT hub can filter on these properties without access to the message body.
            if temperature > 30:
              message.custom_properties["temperatureAlert"] = "true"
            else:
              message.custom_properties["temperatureAlert"] = "false"

            # Send the message.
            print( "Sending message: {}".format(message) )
            client.send_message(message)
            print ( "Message successfully sent" )
            time.sleep(3)

    except KeyboardInterrupt:
        print ( "IoTHubClient sample stopped" )

if __name__ == '__main__':
    print ( "IoT Hub Quickstart #1 - Simulated device" )
    print ( "Press Ctrl-C to exit" )
    iothub_client_telemetry_sample_run()
DialogFlow : Introduction to AI Chatbot

DialogFlow : Introduction to AI Chatbot

What is DialogFlow?

Dialogflow is also called as API.AI which is Google’s chatbot development framework. It is used for Natural Language Processing using machine learning. More interesting, Dialogflow is Saas based product so that you don’t have to worry about infrastructure which can be scaled for million users easily.

Features of Dialogflow

  • Multi-channel support : Dialogflow support one-click integration for more than 20+ platforms including Slack, Facebook Messenger, Twitter, Kik, Line etc.
  • Best NLP : Dialogflow has better machine learning as compared to its competitors even with less training data.
  • Price : Dialogflow can be used for free of cost if you are using Standard edition.
  • Multi-language support : Dialogflow supports more than 14+ languages worldwide & more features are coming.

Building blocks of Dialogflow

Agent : Agents can be described as the app that we create on Dialogflow which holds definition of intents, entities, knowledge base, fulfillment etc. We can export the agent’s zip file as well which is really cool.

Intent : What the user wants to do is called an intent, i.e. intention of the user. As  intents are what user wants to do, and not what we do with that information or how we reply. Intents contains many things like contexts, events, training phrases, responses etc.

Training phrases : We can say a same thing in numerous ways, but means a single task/thing. For example, if we want to set location mark, we can say [set my location mark], [i want to set a location mark`] , [can you please set location mark for me] etc. These are called training phrases which will be used to match what user wants to do.

Entities : For completing a task, we might need some data from the user. For example, for flight booking we need source, destination, date etc. These are called entities.

Fulfillment : Sometimes, we need additional logic to complete a task. We can call use fulfillment for this. For example, if user wants to book a flight we will match the intent, collect required data then we need to call some flight booking API.

Response : After all the processing, we need to reply back to the user. We do this using responses. We can configure multiple responses in the dialogflow console. Also, we can configure platform specific responses as well.

Faster RCNN : Machine Learning Algorithm

Faster RCNN : Machine Learning Algorithm

What is Faster RCNN?

In this post, I will explain object detection and Faster RCNN which is a machine learning algorithm. We shall start from beginners’ level and go till the state-of-the-art in object detection, understanding the intuition, approach and salient features of each method.

Faster R-CNN was originally published in NIPS. It was presented by Ross Girshick, Shaoqing Ren, Kaiming He and Jian Sun in 2015.

It is one of the famous object detection architectures that uses convolution neural networks like YOLO (You Look Only Once) and SSD ( Single Shot Detector).

Everything started with “Rich feature hierarchies for accurate object detection and semantic segmentation” (R-CNN) in 2014, which used an algorithm called Selective Search to propose possible regions of interest and a standard Convolutional Neural Network (CNN) to classify and adjust them.

It quickly evolved into Fast R-CNN, published in early 2015, where a technique called Region of Interest Pooling allowed for sharing expensive computations and made the model much faster.

Finally came Faster R-CNN, where the first fully differential model was proposed. Faster R-CNN architecture is complex because it has several moving parts. It all starts with an image, from which we want to obtain:

  • a list of bounding boxes.
  • a label assigned to each bounding box.
  • a probability for each label and bounding box.

The input images are represented as : Height*Depth*Width. Tensors (multidimensional arrays) are passed through a pre-trained CNN. We use this as a feature extractor for the next part.

This technique is very commonly used in the context of Transfer Learning. This technique is mainly used for training a classifier on a small data set using the weights of a network trained on a bigger data set.

We now have a Region Proposal Network (RPN, for short). After CNN computes it results, it is used to find up to a predefined number of regions (bounding boxes), which may contain objects.

The hardest issue with using Deep Learning (DL) for object detection is generating a variable-length list of bounding boxes. When modeling deep neural networks, the last block is usually a fixed sized tensor output.

The variable-length problem is solved in the RPN by using anchors: fixed sized reference bounding boxes which are placed uniformly throughout the original image. Instead of having to detect where objects are, we model the problem into two parts.

After having a list of possible relevant objects and their locations in the original image, it becomes a more straightforward problem to solve. Using the features extracted by the CNN and the bounding boxes with relevant objects, we apply Region of Interest (RoI) Pooling and extract those features which would correspond to the relevant objects into a new tensor.

Finally, comes the R-CNN module, which uses that information to:

  • Classify the content in the bounding box (or discard it, using “background” as a label).
  • Adjust the bounding box coordinates (so it better fits the object).

 

Obviously, some major bits of information are missing, but that’s basically the general idea of how Faster R-CNN works. Next, we’ll go over the details on both the architecture and loss/training for each of the components.

By now, you should have a clear idea of how Faster R-CNN works. Faster R-CNN is one of the models that proved that it is possible to solve complex computer vision problems with the same principles that showed such amazing results at the start of this new deep learning revolution.

New models are currently being built, not only for object detection, but for semantic segmentation, 3D-object detection, and more, that are based on this original model. Some borrow the RPN, some borrow the R-CNN, others just build on top of both. This is why it is important to fully understand what is under the hood so we are better prepared to tackle future problems.

Communication between Raspberry Pi and PC using MQTT

Communication between Raspberry Pi and PC using MQTT

We know that MQTT can be and is widely used for Internet of Things Applications. But do you know that mqtt can be a good choice of sending data in local networks too? Instead of juggling with TCP or HTTP request and running webserver, mqtt can be a super simple, yet reliable solution for local network data exchange between raspberry pi to raspberry pi or Raspberry pi to computer. You can use mqtt for any small requirement of sending data from one computer to another computer. or you can use mqtt to send data to PC from raspberry pi. You can also use mqtt to send data to raspeberry pi from PC. If you want to know how to setup raspberry pi for the first time, you can read it here

In order to do any of these things, first thing is to understand how mqtt works? and what are the advantages over the conventional client-server communication

How Client-server communication Works?

In a very conventional sense, whenever we talk about 2 computers talking to each other, the general way of communication is Client -> Server Communication.

Lets say when 2 computers wants to talk to each other, unless we’re using a direct TCP communicaiton, we often need server. The typical configuration will look like this

How to use mqtt

Typical Client server configuration

Now in above structure, what usually happens is when client 1 sends some data, the server has to save it. And when client 2 sends a request for that data then server will serve it. Lets take an example of IoT project and client 1 is sending temperature and client 2 wants to have that temperature. The communication goes like this

  1. Client 1 reads temperature and sends it to Server
  2. Server receives it and stores it somehow
  3. Client 2 requests server about data
  4. Server responds with the available data
  5. client 2 gets requested data

How MQTT Works?

Now if the same communication is to be done using mqtt, lets see how it works.

First, in MQTT, there is no need to save the data at the server end. The data saving into any database on server is completely optional. Instead the server immediately sends that data back to the clients who need it by fetching from its own cache. Now how to know which client wants that data? In order to know which client wants which data and which client sends which data, mqtt uses something called topics. A topic is basically a virtual communication ID and is better understood in terms of internet of things. This is one of the reason why mqtt is used most in internet of things.

So talking about IoT, a topic can be a sensor value or a parameter which is being sent by one or more devices and which needs to be received by one or more devices. So topic names can be

  1. Temperature
  2. Humidity
  3. Pressure
  4. Presence sensor
  5. LPG Sensor Value
  6. and so on…

topic can also be the device control action. For example, in IoT you have to turn on cooler or heater or a fan or a motor or anything using a relay. Then topic names can be

  1. Relay 1 or relay 2 or so on
  2. LED
  3. Fan
  4. Motor

basically topic is a means of communication with which the clients will communicate each other.

Now the clients or individual computer in mqtt, can have one of the 2 jobs.

  1. Sending Data
  2. Receiving Data
  3. Doing both

so depending on whether its sending data or receiving data, the client computers are called as

  • Publisher (who sends data)
  • Subscriber (who receives data)

Look at the generalized mqtt block diagram

how mqtt works

how mqtt works

As you can see, the entities are now called as publisher and subscriber. As the storage is completely optional at the server, its now called as broker. The broker is nothing different than server in our previous case. It is a physical entity in your network, like a computer PC or raspberry pi. But saving data ont this computer is optional. The communication between devices happens over a particular topic. Lets assume there is just temperature data which needs to be exchanged. In this case, lets see how mqtt communication happens between 2 computers.

So the subscriber here, at the time of boot up or at the time of running the application code, has to subscribe to the topic it wants to read from the network. Lets assume the topic name here is temp. The publisher is supposed to publish to this topic to broker. And the subscriber has to stay subscribed to this topic from broker. The communication happens like this.

  1. Publisher will read the temperature value and publish over the topic called temp
  2. Broker receives the temperature value over a topic called temp and immediately distributes / sends the value to all the subscribers of the topic temp
  3. All the subscribers of topic temp receives the value.

Its just pure simple and fun to make communication this way. The best part is, the publisher can publish to several topics and subscribe to several topics as well. The same case with subscriber.

How to use mqtt in python

Having understood the theory of how mqtt works, lets give it a quick spin. For this experiment, you’ll need at least 2 computers to have real fun and experience of understanding communication. One of our computer will act as broker and subscriber. One computer will act as publisher.

Installation and Running MQTT python program is a 2 part process.

  1. We need a MQTT server who runs the service, technically, its called mqtt broker — Its Raspberry pi in this experiment.
  2. We need a publisher, who just sends some data to or receives some data from the server, — Its PC in our case can be other RPi or Nodemcu or esp32 or any such thing. In current scene, its the PC

So what we need is an MQTT server (or broker) running on raspberry pi. mosquitto is one such server which can run on Raspberry pi. In this tutorial, we use mosquitto server on raspberry pi.

Now lets see installations to be done

Install Python MQTT Library On raspberry Pi

we need to install both the mqtt server as well as the python client library on raspberry pi so that we can not only receive data, but also be able to interpret it using python code. In short to receive the data in python codes.

so on raspberry pi, first install the mqtt server with below command. Make sure you type these commands in terminal of your raspberry pi computer.

sudo apt-get install -y mosquitto mosquitto-clients

this command will install the mosquitto MQTT broker and client libraries on raspberry pi and will run it automatically in the background. The broker is now installed on the raspberry pi. Now lets run the mqtt broker so that its operational. This can be done by

sudo systemctl enable mosquitto

Above line will run the broker on raspberry pi.

Next, we need to run the subscriber code on raspberry pi as well. This code will read the values published by the publisher. In this case, we’re making use of broker itself as a subscriber as well. To access the mqtt functionalities through python program, we need to install the mqtt python libraries on raspberry pi. Mosquitto here is the software which will act as broker meaning it will act as the receiver of data or sender too in some cases. To read the received data in python program, we need python mqtt library. To install python MQTT library, run below command on termianl of raspberry pi. The most popular mqtt library for python is paho-mqtt library which can be installed with this command

sudo pip install paho-mqtt

Above line will install the paho-mqtt python library with which we can write a code to read the data coming from a sender like PC or microcontroller.

If you’ve both python2 and python3 installed on your raspberry pi, which you obviously would have; then its better to explicitly specify that you want to install libraries for python3 with this command

sudo pip3 install paho-mqtt

Above command will install paho mqtt libraries for python3

MQTT Python Code

Now the Code, below python code is useful to receive data on raspberry pi mqtt broker on specified port address. As discussed before, MQTT needs a topic like temp to receive data, this is also called as channel, so whatever topic you’re specifying here, should be the same one used on the sending device (publisher). Look at the code below, this is a python code for raspeberry pi to receive mqtt data.

import paho.mqtt.client as mqtt #import library
 
MQTT_SERVER = "localhost" #specify the broker address, it can be IP of raspberry pi or simply localhost
MQTT_PATH = "test_channel" #this is the name of topic, like temp
 
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
    print("Connected with result code "+str(rc))
 
    # Subscribing in on_connect() means that if we lose the connection and
    # reconnect then subscriptions will be renewed.
    client.subscribe(MQTT_PATH)
 
# The callback for when a PUBLISH message is received from the server.
def on_message(client, userdata, msg):
    print(msg.topic+" "+str(msg.payload))
    # more callbacks, etc
 
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message
client.connect(MQTT_SERVER)
client.loop_forever()# use this line if you don't want to write any further code. It blocks the code forever to check for data
#client.loop_start()  #use this line if you want to write any more code here

Install MQTT python libraries On PC

After installing everything required on Raspberry Pi, we’ve to install the things needed on PC

We only need the python mqtt libraries on PC for sending data to mqtt broker running on raspberry pi. It can be installed by running below command in command prompt of windows. Make sure you run the command prompt by right clicking and clicking on “Run as Administrator”

pip3 install paho-mqtt

make sure, you open the command prompt as “Administrator” otherwise it may cause issues in installation.

Now use below simple python code to send data to the test channel created in raspberry pi mqtt server. You need to specify the raspberry pi IP address as the mqtt server address in the below code. Run below code on PC

  
import paho.mqtt.publish as publish
 
MQTT_SERVER = "192.168.1.5"
MQTT_PATH = "test_channel"
import time
while True:
    publish.single(MQTT_PATH, "Hello World!", hostname=MQTT_SERVER) #send data continuously every 3 seconds
    time.sleep(3)

And that is about it. whatever data instead of “hello world” you send, it’ll be sent and published to the mqtt broker. Now this is a very simple and crude sample and as you learn more, you can experiment more about it.

Interesting thing is, MQTT is a preferred way to send data from any kind of IoT Device to major cloud service providers like microsoft azure and aws.

Keep Experimenting!!!

How to learn PCB Design : Ultimate PCB Design Guidebook you need

How to learn PCB Design : Ultimate PCB Design Guidebook you need

PCB Design is the art and science of creating a 2d Design for electronics circuit which can be fabricated on a board.

Download-Now

If you’re anyway related to electronics, either a hobbyists, or an engineering student, or someone who’s currently working in the field of electronics, then its almost impossible that you don’t know about PCB Design

As said PCB stands for Printed circuit board. Whenever we have a circuit on paper, and we want to test it or build physical format of that circuit then we build a printed circuit board. So basically PCB is a solid format of a circuit which is drawn on paper. And to design the PCB we need to understand about the electronic circuit and its interactions properly. That’s why it said that PCB design is an art as well as a science at the same time. A designer must consider number of different parameters but most important of them are the size of PCB and the number of components mounted onto it. A good PCB design is one which can accommodate more components in less area Hey at the same time not giving any Hey unconnected traces.

PCB Design or printed circuit board design is the process of giving a solid form to a circuit we create on paper. Usually we can prototype any circuit using a breadboard. On a breadboard you can very well test a circuit but to create a physical circuit you need to design PCB’s. learn more about breadboards here Short form of Printed Circuit Board is what we commonly call as PCB. PCB Design is an art and science at the same time, because, you need to know about the electronic components, their current flow and related things in order to design PCB and, you must be artistic enough to make your pcb look good. You might have heard about the Steve Job’s obsession about making things beautiful inside a computer, and it also involved, how the PCB’s looked, and how the tracks bent on the board 🙂

What are the major steps in PCB Design to know?

For anyone to be able to design PCB’s, few things are important to be known first which are

  • Familiarity with Electronics Components
  • Understanding of PCB Footprint which is also called as package
  • Understanding of Copper Sides in the PCB that you’re using, single or double sided
  • Component Placement, proper component placement is most crucial in designing boards
  • Routing, you need to know the requirements of current to flow from the PCB tracks that you’re going to design, what are the requirements, and whats the relation between track size and the maximum current it allows to flow
Download-Now

How PCBs are Designed?

PCB Design, in old days, was mostly done on paper, where one has to just draw the Artwork on paper, usually a graph paper to get proper idea of dimensions and then place the component footprints on the paper by drawing them. Last step was to interconnect those components using tracks drawn simply with pencil. In many academic institutes, this is the primary step of how PCB design is taught to students and its for the better because you get the core concept of it when learning it for the first time.

Initially, everyone learns about single sided PCB’s where there’s copper only on one side of PCB and over time, the PCB design learning becomes much more complex when we know about creating a dense PCB in a small size. So then comes double sided PCBs where there is copper on both sides, so designer can place components as well as route tracks from both sides of PCB. And from this time and on, most designers shift to using Computer Aided Tools for PCB Design (CAD)

What are popular CAD PCB Design tools?

There are many PCB design tools available in market, many of them are free, many of them are paid versions. And selection of the PCB design tool completely depends on what suits best for your requirement. Am just giving few names here based on how popular they are and how costly the are, but offcourse, there’s much more than this list

  1. Mentor Graphics PADs, perhaps the most expensive PCB Design tool used by many corporate product design companies
  2. Proteus Design Suite, more preferable due to both PCB design and electronics simulations that comes under single package
  3. Altium(previously protel) provides a complete design suite with 3D visualization and overview about how PCBs will fit into its enclosure
  4. OrCAD one of the oldest software
  5. Eagle undoubtedly, eagle pcb design software can be called as the most dominant and most popular tool because its used by both industries and hobbyists community around the world, and with flexible pricing, its affordable for even a single person startup
  6. KiCAD one of the most popular 100% free PCB design tool
  7. EasyEDA complete cloud based 100% free online and powerful pcb design tool

The list goes on and on and its just based on trials and erros that you’ve to chose the tool appropriate for you

Download-Now

Importance of Learning PCB Design

If you’re a student studying engineering or someone who is willing to start his own startup, its very important to understand and learn at least the basics of PCB design. As engineering student, knowledge of basic single sided PCB design is something kind of compulsory thing to know about. You can download any of the above software or try easyEDA directly on cloud without downloading the software on your computer and start experimenting with it right away

Now, we all know that the most developments, everyday are happening in the field of electronics, there are new mobiles, new IoT devices, and lots of new gadgets and researches going on, and all of this needs product design which involves PCB design as primary skill. And in the era of Arduino’s and Raspberry Pi, its easier to find a programmer or embedded developer but day by day, its getting difficult for startups to find a good PCB designer, why? because people are simply ignoring studying PCB designs.

Which software to choose?

Whether you’re a student looking for job or a hobbyists who wants to make nice fun projects for himself for the coming weekend, learning PCB design by choosing appropriate tool becomes very important. My personal suggestions is not only one but I’ve 2 recommendations. The recommendations are based on very simple parameters

  • Popularity (eagle is one of the most popular one)
  • Cost (easyEDA is by far the best completely FREE pcb Design suite I’ve ever used)

Eagle (download here)

Choose eagle if you either plan to start a company in future, or wants to design hobby circuits which are small one. These are 2 ends of a string. Because eagle free version allows a fairly small size of PCB to be designed so it should fit only small circuits and eventually you might want to buy it.

But the benefit with eagle is immense, first of all, its a completely powerful tool with all the features you might need, secondly, almost every open source hardware design available on internet is made using Eagle, so adaptation is easier,a complete guide on eagle

  1. Free limited version is available
  2. Very popular
  3. Large user libraries available for almost every part to be used
  4. Number of open source projects made in eagle, makes it easy to adopt
  5. Very little learning curve
  6. Small size installation

For those interested in knowing the basics of Printed Circuit Board design, here’s my explained video which will create most of the doubts for beginner

Download-Now

EasyEDA (Download or use here)

If you’re comfortable using a completely cloud based software where all your designs are also saved on cloud, then easyEDA is one of the best choices because of many reasons,learn here a complete guide 

  1. Its Free
  2. Takes no installation, runs on cloud
  3. Optionally you can run it on your local machine but its totally optional
  4. Learning curve is simple, I mean dead simple, probably 1 hour
  5. User contributed parts library is huge, large, gigantic I’d say 🙂

Based on these 2 things, you can choose whichever is best for you after experimenting.

For those interested in knowing the basics of Printed Circuit Board design, here’s my explained video which will create most of the doubts for beginner

Download-Now

What Is PCB made of?

A PCB is made up of a thin board which is having copper deposited on one or both sides of the board. The board is usually made up of a non-conductive material. The board is usually having a thickness which where is from 0. 6 MM to 2 mm. the most popular board size is 1.6 mm. The thickness of copper deposited onto it varies widely but the standard thickness is 35 micron. However we have used PCBs where we wanted up to 100 micron thickness. The thickness of copper layer is directly proportional to the current the copper layer can conduct. When we need the same size copper layer to carry more current, in that case we choose to increase the layer thickness instead of completely redesigning PCBs. In single sided board, we have copper deposited on only one side. In double sided PCB, copper is deposited on both the layers of board. A bare PCB looks like this.

There are variety of materials with which the board is made up of. However a comprehensive list for reference is available here. This material is called as substrate. Usually, the most widely used substrate is a fiber glass or also a code name FR-4. This solid core gives the PCB its strength. Depending upon requirement, flexible PCBs can also be made. In the case of flexible PCB, the substrate is made up of high temperature plastic.

Copper layers can be of different thickness Most common and popular thickness of copper layer is 35 micron

Download-Now

Substrate

The base material or substrate, is usually fiberglass it’s called “FR4”. This solid core gives the PCB it’s rigidity and thickness. There also flexible PCB’s built on flexible high temperature plastic(Kapton or the equivalent).Board thickness 0.8mm-2.6mm thickness, most common is 1.6mm thick board

What is the process of PCB manufacturing?

 

 

Hand Made PCb

The steps of PCB manufacturing can be summarized as

  1. Schematic Capture: Drawing the Circuit diagram of required PCB
  2. Draw PCB Layout and Artwork: The process of creating a layout of components on an expected size and then interconnecting the components using tracks. This is a drawing stage and usually done on computer using suitable software.
  3. DRC: Once the design is completed, we need to perform a design rule check to see if there are any errors
  4. Export Gerber: In this step we export the manufacturing data from the PCB Design software. This data is then sent to manufacturer
  5. Drilling: Manufacturer, first drills your entire PCB
  6. Etching: in this step, the PCB design is drawn on the PCB and it undergoes a process called etching. In etching process, the unwanted copper is removed using a chemical reaction with a suitable chemical like ferric chloride. After etching, PCB contains only the copper which is needed for tracks and all unwanted copper is removed.
  7. Printing: The additional colour mask, text layer and every thing needed is printed in this step
  8. Shipping: once its done, the PCBs are cut depending upon requirement and shipped to the customer.

DIY vs Manufactured

 

 

DIY vs Manufactured PCB

Download-Now

There is a significant difference between the quality of a do-it-yourself PCB and the one which is manufactured by a PCB manufacturer. You can make your own PCB’s for single sided PCB’s without any complex machinery with you. But the same is not possible for a double-sided PCB. The DIY PCB is made by printing the layout using a laser printer on a photo paper and then transferring that to PCB using Hot iron. The etching can be done at home by simply making a solution of FECL3 chemical. But when it comes to long life operation, its always preferred to get the PCB’s manufactured from a known standard manufacturer.

The DIY PCB looks like this:

learning pcb design

 

 

DIY PCB

and the manufactured PCB looks like this

PCB Design with Eagle

 

 

Manufactured PCB

Download-Now

Solder Mask and Silk Screen

When you manually make PCBs at home, you can not have the solder mask and silk screen on PCB. Solder mask is the nice attractive Green/red/black/blue colour which appears on a PCB when we look at it. The silk screen is the white borders around the components and the labels of the components are also printed using the same white ink. We call this as silk screen. Since these prints needs a very fine adjustment between the printing mechanism and PCB itself, it’s really difficult to make them at home. Even if you have a screen-printing setup at home, its still not an easy task to print them on PCB.

Solder Mask

 

 

Solder Mask

Silk Screen

 

 

Silk Screen
Download-Now

Common Terms

DRC–> Design rule check
Hole–> Hole to insert and solder component
Pad–> Pad to solder surface mount component
Via–> Hole to connect 2 layers of PCb
Track–> Copper line connecting 2 parts / wire of circuit
Jumper–> Wire to place where track can’t be drawn
Plane–> Excess copper area
Foot print–> Component print on PCB

Measurement units on PCB

Generally all PCB design softwares support multiple measurement units to make it easier for all the designers across the world. There are few measurement units which are supposed to be very standard in PCB Design softwares. And the unit is called as th or thou

And its a good practice to understand about the thou. Its nothing but one thousandth of an inch. So its easier to remember as well.

1 th == thou == 0.001 inch = 0.0254 mm =0.00254 CM
thou is the most common unit in PCB design tools, However mm can also be used.

Popular dimensions offered by PCB design softwares

  • thou also specified as th
  • mm
  • cm
  • inch
Download-Now

Single Sided PCB Design and double sided PCB Design

When we’re creating a simple circuit, usually all the components are placed on one side of the board and the tracks appear on the opposite side of the board. This type of PCB design is called as Single Sided PCB Design. This is most common among the developers and hobbyists. The biggest benefit of using single sided PCB, is the ease of design. Anyone can develop a small single sided Design on Paper also. Further more the projects having less number of components can be designed using PCB

But the disadvantage of Single sided PCB comes forth when we’re trying to create a complex circuit in a restricted format. In that case, a single sided PCB design may not fir the expected size of the board and we may need to turn to Double Sided PCB Design

Advantages of Single Sided PCB Design

  • Easier to start development
  • Low priced
  • can be made at home
  • Quick turnaround / delivery time

Disadvantages of Single Sided PCB

  • Complex circuit’s cannot be built in a same space
  • due to all components being on same size, usually the size of board is bigger.

Double Sided PCB

In a double sided PCB, the copper deposition is present on both the sides of the board. Due to the copper deposition on both sides, we can design circuit paths on both sides of the board. This also helps us mount components from both the sides. The 2 layers, top and bottom can be connected by “via”

Via, is a name given to a small hole on PCB which is plated thougoughly. This plated hole gives connectivity for both the layers to communicate with each other. Means if you’re routing a track on bottom copper, but now you think that some part of the route should come from the top layer of PCB, then a via is added. The via gives a conducting path between top layer and bottom layer of PCB

Advantages of Double Sided PCB Design

  • Complex PCBs can be designed in a small size / package
  • gives more freedom and reduces the human effort to create PCB Design

Disadvantages of Doble Sided PCB Design

  • Double side PCB Design and manufacturing is expensive compared to single sided Design
  • Design process is quite lengthy
  • More time required to manufacture PCBs
Download-Now

Surface Mount Vs Through Hole Components

In electronics circuit design, there are primarily 2 type of components which are available

  • Through-hole
  • Surface Mounted

 

 

Through Hole IC

A through hole component, as the name suggests go through a hole on PCB to the other side. The soldering action is then taken from the other side. Usual resistors, capacitors, and even IC’s like 555 or op-amp comes as through hole package by default. The electronic components used for study and experimentation are also through hole component to make it easier to insert on a bread board or soldering and de-soldering the component from PCB.

 

 

Surface Mount Device (SMD) also called as Surface mount technology (SMT) Component

Where as SMD or Surface Mounted Device is the one which can be mounted directly on the surface of PCB. Look at the picture below

how to start learning PCB Design

 

 

Through Hole vs Surface Mount
Download-Now

as you can notice, the IC is a surface mount component. It can directly be soldered on PCB and saves a lot of space because its generally very smaller than the through hole components. Whereas the through hole components shown in below picture are resistors, capacitors and many such general components which we’ve been using for a while.

Soldering a through hole component is very easier and can be done via hand without much efforts. Soldering of SMD components using bare hands can be tricky. Although it depends totally on the user’s hand, but hand soldering is not a solution for mass manufacturing and in that case a reflow soldering oven is used for all types of components.

One of the biggest advantage of through-hole components is that it provides a very strong mechanical bonds with PCB making it stronger.
Despite the fact that surface-mount technology has, by and large, replaced through-hole mounting, the through hole technique enables engineers and manufacturers to deal with components that will undergo mechanical stress as the result of this mechanical bond. As an example, connectors or heavy components like transformers are generally better suited to through-hole mounting

Having laid out as much information in as less words, its time to start your own PCB Design journey. Its completely up to you to choose the software, the PCB manufacturer and every single aspect of it. Remember you start experimenting first, and then go on refining the tools. Keep Experimenting!!!

Download-Now