According to Philips, healthcare engineering is where the big money is. So hey, why not built a medial application myself? Ever since I was a child, my posture isn’t the way I would like it to be. I tend to stand like a 90 year old crooked guy. Let’s built something to change that!
Changing your posture is mainly about the awareness of your posture. If you find someone who will remind you to stand up straight 16 hours a day, you will probably be able to fix your posture. On the other end, you probably want to punch that person in the the face, end of day one.
Let’s use a micro processor to be that annoying reminder!
I still had a Flex/Bend Sensor laying around which is essentially a variable resistor which changes it’s resistance when you bend it.
By sticking this sensor to my back, I should be able to measure my posture, and notify me if I’m not standing up straight.
Heads up, you’re about to see a topless photo of me. If you’re eating breakfast, you might want to skip this …
Since I want to alert myself using a vibrating motor, and want to calibrate it using a button, I needed some extra components to get it all up and running. A breadbord is always the best way to experiment …
Using a Arduino Pro Mini (Clone), I was able to create a simple sketch that does everything It needs to do. The sketch measures the resistance on the Flex/Bend Sensor, stores the value when the calibration button is pressed, and powers the LED (with connected buzzer) when the resistance increases. To make it less annoying, the resistance must be above a certain threshold for a minimum of 2.5 seconds. This all adds up in the following sketch:
// Mediuno.ino
#define LED 1
#define SENSOR A3
#define BUTTON 0
int treshold = 2; // Minimum sensor change.
int calibratedValue = 0;
unsigned long delayTime = 2500; // Delay before notifying.
unsigned long resetTime = millis();
void setup() {
pinMode(LED, OUTPUT);
pinMode(BUTTON, INPUT);
}
void loop() {
// Read the sensor value.
int sensorValue = analogRead(SENSOR);
// Check if the calibration button is pressed.
if (digitalRead(BUTTON)) {
// Store the current value.
calibratedValue = sensorValue;
// Notify the user it is calibrated.
// The Pulse function is defined at
// the bottom of this sketch.
pulse(5);
}
// Check if the current value is above
// the stored calibrated value.
// We use the defined treshold.
if (sensorValue - calibratedValue > treshold) {
// If the last time the timer was reset
// was longer than delayTime ...
if (millis() - resetTime > delayTime) {
// ... notify the user!
digitalWrite(LED, HIGH);
}
} else {
// If the sensor velue is below the
// threshold, turn of the LED and
// reset the timer.
digitalWrite(LED, LOW);
resetTime = millis();
}
// Wait for 250 millisec before we loop.
delay(250);
}
void pulse(int count) {
// Pulse the motor on and off
// depending on the count value.
for (int i = 0; i < count; i++) {
digitalWrite(LED, HIGH);
delay(50);
digitalWrite(LED, LOW);
delay(100);
}
}
With the above code running smoothly, It’s time to make it more mobile! Before I started soldering, I converted my breadboard experiment into a more elaborate diagram. The Arduino Pro Mini was replaced by ATTiny85 using my TinyLoadr. Because of this, I also added a 100uF capacitor to prevent any problems with voltage spikes generated by the vibrating motor.
Soldering was the only thing I needed to do, to finish the mobile version of my Meduino. 3AA batteries (professionally taped together) poweres my little experiment, resulting in the following package:
So from now on, I will either stand up straight, or bend with a shake! Now, if this doesn’t let me win the Nobel price of medical science, I don’t know what will …
Any suggestions on how to improve it? Leave a comment down below!