Time delay relay circuit

What is a time delay relay circuit?

In a time delay relay circuit, relay contacts are closed or open after the preset time interval. Whereas in a normal relay contacts are open/closed immediately when coil is energized. It prevents the damaging effect of voltage spikes or input surge current by delaying the relay on/off.

Schematic diagram

Time_delay_relay_circuit
Time delay relay circuit

Components list

  • 12v Relay
  • Transistor TIP122
  • D1 – IN4007
  • D2 – Zener diode 3.3v
  • VR1 – 100K
  • R1,R2,R3 –  1K
  • R4 – 330 Ohm
  • C1 – 1000 μF 25 v
  • C2 – 100 μF 25 v
  • LED – 2 nos

How it works ?

The circuit is based on RC time delay and zener controlled switch. When the power to the circuit is switch on, the 1000 μF capacitor charges through 100 k VR. Once the charge through the capacitor reaches 3.3 v zener diode starts conducting. As the zener is connected to the base of transistor, it triggers the transistor and it is turned on. The relay connected to the transistor is energized. The delay in the relay can be controlled by the VR 100K.

1 Watt audio amplifier for Mobile device

About LM4890

1 Watt audio amplifier for mobile device has been designed using LM4890 power amplifier. LM4890 is primarily designed for mobile phones and other portable devices. It is capable of delivering 1 watt of continuous average power to an 8 ohm load from 5v power supply. It has a distortion of less than 1%.

LM4890 does not require output coupling capacitors and therefore ideally suited for mobile phones and other low voltage applications where minimal power consumption is primary requirement. Power output at 5v is 1 watt and at 3.3 v it is approximately 0.4 watt.

Circuit diagram

LM 4890 - 1 watt audio power amplifier

Parts required.

  • C1= 1 μf 16v
  • C2=0.39 μF 50v
  • C3=1 μf 16 v
  • C4=25 pf
  • R1, R2, R3 = 20 k
  • J1 an dJ2 = Jumper head vertical mount
  • Speaker – 8 Ω

For more circuits on audio amplifier click here

Real time clock with DS1302

Real time clock with DS1302 is designed using Arduino Uno.

About DS1302

The DS1302 is a trickle-charge timekeeping chip containing a real-time clock/calendar and 31 bytes of static RAM. It communicates with a microprocessor via a simple serial interface. The real-time clock/calendar provides seconds, minutes, hours, day, date, month, and year information. DS1302 requires only three wires to communicate with the clock/RAM: CE, I/O (data line), and SCLK (serial clock). It has dual power pins, one for primary and another for backup.  In this example the Primary power will be provided by the Arduino, and the back up by a CR2032 battery.

During reading, the clock could rollover. That would result in bad clock data. To prevent that, the DS1302 has a buffer to store the clock data. That buffer can be read in a single communication session, called a “burst” mode.

The Year data of the DS1302 is only two digits (0-99). The Year ‘0’ is 2000, and not 1970. It has a Leap-Year compensation from 2000 up to 2099 (for a value of 0-99).The data in this ram will get lost if the Arduino is off, and the battery gets empty.

What is required to build the real time clock?

You will need following parts/components

  • Arduino Uno
  • DS1302 Module
  • Button cell

How to connect to Arduino?

The DS1302 can be easily connected to the Arduino. Three pins are needed for the interface (CE, I/O, SCLK), and Vcc2 should be connected to +5V (or +3.3V). The Vcc1 is for a battery .

A crystal of 32.768kHz should be connected to X1 and X2.

The DS1302 can run with a voltage from 2.0V to 5.5V.

Sample Code

// Example sketch for interfacing with the DS1302 timekeeping chip.
#include <stdio.h>
#include <DS1302.h>
namespace {
// Set the appropriate digital I/O pin connections. These are the pin
// assignments for the Arduino as well for as the DS1302 chip.
//
const int CePin   = 5;  // Chip Enable
const int IoPin   = 6;  // Input/Output
const int SclkPin = 7;  // Serial Clock

// Create a DS1302 object.
DS1302 rtc(CePin, IoPin, SclkPin);
String dayAsString(const Time::Day day) {
  switch (day) {
    case Time::kSunday: return "Sunday";
    case Time::kMonday: return "Monday";
    case Time::kTuesday: return "Tuesday";
    case Time::kWednesday: return "Wednesday";
    case Time::kThursday: return "Thursday";
    case Time::kFriday: return "Friday";
    case Time::kSaturday: return "Saturday";
  }
  return "(unknown day)";
}
void printTime() {
  // Get the current time and date from the chip.
  Time t = rtc.time();
  // Name the day of the week.
  const String day = dayAsString(t.day);
  // Format the time and date and insert into the temporary buffer.
  char buf[50];
  snprintf(buf, sizeof(buf), "%s %04d-%02d-%02d %02d:%02d:%02d",
           day.c_str(),
           t.yr, t.mon, t.date,
           t.hr, t.min, t.sec);
 // Print the formatted string to serial so we can see the time.
  Serial.println(buf);

}
}  // namespace
void setup() {
  Serial.begin(9600);
 // Initialize a new chip by turning off write protection and clearing the
  // clock halt flag. These methods needn't always be called. See the DS1302
  // datasheet for details.

 //  rtc.writeProtect(false);

  // rtc.halt(false);
  // Make a new time object to set the date and time.
 // This need to be done first time to set the Date and time.
  // Thursday, July 6, 2017 at 22:58:50.
  // Time t(2017, 07, 6, 22, 58, 50, Time::kThursday);
  // Set the time and date on the chip.
  // rtc.time(t);
}
// Loop and print the time every second.
void loop() {
  printTime();
  delay(1000);
}

Note: Download the library from https://github.com/msparks/arduino-ds1302

DS1302 Datasheet: http://datasheets.maximintegrated.com/en/ds/DS1302.pdf

 

In the next Post I will modify this to make Alarm clock using LCD display.

Seven segment display counter

A seven segment display is typically used to display numbers from 0-9. It consists of 7 bar segments and a dot( 8 Segments). They are numbered A to F and DP for the dot or decimal place. There are 2 types of 7 Segment display

  • Common anode
  • Common cathode

 

Seven Segments are labelled as below.

For more detail on 7 segment display refer my blog post on it here.

To display number we need to turn on the correct segments as shown below:

0- ABCDEF
1- BC
2- ABGED
3- ABCDG
4- BCFG
5- ACDFG
6- ACDEFG
7- ABC
8- ABCDEFG
9- ABCFG

List of Parts needed

  1. Common cathode seven segment LED display
  2. 470 Ohm resistors – 7 nos
  3. Arduino UNO

Schematic diagram:

Seven Segment counter

 

Below is the code for the one digit counter

//Pins for seven segment
int sega = 1;
int segb = 2;
int segc = 3;
int segd = 4;
int sege = 5;
int segf = 6;
int segg = 7;
int dispa = 8;
int dispb = 9;

void setup() {
 // Setup code to run once
   pinMode(sega,OUTPUT);
   pinMode(segb,OUTPUT);
   pinMode(segc,OUTPUT);
   pinMode(segd,OUTPUT);
   pinMode(sege,OUTPUT);
   pinMode(segf,OUTPUT);
   pinMode(segg,OUTPUT);
   pinMode(dispa,OUTPUT);
   pinMode(dispb,OUTPUT);
}

void loop() {
 // put your main code here, to run repeatedly:
  for(int count=0;count<10;count++)
  {
    digitalWrite(sega,LOW);
    digitalWrite(segb,LOW);
    digitalWrite(segc,LOW);
    digitalWrite(segd,LOW);
    digitalWrite(sege,LOW);
    digitalWrite(segf,LOW);
    digitalWrite(segg,LOW);
    if(count==0){
     digitalWrite(sega,HIGH);
     digitalWrite(segb,HIGH);
     digitalWrite(segc,HIGH);
     digitalWrite(segd,HIGH);
     digitalWrite(sege,HIGH);
     digitalWrite(segf,HIGH);
  }
  if(count==1){
    digitalWrite(segb,HIGH);
    digitalWrite(segc,HIGH);
  }
  if(count==2){
    digitalWrite(sega,HIGH);
    digitalWrite(segb,HIGH);
    digitalWrite(segg,HIGH);
    digitalWrite(sege,HIGH);
    digitalWrite(segd,HIGH);
  }
  if(count==3){
    digitalWrite(sega,HIGH);
    digitalWrite(segb,HIGH);
    digitalWrite(segc,HIGH);
    digitalWrite(segd,HIGH);
    digitalWrite(segg,HIGH);
  }
  if(count==4){
    digitalWrite(segb,HIGH);
    digitalWrite(segc,HIGH);
    digitalWrite(segf,HIGH);
    digitalWrite(segg,HIGH);
  }
  if(count==5){
    digitalWrite(sega,HIGH);
    digitalWrite(segc,HIGH);
    digitalWrite(segd,HIGH);
    digitalWrite(segf,HIGH);
    digitalWrite(segg,HIGH);
  }
  if(count==6){
    digitalWrite(sega,HIGH);
    digitalWrite(segc,HIGH);
    digitalWrite(segd,HIGH);
    digitalWrite(sege,HIGH);
    digitalWrite(segf,HIGH);
    digitalWrite(segg,HIGH);
  }
  if(count==7){
    digitalWrite(sega,HIGH);
    digitalWrite(segb,HIGH);
    digitalWrite(segc,HIGH);
  }
  if(count==8){
    digitalWrite(sega,HIGH);
    digitalWrite(segb,HIGH);
    digitalWrite(segc,HIGH);
    digitalWrite(segd,HIGH);
    digitalWrite(sege,HIGH);
    digitalWrite(segf,HIGH);
    digitalWrite(segg,HIGH);
  }
  if(count==9){
    digitalWrite(sega,HIGH);
    digitalWrite(segb,HIGH);
    digitalWrite(segc,HIGH);
    digitalWrite(segf,HIGH);
    digitalWrite(segg,HIGH);
  } 
  delay(1000);
 }
}

 

Plus/minus supply using LMC7660

LM 7660 is a CMOS voltage convertor capable of converting a positive voltage in the range of +1.5 v – 10 v to the corresponding negative voltage of -1.5v to -10v using very few external components. Below is the schematic diagram for the same.

We can use this get +/-5v from different sources like from 9v battery. Adding LM7805 converter to a 9v battery or 9v power supply will reduce it to 5v as shown below.

Components

  • IC1 – LMC7660
  • IC2 – LM7805
  • C1,C2 – 10μF 16V
  • C3 – 470 μF 25V
  • C4 – 2.2μF 16V
  • Battery – 9v

 

Bicycle USB Charger

This circuit has been developed to add a USB charging port to a bicycle for charging a mobile phone. The input supply for the circuit is produced by a dynamo (6V, 3W dynamo) in the bicycle.

The circuit is based on LM2596-5.0. It is a 3A step down voltage regulator. LM 2596 are available in fixed output voltage of 3.3, 5, 12v and an adjustable output version. The LM2596 series operates at a switching frequency of 150 kHz, thus allowing smaller-sized filter components than what would be needed with traditional lower-frequency switching regulators. The IC provides all active functions for a step-down (buck) switching regulator, capable of driving a 3A load with excellent line and load regulation.

Circuit & Part list

  • C1        1000uf
  • C2        470 uf
  • D1-D2        1N5818
  • D5        1N5818
  • J        Dynamo 6v 3W
  • L        33 u
  • LED
  • R          1k
  • SW        1 on/off switch
  • IC        LM2596
  • USB-A Connector

How it Works?

The alternating voltage generated by the dynamo is converted to DC by a full-wave bridge rectifier comprising Schottky barrier rectifier diodes D1 through D4 and a filtering electrolytic capacitor (C1). The output of the bridge rectifier, which is charged to peak value of AC voltage (nearly 10V), is input to switching regulator LM2596-5.0 to provide a regulated 5V (DC) output, which is suitable for charging mobile devices using the USB connector.

The 5mm LED (LED1) in the circuit indicates output status. Feedback connection FB (pin 4 on IC1) is connected directly to output voltage at electrolytic capacitor C2. The 33μH inductor (L1) should be rated for a DC current of at least 1A. The dynamo output is connected to the circuit by switch S1.

Light Sensor using Arduino

Introduction

In this project, a simple light sensor is designed using LDR. The project is built around Arduino.

Components required

  • Arduino UNO
  • Light Dependent Resistor (LDR)
  • 100 KΩ POT
  • Buzzer

Circuit Diagram

Working

A 100 KΩ POT and the LDR form a voltage divider and the output of the voltage divider is given to the analog input A0 of Arduino. A buzzer is connected to pin 11 of Arduino.

When the LDR detects a light over certain intensity, the Arduino will trigger the buzzer. When the intensity of light decreases, the buzzer is turned off.

The 100 KΩ POT used in the voltage divider network can be used to adjust the intensity levels at which the buzzer is triggered.

Code

int sensorPin = A0; // select the input pin for the potentiometer
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
// declare the ledPin as an OUTPUT:
Serial.begin(9600);
pinMode(11,OUTPUT);
}
void loop()
{
sensorValue=analogRead(sensorPin);
if(sensorValue <= 14)
digitalWrite(11,HIGH);
else
digitalWrite(11,LOW);
Serial.println(sensorValue);
delay(2);
}

This circuit is similar to dark sensor circuit using BC547 transistor.

Make your own Li-ion power bank

Introduction

There are many ways to make a Li-ion power bank. We will here use 3.7v Li-ion rechargeable battery and few other modules. You can purchase the battery from ebay or Aliexpress or extract from your old laptop battery. This power bank can be used for charging smartphones.

What all you need ?

Following are the components/module required to make your own Li-ion power bank. In the below project I have used only one battery of capacity 2600 mAH. You can add more battery in parallel to increase the capacity of your Li-ion power bank.

  1. Li-ion 3.7 volt battery of type 18650 and 2600mAh
  2. 5V Mini MICRO USB 1A TP4056 Lithium Battery Charging Charger ModuleCharger_module
  3. DC-DC Boost Converter Step Up Module 1-5V to 5V Booster_module
  4. A case of your choice
  5. USB connectors

Assembly

  • Connect Li-ion battery positive and negative to charger module B+ and B- respectively. The charging module has mini usb connector which can be used as input 5 v charging voltage. You can also connect In+ and In- to Solar panel (optional)
  • Connect DC-DC boost converter to Battery via a switch. IN+ and IN- of boost converter should be connected to battery.
  • Connect Ground and 5v to USB connector as output.

The battery charger module, is designed around a dedicated lithium-ion battery charger TP4056 chip. The onboard charge controller chip handles BATT.1 charging operation by processing the 5V DC input supply received through the USB socket (or through IN+ and IN- terminals). Output terminals (BAT+ and BAT-) can be directly connected to BATT.1. Two onboard SMD LEDs located on top of the circuit board provide charging-status indications.

BATT is used as the power reservoir. Since only 3.7V DC supply is available from BATT, DC-DC boost converter is used to cater to the stable 5V DC supply at output. If input voltage of 0.9V to 5V DC is available, this converter gives stable 5V DC output through its USB socket. When the battery is fully charged, a blue-coloured LED will turn on. You may remove the charger connected at USB-IN.

Li-ion power bank

Microphone pre amplifier using LM358

Pre amplifier using LM358

microphone pre amplifier using LM358

Components

  1. LM358
  2. R1 – 10k
  3. R2 – 47k
  4. R3 – 10k
  5. R4 – 10k
  6. 1M POT
  7. C1 -4.7 μf
  8. C2 – 10 μf

This is a simple mic pre amplifier using LM358. The circuit is self explanatory and is based on LM358 op-amp.

The main function of a pre amplifier is to amplify small and weak signals. The pre amplifier amplifies signal with very high gain but does not have the drive current or current gain to drive the output. hence the boasted signal from pre amplifier is given to power amplifier where the current is amplified. You can connect to amplifier using LM386 described in my previous post or any other amplifier that you have.

 

Simple 2 minute Timer Circuit for your DIY

In this post, a simple timer circuit switch for light is designed that will turn on a high power LED for a particular duration.

Timer is a switch that is operated by a timer system. The switch is turned on or off by the timer only after the preset time. One of the best examples of a timer switch is the sleep mode in televisions and computers. If no key is pressed for a particular duration, the television or computer will automatically go to sleep mode where the device enters a low power consumption mode or may even be switched off.

Circuit Idea

timer circuit

Components Required

  1. T1 – BC337
  2. T2 – BC547
  3. D1 – 1N4007
  4. LED
  5. R1-270 Ω
  6. R2 -12 k
  7. R3 -10k
  8. R4 -220Ω
  9. R5 -1k
  10. VR1 -100k pot
  11. C1 -1000 μf
  12. Push switch

Circuit Design

It’s a transistor based electronic timer. The design of the timer switch is very simple. A push switch  triggers the light. The timer is based on the charging and discharging of the capacitor in the RC network. The circuit is very simple and self-explanatory.

How it works

When the switch is closed, the transistor BC547 is turned on. The 1000µF capacitor will charge at the same time through 220Ω resistor.

As BC547 is turned on and its emitter is connected to the base of BC337 through 12K resistor, it will trigger BC337 and it starts conducting.

As the LED is connected to collector of BC337, it is turned on. R1 acts as the current limiting resistor for the LED. When the switch is opened or button is released, BC547 will stay turned on due to the charge from the capacitor. The time of discharge of capacitor through 10KΩ resistor and 100KΩ POT can be set by adjusting the variable resistor.

A 1KΩ resistor acts as a protection resistor when the resistance of variable resistor is completely reduced.

The timer switch in this project will keep the LED turned on for a maximum of approximately 2 minutes.