Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!

Ecycle

Bicycle with calories burned indicator system. Data will also be uploaded to cloud for analyzing the trends in terms of calories burned.

BeginnerFull instructions provided2 days746
Ecycle

Things used in this project

Hardware components

MSP-EXP430G2 MSP430 LaunchPad
Texas Instruments MSP-EXP430G2 MSP430 LaunchPad
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
magnet bar
×1
reed switch
×1

Software apps and online services

Energia
Texas Instruments Energia
MIT App Inventor
MIT App Inventor

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)

Story

Read more

Code

Calories burned calculator

Arduino
Main code for displaying the calories burned on LCD
#include<LiquidCrystal.h>
LiquidCrystal lcd(13,12,8,9,10,11);
int m;
float total;
void setup() 
{
  // put your setup code here, to run once:
  pinMode(2,OUTPUT); // pin 2 configured as output (red led) 
  pinMode(6,INPUT); // sensor is conected to pin 6 
  digitalWrite(6,HIGH);
  lcd.begin(16,2); // initialize 16x2 LCD
  pinMode(5,INPUT_PULLUP); // button to stop the system 
  Serial.begin(9600);// initialize serial communication at 9600 bps

  // greeting messages
  lcd.print("Welcome User");
  lcd.setCursor(0,1);
  lcd.print("Start Ride...");
  delay(1500); // wait for 1.5 sec
}

void res_lcd()
{
  lcd.clear(); // clear the lcd display
  lcd.setCursor(0,0); // put cursor on top left position
}

void loop() 
{
  // put your main code here, to run repeatedly:
  if(digitalRead(6)==HIGH)
  {
    digitalWrite(2,LOW);  // switch off the red led
  }
  if(digitalRead(6)==LOW)
  {
    res_lcd();
    digitalWrite(2,HIGH); // switch on the red led for pulse indication
    m=m+1; // variable for counting number of pedal revolution
    total=0.1*m; // variable for storing calories burned
    lcd.print(total); // print the calories burnt on lcd
    while(digitalRead(6)==LOW); // stay here till the sensor reads low level signal on pin 6*
    delay(100);
  }

// routine to stop the system and send the caloried burned online
  if(digitalRead(5)==LOW) // execute this routine when push button connected to pin 5 is pressed*
  {
    Serial.print(total); // send the data of total calories burned to bluetooth
    res_lcd();
    lcd.print("Calories burned:"); // print message on lcd
    lcd.setCursor(0,1); // shift cursor to 2nd line
    lcd.print(total); // print the calories burned on lcd
    delay(2500); // wait fpr 2.5 sec
    res_lcd();
    lcd.print("sending data...");
    Serial.print("*");
    Serial.print(total); // send the data of total calories burned to bluetooth
    Serial.print("#");
    delay(1500);
    res_lcd();
    lcd.print("data sent...");
    lcd.setCursor(0,1);
    lcd.print("Thank you...");
    m=0; // rest the pulse count
    total=0.0;  // reset the variable total
    delay(1500);
    res_lcd();
  }
   
}

Credits

Dr. Umesh Dutta
42 projects • 60 followers
Working as Director of Innovation Centre at Manav Rachna, India. I am into development for the last 12 years.
Contact
Nilansh Khurana
3 projects • 1 follower
Contact
devdutt
10 projects • 9 followers
Robotic Gold Medalist at IIT Guwahati and Embedded,Hardware Developer at Manav Rachna Innovation and Incubation Centre
Contact
dhruv rohatgi
2 projects • 1 follower
Contact
Shivam Gupta
10 projects • 6 followers
hmsgupta.3062@gmail.com
Contact
Texas Instruments University Program
91 projects • 120 followers
TI helps students discover what's possible to engineer their future.
Contact
Energia
34 projects • 26 followers
Founder of @energiaproject
Contact

Comments

Please log in or sign up to comment.