Friday, 31 August 2018

How to troubleshoot electronics?

The other day, a customer sent me a question:

“My touch lamp which was working perfectly for some months now fails. In this case what would be the first step to start fault finding with a multimeter?”

[OYVIND]:

For troubleshooting, I usually start by measuring voltages around the circuit.

I try to find points out that should have a certain voltage, then measure it.

When I find a voltage that does not make sense at a certain point, that’s a good place to continue investigating.

I look at the components that should create the voltage there, then try to figure out why the voltage is wrong.

After a while, I usually find the faulty part by using this strategy.

I used this strategy this repair my drone:

https://www.build-electronic-circuits.com/how-to-repair-electronics/

Keep On Soldering!
Oyvind @ build-electronic-circuits.com

Copyright Build Electronic Circuits

Basic Electronic Components

If you are new to electronics or starting to build electronic circuits, then the important thing to do is to get familiar with few Basic Electronic Components and Equipment. Without understanding these basic electronic components i.e. their values, ratings, purpose etc. your circuit design might not function as expected.

There are many electronic components like Resistors, Capacitors, LEDs, Transistors, etc. and there are also many equipment like a Power Supply, Oscilloscope, Function Generator (or Signal Generator), Multimeter, etc.

In this tutorial, you can get a brief overview of few of the most common basic electronic components. For more information about a particular component, you can check out the link associated with individual component.

Basic Electronic Components

There are many ways to classify different types of electronic components but the most common way is to classify them in to three types:

1)Active Electronic Components,

2)Passive Electronic Components and

3)Electromechanical Components.

Active Electronic Components

Strictly speaking, an Active Component is a device that acts as a source of energy, like a battery. But the definition of Active Components differs according to a few electronic engineers who perform circuit analysis. Active components are defined as the devices that depend on energy source and can introduce power into a circuit.

For example consider the diode, which is an active component. When the diode is connected to the circuit and energy source is applied, it immediately does not conduct the electrons. It starts conducting only when its threshold value is reached. Thus it depends on the energy source for its working. Hence it is an active component.

Active Electronic Components can control the flow of electrons through them. Some of the commonly used Active Components are Transistors, Semiconductors(Diodes), ICs (Integrated Circuits), Power Sources (Batteries, AC and DC Power Supplies), etc.

Diodes

A diode is a non-linear semiconductor device, that allows the flow of current in one direction. A Diode is a two – terminal device and the two terminals are Anode and Cathode respectively. The following is the symbol of a Diode.

There are again a variety of components that come under the category of Diodes. They are PN Junction Diode, Light Emitting Diode (LED), Zener Diode, Schottky Diode, Photodiode, and DIAC.

Table for different types of diodes

Diode Application
GUNN Diode Used in producing microwave signals
Laser Diode Used in fiber optic communications, barcode readers ,CD/DVD drives.
Light emitting diode Using lightening applications like aviation lightening, traffic signals, camera flashes.
Photodiode Used as high voltage rectifier, photo detector, radio frequency switch.
Step recovery Diode Used for  generation and shaping of high frequency pulses.
Tunnel Diode Used in microwave applications
Varactor diode Mostly used in radio frequency applications.
Zener Diode Mostly used as voltage reference diodes

Transistors

Transistor, the invention that changed the future of electronic circuits. It is a semiconductor device that can be used to either switch electrical power or amplify electronic signals.

A Transistor is a 3 terminal device that can be either a current controlled device or a voltage controlled device.Different types of transistors exists.Basically they are classified as

1) Bipolar Junction Transistors (BJT) and
2) Field Effect Transistors (FET).

They can be further classified as shown below

More information on TRANSISTORS.

Integrated Circuits (ICs)

An Integrated Circuit or an IC is an integration or incorporation of several electronic components (mainly transistors) on a single device (or chip) made up of a semiconductor material (usually Silicon).

Almost all electronic devices like TVs, Mobile Phones, Laptops, Audio Players, Routers, etc. have Integrated Circuit in them.

ICs are again divided into Analog ICs and Digital ICs. Analog ICs work on Analog Signals like Temperature, Audio, etc. which are continuously varying in nature. Digital ICs on the other hand, work on Discrete Signals i.e. zero volts and a non-zero volts (like 5V or 3.3V) that are represented as Binary 0 and 1.

Basic Electronic Components Image 6

The commonly used IC in basic electronic circuits are Op – Amps (Operational Amplifiers) like LM741, Timers like NE555, Microcontrollers like AT89S52, Counters like CD4017 and Motor Drivers like L293D.

Vacuum Tubes

Before the invention of transistor vacuum tubes were used in place of transistors. This is defined as an electron tube that controls the flow of electrons in vacuum. CRT screens used in old TVs and computer monitors are best examples for vacuum tubes.

Power sources

DC Power Supply

Bench Power Supply is an important piece of equipment when it comes to working around electronic circuits. Electronic components majorly work on DC Power Supply and hence having a reliable source of DC Power Supply is very important.

There are many types of Power Supplies like AC – to – DC Power Supplies, Linear Regulators, Switching Mode Power Supply, etc.An alternative to bench power supply is to use a wall adapter as per the project requirement like 5V or 12V.

Batteries

Battery is a device that converts chemical energy in to electrical energy and provides power to devices like mobile phones, laptops, flashlights, etc. In electronics, we often use batteries to power our circuits, either to make the circuit portable or just to test the functionality of the circuit.

Batteries come in different sizes and voltage. Batteries are also classified as Primary and Secondary. You can use Primary Batteries until they are drained out and discard them later. In case of Secondary Batteries, you can use them even after they are drained out by recharging them.In electronic circuits, we often use 1.5V AA Batteries or 9V PP3 Batteries.

Display Devices

16 x 2 LCD

The most commonly used display module in electronic circuits is an LCD Display and in particular, a 16 x 2 LCD Display. It is an alphanumeric display with two rows and 16 columns and can display a maximum of 32 characters.

7 – Segment Display

Another common display module is the Seven Segment Display. It can be used to display decimal numerals in different electronic devices like clocks, meters, calculators, public information systems, etc.

Passive Components

Passive Components cannot control the flow of current through them i.e. they cannot introduce energy in to the circuit but can increase or decrease voltage and current.

These components don’t depend on the energy source for their operation.Two terminal components like Resistors, Capacitors, Inductors and transformers are examples of Passive Components.

Resistors

The basic of all electronic components are the Resistors. It is a passive electronic components that introduces electrical resistance in to the circuit. Using resistors, we can reduce the current, divide voltages, setup biasing of transistors (or other active elements), etc.

Basic Electronic Components Image 7

Read about Resistors here: INTRODUCTION TO RESISTORS.

Ohm’s Law defines the behavior of a resistor which states that the current through a conductor is directly proportional to the voltage across the conductor. The proportionality constant is called as Resistance.

The mathematical representation of Ohm’s Law is I = V/R.

Different types of resistors can be defined according to their function,size,characteristics etc.Resistors are divided in to Fixed Resistors and Variable Resistors.

Fixed Resistors, as the name suggests, have a fixed resistance and its resistance doesn’t change due to external parameters.Variable Resistors, on the other hand, have a variable resistance that can either be changed manually or controlled by external factors like Light Dependent Resistor (LDR) or Thermistor. Below  image shows different types of resistors available.

types of resistors

Capacitors

The second important passive components is a capacitor, a device that stores energy in the form of electric field. Most capacitors consists of two conducting plates that are separated by a dielectric material.

If Q is the charge on any one of the conductor plates and V is the voltage between them, then the Capacitance C of the Capacitor is C = Q/V.

Basic Electronic Components Image 9

In electronics circuits, a capacitor is mainly used to block DC Current and allow AC Current. The other applications of capacitors are filters, timing circuits, power supplies and energy storing elements.

There are many types of Capacitors like Polarized, Non – Polarized, Ceramic, Film, Electrolytic, Super Capacitors etc.

Also Read INTRODUCTION TO CAPACITORS.

Inductors

If capacitors store energy in the form of electric field, then inductors are devices that store energy in the form of Magnetic Field. Inductor is nothing but a wire that is wound in the form of a coil.

Inductor is  widely used in AC equipment like filters, chokes, tuned circuits etc.

Basic Electronic Components Image 10

The core around which the coil is wound i.e. air, iron, ferrite etc. will determine the strength of the magnetic field. Inductors opposes the change in electric current through them and the changes in current will result in induction of voltage. 

More information on INDUCTORS.

Basic Test and Measurement Equipment

When it comes to designing electronic circuits, testing and measuring various parameters like current, voltage, frequency, resistance, capacitance, etc. is very important. Hence, the Test and Measurement Equipment like Oscilloscopes, Multimeters, Logic Analyzers, Function Generators (or Signal Generators) are often used regularly.

Oscilloscope

The most reliable Test Equipment for observing continuously varying signals is an Oscilloscope. With the help of an Oscilloscope, we can observe the changes in an electrical signal like voltage, over time.

Oscilloscopes are used in a wide range of field like Medical, Electronic, Automobile, Industrial and Telecommunication Applications.

Basic Electronic Components Image 15

Originally, Oscilloscopes are made up of Cathode Ray Tube (CRT) displays but nowadays, almost all Oscilloscopes are Digital Oscilloscopes with advanced features like storage and memory.

Multimeter

A multimeter is a combination of Voltmeter, Ammeter and Ohmmeter. They provide an easy way to measure different parameters of an electronic circuit like current, voltage etc.

Multimeters can measure values in both AC and DC. Earlies Multimeters are Analog and consists of a pointing needle. Modern Multimeters are Digital and are often called as Digital Multimeters or DMMs.

Basic Electronic Components Image 16

DMMs are available as handheld devices as well as bench devices. A Multimeter can be very handy in finding basic faults in a circuit.

Function Generator or Signal Generator

A Signal Generator, as the name suggests, generates a variety of signals for testing and troubleshooting electronic circuits. The most common types of signals are Triangular Wave, Sine Wave, Square Wave and Sawtooth Wave.

Basic Electronic Components Image 17

Along with a bench power supply and oscilloscope, a function generator is also an important piece of equipment when designing electronic circuits.

In this article, we have seen few Basic Electronic Components and Test Equipment that we come across very frequently when designing or testing electronic circuits.

There are a lot more components like Transformers, Buttons, Switches, Connectors, etc. which we can explore as we move forward with a project.

The post Basic Electronic Components appeared first on Electronics Hub.

Interfacing 128×64 OLED Graphic Display with Arduino – Hook-up Guide & Tutorial

In this project, we will learn about 128×64 Graphics Display, how to interface a 128×64 OLED Graphic Display with Arduino and finally I will display few graphical images and text on this display using Arduino UNO. So, let’s get started.

Interfacing 128x64 OLED Graphic Display with Arduino Logo Display

Introduction

In almost all the projects that I have implemented so far, I have used the traditional 16×2 Alphanumeric LCD Display to display any vital information from Arduino. It is a great display option if your requirement is to display number and alphabets (and a few special characters as well) in your project.

The main limitation of 16×2 LCD displays is that you are constrained to displaying just numbers and alphabets and if you want to display small graphical images, then the struggle begins.

Here comes the 128×64 Graphics OLED Display to the rescue. It is a tiny little display module that can be used to display small graphical images easily using Arduino (or any other microcontroller).

A Brief Note on 0.96 inch 128×64 OLED Graphic Display

Before discussing about the 128×64 Graphical OLED Display Module and interfacing it with Arduino, let me show you the module used in this project. The following image shows a typical 0.96” OLED Graphic Display Module with a resolution of 128×64 Pixels.

Interfacing 128x64 OLED Graphic Display with Arduino 0.96 OLED Display

This is a monochrome OLED Display with while light and since it is an OLED display, there is no concept of backlight as individual pixel is self-illuminating. This 128×64 Pixel OLED Display measures about 0.96” diagonally. So, you can understand by this dimension that it is a fairly small display module.

NOTE: I am not sure whether there is any voltage regulator on the board so I have connected it to 3.3V supply (as the OLED Driver/Controller IC is rated for 3.3V). Some boards include a voltage regulator.

Any display module must have an appropriate Driver/Controller Module associated with it. In case of our traditional 16×2 LCD Displays, it is HD44780 IC. Coming to the 128×64 OLED Display module, the Driver module is SSD1306 from Solomon Systech.

This particular driver IC is suitable for driving OLEDs and PLEDs of a resolution of 128×64 Pixels.

Interfacing 128x64 OLED Graphic Display with Arduino 0.96 OLED Display Rear

The SSD1306 OLED Driver IC supports various interfaces like Parallel, 4-wire SPI, 3-wire SPI and I2C. This particular OLED Graphic Display which I am using has pins for I2C Communication and interfacing with Microcontrollers.

Interfacing 128×64 OLED Graphic Display with Arduino

Now that we have seen a little bit about the 0.96” OLED Display, let us now proceed with interfacing a 0.96” 128×64 OLED Graphic Display with Arduino. There are two important things to remember before proceeding with the interface.

First thing is the power supply. Find out the power supply requirements of your board and connected to appropriate power supply pin i.e. 5V or 3.3V.

The next important thing is the communication interface. Some modules come with both SPI and I2C Interface pins on board. Check out the pins on your board and proceed with the interface of your choice.

In my case, I have connected the OLED Display Module to 3.3V Supply and as my board has only I2C Communication i.e. SDA and SCL Pins, I have used the same.

Finally, using appropriate libraries with your Arduino IDE. I will talk about the libraries and special tools in the Code section.

Circuit Diagram

The circuit diagram for interfacing 128×64 OLED Graphic Display with Arduino UNO is shown in the following image.

Interfacing 128x64 OLED Graphic Display with Arduino Circuit Diagram

Components Required

  • Arduino UNO
  • Monochrome 0.96” 128×64 OLED Graphic Display
  • Breadboard
  • Connecting Wires
  • 10KΩ Potentiometer (optional)

Circuit Design

Connect the VCC and GND of the OLED display to 3.3V and GND of Arduino. Then the connect the SDA and SCL pin of the display module to A4 and A5 (Analog Inputs) of Arduino UNO.

Optional Connection: Just to demonstrate the output, I have connected a 10KΩ POT to A0 of Arduino (with its other terminals being connected to 5V and GND).

Download Necessary Libraries

Before looking at the code, you need to gather a few things. First thing is the libraries used to drive the OLED Display. You need to download two special libraries: one is for the SSD1306 OLED Driver and the other is for all the Graphics related functions like drawing lines, pixels, circles etc.

These libraries are developed by Adafruit and are called Adafruit_SSD1306 and Adafruit_GFX. You can download these libraries from the following links: Adafruit_SSD1306 and Adafruit-GFX-Library.

Download the zip files, extract the contents and place them in libraries folder of Arduino.

The second important thing is that if you want to display any small graphical images, you need to convert them to byte arrays. There are many tools but I have used this online tool.

First, convert your image to a bitmap image (.bmp) file using photoshop or paint. It is important that your image is of the same resolution as you OLED Display i.e. 128×64 in my case.

Code

I have used two codes in the project. One code is just for displaying few random graphical images of different logos and the other code is to display the value read from the Potentiometer connected to Arduino. I have included both the codes.

Interfacing 128x64 OLED Graphic Display with Arduino POT Value Display

IMPORTANT NOTE: Before uploading the code, you need to set the resolution of your OLED Display i.e. whether 128×64 or 128×32 by commenting/uncommenting the appropriate value in the Adafruit_SSD1306.h file in the libraries. Do not forget this step.

Code for Logo

Code for POT Value

The post Interfacing 128×64 OLED Graphic Display with Arduino – Hook-up Guide & Tutorial appeared first on Electronics Hub.

Wednesday, 29 August 2018

Clap Switch Circuit for Devices using 555 and 4017

We have already seen the circuit diagram, working and applications of 9 way Clap Switch Circuit. Now, we are going to deal another circuit named clap switch circuit for devices. I will present two circuits for clap switches, both of these circuits will be based on 555 IC and 4017 IC.

Clap Switch Circuit for Devices using 555 and 4017 Image

Using these circuits, you can control electrical appliances by simple clapping. Summary of the project given below:

Clap Switch Circuit Summary

  • If you wish to “ON” and “OFF” the device without moving from your place, then this circuit is helpful for you.
  • One more plus point of this circuit is that there is no fear of the electrical shocks as you are not required to touch any of the mechanical switches physically.
  • Visual indication of the devices is also provided to you.
  • With the help of this circuit, speed of the fan can also be controlled by connecting regulator with individual outputs.

Clap Switch Circuit using 555 and 4017

In the first circuit, I will control a single relay using clap switch. When you clap once, the relay is activated and the light (or any load) is turned ON. When you clap for the second time, the relay is deactivated and the light is turned OFF.

Circuit Diagram

Clap Switch Circuit for Devices using 555 and 4017 Circuit Diagram

Components Required

  • 555 IC
  • CD4017 IC
  • Relay
  • Resistors – 100Ω, 560Ω, 4.6KΩ, 18KΩ x 3, 33KΩ
  • Capacitors – 0.1µF x 2, 4.7µF
  • Microphone
  • BC547
  • 1N4004 Diode
  • LED

PCB for Clap Switch Circuit

I have made a simple PCB for the above mentioned clap switch circuit. The PCB layout is shown on the following image.

Clap Switch Circuit for Devices using 555 and 4017 PCB Layout

If you want to make your own PCB, I have included the Eagle CAD PCB Files. You can download them from here.

Clap Switch Circuit for Multiple Devices

In the second circuit (similar to the one above), I have added a few extra relays to control additional devices.

Circuit Diagram

Clap Switch Circuit Diagram

Circuit Diagram of Clap Switch – ElectronicsHub.Org

Circuit Components

  • IC
    • IC1(NE555) – 1
    • IC2(CD4017) – 1
  • Resistor
    • R1,R4(10K) – 2
    • R2,R7,R8,R9(1K) – 4
    • R3(2.2K) – 1
    • R5(220E) – 1
    • R6(150) – 1
  • C1,C2(.1uf) – 2
  • C3(1uf) – 1
  • C4(4.7uf) – 1
  • Mic – 1
  • LED – 3
  • T1(BC548) – 1
  • T2,T3,T4(BC547) – 3
  • Relay – 3

Clap Switch Circuit Description

Along with some of the other components, this circuit is mainly based on the two ICs i.e. NE555 timer along with CD4017.

IC 555 timer in this circuit is wired like a monostable oscillator. For this circuit, IC NE555 monostable produces a clock pulse, which is used to give an oscillating wave at IC1 pin 3 which is an output pin. Monostable (or you can say one shot multivibrator) contains only one steady state and all we need is to trigger it externally to return it in reverse direction to its original state.

Another one is the CD4017 which is a CMOS counter/divider IC. It receives a clock signal through the clock input and in the sequential manner it turns ON all the 10 outputs, every time it gets the clock input pulse.

In order to get familiar with the working of the IC, it is essential for the one  to get familiar with the every pin of the IC. These IC consist of 3 input pins along with 10 output pins also have one pin for ground and one more for the power supply and one more pin for the Carry out. Pin diagram of the IC is designed below –

IC 555 Pin Diagram

  1. Input Pin:
    • Reset Pin (Pin 15) – The counter is reset to the zero position by this pin. Suppose you wish that the counter will only count till third position then you need linked the fourth pin with 15 pin. So after reaching to the third output it will automatically begin its counting from zero.
    • Clock Pin (Pin14) – In each of the timing pin 14 moves at high the output will be given to you. From the initial clock pulse output will be received at the pin 3 likewise for the next clock pulse output will be received at the pin 2 and so on.
    • Clock Inhibit Pin (Pin 13) – The counter is switched to “on” and “off”  by this pin. If you need that the counter to be switched off then for that pin 13 must be at high state. If the pin is at high then it will disregard the clock pulse without paying attention that how much time you press the switch i.e. the count will not go forward. Pin 13 in our circuit is grounded.
  2. Output Pin (Pin Q0- Q9) -It is used to get the input in chronological order. Like pin 3  will give you the output for the first pulse and so on.
  3. Ground Pin (Pin 8) and Supply pin (pin 16) – For the proper working of these IC these pins are used to give ground as well as power supply.
  4. Carry out Pin (Pin 12) – These pins are used to link one or more CD4017 IC with each other. Suppose    you have a desire to connect one more CD4017 IC then attach pin 12 to the clock input to its next one. The carry pin of first CD4017 is connected to clock input of the second and the carry pin of the second is connected to the clock input of the third and so on. In our circuit we left this pin as we have desire of only one IC in our circuit.

How Clap Switch Circuit Works?

At the time when some one slap in front of the Mic the sound signal is converted into the electrical signal by the condenser microphone.These signals are then given to the transistor T1 base which in return trigger the IC1 pin2. And with the help of the formula shown below the time period for which the output stay in the high position can be calculated –

T = 1.1*R5*C4

At the moment the output from the IC1 pin 3 is given to CD4017 decade counter 14 pin, which supply a clock pulse for the proper working of IC2. The counting of the CD4017 begins from the zero after getting the clock input. And it moves to forward one by one at each time whenever pin 14 moves to high (as in front of the mic we clap). Like we get output from the pin 2 for the first clap i.e. Q1 and LED1 will shine and the device connected to relay start operating . While for the second clap output will receive at pin 4 and LED2 will shine while at this time LED1 turn off and so on. At each output point you need to attach the individual relay .10 individual devices can be controlled with the help of this circuit just connect the relay at appropriate outputs of CD4017.

Note: For some more interesting projects and circuit diagrams, visit Mini Projects on Electronics.

The post Clap Switch Circuit for Devices using 555 and 4017 appeared first on Electronics Hub.

Arduino DS3231 RTC Module Tutorial

In this project, I will discuss about DS3231 RTC Module, important components and features of this module and finally show you how to Interface a DS3231 Real Time Clock (RTC) Module with Arduino.

Arduino DS3231 RTC Module Tutorial Introduction

Introduction

Real Time Clock or RTC is a timekeeping device in the form of an Integrated Circuit or IC. RTC is an integral component of many time critical applications and devices like Servers, GPS, Data Loggers etc.

I have already implemented a couple of projects using Real Time Clock or RTC Module earlier with both 8051 Microcontroller and Arduino.

With 8051, I have used DS1307 RTC Module in a project called RFID BASED CAR PARKING SYSTEM. Coming to Arduino, I have used the same DS1307 RTC in ARDUINO ALARM CLOCK and ARDUINO REAL TIME CLOCK TUTORIAL USING DS1307. If you want a quick reference, you can go through the provided links.

Also, in the Arduino Real Time Clock Tutorial using DS1307 project, I have talked about the need for an RTC. So, I won’t go into that aspect again. I will directly jump into the IC of interest: the DS3231 RTC IC.  

A Brief Note on DS3231 RTC IC

The DS3231 is an RTC IC developed by Maxim Integrated. It is a low cost, extremely accurate RTC IC with communication over I2C Interface. An interesting feature of DS3231 RTC IC is that it has integrated crystal oscillator and temperature sensor and hence you don’t have to connect an external crystal.

It is available in SO-16 Package. Although it needs only 8 pins in the available 16 pins to function, the integration of crystal makes the IC bulkier and hence it is packed as a 16-pin IC instead of 8-pin IC.

The following image shows the Pin diagram of the DS3231 RTC IC.

Arduino DS3231 RTC Module Tutorial DS3231 IC Pins

Pin Description of DS3231 IC

Coming to the pin description of DS3231 IC, the following table gives a simple functionality overview of the pins.

Pin Number

Pin Name

Description

1

32KHz

32KHz output

2 VCC

DC Power Pin

3

INT/SQW Active LOW Interrupt or Square wave output
4 RST

Active LOW Reset

5 – 12

NC No Connection

13

GND

Ground

14 VBAT

Back-up Power Supply Input from Battery

15

SDA

Serial Data I/O

16

SCL

Serial Clock Input

NOTE: Pins 5-12 are NC Pins. They can be tied to GND.

DS3231 RTC Module

Using DS3231 IC as the main component, several manufacturers developed DS3231 RTC Modules with all the necessary components. Almost all the modules available today consists of an additional IC, 24C32N (or something similar). This secondary IC is an EEPROM IC of 32Kb size.

Since both RTC and EEPROM ICs are interfaced through I2C Protocol, you won’t need any extra pins as both these I2C Devices can act as slaves while a microcontroller acts as a master.

The DS3231 RTC Module used in this project is shown in the image below.

Arduino DS3231 RTC Module Tutorial DS3231 Real Time Clock Module

Since RTC is all about maintaining time irrespective of the power supply, you can connect a 3V CR2032 Lithium Battery to the RTC IC to keep the clock ticking. In the DS3231 Module, there is a provision for you to connect a battery using the battery holder provided on the back.

Arduino DS3231 RTC Module Tutorial DS3231 RTC Module Back

Components and Pin of DS3231 RTC Module

As mentioned earlier, DS3231 IC and 24C32 EEPROM IC are the main components on a typical DS3231 RTC Module board. Apart from that, there are a few other components like Power ON LED, few resistors, capacitors, a battery holder and pins for connecting with microcontroller.

The following image shows the components and pins on the DS3231 RTC Module.

Arduino DS3231 RTC Module Tutorial DS3231 RTC Module Components

Interfacing DS3231 RTC Module with Arduino

If you remember an earlier project using MicroSD Card Adapter, I have setup a simple data logging application where the data from a sensor is captured and stored in the microSD Card in the form of a text file.

By integrating a Real Time Clock like DS3231 to the above project, you can keep track of the data log with accurate time details.

Hence, interfacing DS3231 RTC Module with Arduino has a numerous application and advantages.

Circuit Diagram

Arduino DS3231 RTC Module Tutorial Circuit Diagram

Components Required

  • Arduino UNO
  • DS3231 RTC Module
  • 16×2 LCD Display
  • Mini Breadboard
  • 10KΩ POT
  • Connecting Wires

Circuit Design

First, let me begin the connections between Arduino and DS3231. Since the interface between them is I2C, identify the I2C Pins on your Arduino Board (if you are using any other board than UNO).

In Arduino UNO, A4 and A5 are SDA and SCL pins. Connect these pins with corresponding SDA and SCL pins of the DS3231 Module. Also, connect the VCC and GND of the RTC Module to +5V and GND of Arduino.

Arduino DS3231 RTC Module Tutorial Circuit Design

To view the output, I have used an LCD Module. Connect the RS and E pins of LCD to Pins 7 and 6. Connect D4-D7 of LCD to 5-2 of Arduino.

Code

I have used a special library called “RTClib” from Adafruit (which is a forked version of JeeLab’s RTC Library). Download the library from this link and place the extracted folder in the libraries directory of Arduino.

Since the communication is I2C, I have also used the “Wire” library. You don’t need to download this library as it is integrated with Arduino IDE.

Working

The working of the Arduino DS3231 RTC Module Interface is very easy. Arduino first initializes the RTC Module with its slave address (0x68 for DS3231 IC).

Arduino then updates the internal registers of the RTC IC with the date and time at which the code is compiled and uploaded to Arduino. The uploaded date and time can be viewed on the LCD display.

Arduino DS3231 RTC Module Tutorial Output

If you want the DS3231 Module to keep time even after you disconnect power to Arduino, you can connect a 3V Lithium Battery.

Applications

  • Servers
  • Data Loggers
  • GPS Modules
  • Power Meters

The post Arduino DS3231 RTC Module Tutorial appeared first on Electronics Hub.

Basic Electrical Circuits-Components,Types

What is an Electric Circuit?

An Electric Circuit is a closed path for transmitting an electric current through the medium of electrical and magnetic fields. The flow of electrons across the loop constitutes the electric current. Electrons enter the circuit through the ‘Source’ which can be a battery or a generator. The source provides energy to the electrons, by setting up an electrical field which provides the electromotive force.

The electrons leave the circuit through the load, to the earth ground, thus completing a closed path. The load or output can be any simple home appliance like television, lamp, refrigerator, or can be a complex load such as that on a hydroelectric power generating station.

A simple electric circuit consists of a source (such as a battery), wires as conducting medium and a load (such as a light bulb). The battery provides required energy for flow of electrons, to the light bulb.

Basic Circuit Elements

As mentioned above in the introduction, a circuit is an interconnection of elements. These elements are classified into active or passive elements, based on their capability to generate energy.

Active Circuit Elements

Active Elements are those which can generate energy. Examples include batteries, generators, operational amplifiers and diodes. Note that in an electrical circuit, the source elements are the most significant active elements.

An energy source, whether a voltage or current source, is of 2 types – Independent and Dependent sources. Example of an Independent source is the battery which provides a constant voltage to the circuit, irrespective of the current flowing through the terminals.

Example of a dependent source is a transistor, which provides current to the circuit, depending upon the voltage applied to it. Another example is an Operational Amplifier, which provides voltage, depending upon the differential input voltage applied to its terminals.

Passive circuit Elements

Passive Elements can be defined as elements which can control the flow of electrons through them.They either increase or decrease the voltage. Here are some examples of passive elements.

Resistor: A resistor opposes the flow of current through it. For a linear circuit, Ohm’s law is applicable, which states that voltage across the resistor is directly proportional to the current flowing through it, the proportional constant being the resistance.

Inductor: An inductor stores energy in form of the electromagnetic field. The voltage across an inductor is proportional to the rate of change of current flowing through it.

Capacitor: A capacitor stores energy in form of the electrostatic field. The voltage across a capacitor is proportional to the charge.

Types of Electrical Circuits

DC Circuits

In DC Circuits, the excitation applied is a constant source. Based on the type of connection of active and passive components with the source, a circuit can be classified into Series and Parallel circuits.

Series Circuits

When several passive elements are connected in series with an energy source, such a circuit is known as a series circuit. For a series circuit, same amount of current flows through each element and voltage is divided. In series circuit, as the elements are connected in a line,if there is faulty element among them ,complete circuit acts as open circuit.

series circuit

  • For a resistor connected in DC circuits, the voltage across its terminals is directly proportional to the current passing through it, thus maintaining a linear relationship between the voltage and current. For resistors connected in series, the total resistance is equal to the sum of all resistance values.
  • For capacitors connected in series, the total capacitance is equal to the sum of reciprocals of all capacitance values.
  • For inductors connected in series, total inductance is equal to the sum of all inductance values.

Parallel Circuits

In a parallel circuit, one terminal of all the elements is connected to the one terminal of the source and the other terminal of all elements is connected to the other terminal of the source.

In parallel circuits, the voltage remains the same in the parallel elements while the current changes. If there is any faulty element among parallel elements there is no effect on the circuit.

parallel circuit

  • For resistors connected in parallel, the total resistance is equal to the sum of reciprocals of all resistance values.
  • For capacitors connected in series, the total capacitance is equal to the sum of all capacitance values.
  • For inductors connected in series, total inductance is equal to the sum of all reciprocals of inductance values.

AC circuits

Ac circuits are those circuits, Whose excitation element is an AC source. Unlike DC source which is constant AC source has variable current and voltage at regular intervals of time. Generally, for high power applications, AC circuits are used.

Simple AC Circuit using resistance

For alternating current passing through the resistor, the ratio of current and voltage depends upon the phase and frequency of the supply. The applied voltage will change constantly with time and Ohm’s law can be used to calculate current passing through the resistor at any instant of time.

In other words, if at time t seconds, the value of voltage is v volts, current will be:

i = v/R

where the value of R is always constant.

Above equation shows that polarity of current depends upon that of the voltage. Also, both current and voltage reach their maximum and zero points at the same time. Thus, for a resistor, voltage is in phase with the applied current.

Consider the below circuit diagram

Direction of flow of AC current

When the switch is closed, current passes through the resistor and is given by the below equation

i=Im cos(ωt+Φ)

Voltage,V=IR=RIm cos(ωt+Φ)

For a resistor, both voltage and current values will rise and fall at the same time. Hence, the phase difference between voltage and current is zero.

AC Circuit using pure inductance

A coil of thin wire wrapped on a cylindrical core is known as an Inductor. The core can be an air core (hollow laminated) or an iron core. As alternating current flows through the inductor, the magnetic field also changes. This change in magnetic field results in an induced voltage across the inductor. As per Lenz law, the induced voltage is such that it opposes the flow of current through it.

During the first half cycle of the source voltage, the inductor stores energy in form of magnetic field and in the next half, it releases energy.
The induced EMF is given as below

e=Ldi/dt

Here, L is the self-inductance.

Now, Input AC voltage applied is given as v(t)=Vm Sinωt

Current through the inductor is:I(t)=Im Sinωt

AC Applied Across a Pure Inductor

So, the voltage across the inductor would be

e=L di/dt=wLI_m cos⁡wt=wLI_m sin⁡(wt+90)

Thus, for an inductor, voltage leads the current by 90 degrees.

Now, resistance by an inductor is termed as Reactance and given by

Thus, impedance or resistance is proportional to rate of change of current for an inductor.

AC Circuit with a capacitor

For a constant DC supply, the capacitor plates charge up to the applied voltage, stores this charge temporarily and then starts discharging. Once a capacitor is fully charged, it blocks the flow of current as the plates get saturated.

AC Applied Across a Pure Capacitor
When AC supply voltage is applied to a capacitor, the rate of charging and discharging depends upon the supply frequency. Voltage across the capacitor lags the current flowing through it by 90 degrees.

Current through the capacitor is given as

e = Ldi/dt

The capacitive reactance is given as:

e = Ld/idt

Thus, impedance or reactance to AC supply is inversely proportional to the frequency of supply.

What is a short circuit and an open circuit?

Short Circuit

A low or negligible resistance connection between two conductors in an electric circuit is termed as a short circuit. A short circuit would result in the production of more heat and eventually resulting in sparks, flames or smoke.

A short circuit can be caused due to loose connections, faulty insulation, abrupt chewing up of wires by pests, and old appliances. One of the best and commonly used techniques to prevent damages using short circuit is using a fuse or a circuit breaker.

Open Circuit

An open circuit is caused due to an interruption in the electrical circuit. When any element in a circuit is left unconnected, an open circuit is created. While voltage across an open circuit has some finite value, current is zero.

Circuit Protection

Deliberate installation of a weak link within an electrical circuit is known as circuit protection. Purpose behind this installation is the prevention of damage due to short circuit, excess amount of temperature and other damages.
A circuit protection device can be a fuse, circuit breaker, a thyristor or a switch.

The post Basic Electrical Circuits-Components,Types appeared first on Electronics Hub.

Tuesday, 28 August 2018

Researchers 3D print prototype for 'bionic eye'

A team of researchers has, for the first time, fully 3D printed an array of light receptors on a hemispherical surface. This discovery marks a significant step toward creating a 'bionic eye' that could someday help blind people see or sighted people see better.

New sensor could help doctors monitor patient progress from a distance

A self-powered sensor could allow doctors to remotely monitor the recovery of surgical patients. The small, tube-like device is designed to be fitted to braces after joint surgery to wirelessly send information to computers, smartphones or smartwatches to track range of motion and other indicators of improvement.

Carbon in color: First-ever colored thin films of nanotubes created

A method can produce large quantities of pristine single-walled carbon nanotubes in select shades of the rainbow. The secret is a fine-tuned fabrication process -- and a small dose of carbon dioxide. The films could find applications in touch screen technologies or as coating agents for new types of solar cells.

All wired up: New molecular wires for single-molecule electronic devices

Scientists have designed a new type of molecular wire doped with organometallic ruthenium to achieve unprecedentedly higher conductance than earlier molecular wires. The origin of high conductance in these wires suggests a potential strategy for developing of novel molecular components, which could be the building blocks of future minuscule electronic devices.

Monday, 27 August 2018

Nano-imaging of intersubband transitions in few-layer 2-D materials

A study reports on the first observation of intersubband transitions in 2-D materials via scattering scanning near-field optical microscopy.

Water vapor annealing technique on diamond surfaces for next-generation power devices

The existing surface termination technique using hydrogen to stabilize the diamond's structure for application in electronic power devices results in two-dimensional hole gas layers (2DHG). Attempting to remove these layers using oxygen-termination roughens the diamond surface and leads to degradation of the device performance. To overcome this, researchers removed 2DHG from diamond using water vapor annealing and maintained an atomically flat surface.

Getting a charge out of MOFs

Researchers have made a metal organic framework (MOF) with the highest electron charge mobilities ever observed, along with a technique to improve the conductivity of other MOFs.

Thursday, 23 August 2018

Arduino MCP2515 CAN Bus Interface Tutorial

In this project, we will learn about the MCP2515 CAN Controller Module, how to interface the MCP2515 CAN Bus Controller with Arduino and finally how to enable communication between two Arduino board with the help of two MCP2515 CAN Controllers and the CAN Protocol.

Arduino MCP2515 CAN Bus Interface Image

Introduction

Controlled Area Network of simple CAN is a bus standard that allows a Microcontroller and its peripheral devices to communicate without the need of a host device or a computer.

Developed by Robert Bosch GmbH, CAN is protocol is main used in automobiles for communication between a control unit and its components.

For example, the Engine Control Unit is a major control using in a car. This unit is connected to many sensors and actuators like air flow, pressure, temperature, valve control, motors for air control etc. The communication between these modules and the control unit is through CAN Bus.

In order to understand a little bit more about CAN Bus, CAN Controller and other important aspects, the MCP2515 CAN Bus Controller Module is very helpful.   

Also read: BASICS OF SPI COMMUNICATION.

A Brief Note on MCP2515 CAN Bus Controller Module

The MCP2515 CAN Bus Controller is a simple Module that supports CAN Protocol version 2.0B and can be used for communication at 1Mbps. In order to setup a complete communication system, you will need two CAN Bus Module.

The module used in the project is shown in the image below.

Arduino MCP2515 CAN Bus Interface MCP2515 CAN Module

This particular module is based on MCP2515 CAN Controller IC and TJA1050 CAN Transceiver IC. The MCP2515 IC is a standalone CAN Controller and has integrated SPI Interface for communication with microcontrollers.

Coming to the TJA1050 IC, it acts as an interface between the MCP2515 CAN Controller IC and the Physical CAN Bus.

The following image shows the components and pins on a typical MCP2515 Module.

Arduino MCP2515 CAN Bus Interface MCP2515 CAN Module Components

Schematic of MCP2515 CAN Bus Module

Before seeing the schematic of the module, you need to understand a couple of things about both the ICs i.e. MCP2515 and TJA1050.

MCP2515 IC is the main controller that internally consists of three main subcomponents: The CAN Module, the Control Logic and the SPI Block.

CAN Module is responsible for transmitting and receiving messages on the CAN Bus. Control Logic handles the setup and operation of the MCP2515 by interfacing all the blocks. The SPI Block is responsible for the SPI Communication interface.

Coming to the TJA1050 IC, since it acts as an interface between MCP2515 CAN Controller and the physical CAN Bus, this IC is responsible for taking the data from the controller and relaying it on to the bus.

The following image shows the schematic of the MCP2515 CAN Module and it shows how MCP2515 IC and TJA1050 IC are connected on the Module.

Arduino MCP2515 CAN Bus Interface MCP2515 Schematic

Circuit Diagram for Interfacing MCP2515 with Arduino

The following image shows the circuit diagram of interfacing MCP2515 CAN Module with Arduino and possible communication between two Arduino over CAN Protocol.

Arduino MCP2515 CAN Bus Interface Circuit Diagram

If the pins of the MCP2515 Module are not clear, the following image might be useful.

Arduino MCP2515 CAN Bus Interface MCP2515 CAN Module Pins

Components Required

  • Arduino UNO x 2
  • MCP2515 x 2
  • USB Cable x 2
  • Connecting Wires

Circuit Design

As mentioned earlier, the CAN Controller IC facilitates SPI Communication Protocol for interfacing with any Microcontroller. Hence, connect the SPI Pin i.e. SCK, MOSI (SI), MISO (SO) and CS of the MCP2515 Module to corresponding SPI Pins of Arduino (see circuit diagram).

Arduino MCP2515 CAN Bus Interface Circuit Design

Make two such connections: one pair acts as a transmitter and the other as a receiver. Now for the communication between this transmitter and receiver, connect CANH and CANL pins of each MCP2515 Module.  

Code

Before going into the code, you need to download a library for the MCP2515 Module. There are many libraries but I have used this particular one.

Download it and place the extracted contents in the libraries directory of Arduino.

Since the communication involves a Transmitter Module and a Receiver Module, the code is also divided into Transmitter Code and Receiver Code.

Transmitter Code

Receiver Code

Working

Working of this project is very simple as all the work is done by the libraries (SPI and CAN). Since CAN is message-based communication, you need to send a message anywhere between 0 and 8 bytes.

In this project, the transmitter is sending a message as 1 1 2 3 0 5 6 7. This message is transmitted over CAN Bus and the receiver receives this message and is displayed on its serial monitor.

Additionally, the 0th and 4th bit i.e. 1 and 0 in the above sequence are extracted separately by the receiver and turns ON and OFF the LED connected to Pin 2 of Arduino.

Applications

As mentioned in the introduction, CAN is widely used in the field of automobiles. Some of the applications include:

  • Electronic Gear Shift System
  • Main Interface in Automation (like industrial)
  • Medical Equipment
  • Robotics
  • Auto Start/Stop of Car Engine

The post Arduino MCP2515 CAN Bus Interface Tutorial appeared first on Electronics Hub.

Wednesday, 22 August 2018

Connecting the (nano) dots: Big-picture thinking can advance nanoparticle manufacturing

Scientists advocate that researchers, manufacturers and administrators wanting to advance the nanoparticle manufacturing industry 'connect the dots' by considering shared quality control challenges broadly and tackling them collectively rather than individually.

Tuesday, 21 August 2018

Quantum simulation reveals mobility edge in a low-dimensional disordered landscape

Scientists using an innovative quantum simulation technique have made one of the first observations of a mobility edge in a low-dimensional system. Scientists were able to combine a disordered virtual material -- in this case a pair of coupled 1D chains -- with artificial magnetic fields to explore this phenomenon.

POV Display using Arduino

Monday, 20 August 2018

Link between magnetic field strength and temperature

Researchers recently discovered that the strength of the magnetic field required to elicit a particular quantum mechanical process corresponds to the temperature of the material. Based on this finding, scientists can determine a sample's temperature to a resolution of one cubic micron by measuring the field strength at which this effect occurs. Temperature sensing is integral in most industrial, electronic and chemical processes, so greater spatial resolution could benefit commercial and scientific pursuits.

A new generation of artificial retinas based on 2D materials

Scientists report they have successfully developed and tested the world's first ultrathin artificial retina that could vastly improve on existing implantable visualization technology for the blind. The flexible 2-D material-based device could someday restore sight to the millions of people with retinal diseases.

Saturday, 18 August 2018

World's first-ever 4D printing for ceramics

A ground-breaking advancement in materials research by successfully developing the world's first-ever 4D printing for ceramics, which are mechanically robust and can have complex shapes. This could turn a new page in the structural application of ceramics.

A valley so low: Electrons congregate in ways that could be useful to 'valleytronics'

Researchers have made a finding that could help usher in new area of technology called 'valleytronics.' The study found that electrons in bismuth crystals prefer to collect in one valley rather than being distributed equally across valleys, setting up a type of electricity known as ferroelectricity.

Arduino Multitasking Tutorial

Friday, 17 August 2018

Low bandwidth? Use more colors at once

As researchers engineer solutions for eventually replacing electronics with photonics, one team team has simplified the manufacturing process that allows utilizing multiple colors at the same time on an electronic chip instead of a single color at a time.

Thursday, 16 August 2018

Smallest transistor switches current with a single atom in solid electrolyte

Researchers have developed a single-atom transistor, the world's smallest. This quantum electronics component switches electrical current by controlled repositioning of a single atom, now also in the solid state in a gel electrolyte. The single-atom transistor works at room temperature and consumes very little energy, which opens up entirely new perspectives for information technology.

Twisted electronics open the door to tunable 2-D materials

Researchers report an advance that may revolutionize the field of 2-D materials such as graphene: a 'twistronic' device whose characteristics can be varied by simply varying the angle between two different 2-D layers placed on top of one another. The device provides unprecedented control over the angular orientation in twisted-layer devices, and enables researchers to study the effects of twist angle on electronic, optical, and mechanical properties in a single device.

Arduino Millis Tutorial – Millis() the Delay Killer

In this tutorial, I will talk about the millis function in Arduino, how it works, what are its benefits and finally, how can we use Arduino Millis function efficiently to introduce the concept of Multitasking in Arduino.

Traditional Programming

Before I begin the Arduino Millis Tutorial, let me show a simple example circuit and code that you might be following till now.

Assume, Arduino UNO board and in that board, a user LED is connected to Digital IO pin 13. The following code is a simple Blink Code that Blinks the LED connected to Pin 13 of Arduino UNO.

In this code, the Arduino UNO is configured to make the Digital IO pin 13 HIGH for a second and LOW for a second and this process repeats in a loop.

Delay is the culprit

You might be familiar with the delay() function in the Arduino environment. From the day go with Arduino, delay is one of the first function you come across. It is a simple function that is associated with timing.

Using the delay function is simple and straightforward: mention the amount of time in milliseconds in the delay function and your microcontroller holds its operations for that period of time.

There seems no problem with this approach but if you observe or understand closely how delay works internally, you will get to know the disadvantage of delay.

When the delay function with a value is called, Arduino enters into a busy state and suspends all activity until that time is finished. During this state i.e. during the execution of the delay function, Arduino cannot perform any other tasks, like reading a button for example.

The following is a possible code for delay that keeps the processor busy.

NOTE: This is in fact the main delay code I use in my 8051 Microcontroller projects. The combination of 250 and 248 in the for loops take approximately 1millisecond of the controller’s execution time. If I run this loop for 1000 times, I get a delay of approximately 1000ms or 1 second.  

How Arduino benefits by avoiding Delay?

Arduino is a microcontroller based system that performs simple tasks based on a single program. There is no operating system involved with Arduino and hence you cannot run multiple programs on Arduino.

Does this mean we are struck with just one program that runs over and over? The simple answer is yes. But this doesn’t mean that we cannot program Arduino to handle multiple tasks.

In order to program Arduino to manage many tasks (many tasks in a single program), functions like delay, which engage the processor is a busy state, must be avoided. So, get ready to ditch the delay.

Meet Millis the Delay Killer

Now that we have understood that using delay function in our Arduino programs must be avoided, how can we achieve the same functionality without actually using the delay?

In order to achieve the functionality of timing, the simple process is to keep track of a clock at regular intervals. If you regularly check a clock, you can easily know when is the time to act on something.

This is possible in Arduino with the help of millis function.

Before actually talking about the mechanism responsible for this, let me show you the code for blinking an LED without using the delay function.

Blinking an LED without using Delay

The following is a simple for blinking an LED connected to Pin 13 of Arduino to blink without using the delay function.

Arduino Millis Tutorial

If you try the above mentioned code for blinking the LED, it will work flawlessly. But in order to understand more, you need to get to know the Arduino Millis function.

According to the literature provided by Arduino, millis is an Arduino function that returns the present time in milliseconds from the moment the Arduino board is powered on or reset.

The return value of millis is number of milliseconds through an unsigned long variable since the program in Arduino started. The reason I mentioned the return type as unsigned long is because if you use this return types, you can keep track of the time for almost 50 days, after which the value resets to 0.

If you try to use any other return type like int or signed long, you may get logical errors or less duration.

Arduino Millis Example

The following code shows the usage of millis function in Arduino.

This code prints the text “Hello” on the Serial Monitor for each second. The following image shows the output on the Serial Monitor.

Arduino Millis Tutorial Image 1

Arduino Millis Applications

Using millis in Arduino allows you to be more creative than before. Consider an application where you want to print MESSAGE1 for every 5 seconds, MESSAGE2 for every 7 seconds and a MESSAGE3 for every 9 seconds.

You can implement this type of functionality in Arduino with the help of millis function but it is not possible delay.

Here is a screen shot of the output of the above code for the first 50 seconds.

Arduino Millis Tutorial Image 2

Future implementations of millis

In the beginning of this tutorial, I have talked about multitasking in Arduino. In the next tutorial, I will talk about that and how can we achieve multitasking in Arduino using millis.

The post Arduino Millis Tutorial – Millis() the Delay Killer appeared first on Electronics Hub.

Tiny, wireless antennas use light to monitor cellular communication

Researchers developed a biosensing technique that eliminates the need for wires. Instead, tiny, wireless antennas use light to detect minute...