Simplfying the current pedometer for the aging generation looking to get healthy. Most older users are turned off by complex devices and UIs. Being able to monitor their own health by implementing a simple and user-friendly interface can lead to a more active lifestyle.
Firstly, a list of parts will be required in order to recreate this project. Below is price a breakdown of the prices and parts for each component used to get the project to completion. Spreadsheet with hyperlinks can be found here.
In this step we will cover basic Raspberry Pi imaging so you are able to login and access your device to test and drive your sensors. Download the latest Raspberry Pi image. Our recommendation is NOOBS. This will ensure that starting off, you will have almost everything you need if you decide to re-purpose the device later on.
-
Download etcher. This program will allow you to burn the Raspberry Pi image to your SD card.
-
Insert your SD card into the SD card reader and plug it into your computer.
-
Open etcher and follow the on screen instructions to burn your image. We found this program the easiest to use. Extra documentation if needed.
-
Insert the SD card into your Raspberry Pi along the underside of the device, logo facing out. Plug all of the required cables in such as: Ethernet, HDMI cable, mouse, keyboard, power, and turn the device on.
-
Upon boot you will see an option for different operating systems. Select Raspbian and follow the on screen instructions to complete the OS installation.
-
At this point the Pi should boot to desktop. Follow the additional set up options on screen.
-
Enable I2C. This is the method we will be using to communicate with our Raspberry Pi. Type
sudo apt-get install -y python-smbus i2c-tools
into the terminal by pressingctrl+alt+t.
-
Type
sudo raspi-config
into the terminal. -
Go to interfacing options > and enable I2C.
-
Power down with
sudo powerdown
from the terminal by pressing and set the Pi aside. You will not be using it until sensor testing.
Here we will cover basic sensor connectivity to the Raspberry Pi using a breadboard for creating mock layout/design that will be used in the PCB creation stage.
-
Gather the following items: Breadboard, LSM303 Sensor, MPR121, 128x64
LCD sensor, and 4 Female-to-Male GPIO cables. -
Identify the labels on the sensor. For basic usage, we will be using: 3.3v, GND, SDA, and SCL.
-
Identify the corresponding pinouts on the Raspberry Pi. This website is a great tool to use if you are unsure.
-
Plug in the female part of the GPIO cables into the Raspberry Pi’s 1,3,5, and 6 pins, based on the chart from pinout.xyz. These are the pins we are going to be using for this project.
-
Using the connectors that came with the sensors, plug them into the breadboard and rest the sensors accordingly. Below is an example.
-
Connect the corresponding cables from the Raspberry Pi into the matched holes for the sensor.
-
(Optional but recommended) Power on the Raspberry Pi to see if the sensors are being detected correctly by viewing their address values.
-
(Optional but recommended) Open the terminal with
ctrl + alt + t
and run the command:i2cdetect –y 1
. Ideally, the resulting output should be as follows, if not double check your connections and try again. -
Voila! You have your mock up sensor connection!
This is part of the project that needs to be proceeded with care and caution. It is advised to double check your designs before purchasing etching and cutting services. For this step, Fritzing will be used. It is an open-source application that allows the user to easily create PCB schematics for different development platforms. It is highly customizable and easy to use.
-
Download and extract Fritzing. Installation notes are on the linked page for various operating systems.
-
(Optional) Download the AdaFruit Fritzing Library. Handy if you want to take the extra step and create a mock or your own connection/designs in Fritzing.
-
Download our Fritzing file here and open it. From the PCB tab, you can make changes at your leisure and pick it apart to see how it was made. Below is an image of our design.
-
Export as a gerber file (the format primarily used in create a physical PCB). File > Export for Production > Extended Gerber and select an appropriate folder.
-
Zip/Compress the folder containing the gerber files and send them to your etcher of choice.
Once you have your PCB etched, we are ready to solder the parts together. Again, please double check your design before finally soldering.
-
Gather your sensors, copper wire, wire stripper, the pin headers that came with the sensor, your PCB, solder, and soldering iron.
-
Solder your headers that came with your sensors, pictured above, to the corresponding holes. Put the longer end of the headers into your breadboard and place your sensor holes into the upright pins and solder all of the pins. This will ensure your sensor doesn’t move too much during soldering and a sturdy connection. Note: Watch this video on soldering tips for additional help. Solder in a well ventilated area and use safety glasses.
-
Solder your vias on your PCB. The easiest method we found, was to strip your copper wiring, stick it into the breadboard, and slide one via onto it so that it is flat and stable for soldering. Imaged below is an example, and repeat for each via. Once each via is soldered, snip the excess wire with cutters.
-
Solder your stackable headers. Using the breadboard again, take some extra copper wire from the snipped vias, or strip more, and place it into the female part of the header. The more, the sturdier. Flip the header over and plug it into the breadboard. Place your PCB onto the pins sticking out and solder the connections. Example placeholder image below.
-
Repeat the process for the 2x20 header for the Raspberry Pi. It’s not entirely necessary to solder all of the holes, but it ensures the PCB does not bend as much.
-
Your soldering should be complete. Plug everything in accordingly, and you should be ready for the next step! Example placeholder image below.
Once everything is plugged in, and you have double checked your connections, power on your Raspberry Pi.
-
Open up the terminal with
ctrl + alt + t
and run the commandi2cdetect –y 1.
-
Hopefully everything is in working order. If so, you will see the following address values.
-
If not, go back and check if your sensors are connected accordingly.
For this portion, you will need an internet connection as you will be required to download libraries in order to test each sensor.
-
Make sure your Pi is up to date with the latest packages. Run
sudo apt update
in the terminal to make sure everything is up to date. -
We will be using Python to test the sensors, and will need the appropriate tools. Run the following commands in the terminal to ensure we have everything required to read from the sensor. We will test the LSM303 first.
sudo apt-get install git build-essential python-dev cd ~ git clone https://github.com/adafruit/Adafruit_Python_LSM303.git cd Adafruit_Python_LSM303 sudo python setup.py install
-
Navigate to the
/Adafruit_Python_LSM303/examples
directory. -
Test your sensor by running
sudo python simpletest.py
. Your readings should look like the following: -
You can test the readings by moving your device in different directions with different speeds. You will notice the values changing accordingly.
-
Download the test code from Jonas’s repository with:
wget https://raw.githubusercontent.com/YamiYukiSenpai/MacroKeyTouchSensor/master/cap-touch.py
-
Run the code using
sudo python cap-touch.py
. You will then be able to touch each of the nodes on the sensor, or you can have individual wires running from each position. Below is an example output.
-
Download the test code using:
git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git
-
Navigate to the
Adafruit_Python_SSD1306/examples
directory and run the example code usingsudo python shapes.py
. The following should look like the placeholder image below.
We have provided a rough case file (Created with CorelDraw x6) for those that wish to continue further for potential real world use. This case will ensure your sensors, Pi, and PCB are protected all while providing enough room for you to remove the sensor at your leisure. For portability, there is definite room that can be improved upon if you wish to make the device smaller and more portable. This concludes the end of the build instructions, and below is a placeholder image regarding the final product.