Making a pedometer that sends data wirelessly to my PC

Hello, I'm looking at making a pedometer from an Aruino Nano 33 IoT and an ADXL345 Triple Axis Accelerometer. I'm a product design student so I know very little about programming and after reading a lot online about other people trying the same project I still cannot seem to get it to work. I need the Arduino to interpret the data from the accelerometer, convert it into steps and send the steps to my PC wirelessly using the arduino cloud. I think I have the hardware set up correctly however I have almost no idea with the code. Please help!

Welcome to the forum

Please post a schematic of your projec (photo of a hand drawn diagram will be good enough) and your best effort at the coding for it

Please follow the advice on posting code given in Read this before posting a programming question in order to make your sketch easy to read, copy and test

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

If the code exceeds the 9000 character inline limit then attach it to a post

Here is the code, at the moment it only reads the data from the accelerometer, and displays it in the serial monitor. There should also be an image of the circuit attached. I dont know where to go from here

#include <Wire.h>

int ADXL345 = 0x53; 

float X_out, Y_out, Z_out; 

void setup() {

void loop() {
  Wire.requestFrom(ADXL345, 6, true); 
  X_out = (| << 8); 
  X_out = X_out/256; 
  Y_out = (| << 8); 
  Y_out = Y_out/256;
  Z_out = (| << 8); 
  Z_out = Z_out/256;

  Serial.print("Xa= ");
  Serial.print("   Ya= ");
  Serial.print("   Za= ");

The nano 33 IoT has it's own accelerometer. Why do you need to use an external one?

Reading the accelerometer seems easy enough, and I'm sure you can find examples on-line telling you how to send the data over wifi or Bluetooth.

The crux of it would seem to be the math required to interpret what you get from the accelerometer and convert it into steps. It'll be complicated by the fact that you will need to make it work in any orientation too. I'd suggest that you might want to look at other similar projects to see if you can get some ideas on the calculation method - it's not really an Arduino problem.

I would work on getting the raw data to a PC and record yourself walking around, running, sitting down, drinking coffee etc. Once you have that sample data you can run test code over it repeatedly on the PC to do the analysis, refining your algorithm as you go.

I'd also use a real pedometer (or your phone) to get counts for those sample activities to compare against. I note that such devices rarely agree with each other exactly.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.