Thursday 20 December 2018

Lcd clock using arduino and ds1307

////////////////////////////lcd clock using arduino and ds1307/////////////////////////
///////////////////////////senthamizhanjackie@gmail.com//////////////////////
////////////////////////////////created on 20/12/18//////////////////////////////////


#include <Wire.h>
#include <TimeLib.h>
#include <DS1307RTC.h>
#include <LiquidCrystal.h>

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup()
{
  lcd.begin(16, 2);
  lcd.clear(); 
  lcd.print(" lcd clock ");
  lcd.setCursor(0,1);
  lcd.print(" code dt 181220 ");
  delay(2000);
  lcd.clear();
}


void loop()
{
  tmElements_t tm;
  if (RTC.read(tm))
  {
    lcd.setCursor(0,0);
    lcd.print("Time  ");
    print2digits(tm.Hour);
    lcd.print(':');
    print2digits(tm.Minute);
    lcd.print(':');
    print2digits(tm.Second);
    lcd.setCursor(0,1);
    lcd.print("Date  ");
    lcd.print(tm.Day);
    lcd.print('/');
    lcd.print(tm.Month);
    lcd.print('/');
    lcd.print(tmYearToCalendar(tm.Year));
  }
  delay(1000);
}

void print2digits(int number)
{
  if (number >= 0 && number < 10)
  {
    lcd.print('0');
  }
  lcd.print(number);
}

Saturday 9 June 2018

DIY Battery backup for you modem

Usually, a modem is powered using  AC to DC adapter which converts 230 volts AC to 9 volts or 12 volts DC

In case of power failures modem is power using an inverter,

But an invertor usually contains a 12v lead acid batteries, which is then converted to 230 volts AC using a power electronics circuit,

But in modem DC supply is used, converting a 12v Dc supply to AC and converting back them into DC usually makes more power losses.

These power losses can be avoided by directly using the battery supply to power the modem.

Using lead-acid battery

if your modem requires 12v DC to operate, you can directly use the lead-acid battery with a 12V regulator, because usually, Lead-acid batteries output voltage is greater than 12v, you can use a regulator to get stable 12v supply to a modem.

in case if your modem requires 9v to operate you can use a 9v regulator.







 ********If you use Linear voltage regulators like 7809 or 7812 they produce lots of heat for a prolonged operation, you need to add a heat sink to it, this also not an efficient way to power a 9v device with a 12v battery, you can use a DC-DC buck converter, which does the same function of converting high voltage dc to a low voltage dc, which works on the principle of switching mode power supply, but these are much more power efficient than the Linear voltage regulators.******


in case if you do not have a lead- acid battery, you can also use any kind of independent of the voltage.

eg: lithium batteries
      Nickel Cadmium batteries


you can make them in  series to give more voltage or you can make them in parallel to make more Amp hours




 but in this case, you cannot use a regulator because the required voltage is greater than the available voltage so we need to boost up the voltage to get required voltage.


There are pre-made boards available as the DC-DC boost converter to boost a lower voltage to a higher voltage.





In series the voltage of the battery increases,
in this case, you can use either a regulator or a DC-DC buck converter to achieve the required voltage,






These are some ways of powering your dc devices with you batteries,


in fact charging batteries need some special attention,

we will discuss them in the next post,

Sunday 20 May 2018

DIY flexible keyboard

For the making of a Flexible keyboard, we need an ordinary USB or a wireless keyboard, in my case I use a rigid USB keyboard.



STEP 1:
Find the screws to open the keyboard, its usually at the bottom of the keyboard.



STEP 2:
Find the control board and the flexible circuit layout.

STEP 3:
Cut and remove the control board along with the mounting holes in the keyboard frame.


STEP 3:
Make sure everything works.







Wednesday 2 May 2018

Interfacing ADC 0804 with 8051 micro controller





Source Code:

#include<reg51.h>

#define adc P2

sbit load = P1^6;

////0804_adc_pin_details/////

sbit soc = P1^0;//HIGH to LOW gets data from internal registe to pins in adc
sbit rd = P1^1;// LOW to HIGH pulse is given for start of conversion
sbit intr = P1^2;// pin turn LOW when conversion is done

void intserial();
void sendserial(unsigned char dat);
void delay(unsigned int count);
unsigned char get_adc_data();
unsigned char mydata;


/////////////////////////////////////////

void sendserial(unsigned char dat)
{
TI = 0;
SBUF = dat;
while(TI == 0);
}

//////////////////////////////////////////

void intserial()
{
TMOD = 0x21;// timer 1 and 2 @ auto reload mode
TL1 = 253; //9600 baud rate
  TH1 = 253; //9600 baud rate
SCON = 0X50; // 8 bit serial communication
TR1 = 1;
}

////////////////////////////////////////////

unsigned char get_adc_data()
{
rd = 0;
soc = 1;
//delay(10);
rd = 1;
//waits untill adc conversion is over
soc = 0;
//mydata = adc;//copies adc data to mydata
return P2;
}

//////////////////////////////////////////////

void delay(unsigned int count) 
{
int i,j;
for(i=0;i<count;i++)
  for(j=0;j<1000;j++);
}

////////////////////////////////////////////////

void main()
{
intserial();
while(1) // repeats infinite
{
mydata=get_adc_data();
sendserial(mydata);
    if(mydata>51)
       load=0;
  else
load=1;
}
}
///////////////////////////////////////////////







Saturday 28 April 2018

Heart rate monitor using Arduino and lcd



The circuit used in the previous post is used for this project tooo,



Arduino source code:

//////////////////////////////////////
///created by M.Senthamizhan/////
////senthamizhanjackie@gmail.com//////
////date : 27/4/18/////////
float mix = 0.00;

#include<LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //for lcd interface initialize

int val, beat;
int count = 0;
unsigned int previoustime;
unsigned int currentime;
float del;

void setup()
{
  Serial.begin(9600);
  //lcd.begin(8, 2);
  pinMode(A0, INPUT);
  pinMode(13, OUTPUT);
  //Beat status LED
}

void loop()
{
  for LCD interface
  lcd.setCursor(0, 0);
  lcd.print(" HEART :");

  lcd.setCursor(0,);
  lcd.print("IS : ");

   mix = 0.0;
  val = analogRead(A0);
  //Serial.println(val);
   //mix = val+mix;
   //Serial.println(mix);
  if (val > 200)
  {
    count++;
    currentime = millis();
    //Serial.println(currentime);
    del = currentime - previoustime;
    //Serial.println(del);
    previoustime = currentime;
    float Q = 1000 / del;
     float fb = 60 * Q;
   Serial.println(fb);
   //f = fb / 1000;
    //Serial.println(f);
   
    digitalWrite(13, HIGH);
    delay(400);

    lcd.setCursor(1,1);
    lcd.print(fb);
    lcd.print(" ");
    lcd.print(" BPM  ");

  }
  else
  {
    digitalWrite(13, LOW);
  }
}


Finished design:








Heart rate monitor using Arduino and lab view

using the same circuit in the previous post, the arduino source code is only changed, and for viewing output




Arduino Code for Heart rate measurement

int val, beat;
int count = 0;
unsigned int previoustime;
unsigned int currentime;
float del;

void setup()
{
  Serial.begin(9600);
  //lcd.begin(8, 2);
  pinMode(A0, INPUT);
  pinMode(13, OUTPUT);
  //Beat status LED
}

void loop()
{
  val = analogRead(A0);
  if (val > 200)
  {
    count++;
    currentime = millis();
    del = currentime - previoustime;
    previoustime = currentime;
    float Q = 1000 / del;
     float fb = 60 * Q;
   Serial.println(fb);
    digitalWrite(13, HIGH);
    delay(400);
  }
  else
  {
    digitalWrite(13, LOW);
  }
}


Block diagram:






Front panel



Electronic Stethoscope using arduino and labview



The microphone is fixed into the diaphram of the stethoscope


Schematic:







Arduino Code:

int mydata=0;
void setup()
{
 pinMode(A0,INPUT);
 Serial.begin(9600);
}

void loop()
{
 
  mydata=analogRead(A0);
  Serial.println(mydata);
  delay(5);
}


lab view block diagram




Lab view front panel:


















   

Diaphram of the stethoscope with microphone                       finished pcb



Smart fuel measurement using arduino uno


The fuel gauge in every bike has the resistance as output,

the variable resistance is connect as pull up and the 1 k resistor is connected as pull down

the variable resistance which is connected to the 1 k resistor is connected  to the A0  pin of  arduino






int analogPin = 0;
int raw = 0;
int Vin = 5;
float Vout = 0;
float value;
float per;
float km;
float pet;
float R1 = 1000;
float R2 = 0;
float buffer = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  raw = analogRead(analogPin);
  if (raw)
  {
    buffer = raw * Vin;
    Vout = (buffer) / 1024.0;
    buffer = (Vin / Vout) - 1;
    R2 = R1 * buffer;
    Serial.print("Vout: ");
    Serial.println(Vout);
    Serial.print("R2: ");
    Serial.println(R2);
    value = 154.5 - R2; ////////////////varies depending upon the bike
    Serial.print("Resistance: ");
    Serial.println(value);
    per = (value / 120) * 100; ////////////////varies depending upon the bike
    Serial.print("Petrol %: ");
    Serial.println(per);
    pet = 0.115384 * per; ////////////////varies depending upon the bike
    Serial.print("Petrol in liters:");
    Serial.println(pet);
    km = 40 * pet; ////////////////varies depending upon the bike
    Serial.print("Kilometers Available:");
    Serial.println(km);
    Serial.println("");
    delay(2000);
  }
}

My android apps for bluetooth communication

These apps were created in MIT app inventor, which is one of the easiest way to create apps


Apps can be downloaded here in this google drive

Simple Home Automation using 8051 microcontroler



The serial data can be sent through the RS-232 via pc or through bluetooth module



source code:

#include<reg51.h>
sbit load=P0^1;
sbit led =P0^0;
void initserial();
//void sendserial();
unsigned char receiveserial();
unsigned char mydata;
void delay();

void main()
{
initserial();

while(1)
{
led = 0;
  mydata=receiveserial();
//sendserial(mydata);
delay();
if(mydata=='0')
load=0;
else
load=1;
}
}

void initserial()
{
TMOD=0X21;
TL1=253;
TH1=253;
  SCON=0X50;
TR1=1;
}

unsigned char receiveserial()
{
while(RI==0);
mydata=SBUF;
RI=0;
return mydata;
}
//void sendserial(unsigned char dat)
//{
//TI=0;
//SBUF = dat;
//while(TI==0);
//}

void delay()
{
TL0=0xFF;
TH0=0x67;
TR0=1;
TF0=0;
while(TF0==0);
}

Friday 27 April 2018

Fuel meter in 8051 micro controller using ADC 0808




Fuel gauges in bikes are mostly of variable resistance type, so a ohmmeter is designed in 8051 micro controller using adc 0808 and the output seen in 16x2 lcd and the adc output is sent in serial communication for code debugging and circuit debugging

in my case the output resistance of the fuel gauge increases as the fuel in the tank decrease, you can also modify the code depending upon the type of gauge

variable resistors are used here for debugging the circuit. which like the variable resistor of the fuel gauge



Components used:

  • 8051 development board
  • adc0808
  • 16 x 2 lcd 

Software used

  • keil u vision(creating and debugging c code)
  • proteus ( for simulation )
  • jet flasher ( for flashing hex file to  microcontroller)

Schematic




c code


///// created by senthamizhanjackie@gmail.com
/////https://hackentronics.blogspot.in/
////created on 27/4/2018

#include<reg51.h>

#define input P2 // adc input port
#define vin 5   // v ref for adc 0808
#define lcd P1  // LCD data lines port

///////////////For adc////////////////////////

sbit eoc = P0^0; // end of conversion (when low, conversion is done)
sbit sc = P0^1;  // start of conversion (high to low)
sbit clk = P0^2; // external clk
sbit oe = P0^3;  // read line (high to low)
sbit ale = P0^4;  //Address latch enable (high to low)

///////////////For LCD///////////////////////

sbit en = P3^5; //enable (high to low)
sbit rw = P3^6; //(Read write 0 for writing data toclcd screen)
sbit rs = P3^7; // register select (0 for command, 1 for data) 


///////////////////////////////////////////////////////////

unsigned char note[13] = "Fuel Percent "; //lcd line 1 

unsigned char line[13] = "Kms Remain   ";//lcd line 2

unsigned char value;

unsigned char mydata; //adcdata storing

unsigned char read_adc();

unsigned int g;

unsigned int h;

unsigned int A,K,C,D,E,F,I,K;

unsigned int M,N,V,L;

unsigned int res,mil;

///////////////////////////////////////////////

void delay(unsigned int);

void intserial();

void sendserial();

void intlcd();

void sendlcdcmd(unsigned char lcdcmd);

void sendlcddata(unsigned char lcddata);


////////////////////////////////////////////////////

void sendlcddata(unsigned char lcddata)
{
rs = 1;
rw = 0;
lcd = lcddata;
en = 1;
delay(2);
en = 0;
delay(2);
}

void sendlcdcmd(unsigned char lcdcmd)
{
rs = 0;
rw = 0;
lcd = lcdcmd;
en = 1;
delay(2);
en = 0;
delay(2);
}


void intlcd()
{
sendlcdcmd(0x38);
sendlcdcmd(0x0e);
  sendlcdcmd(0x06);
sendlcdcmd(0x01);
}

void intserial()
{
TMOD = 0x22;// timer 1 and 2 @ auto reload mode
TL1 = 253; //9600 baud rate
  TH1 = 253; //9600 baud rate 
SCON = 0X50; // 8 bit serial communication
TR1 = 1;
}

void sendserial()
{
TI = 0;
SBUF = mydata;
while(TI == 0);
}


unsigned char read_adc()
{
   ale=0;   
   sc=0;

   delay(1);
sc=1;
   ale=1;

   while(eoc==1);
oe=0;
delay(1);
oe=1;

   value = input;

return value;
}


void timer0() interrupt 1
{
clk=~clk;
}

void delay(unsigned int count)  
{
int i,j;
for(i=0;i<count;i++)
  for(j=0;j<100;j++);
}

/////////////////////main////////////////////////////
void main()
{

 EA = 1;
 ET0 = 1;

 TL0 = 253;
 TH0 = 253;
 TR0=1;

 intserial();
 intlcd();
 sendlcdcmd(0x80); 

 for(g=0;g<13;g++)
{
sendlcddata(note[g]); //line 1 in lcd
}
sendlcdcmd(0xC0); 
for(K=0;K<13;K++)
{
sendlcddata(line[K]); //line 2 in lcd
}

while(1)
{
mydata = read_adc();
sendserial();
res = mydata-100;
mil = (4*res);

sendlcdcmd(0x8d);

C = res/100;
D = res %100;
sendlcddata(C+0x30);
delay(1);

E = D /10;
F = D %10;
sendlcddata(E+0x30);
delay(1);

sendlcddata(F+0x30);
delay(1);

sendlcdcmd(0xCD);


M = mil/100;
N = mil %100;
sendlcddata(M+0x30);
delay(1);

V = D /10;
L = D %10;
sendlcddata(V+0x30);
delay(1);

sendlcddata(L+0x30);
delay(1);
}
}

Proteus simulation







download the C file and the Hex file here





Own IOT website and Hardware Using Node MCU (cyber thinks)

NODE MCU code -- website link  Cyberthinks google drive link  cyberthinks website files #include <ESP8266WiFi.h> #include <ArduinoJ...