April 30, 2021

7 Segment Display Interface With Arduino

Seven segment displays come in different sizes. Their pin configuration also varies. So after purchasing any Common Cathode (CC) or Common Anode (CA) type display one must find the pin configuration. Usually, the datasheet could be found using the printed model number on the 7-Segment display. Depending upon the type (CC or CA) drivers are available to drive a display. Otherwise, they require an 8bit data line and 1bit control line per display. Drivers also help to drive the current for segments as sometimes for bigger displays the requirement of the current might be more than the controller could supply.

In a 7 Segment Display, the segments are named as a,b,c,...,e,f, and Dot Point. The segments are positioned as below.

   

To interface 7-Seg display with Arduino, we need

  • Arduino UNO / NANO
  • 7-Seg Display Common Anode type
  • 330 Ohms Resistor
  • 40x1 Male Berg Strip
  • Dot Vero or Bread Board
  • Connecting Wires
  • Jumper Wires - Male Female Type
  • Soldering Kit (Not required for Bread Board)

Connection Diagram:
  • D2 is connected to A
  • D3 is connected to B
  • D4 is connected to C
  • D5 is connected to D
  • D6 is connected to E
  • D7 is connected to F
  • D8 is connected to G
  • D9 is connected to Common Pin
Once the connection is complete copy the below code to Arduino IDE and upload it to your Arduino.

The code is for displaying 0-9. After uploading you should see the counting started. Please check the video for results.

Troubleshoot:
  • If you find that all the segments are not glowing at 8 that means there are some wires that are not connected properly.
  • If you see that display is showing abnormal values please check the connection diagram between Arduino and the Display.

Source Code:

Video:
 

April 29, 2021

Introduction to LED Based Displays

LEDs are the most basic kind of display. But the problem is One LED has only two states, On state and Off state. So it can not give more than two outputs. If we need more than two outputs what option do we have?

We can use multiple LEDs to make a display. So eight LEDs are combined together to make a display that can show 0-9 and Dot point. To display a digit maximum of seven segments consists of seven LEDs are used. Hence the name came Seven Segment Display. Eight LEDs can be connected in two ways either we could common all of their positive together or the negative together. This is why we have two types of seven-segment displays. Common cathode and common anode. A typical structure and connection diagram of the 7-Segment display is shown below. 0-9 is not enough to display right? What if we need to display characters, symbols, or images?
       

Dot Matrix displays are the solutions. Multiple LEDs are connected together to form an array. They are connected row-wise cathode and column-wise anode or vice-versa. Now with this formation, we can easily display anything we want. If we use RGB LEDs then displaying colored images also possible.  A typical connection diagram and image of the dot matrix display are shown below.







16x2 LCD Interface with Arduino using IIC Module

LCD Displays comes in different sizes. These displays are popular because they are easy to interface with. We had already interfaced 16x2 LCD with Arduino Microcontroller in our previous blog LCD Display Interface with Arduino.

There was one drawback. LCD Displays require a minimum of six pins. Most of the microcontroller does not have this much pins to bare. What if we need to interface two LCDs, that would cost twelve pins. To solve this issue we need the I2C Module.


With help of this module, we only need only the I2C bus. The advantage is multiple devices could be connected on one bus.


Things we need:

  • Arduino Uno
  • IIC Module for LCD Display
  • 16x2 LCD Display
  • 2mm Pitch 1x40 Female Berg Strip
  • 2mm Pitch 1x40 Male Berg Strip


Connection is simple, First using Berg Strip connect LCD Module with the IIC Module. Then using Jumper wire connect Arduino 5V pin to Modules VCC Pin, Arduino Gnd pin to Module Gnd Pin, Arduino A5 Pin to Modules SCL Pin, and Arduinos A4 Pin to I2C Modules SDA Pin as shown below.

LCD Module can be soldered directly with the IIC Module but this would create a problem if any of the two gets damaged. Otherwise, LCD can be brought together pre-soldered with the IIC Module.

Circuit Diagram:

After the connection is complete copy-paste and upload, the I2C scanner code. Then open the Serial Monitor there you will find the I2C address for your device. Note the IIC address.

I2C Scanner: 

Now Copy the code below to your Arduino IDE and Replace my IIC address (0x3F) with your IIC address that you noted ago. Then upload the code. And you should see the screen working. If nothing on the screen try to rotate the Potentiometer that you have on the IIC Module. That pot controls the Contrast of your display.

Before you upload the code library needs to be installed. Please follow the below mention instruction to install the library.
https://creativestudio1973.blogspot.com/2019/11/introduction-to-arduino-library-manager.html

Source Code:

Video:

April 28, 2021

IoT Using Blynk - Temperature and Humidity Monitoring

Value Display Widget is another widget that we are going to use today. It is used to display values. We are going to monitor Temperature and Humidity using this widget.

In our previous blog, we have interfaced the DHT22 Sensor with Arduino. Now in this blog, we send data to Blynk so that we could monitor it over IoT.

DHT 22 has a one-wire interface. In this project, we have connected DHT22 in the D2 pin of NodeMCU. Virtual Pin V1 and V2 are used for the Value Display Widgets. 

For this project, we need

  • NodeMCU
  • DHT22
  • Jumper Wires
  • Blynk App

 Add two Value Display Widgets, named as Temperature and Humidity. Set the Inputs as V1 for Humidity and V2 for Temperature as shown below.


Now open the IDE copy-paste the code. Carefully delete YourAuthToken and paste your auth code there. Then delete YourNetworkName and write your WiFi router or phone's hotspot name there. Finally, delete YourPassword and put your Wi-Fi or hotspot password. Then you can upload the code. Once uploaded your NodeMCU should get connected to your WiFi network.

Source Code:

Results:


How to make a Relay Board

Relay is a switch that can be actuated using an electrical signal. In this blog, we will discuss the operation of a relay and relay board along with the process of interfacing with different microcontrollers. There are many types of relays. We will discuss SPDT type. An SPDT relay has five terminals Normally Open (NO), Normally Close (NC), Common (C), A1 and A2 are used to power the coil. When the coil is powered contact between C and NC switches to NO side, this is called actuated state. 

Relays are used when we are using electrically isolated circuits. Like using a 5V DC Relay we can turn on 230V AC load. 

Things we need

  • SPDT Relay 5V (RL1)
  • NPN Transistor : BC547 (Q1)
  • Resistor : 1k Ohm (R1)
  • Diode : 1N4007 (D1)
  • LED Optional

In our project we can connect any micronontroller's pin at Input. 1k Ohm resistor is used to control the base current of the transistor Q1. D1 is a Freewheeling Diode. RL1 is the relay that is controlling the 12V Load.



Video: