Introduction: PostureQ

This project creates a portable meter for measuring good posture using the Arduino. It also uses the Arduino shield found at along with a few of the Breadware modules. If you'd like to save 10% on a Breadware shield, enter the code byars17 at checkout.

Thanks to the ease of using the Breadware shield, this project only takes a few minutes to put together. It will also serve as a short introduction to Breadware software.

Step 1: Bill of Materials

1. Arduino Mega

2. Mega-B Bread™Board

3. Button Module

4. Accelerometer Module

5. Output Sensor ( I used the LED module in this tutorial )

Step 2: Create the Project

First, go to and login or create an account.

Once signed in, press New Project on the bar on the left side of the webpage.

Select the Mega-B Board and Blank Template.

Step 3: Prepare the Board

When the project first opens, there will be an empty board on the screen with Breadware modules to the right. We will be setting the Accelerometer, Button and LED onto the board. You can drag them onto any of the available spots, but make sure the physical board mirrors the positions you use in the program. I positioned them as shown in the image.

As the components are placed on the board, you will be asked to name them. I named the button 'PowerButton', the accelerometer 'TiltDetector', and the LED 'PostureIndicator'. Feel free to name them anything you like. You will have to replace my names in the code if you do choose unique names,though.

**Note** Where the accelerometer is positioned affects the readings it receives. This will lead to a small adjustment in the code provided.

Step 4: Create the Firmware

Go to the Write Firmware tab, shown in the image. Enter the code below into the loop tab (remember to change the names in the code if you didn't use mine).

**Note** You might have to play around with the value in if(pitch < -50). I set the value as -50 based on trial and error. A lower number would allow you to lean further forward and backward before the PostureIndicator LED lights up. Also, if you don't put the accelerometer in the same position I did you will have to determine a value for yourself. To help determine what value to choose, the code prints the pitch values to the serial monitor.


while(!PowerButton.is_pressed()); //wait for button press
while(PowerButton.is_pressed()); //wait for button to be released

//record posture until button is pressed again


// create a motion variable to allow sensor to differentiate between tilting and motion

double motion =sqrt(TiltDetector.read_x()*TiltDetector.read_x()+TiltDetector.read_y()


// read the pitch to detect bad posture

double pitch = atan2((- TiltDetector.read_x()) , sqrt(TiltDetector.read_y()

* TiltDetector.read_y() +TiltDetector.read_z() * TiltDetector.read_z())) * 57.3;

if(pitch > -50 && motion < 11 && motion > 8) {



Serial.println(pitch); //print the pitch to the serial monitor to see what it reads



while(PowerButton.is_pressed()); // don't begin loop again until button is released

Step 5: Upload the Code

Press the save button (shown in first image) and then the download button (to its right).

Create a new folder anywhere you'd like and unzip the downloaded file into this new folder. The folder can be named anything you'd like, but you must change the .ino file among the unzipped files to match the folder's name. For instance, I named my folder PostureQ so I had to rename the .ino file to PostureQ.ino.

Once this is done, open the .ino file.

**Note** You will need the Arduino IDE installed to do this. The download is located at

Finally, connect the Arduino Mega to your computer and upload the code onto the board.

Step 6: Check Your Posture!

Attach the Mega upright onto your shoulder to measure posture. To start recording press the button and when you're done recording press it again. If you lean too far forward or backward the LED will go off indicating bad posture.

**Note** For convenience I would suggest connecting the Accelerometer to the board using wires so that you could have just the accelerometer on your shoulder while the mega rests comfortably in your pocket. As seen in the image, the pins on the LED, from left to right, say VCC, GND, <blank>,<blank>, GPIO. If you use wires, the two blank pins don't need to be connected.

Also, I used the LED module to indicate bad posture, but you could use any module you'd like. This device will save your back!