Showing posts with label manjeet singh. Show all posts
Showing posts with label manjeet singh. Show all posts

Introduction to Breadboard

Brief about Breadboard

  • A breadboard is a plastic board with many small holes that is used to create and test circuits. 
  • It has holes on it that are joined internally in a certain manner, as illustrated in the image below. 
  • The green line connecting the holes indicates that they are linked inside. Power is represented by the red line, which is generally linked to the power rail. 
  • Ground is represented by the blue line, which is generally linked to the circuit's ground. 
  • Decade Counters and other ICs can be positioned in the middle of the breadboard to share the first eight pins with the yellow line and the second eight pins with the green line.
  • Brief History: Wire-wrap technology was used to design, fabricate, and test electronic circuits and prototypes in the 1960s. The components (big electronics parts) were then attached to the larger boards (like wooden boards used for bread slicing) via wires, pins, or thumbtacks. These circuit boards are known as breadboards, but their formal term is solderless breadboards. These solderless breadboards are made up of holes that are used to place component terminals, and then wires are used to link the holes together.
Bread Board

How to Make a Circuit with a Breadboard?
  • Follow the circuit schematic and connect one component in a line to utilise a breadboard for your circuit. 
  • After double-checking all of the connections, attach the battery last. Keep a look out for typical blunders like mixing ground and supply, connecting to the wrong rail, and not correctly setting ICs, among others.
  • On a breadboard, we created a circuit for a glowing LED as shown in the diagram below.
How to use Breadboard

Breadboard Connections Basics.
  • When we first see a breadboard, we may think it's going to be a difficult task to connect the circuit since it has multiple holes that can be confusing. 
  • In reality, once we understand the fundamentals of breadboard connections, connecting the circuit is a breeze. 
  • Positive (one row of first and last two) and negative (two rows of first and last two) are utilised on the first two rows (top) and final two rows (bottom) of the breadboard, respectively (another row of first and last two).
Breadboard Connection
  • The initial (top) and last (bottom) two rows of the breadboard are horizontally connected internally, with 5 holes in each column (total of 10 columns). 
  • If the power supply terminal is linked to one of the top or bottom rows (one of the two rows), the same electric power can be drawn from the next five holes in the same column.


IoT Protocols

IoT Protocols You Need to Know About

  • There are a variety of IoT protocols to used in IOT in which each protocol has unique capabilities or characteristics that make it superior to other solutions for certain IoT installations.
  • Each IoT protocol supports device-to-device, device-to-gateway, and device-to-cloud/data center communication, as well as combinations of these.
  • Geographic and unique location, power consumption requirements, battery-operated choices, the existence of physical obstacles, and cost all play a role in determining which protocol is best for an IoT deployment.

Some of the Specific IoT Protocols List.
  • AMQP.
  • Bluetooth and BLE.
  • Cellular.
  • CoAP.
  • DDS.
  • LoRa and LoRaWAN.
  • LWM2M.
  • MQTT.
  • Wi-Fi.
  • XMPP.
  • Zigbee.
IOT Protocols

1. AMQP:
  • AMQP, which stands for Advanced Message Queuing Protocol, is an open standard protocol for message-oriented technology. As a result, independent of the message brokers or platforms in use, it enables messaging compatibility across systems. 
  • It provides security and interoperability, as well as dependability, even over insecure networks. 
  • It facilitates communication even when systems aren't available at the same time.
2. Bluetooth and BLE:
  • Bluetooth is a short-range wireless technology that employs ultra-high frequency radio waves with small wavelengths. 
  • It was originally designed for audio streaming, but it has now evolved into a vital component of wireless and linked devices. 
  • As a result, this low-power, short-range networking solution is a popular choice for both PANs and IoT installations.
  • Bluetooth Low Energy, often known as Bluetooth LE or BLE, is a new form of Bluetooth that is geared for IoT connectivity. 
  • BLE, as its name implies, uses less power than normal Bluetooth, making it particularly desirable in a variety of applications, including consumer health and fitness trackers and smart home devices, as well as business in-store navigation.
3. Cellular.
  • Cellular is one of the most commonly accessible and well-known solutions for IoT applications, and it's one of the finest for installations that require long-distance connectivity. 
  • While outdated cellular technologies such as 2G and 3G are being phased out, telecoms providers are rapidly expanding the coverage of newer high-speed standards such as 4G/LTE and 5G. 
  • High-bandwidth and dependable connectivity are provided by cellular technology. 
  • It has the capacity to transport large amounts of data, which is critical for many IoT implementations. 
  • These capabilities, however, come at a cost: they are more expensive and use more energy than other solutions.
4. CoAP:
  • CoAP, or Constrained Application Protocol, was created by the IETF Constrained restful Environments working group in 2013 to interact with HTTP-based IoT systems. 
  • The User Datagram Protocol (UDP) is used by CoAP to create secure conversations and data transmission between many sites. 
  • CoAP is a protocol that allows limited devices to join an IoT ecosystem, even if they have poor bandwidth, low availability, and/or low energy. 
  • It is commonly used for machine-to-machine (M2M) applications.
5. DDS:
  • Data Distribution Service for Real-Time Systems was created by the Object Management Group (OMG). 
  • "It links the components of a system together, offering low-latency data communication, exceptional dependability, and a scalable architecture that business and mission-critical IoT applications require," according to OMG.
  • Using a publish-subscribe paradigm, this M2M standard offers high-performance and highly scalable real-time data communication.
6. LoRa and LoRaWAN:
  • LoRa, which stands for long range, is a non-cellular wireless technology that, as its name suggests, allows for long-range communication. 
  • It has a low power consumption and secure data transfer for M2M and IoT implementations. 
  • It was once a proprietary technology that is now incorporated into Semtech's radio frequency platform. 
  • Semtech was a founding member of the LoRa Alliance, which is currently the governing organisation for LoRa Technology. 
  • The LoRa Alliance also created and maintains LoRaWAN, an open cloud-based protocol that allows LoRa devices to interact.
7. LWM2M:
  • Lightweight M2M (LWM2M) is a device management protocol built for sensor networks and the needs of an M2M environment, according to OMA SpecWorks. 
  • This communication protocol was created primarily for remote device administration and telemetry in IoT contexts and other M2M applications, making it an excellent choice for low-power devices with limited processing and storage capabilities.
8. MQTT:
  • It was initially called as Message Queuing Telemetry Transport and was developed in 1999. It is now just known as MQTT. 
  • Message queuing is no longer used in this protocol. To facilitate M2M communication, MQTT employs a publish-subscribe architecture. 
  • Its basic communications system works with restricted devices and allows several devices to communicate. 
  • It was created to function in low-bandwidth environments, such as for sensors and mobile devices connected to unreliable networks. 
  • Because of this, it's a popular choice for connecting devices with a tiny code footprint, as well as wireless networks with different amounts of delay caused by bandwidth limits or unstable connections. 
  • MQTT, which began as a private protocol, is today the most widely used open source protocol for linking IoT and industrial IoT devices.
9. Wi-Fi:
  • Wi-Fi is a popular IoT protocol because to its vast use in residential, commercial, and industrial structures. 
  • It has a rapid data transfer rate and can handle enormous volumes of data. With short- to medium-range lengths, Wi-Fi is especially well suited for LAN setups. 
  • Furthermore, the different Wi-Fi protocols (the most prevalent in homes and some companies is 802.11n) provide technicians with a variety of implementation alternatives. 
  • Many Wi-Fi protocols, including the one typically used in homes, are, however, too power-hungry for some IoT applications, particularly low-power/battery-powered devices. 
  • For some deployments, this eliminates Wi-Fi as a viable choice. Additionally, Wi-limited Fi's range and scalability make it unsuitable for many IoT implementations.
10. XMPP:
  • Extensible Messaging and Presence Protocol, or XMPP, was created by the Jabber open source community in the early 2000s for real-time human-to-human communication. 
  • It is presently used for M2M communication in lightweight middleware and for routing XML data. 
  • XMPP allows several entities on a network to communicate structured yet extensible data in real time, and it's most commonly utilised in consumer-oriented IoT installations like smart appliances. 
  • The XMPP Standards Foundation supports it as an open source protocol.
11. Zigbee:
  • Zigbee is a mesh network protocol that was created for building and home automation applications. 
  • It is one of the most widely used mesh protocols in IoT contexts. Zigbee is a low-power, short-range protocol that may be used to connect many devices. 
  • It has a larger range than BLE, however it transmits data at a slower pace. 
  • It has a flexible self-organizing mesh, ultra-low power, and a library of applications, and is overseen by the Zigbee Alliance.
12. Z-Wave:
  • Z-Wave is a wireless mesh network communication protocol based on low-power radio frequency technology that is another proprietary alternative. 
  • Z-Wave, like Bluetooth and Wi-Fi, allows smart devices to interact using encryption, increasing the security of IoT deployments. 
  • It's widely utilised in home automation and security systems, as well as business applications like energy management technology. 
  • In the United States, it broadcasts on the 908.42 MHz radio frequency, albeit the frequency varies by nation. 
  • The Z-Wave Alliance is a member consortium dedicated to improving the technology and interoperability of Z-Wave-enabled products.

Data types, variables and Operators in Arduino.

Data types in Arduino.
  • Data types are the types of data which are used to create an arduino program.
  • Data types also define how much apace a variable will occupy in computer memory.
  • The following table provides all the data types which are used during Arduino programming.
Data Types in Arduino


voidBoolean char
Unsigned charbyteint
Unsigned intwordlong
Unsigned longshortfloat
doublearrayString-char array
String-object

  • Void- It indicates that the function is expected to return no information to the function from which it was called.
  • boolean (8 bit) - simple logical true/false.
  • char (8 bit) - signed number from -128 to 127. 
  • unsigned char (8 bit) - same as 'byte'; if this is what you're after, you should use 'byte' instead, for reasons of clarity.
  • byte (8 bit) - unsigned number from 0-255
  • int (16 bit) - signed number from -32768 to 32767.
  • unsigned int (16 bit)- the same as 'word'. Use 'word' instead for clarity and brevity IDE.
  • word (16 bit) - unsigned number from 0-65535.
  • long (32 bit) - signed number from -2,147,483,648 to 2,147,483,647.
  • unsigned long (32 bit) - unsigned number from 0-4,294,967,295. The most common usage of this is to store the result of the millis() function, which returns the number of milliseconds the current code has been running
  • short- A short is a 16-bit data-type. On all Arduinos (ATMega and ARM based), a short stores a 16-bit (2-byte) value. This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1).
  • float (32 bit) - Data type for floating-point number is a number that has a decimal point. Floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38. They are stored as 32 bits (4 bytes) of information.
  • double- On the Uno and other ATMEGA based boards, Double precision floating-point number occupies four bytes. That is, the double implementation is exactly the same as the float, with no gain in precision. On the Arduino Due, doubles have 8-byte (64 bit) precision.
Variables and their Scope
  • The scope of variables in the C programming language, which Arduino uses, is a property. A scope is a section of the programme where variables can be defined in one of three places.
  1. Inside a function or a block, which is called local variables.
  2. Outside of all functions, which is called global variables.
  3. In the definition of function parameters, which is called formal parameters.
Local variables:
  • Local variables are variables that are defined within a function or block. 
  • They can only be utilized by statements that are included within that function or code block. 
  • Local variables aren't known to have any effect outside of their own scope. 
  • The following is an example of how to use local variables.
For Example: 

Void setup () {

}

Void loop () {
   int x , y ;
   int z ; Local variable declaration
   x = 0;
   y = 0; actual initialization
   z = 10;
}
      Global variables:
      • Global variables are defined at the beginning of the programme, outside of any functions. 
      • The value of the global variables will remain constant over the life of your programme.
      • Any function has access to a global variable. That is, once a global variable is declared, it is available for use throughout your entire programme. 
      For Examples:

      Int T , S ;
      float c = 0 ; Global variable declaration

      Void setup () {

      }

      Void loop () {
         int x , y ;
         int z ; Local variable declaration
         x = 0;
         y = 0; actual initialization
         z = 10;
      }

      Operators in Arduino:
      • A symbol that directs the compiler to execute certain mathematical or logical tasks is known as an operator. 
      • The C language has a large number of built-in operators, including the following:
      1. Arithmetic Operators.
      2. Comparison Operators.
      3. Boolean Operators.
      4. Bitwise Operators.
      5. Compound Operators.
      Operators in Arduino

      1. Arithmetic Operators
      • Assume variable A holds 20 and variable B holds 40 then −

      Operator name

      Operator simple

      Description

      Example

      Assignment operator

      =

      Stores the value to the right of the equal sign in the variable to the left of the equal sign.

      A = B

      Addition

      +

      Adds two operands

      A + B will give 60

      Subtraction

      -

      Subtracts second operand from the first

      A - B will give -20

      Multiplication

      *

      Multiply both operands

      A * B will give 800

      Division

      /

      Divide numerator by denominator

      B / A will give 2

      Modulo

      %

      Modulus Operator and remainder of after an integer division

      B % A will give 0


      Example:

      void loop () {
         int a = 9,b = 4,c;
         c = a + b;
         c = a - b;
         c = a * b;
         c = a / b;
         c = a % b;
      }

      Expected Output:
      a + b = 13
      a - b = 5
      a * b = 36
      a / b = 2
      Remainder when a divided by b = 1

      2. Comparison Operators:
      • Assume variable A holds 10 and variable B holds 20 then −

      Operator name

      Operator simple

      Description

      Example

      Equal to

      = =

      Checks if the value of two operands is equal or not, if yes then condition becomes true.

      (A == B) is not true

      Not equal to

      ! =

      Checks if the value of two operands is equal or not, if values are not equal then condition becomes true.

      (A != B) is true

      Less than

      < 

      Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true.

      (A < B) is true

      Greater than

      > 

      Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true.

      (A > B) is not true

      Less than or equal to

      < =

      Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true.

      (A <= B) is true

      Greater than or equal to

      > =

      Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true.

      (A >= B) is not true


      Example:

      void loop () { 
         int a = 9,b = 4
         bool c = false;
         if(a == b)
            c = true;
         else
            c = false;

         if(a != b)
            c = true;
         else
            c = false;
         
         if(a < b)
            c = true;
         else
            c = false;
         
         if(a > b)
            c = true;
         else
            c = false;
         
         if(a <= b)
            c = true;
         else
            c = false;
         
         if(a >= b)
            c = true;
         else
            c = false;
      }

      Expected Output:

      c = false
      c = true
      c = false
      c = true
      c = false
      c = false

      3. Boolean Operators:
      • Assume variable A holds 10 and variable B holds 20 then −

      Operator name

      Operator simple

      Description

      Example

      and

      &&

      Called Logical AND operator. If both the operands are non-zero then then condition becomes true.

      (A && B) is true

      or

      ||

      Called Logical OR Operator. If any of the two operands is non-zero then then condition becomes true.

      (A || B) is true

      not

      !

      Called Logical NOT Operator. Use to reverses the logical state of its operand. If a condition is true then Logical NOT operator will make false.

      !(A && B) is false

       Example:

      void loop () {
         int a = 9,b = 4
         bool c = false;
         if((a > b)&& (b < a))
            c = true;
         else
            c = false;

         if((a == b)|| (b < a))
            c = true;
         else
            c = false;

         if( !(a == b)&& (b < a))
            c = true;
         else
            c = false;
      }

      Expected Output:
      c = true
      c = true
      c = true

      4. Bitwise Operators:
      • Assume variable A holds 60 and variable B holds 13 then −

      Operator name

      Operator simple

      Description

      Example

      and

      &

      Binary AND Operator copies a bit to the result if it exists in both operands.

      (A & B) will give 12 which is 0000 1100

      or

      |

      Binary OR Operator copies a bit if it exists in either operand

      (A | B) will give 61 which is 0011 1101

      xor

      ^

      Binary XOR Operator copies the bit if it is set in one operand but not both.

      (A ^ B) will give 49 which is 0011 0001

      not

      ~

      Binary Ones Complement Operator is unary and has the effect of 'flipping' bits.

      (~A ) will give -60 which is 1100 0011

      shift left

      << 

      Binary Left Shift Operator. The left operands value is moved left by the number of bits specified by the right operand.

      A << 2 will give 240 which is 1111 0000

      shift right

      >> 

      Binary Right Shift Operator. The left operands value is moved right by the number of bits specified by the right operand.

      A >> 2 will give 15 which is 0000 1111


      Example:

      void loop () {
         int a = 10,b = 20
         int c = 0;
         c = a & b ;
         c = a | b ;
         c = a ^ b ;
         c = a ~ b ;
         c = a << b ;
         c = a >> b ; 
      }

      Expected Output: 
      c = 12
      c = 61
      c = 49
      c = -60
      c = 240
      c = 15
      5. Compound Operators:
      • Assume variable A holds 10 and variable B holds 20 then − 

      Operator name

      Operator simple

      Description

      Example

      increment

      ++

      Increment operator, increases integer value by one

      A++ will give 11

      decrement

      --

      Decrement operator, decreases integer value by one

      A-- will give 9

      compound addition

      +=

      Add AND assignment operator. It adds right operand to the left operand and assign the result to left operand

      B += A is equivalent to B = B+ A

      compound subtraction

      -=

      Subtract AND assignment operator. It subtracts right operand from the left operand and assign the result to left operand

      B -= A is equivalent to B = B - A

      compound multiplication

      *=

      Multiply AND assignment operator. It multiplies right operand with the left operand and assign the result to left operand

      B*= A is equivalent to B = B* A

      compound division

      /=

      Divide AND assignment operator. It divides left operand with the right operand and assign the result to left operand

      B /= A is equivalent to B = B / A

      compound modulo

      %=

      Modulus AND assignment operator. It takes modulus using two operands and assign the result to left operand

      B %= A is equivalent to B = B % A

      compound bitwise or

      |=

      bitwise inclusive OR and assignment operator

      A |= 2 is same as A = A | 2

      compound bitwise and

      &=

      Bitwise AND assignment operator

      A &= 2 is same as A = A & 2


      Example: 

      void loop () {
         int a = 10,b = 20
         int c = 0;
         
         a++;
         a--;
         b += a;
         b -= a;
         b *= a;
         b /= a;
         a %= b;
         a |= b;
         a &= b;
      }

      Expected Output:
      a = 11
      a = 9
      b = 30
      b = 10
      b = 200
      b = 2
      a = 0
      a = 0
      a = 30