Introduction: Oscilloscope,Frequency Counter and Component Tester Using Arduino

About: iam a B.E Electronics and Communication Engineer. I have great interest on electronics.

This device can able to perform Frequency Counting,Oscilloscope,Capacitance Measurement,Continuity Testing,Temperature and Humidity sensing,Digital Clock having TIME and DATE.This device will be useful for doing electronic projects.

Step 1: Components Required

LCD

  • 20 x 4 LCD

Micro Controller

  • Arduino Nano

Module

  • TP4056
  • 3V to 5V DC Stepup Converter

Temperature Sensor

  • LM 35

Humidity Sensor

  • DHT 22

Real Time Clock

  • DS1307 I2C Tiny RTC

Integrated Circuit

  • 74HC595N Shift Register
  • 74LS14 Schmitt Trigger

PCB

  • General Purpose PCB

Header Pins

  • Male Header Pins

Jumper Wire

  • Female to Female jumper wire-------7

Connectors

  • Two pin screw terminal--------5

Buzzer

  • Small piezo buzzer

Diode

  • 1N4007
  • 1N4148 --------- 2

Resistors

  • 5KΩ,220Ω
  • 10KΩ -------------3

Potentiometer

  • 10K pot

Buttons

  • Push Button-------2

Battery

  • 18650 Lithium Ion Cell

Switch

  • SPDT Switch

Step 2: Schematic Diagram

The potentiometer which i used in LCD is 10K.

CON 1

Frequency counter input.You can connect any external AC signal to know the frequency.

CON 2

Capacitance Meter input for Range 20 pF to 1000 nF.

CON 3

Capacitance Meter input for Range 1μF to 4700 μF.

CON 4

Oscilloscope input.You can connect any AC signal and view it in PC.

CON 5

Continuity Tester input.

Step 3: Schematic Diagram for PushButton

Reset button is used to reset the arduino to go back to initial menu.Function button is used to change the functions performed by arduino.Function button need to be long pressed to change the functions.

Step 4: Soldering the Schematic

I have soldered the circuits and header pins in general purpose pcb according to the schematic diagram.

Step 5: Soldering the LCD Interfacing Circuit

Step 6: Assembling

Step 7: Program Code

I have attached the program code in rar and txt format.Extract the rar file and open it in arduino IDE.

Step 8: LCD Interfacing Using Shift Register

Operation of the circuit

I had used shift register 74HC595N to interface LCD.This shift register will take three digital inputs and produce eight digital output.To save the digital I/O pins i have interfaced LCD using 74HC595N.

Step 9: Oscilloscope

Oscilloscope is one of the essential tool for electronics hobbyists to verify their designs.This oscilloscope can be designed at a very low cost and only thing that you need to have is an arduino and a computer.Here arduino board acts as a hardware for signal acquisition.You can use this oscilloscope to see different frequency wave forms.

Operation

The heart of the oscilloscope is arduino that reads the values from its inbuilt ADC and send these values to PC via USB port.For seeing the output you need to install an application in your Windows PC.To plot input signals as waveforms on your computer screen this application acts as the front-end.D1 and D2 as input protection circuit to pin A0 of the Arduino’s ADC.The 10K will work as a current limiter in case the input goes beyond 5V.We use pin A0 to capture the input signal.The captured input signal is fed to PC by UART-USB converter in the Arduino.A virtual COMP port is created whenever an arduino is connected to PC and this application will detect this COMP port then starts plotting signals visually using Graph libraries.Finally the output can be seen on the application screen.

Note

I tried to include this oscilloscope program code to the switch case statement in the main program.But it does not work out because for performing oscilloscope function arduino need to synchronize with the speed of PCSCOPE application.If i include this function in main program it reduces the execution speed of arduino.As a result PCSCOPE not detecting the arduino hardware.Solution to this problem can be overcome by reprogramming the arduino with oscilloscope program code whenever it is necessary to use this function and restore back the main program code having functions like Capacitance meter,Frequency Counter etc by programming the arduino.The program code for oscilloscope is given below.

How to use

  • Reprogram the arduino with oscilloscope program code.
  • Connect the arduino to PC and open the PCscope application.
  • Click on the connect button in the PCscope application.
  • connect any signal wave form to arduino at pin A0.
  • Now you can see the waveform in the PC scope application.

Software and Program code.

I have attached the PC scope software in RAR format.Download and extract it to install.

I have attached the program code in RAR and TXT format.Download the RAR file and extract it to open in arduino IDE.

Step 10: Output

I have used 5V transformer to check the Oscilloscope Output.You can see the output is a sine wave with 49Hz frequency.

Step 11: Frequency Counter

This frequency counter can be used to measure the frequency of any signal.

Operation

It consists of Schmitt trigger inverter 74LS14 is used to convert signals into square wave.If we fed any signal to 74LS14,the output will be a square wave.Then the square wave output is fed to arduino. Calculation of Ton and Toff period of square wave is done by the arduino.The time period of one cycle of signal is obtained by adding Ton and Toff period which is necessary for determining the frequency of the signal.As the16 MHz crystal oscillator used in arduino nano the measurement range of the frequency counter will be from 1Hz to 10MHz.The formula used to calculate frequency

f=1/pulseTotal.

pulseTotal=Ton+Toff

Where

f is frequency.

Step 12: Output

I have used arduino uno as signal generator for testing frequency counter output.

Step 13: Capacitance Meter for Range 1MicroFarad to 4700 MicroFarad

Working Principle

To measure the capacitance in the range of 1 µF to 4700 µF, we have to use the above circuit.The principle in this capacitance meter is one of the basic property of the capacitor that is finding Time Constant.Time Constant can be defined as time taken to charge a capacitor (C) through a resistor (R) to reach 63.2 % of the maximum supply voltage.Time Constant (τ) can also be defined as the time taken by a fully charged capacitor C to discharge to 36.8 % of its maximum voltage through a resistor R.

Small value capacitors such as picoFarad and nanoFarad will have less time constant and takes less time to charge.Likewise larger capacitors will have higher time constants.

Time Constant can be mathematically expressed as TC or τ = R x C.

Where

  • TC is the time constant of Capacitor in seconds (s),
  • C is the Capacitance of the Capacitor in Farads (F)
  • R is the Resistance of the Resistor in Ohms (Ω).

The above circuit and graph will show you the time constant curve for a Capacitor C, charging to supply voltage V through a Resistor R.Here also we use the same concept using Arduino.The unknown capacitor will be charged through a known resistance using Arduino pins and calculate the time it takes to reach 63.2 % of supply voltage.

We can calculate the Capacitance based on the time.The used to calculate capacitance is C = τ / R.To charge the capacitor we will use a 10 KΩ Resistor and to discharge the capacitor we use a 220 Ω Resistor.The voltage across the capacitor is measured using the Analog Input pin A1.The charge and discharge pins on Arduino are 8 and 9 respectively.

At first the capacitor is discharged using pin 9 by setting it as OUTPUT and LOW to make sure that there is no charge in the capacitor.Then we will start the timer and charge capacitor using the charge Pin8 by setting it as OUTPUT and HIGH.

Finally the voltage across the capacitor at the analog pin need to be monitored and we have to stop the timer once it reaches 63.2% of 5V and calculate the capacitance.

Step 14: Output

I have used 1000µF capacitor for measurement.

Step 15: Capacitance Meter for Range 20 PicoFarad to 1000 NanoFarad

Working Principle

We need to use different concept for measuring smaller capacitance.For this we need to understand about the internal structure of ATmega328P.All the I/O ports in ATmega328P Microcontroller have an internal pull – up resistor and an internal capacitor connected between the pin and ground. The above image shows the partial internal circuit of an I/O pin of ATmega328P Microcontroller.

We will be using the internal pull – up resistor and stray capacitor in this circuit by Ignoring the diodes in the above circuit.CT is the unknown capacitor need to be measured and CI is the internal capacitor. We need not want to worry about the internal capacitor and its value can be between 20 pF to 30 pF. The unknown capacitor is connected between A2 and A1. Here, A2 acts as the charging pin and A1 acts as the discharging pin.

At first we will charge the unknown capacitor by setting A2 as HIGH and measure the voltage at A1 by using the formula.


VA0 = (VA2 X CT)/(CT+CI)

We already know that the voltage at A1 with the help of analog read function.By using that value in the below equation, we can get the unknown capacitance as follows.


CT = (CI X VA0)/(VA2-VA0 )


Step 16: Output

I have used 100pF capacitor for measurement.

Step 17: Continuity Tester

Working Principle

The port D8 is held at HIGH by using digitalWrite function.Now we will get 5V at port D8 and anode of PN junction diode 1N4007 is connected to the port D8.We will get 4.7V at the cathode of PN Junction diode.The diode acts as a protection circuit and safeguards the port D8.When we connect the cathode of diode with port D7 by using a wire.The 4.7V will go to port D7.We will detect this voltage by using a digital read function.If this happens arduino can ensure that there is no discontinuity in the wire and print as LINE OK in LCD,also gives a beep sound.To avoid the false detection ground is given to D7 through a 5K resistor.

Step 18: Output

I have used a wire to check its continuity.

Step 19: Temperature and Humidity

It will measure and show the temperature,humidity level of your surrounding environment.

Operation

I have used LM35 as temperature sensor.It measures the surrounding temperature.We can also use DHT22 sensor for temperature measurement.But there is a reason why i have not used DHT22 it is because the temperature measurement range for DHT22 will be from 0 to 50 degree celsius only.Whereas LM35 has −55°C to 150°C temperature range.For detecting the humidity level i used DHT 22 sensor.This sensor will measure the humidity level.The range of this DHT22 will be 0-100%.

Step 20: Output

I have used LM35 and DHT 22 sensor for temperature and humidity measurement.

Step 21: Digital Clock

This digital clock will display TIME and DATE

Operation

I have used DS1307 RTC.It keeps record of time and date even when the power is not available once if the date and time is set.DS1307 RTC has a CMOS battery which is used to maintain the time and date when the power is not available.

See the below instructables to know about DS1307 RTC

Interfacing DS1307 I2C RTC With Arduino

Step 22: Output

Step 23: Battery Circuit

18650 Lithium Cell

Due to the dimension of the cell it is called as 18650 Lithium Cell.It's shape is in cylindrical with 18 mm diameter and height of 65 mm.They are rechargeable cells with 3.7V output.

To charge a single lithium ion cell it requires two stages

  1. Constant current (CC)
  2. Constant voltage (CV)

During CC the charger will supply constant current with increasing voltage till the voltage limit.Next during CV a voltage equal to maximum limit of cell will be applied during which the current declines steadily to the lower threshold current that is 3% of constant current.These operations are carried out by the TP4056 module which is highly reliable.

TP4056 Module

This module is used aslow cost charging solution to charge any type of single lithium ion battery.The module also has two LED indications.The Red color LED (L1) is used to indicate the ongoing charging condition. Blue color LED (L2) indicates the completion of charging.The charge voltage is 4.2V and the default current will be 1A.

3V to 5V DC Stepup Converter Module

This module is used to boost the 3V to 5V.The maximum voltage from 18650 lithium cell is 3.7V, but arduino requires 5V to operate.So we use this module to convert 3V to 5V.

Note

Instead of using two separate switches S1 and S2.I have used Single Pole Double Throw Switch(SPDT).

Step 24: Output Video

Microcontroller Contest

Participated in the
Microcontroller Contest