The main purpose of BMI cap is to measure the height, weight and to know the precise body weight level. A person who wants to know how obese he or she must wear BMI cap and press the blue button on the hat . The ultrasonic sensor will measure the height of person and will send measured data to the Arduino Board through Bluetooth Module. The person’s weight can also be got by using digital weighing machine. The overall measured data will be downloaded on the android phone and added to the BMI (Body Mass Index) equation and will be calculated. A person can check the result and look the BMI Chart on his own to know his body weight level and get the knowledge of do and don’t for his health.
STEP 1 : Things required
- Arduino Uno
- HC-06 bluetooth module
- Ultrasonic Sensor
- Half-size breadboard
- 9 V battery
- Switch
- Resistor
- Connecting wires
- Cap
- Digital weighing machine
- Arduino Uno
The Arduino Uno is an open-source microcontroller board based on the Microchip ATmega328P microcontroller and developed by Arduino.cc. The board is equipped with sets of digital and analog input/output (I/O) pins that may be interfaced to various expansion boards (shields) and other circuits. The board has 14 digital I/O pins (six capable of PWM output), 6 analog I/O pins, and is programmable with the Arduino IDE (Integrated Development Environment), via a type B USB cable. It can be powered by the USB cable or by an external 9-volt battery, though it accepts voltages between 7 and 20 volts.
- Ultrasonic Sensor
Ultrasonic sensor HC-SR04 is used to measure the distance to an object by using ultrasonic waves.
The ultrasonic sensor HC-SR04 includes four pins:
· VCC pin needs to be connected to VCC (5V)
· GND pin needs to be connected to GND (0V)
· TRIG pin this pin receives the control signal (pulse) from Arduino.
· ECHO pin this pin sends a signal (pulse) to Arduino. Arduino measures the duration of pulse to calculate distance.
- HC-06 bluetooth module
Arduino can communicate with other device via Bluetooth using the module HC-06 (slave). It enables the Arduino to be connected and exchange data with other devices such as Smartphone, computer or other microcontrollers. Bluetooth communication can be used to control a robot remotely, Display and store data on your computer or on your smartphone, for instance.
STEP 2: Circuit Diagram
STEP 3: The Code
const int trig=6;
const int echo=12;
int distance;
int duration;
char a;
char b;
String pound;
float BMI=0.00;
int switch1;
int inch;
float meter;
int pound1=0;
#include <SoftwareSerial.h>
SoftwareSerial bluetooth(10, 11); // RX, TX
void setup()
{
pinMode(trig,OUTPUT);
pinMode(echo,INPUT);
pinMode(3,OUTPUT);
pinMode(5,OUTPUT);
pinMode(2,INPUT);
Serial.begin(9600);
bluetooth.begin(9600);
}
void loop()
{
switch1=digitalRead(2);
if(switch1==1)
{
delay(1000);
digitalWrite(trig,LOW);
delayMicroseconds(2);
digitalWrite(trig,HIGH);
delayMicroseconds(10);
digitalWrite(trig,LOW);
duration=pulseIn(echo,HIGH);
distance=(duration/2)/29.1;
inch=(duration/2)/74;
inch=inch+3;
int feet=inch/12;
int x=0;
x=inch%12;
height(feet,x);
if(bluetooth.available())
{
pound=bluetooth.readString();
pound1=pound.toInt();
}
Serial.print("Your weight is ");
Serial.print(pound1);
meter=inch*0.0254;
int temp1=pound1;
float temp2=meter*meter;
BMI=temp1/temp2;
//
// Serial.println(meter);
BMInote(BMI);
}
}
void height(int urFeet, int urInch)
{
bluetooth.print("Height :");
bluetooth.print(urFeet);
bluetooth.print("'");
bluetooth.print(urInch);
bluetooth.print("''");
bluetooth.println();
}
void BMInote(int urBMI)
{
bluetooth.print("You BMI is ");
bluetooth.print(urBMI);
if(urBMI<18)
{
bluetooth.println("You are underweight and unhealthy :( ");
bluetooth.println("You should add healthy calories to your meal and go nutrient dense");
}
else if(urBMI>18 && urBMI<=24)
{
bluetooth.println("You are healthy and physically strong :) ");
bluetooth.println("Focus in the positives");
}
else if(urBMI>24 && urBMI<=29)
{
bluetooth.println("You are overweight and have more body fat than is optimally healthy ");
bluetooth.println("You should limit energy intake from total fats and sugars");
}
else if(urBMI>29 && urBMI<=39)
{
bluetooth.println("You are obese and have more weight than 20% over our ideal weight");
bluetooth.println("You should have a healthy diet and cut out liquid calories");
}
else
{
bluetooth.println("You are extremely obese and unhealthy :(");
bluetooth.println("You should go to the doctor to evaluate your health risks and discuss your weight-loss options");
}
}
Step : 5 Download HC-06 App from Google Store and Connect to the module
- Once you connect the Hc-06 , Red Led will blink which mean it is disconnected .
- Open bluetooth setting in your phone and pair with the device ( HC-06 ), Password can be 1234 or 0000.
- After paring is done, download the app from Playstore and install it. ( there are many HC-06 app available in store )
- After installation, Open the app and connect the HC-06 that you paired.
If connection is completed, blinking red led will stop blinking and will always On which mean HC-06 module and smart phone is connected .
Then Upload the sketch and you can type data ( weight value from weight machine ပေါင်ချိန်စက် ) from the app as input to arduino.
STEP 5: Final Result
Testing
The ultrasonic sensor will measure the height of person and will send measured data to the Arduino Board through Bluetooth Module. The person’s weight can also be got by using digital weighing machine. The overall measured data will be downloaded on the android phone and added to the BMI (Body Mass Index) equation and will be calculated. A person can check the result and look the BMI Chart on his own to know his body weight level and get the knowledge of do and don’t for his health.
Made by Shoon Lei Naing Ye Naung Min Thant Kyaw
Comentarios