Hello! Good morning everyone.
We've been stuck with this problem for two days now, I hope someone can help us solve our problem.
So, we're having a thesis entitled "Footsteps to Electrical Energy Converter".
It is made up of piezoelectrical disk that pumps electric current to our battery (lithium ion) and store them. Our project includes an app that can monitor how much battery percentage our power supply has (lithium battery) and can also monitor how many steps the user has already taken.
The code for our arduino nano is already working and we can now thankfully monitor the steps being taken and the battery percentage seen through the arduino serial monitor.
Now the problem is creating the MIT APP. The design that we tried to do cannot read the battery percentage of the power supply (lithium battery that powers up the arduino) but instead read the battery percentage of the phone that is connected to the bluetooth module. Also it doesn't read the steps being taken.
Can someone help me with this? Please. What code blocks should we use to make this work? How to make this block with the bluetooth module? Thank you in advance. Huhuhuhuhu
I'll put the arduino code that we used that can monitor the steps and battery percentage of the power supply down belooow.
#include <SoftwareSerial.h>
SoftwareSerial btSerial(2, 3); // RX, TX pins for Bluetooth module
const int piezoPin = A0;
int previousValue = 0;
int currentValue = 0;
int pumpCount = 0;
void setup() {
btSerial.begin(9600); // Start the Bluetooth serial communication
Serial.begin(9600); // Start the regular serial communication
}
void loop() {
currentValue = analogRead(piezoPin);
if (currentValue > previousValue + 250) {
pumpCount++;
}
previousValue = currentValue;
btSerial.println(pumpCount);
Serial.println(pumpCount);
int analogValue = analogRead(A1); // variable to store the analog input
float voltage = analogValue * (5.0 / 1023.0); // variable to hold the input converted to voltage
int batteryPercentage = (voltage / 5.0) * 100; // variable to hold the battery percentage
btSerial.print("Battery Percentage: ");
btSerial.println(batteryPercentage);
Serial.print("Battery Percentage: ");
Serial.println(batteryPercentage);
delay(1000); // wait 1 second before the next loop
}