Tuesday 6 April 2021

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


const char* ssid     = "#Hacker";

const char* password = "M.A.K.E.R.B.O.T.";

const char* host = "cyberthinks.000webhostapp.com"; //replace it with your webhost url

String url;

int count = 0;



void setup() {

  Serial.begin(115200);

  delay(100);

  pinMode(D0, OUTPUT);

  digitalWrite(D1, 0);


  Serial.println();

  Serial.println();

  Serial.print("Connecting to ");

  Serial.println(ssid);


  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {

    delay(500);

    Serial.print(".");

  }


  Serial.println("");

  Serial.println("WiFi connected");

  Serial.println("IP address: ");

  Serial.println(WiFi.localIP());

  Serial.print("Netmask: ");

  Serial.println(WiFi.subnetMask());

  Serial.print("Gateway: ");

  Serial.println(WiFi.gatewayIP());

  digitalWrite(D1, 1);

  delay(500);

  digitalWrite(D1, 0);

  delay(500);

}


void loop() {


  Serial.print("connecting to ");

  Serial.println(host);


  WiFiClient client;

  const int httpPort = 80;

  if (!client.connect(host, httpPort)) {

    Serial.println("connection failed");

    return;

  }


  Serial.print("Requesting URL: ");

  Serial.println(url);



  url = "/api/readcommand.php";

  count = count + 1;

  Serial.println("Here1");



  client.print(String("GET ") + url + " HTTP/1.1\r\n" +

               "Host: " + host + "\r\n" +

               "Connection: close\r\n\r\n");


  //Serial.println(String("GET ") + url + " HTTP/1.1\r\n" +

               //  "Host: " + host + "\r\n" +

               //  "Connection: close\r\n\r\n");


  delay(500);

  String section = "header";

  while (client.available()) {

    String line = client.readStringUntil('krkg');


    Serial.println("********************");

    Serial.println(line);

    Serial.println("......................");


    if (section == "header") { // headers..


      if (line == "\n") { // skips the empty space at the beginning

        section = "json";

      }

    }

    

    else if (section == "json") { // print the good stuff

      section = "ignore";

      String result = line.substring(1);


      // Parse JSON

      int size = result.length() + 1;

      char json[size];

      result.toCharArray(json, size);

      StaticJsonBuffer<200> jsonBuffer;

      JsonObject& json_parsed = jsonBuffer.parseObject(json);

      

      if (!json_parsed.success())

      {

        Serial.println("parseObject() failed");

        return;

      }

      

      String led = json_parsed["data"][0];


      Serial.print("mydata:");

      Serial.println(led);


      if (led == "500") {

        digitalWrite(D0, 1);

        delay(100);

        Serial.println("D1 is On..!");

      }

      else if (led == "600") {

        digitalWrite(D0, 0);

        delay(100);

        Serial.println("D1 is Off..!");

      }


    }

  }

  Serial.println();

  Serial.println("closing connection");

  delay(3000);

}


Sunday 4 April 2021

Electricity theft detection system Using Arduino nano and Sim 800l

 



Arduino Code

#include "ACS712.h"

ACS712 sensor1(ACS712_30A, A0);  /// current sensor attached to A0 of arduino nano
ACS712 sensor2(ACS712_30A, A1); /// current sensor attached to 1 of arduino nano

#include <LiquidCrystal.h>  ////////lcd screen
#include <SoftwareSerial.h>  /////Sim 800l communication

SoftwareSerial sim(11, 12); //tx,rx

String number = "9080154392";  //message number

String alert = "ALERT ! Theft Identified";  ///alert message

int i = 0;   

int senttime = 0;
int currenttime = 0;

float I1 = 0.00;
float I2 = 0.00;

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


void setup()
{
  pinMode(13, OUTPUT);

  Serial.begin(9600); //baud rate of serial communication between computer and arduino
  
  lcd.begin(16, 2);
  sim.begin(115200); //baud rate of serial communication between arduino and sim 800l

  lcd.clear();
  
  lcd.setCursor(0, 0);

  lcd.print("  POWER  THEFT  ");
  lcd.setCursor(0, 1);
  lcd.print(" IDENTIFICATION ");

  delay(2000);

  lcd.clear();
  lcd.setCursor(0, 0);

  lcd.print("STARTING  DEVICE");
  delay(250);
  lcd.setCursor(0, 1);
  lcd.print("   in    secs   ");

  Serial.println("Starting Device wait 20 secs");

  for (i = 20; i > 0; i--)
  {
    lcd.setCursor(6, 1);
    lcd.print("  ");
    lcd.setCursor(6, 1);
    lcd.print(i);
    delay(1000);
  }

  ////////////////////////////////////////GSM Initialization/////////////////////////////////////////////

  sim.println("AT");
  delay(200);
  sim.println("AT");
  delay(200);

  if (sim.find("OK"))
  {
    lcd.clear();
    lcd.setCursor(0, 0);
    lcd.print("   GSM module   ");
    lcd.setCursor(0, 1);
    lcd.print("     ready!     ");

    Serial.println("GSM  Module Ready");

    delay(1000);
  }

  else
  {
    while (1)
    {
      lcd.clear();
      lcd.setCursor(0, 0);
      lcd.print("     !ERROR!    ");
      lcd.setCursor(0, 1);
      lcd.print("check GSM module");

      Serial.println("GSM Module error check wires or restart device to fix");

      delay(1000);
    }
  }

  /////////////////////////////////////////////Sensor calibrartion/////////////////////////////////////////////////

  Serial.println("Calibrating... Ensure that no current flows through the sensor at this moment");
  sensor1.calibrate();
  sensor2.calibrate();
  Serial.println("Done!");
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd.print("   Calibrating  ");
  lcd.setCursor(0, 1);
  lcd.print("     sensors    ");
  delay(2000);
}


void loop()
{
  get_sensor_data();

  if ((I1 - I2) > 0.16)
  {
    delay(1000);
    get_sensor_data();
    theftanalysis();
    
    delay(1000);
    get_sensor_data();

    if ((I1 - I2) > 0.16)
    {
      get_sensor_data();
      theftscreen();  ///////////theft confirm

      currenttime = millis();

      Serial.print("current time : ");
      Serial.println(currenttime);

      Serial.print("sent time : ");
      Serial.println(senttime);

      if ((currenttime - senttime) > 20000)
      {
        send_alert();  ////mesge sending
      }

      digitalWrite(13, HIGH);
    }
  }

  else if ((I1 - I2) < 0.10)
  {
    get_sensor_data();
    normal();
    digitalWrite(13, LOW);
  }
}

/////////////////////////////////sensor Function///////////////////////////////////////////

void normal()
{

  lcd.clear();

  lcd.setCursor(0, 0);
  lcd.print("Dist meter     A");
  lcd.setCursor(11, 0);
  lcd.print("    ");
  lcd.setCursor(11, 0);
  lcd.print(I1);

  lcd.setCursor(0, 1);
  lcd.print("Home meter     A");
  lcd.setCursor(11, 1);
  lcd.print("    ");
  lcd.setCursor(11, 1);
  lcd.print(I2);

  Serial.println("Normal");
  Serial.print("Distribution Meter: ");
  Serial.print(I1);
  Serial.println("A");

  Serial.print("Home Meter: ");
  Serial.print(I2);
  Serial.println("A");


  delay(1000);
}

////////////////////////////////gsm functions//////////////////////////////////////////////

void send_alert()
{

  lcd.clear();

  lcd.setCursor(0, 0);
  lcd.print("Sending  Message");
  lcd.setCursor(3, 1);
  lcd.print(number);


  sim.println("AT+CMGF=1");    //Sets the GSM Module in Text Mode
  delay(100);
  sim.println("AT+CMGS=\"" + number + "\"\r");   //specifys the number to send message
  delay(100);
  String SMS = String(alert);
  sim.println(SMS);
  delay(100);
  sim.println((char)26);        //exits from sms mode

  delay(1000);
  senttime = millis();
}

//////////////////////////////////////Theft Screen///////////////////////////////////////

void theftscreen()
{
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("  Alert! Theft  ");

  lcd.setCursor(0, 1);
  lcd.print("D:    A");
  lcd.setCursor(2, 1);
  lcd.print("    ");
  lcd.setCursor(2, 1);
  lcd.print(I1);

  lcd.setCursor(9, 1);
  lcd.print("H:    A");
  lcd.setCursor(11, 1);
  lcd.print("    ");
  lcd.setCursor(11, 1);
  lcd.print(I2);

  Serial.println("ALERT! Theft");
  Serial.print("Distribution Meter: ");
  Serial.print(I1);
  Serial.println("A");

  Serial.print("Home Meter: ");
  Serial.print(I2);
  Serial.println("A");
}

/////////////////////////////////Theft Analyse///////////////////////////////////////////////


void theftanalysis()
{
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Analysing  Theft");

  lcd.setCursor(0, 1);
  lcd.print("D:    A");
  lcd.setCursor(2, 1);
  lcd.print("    ");
  lcd.setCursor(2, 1);
  lcd.print(I1);

  lcd.setCursor(9, 1);
  lcd.print("H:    A");
  lcd.setCursor(11, 1);
  lcd.print("    ");
  lcd.setCursor(11, 1);
  lcd.print(I2);


  Serial.println(" Analysing Theft");
  Serial.print("Distribution Meter: ");
  Serial.print(I1);
  Serial.println("A");

  Serial.print("Home Meter: ");
  Serial.print(I2);
  Serial.println("A");
}

///////////////////////////////////////////get sensor data////////////////////////

void get_sensor_data()
{
  I1 = sensor1.getCurrentAC();
  I2 = sensor2.getCurrentAC();
}


Friday 21 February 2020

DC motor control using LABview and Arduino and PCB files

Schematics


Arduino code 


//////////////////////////////////////senthamizhanjackie@gmail.com///////////////////////

void setup()
{
  Serial.begin(9600);
  pinMode(5, OUTPUT);
  pinMode(3, OUTPUT);
}

void loop()
{
  if (Serial.available())
  {
    int val = Serial.parseInt();
    int speedm = val % 1000;
    int state = val / 1000;

    if (state == 1)
    {
      analogWrite(3, speedm);
      digitalWrite(5, LOW);
    }
    else if (state == 2)
    {
      analogWrite(5, speedm);
      digitalWrite(3, LOW);
    }
  }
}
//////////////////////////////////////////////////////////////////////////////////////////////////////




Components List for PCB


Arduino nano (with usb cable) - 1
L293d -1
16 pin IC base (for l293d) -1
7805 (U3) -1
470 uf (c5)- 1
1uf (c3) -1
330 ohms resistor (R3) -1
LED 5mm - 1
Barrel jack (pcb mount) -1

Geared DC motor (12v) -1
DC 12v Power supply (1 Amp)(with barrel jack pinout) - 1

female header strip -2



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

Lab view files


Front Panel



Block Diagram




PCB Files




Monday 28 January 2019

My project on programmable Digital Instruments

code for the project



click for report and apps aia files


https://drive.google.com/open?id=1np-_N0H5cl_in80sghVV8tPg8xlTZRKg






///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////senthamizhanjackie@gmail.com////////////////////////////////


#include <Wire.h>
#include <Adafruit_MCP4725.h>

Adafruit_MCP4725 dac;

#define DAC_RESOLUTION    (8)

///////////////triangle wave lookup///////////////////

const PROGMEM uint16_t Lookup_tri[256] =
{
  32, 64, 96, 128, 160, 192, 224, 256,
  288, 320, 352, 384, 416, 448, 480, 512,
  544, 576, 608, 640, 672, 704, 736, 768,
  800, 832, 864, 896, 928, 960, 992, 1024,
  1056, 1088, 1120, 1152, 1184, 1216, 1248, 1280,
  1312, 1344, 1376, 1408, 1440, 1472, 1504, 1536,
  1568, 1600, 1632, 1664, 1696, 1728, 1760, 1792,
  1824, 1856, 1888, 1920, 1952, 1984, 2016, 2048,
  2079, 2111, 2143, 2175, 2207, 2239, 2271, 2303,
  2335, 2367, 2399, 2431, 2463, 2495, 2527, 2559,
  2591, 2623, 2655, 2687, 2719, 2751, 2783, 2815,
  2847, 2879, 2911, 2943, 2975, 3007, 3039, 3071,
  3103, 3135, 3167, 3199, 3231, 3263, 3295, 3327,
  3359, 3391, 3423, 3455, 3487, 3519, 3551, 3583,
  3615, 3647, 3679, 3711, 3743, 3775, 3807, 3839,
  3871, 3903, 3935, 3967, 3999, 4031, 4063, 4095,
  4063, 4031, 3999, 3967, 3935, 3903, 3871, 3839,
  3807, 3775, 3743, 3711, 3679, 3647, 3615, 3583,
  3551, 3519, 3487, 3455, 3423, 3391, 3359, 3327,
  3295, 3263, 3231, 3199, 3167, 3135, 3103, 3071,
  3039, 3007, 2975, 2943, 2911, 2879, 2847, 2815,
  2783, 2751, 2719, 2687, 2655, 2623, 2591, 2559,
  2527, 2495, 2463, 2431, 2399, 2367, 2335, 2303,
  2271, 2239, 2207, 2175, 2143, 2111, 2079, 2048,
  2016, 1984, 1952, 1920, 1888, 1856, 1824, 1792,
  1760, 1728, 1696, 1664, 1632, 1600, 1568, 1536,
  1504, 1472, 1440, 1408, 1376, 1344, 1312, 1280,
  1248, 1216, 1184, 1152, 1120, 1088, 1056, 1024,
  992, 960, 928, 896, 864, 832, 800, 768,
  736, 704, 672, 640, 608, 576, 544, 512,
  480, 448, 416, 384, 352, 320, 288, 256,
  224, 192, 160, 128, 96, 64, 32, 0
};

/////////////////////sine lookup///////////////////////

const PROGMEM uint16_t Lookup_Sine[256] =
{
  2048, 2098, 2148, 2198, 2248, 2298, 2348, 2398,
  2447, 2496, 2545, 2594, 2642, 2690, 2737, 2784,
  2831, 2877, 2923, 2968, 3013, 3057, 3100, 3143,
  3185, 3226, 3267, 3307, 3346, 3385, 3423, 3459,
  3495, 3530, 3565, 3598, 3630, 3662, 3692, 3722,
  3750, 3777, 3804, 3829, 3853, 3876, 3898, 3919,
  3939, 3958, 3975, 3992, 4007, 4021, 4034, 4045,
  4056, 4065, 4073, 4080, 4085, 4089, 4093, 4094,
  4095, 4094, 4093, 4089, 4085, 4080, 4073, 4065,
  4056, 4045, 4034, 4021, 4007, 3992, 3975, 3958,
  3939, 3919, 3898, 3876, 3853, 3829, 3804, 3777,
  3750, 3722, 3692, 3662, 3630, 3598, 3565, 3530,
  3495, 3459, 3423, 3385, 3346, 3307, 3267, 3226,
  3185, 3143, 3100, 3057, 3013, 2968, 2923, 2877,
  2831, 2784, 2737, 2690, 2642, 2594, 2545, 2496,
  2447, 2398, 2348, 2298, 2248, 2198, 2148, 2098,
  2048, 1997, 1947, 1897, 1847, 1797, 1747, 1697,
  1648, 1599, 1550, 1501, 1453, 1405, 1358, 1311,
  1264, 1218, 1172, 1127, 1082, 1038,  995,  952,
  910,  869,  828,  788,  749,  710,  672,  636,
  600,  565,  530,  497,  465,  433,  403,  373,
  345,  318,  291,  266,  242,  219,  197,  176,
  156,  137,  120,  103,   88,   74,   61,   50,
  39,   30,   22,   15,   10,    6,    2,    1,
  0,    1,    2,    6,   10,   15,   22,   30,
  39,   50,   61,   74,   88,  103,  120,  137,
  156,  176,  197,  219,  242,  266,  291,  318,
  345,  373,  403,  433,  465,  497,  530,  565,
  600,  636,  672,  710,  749,  788,  828,  869,
  910,  952,  995, 1038, 1082, 1127, 1172, 1218,
  1264, 1311, 1358, 1405, 1453, 1501, 1550, 1599,
  1648, 1697, 1747, 1797, 1847, 1897, 1947, 1997
};

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

int cmd = 0;
int scmd = 0;


void setup()
{
  Serial.begin(9600); // initialize serial communication @9600 baud rate
  dac.begin(0x62);//the begin I2C communication Gy 4725 which has a address of 0x62
  pinMode(A0, INPUT); // initialize pin A0 as input for voltmeter
  pinMode(2, OUTPUT); // initialize pin 2 as output for motor
  pinMode(3, OUTPUT); // initialize pin 3 as output for motor
}

void loop()
{
  main:
  cmd = Serial.read(); // read recieved data from the serial port and save it in cmd

  ///////////////////////voltmeter/////////////////////////////

  byte val = map(analogRead(A0), 0, 1024.0, 0, 255);
  // map the 10 bit valve of ADC to 8 bit for transmitting as a single byte
  Serial.write(val);//write 8 bit value to the serial port
 
  ///////////////////////motor control/////////////////////////

  if (cmd == '0')
  {
    digitalWrite(2, LOW);
    digitalWrite(3, LOW);
  }
  else if (cmd == '1')
  {
    digitalWrite(2, LOW);
    digitalWrite(3, HIGH);
  }
  else if (cmd == '2')
  {
    digitalWrite(2, HIGH);
    digitalWrite(3, LOW);
  }

  ////////////////////Function generator/////////////////////////

  if (cmd == '3')
  {
  sine:
    uint16_t counter;
    for (counter = 0; counter < 256; counter++)
    {
      dac.setVoltage(pgm_read_word(&(Lookup_Sine[counter])), false);
    }

    scmd = Serial.read();
    if (scmd == '6')
    {
      goto main;
    }
    else if (scmd == '4')
    {
      goto triangle;
    }
    else if (scmd == '5')
    {
      goto square;
    }
    else
    {
      goto sine;
    }
  }

  if (cmd == '4')
  {
triangle:
    uint16_t counter;
    for (counter = 0; counter < 256; counter++)
    {
      dac.setVoltage(pgm_read_word(&(Lookup_tri[counter])), false);
    }

    scmd = Serial.read();
    if (scmd == '6')
    {
      goto main;
    }
    else if (scmd == '3')
    {
      goto sine;
    }
    else if (scmd == '5')
    {
      goto square;
    }
    else
    {
      goto triangle;
    }
  }

  if (cmd == '5')
  {
square:
    uint16_t counter;
    for (counter = 0; counter < 128; counter++)
    {
      dac.setVoltage(pgm_read_word(1), false);
    }
    for (counter = 128; counter < 256; counter++)
    {
      dac.setVoltage(0, false);
    }

    scmd = Serial.read();
    if (scmd == '6')
    {
      goto main;
    }
    else if (scmd == '3')
    {
      goto sine;
    }
    else if (scmd == '4')
    {
      goto triangle;
    }
    else
    {
      goto square;
    }
  }
  delay(100);
}

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



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