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...