Project with the aim of creating an altimeter that can display data both in the presence of a smartphone inside a web page and in outdoor environments using a display.
- Overview
- Features
- Getting Started
- Usage
- Architecture
- Design and Implementation
- Tests
- Contributing
- License
- Acknowledgements
The project reported in the repository aims to measure the altitude at which the device is located, giving an approximate measurement. The measurement takes place by means of an atmospheric pressure sensor and with subsequent adjustments the approximate measurement of the elevation with respect to sea level is calculated. Since the measurement is based on atmospheric pressure, it must be considered that it can vary considerably over time due to atmospheric phenomena, consequently, to have a more accurate measurement, it is necessary to average the measurements of the device over several days with stable atmospheric conditions. Having said this premise, the project aims to incorporate challenges from a design point of view ranging from the programming of the device to its realization of the circuit and the body.
The features that the manufactured device supports in its first software version:
- F 1: reading from atmospheric pressure and temperature sensors
- F 2: calculation of the elevation starting from the atmospheric pressure
- F 3: reading of the information coming from the sensors through a 128x32 display
- F 4: reading of the information coming from the sensors in a web page generated by the device
- F 5: battery for using the device outdoors
To start, it is necessary to have the availability of some materials described in the sub-paragraph below:
- Arduino ide
- 3mm inserts
- 3mm screws for the inserts
- cr2032 battery holder
- usb-c cable
- D1mini (esp8266mod)
- 128x32 display
- wires for the circuit for both breadboard and protoboard
- breadboards
- BMP280 pressure sensor
- (optional) 3D printer
- (optional) soldering iron pen
- (optional) protoboard
First of all we proceed with the creation of the circuit on the breadboard, since both the display and the sensor communicate with the I2C protocol we proceed to connect the pins responsible for this communication between the controller and the devices that will communicate with this bus. As shown below:
SCL | SDA | Vin | |
---|---|---|---|
D1 mini | D1 | D2 | # |
Display | SCL | SDA | 3.3v |
BMP280 | SCL | SDA | 3.3v |
Once the circuit has been completed, you can proceed with the installation of the components necessary for the creation of the code:
- Adafruit_BMP280
- Adafruit_GFX
- Adafruit_SSD1306
- ESP8266WiFi
- https://github.com/esp8266/Arduino (it is to be installed in the board section of the Arduino ide)
Once the components have been installed, you can proceed to connect the D1 mini to the PC and continue with the upload of the code to the controller.
The code can be found in the altimeter_code\
folder
The parts necessary for the body can be printed in 3D (stl files are available) by printing and inserting the inserts into the prepared slots, the body is completed. a housing has been prepared for the circuit protoboard (in green in the photo) to be inserted above the battery housing (black box connected to the protoboard):
To use the device you can connect it to an external power source: from off by connecting it to a power bank or use the device's two CR2032 batteries.
Once switched on, the start screen with the "125ade lab" logo will first appear, then the IP address of the page to view the sensor data from the smartphone and then the data from the sensors will appear on the display.
To turn off the device, you need to unplug the power cord or turn off the battery pack switch.
OFF | ON setup phase | ON show IP | ON show data | ON show Web page |
---|---|---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
Conceptually, the device consists of a battery connected to a D1 mini from which an I2C bus connects the 128x32 display and the pressure sensor. As for the software, it is divided into two files, one with the project code and another with the secret.h file which contains the ssid and the wifi password generated by the device. The main code is divided into 3 parts a declaration of most of the variables a second part of setup of the various systems that will be used to then conclude with the third and last part and that is the loop inside which all the logic that manages the functions resides of the device.
In this project there are two distinct streams of development and prototyping that make it interesting: and it is the development that concerns the protoboard and the software as well as the development of the hardware of the device body. Compromises have been reached for both development strands to maintain the performance expectations that this project requires. It should be emphasized that the imperative was the speed of implementation as a whole.
The choices that characterized the development were the availability of the materials used since unlike other projects this was made with the exclusive use of inventories from previous projects from the sensors to the wires used for the protoboard. A protoboard has been used with slots that allow for the removal of the controller and display pins as well as the sensor as this is the first version of the circuit and a specific PCB has not yet been developed for this project hence the need to remove the devices to place them in their final position once the final version has been designed and built. Although the battery does not hold a charge for extended periods of time, it was selected because it gives the device an autonomy of a few days enough to allow the components to be tested in different contexts.
The developed software was structured in the first version to offer all the functions that this project must provide without particular precautions, leaving the possibility of improving the overall sensitivity of the sensors and the user experience to future updates.
The time taken from the design of the circuit, to the realization of the protoboard, as well as the very first version of the software (with only the 1-2-3 functions) were spent less than three hours.
The development of the latter followed a very pragmatic approach with respect to the ergonomics of the device since the categorical need was to protect the sensor and the display from accidental falls in an outdoor environment and to keep the battery and the protoboard inside the device. For the realization we opted for 3D printing and to reduce the time of use of the printer itself we opted for the development of a very massive body in appearance and with lines easily implemented by the printer software, guaranteeing rapid execution. Since objectively the final result is to be updated and improved, it was decided that the first version of the body will be called V1 which consists of three pieces made in 3D printing, two 3mm inserts and two 3mm screws which guarantee the correct closure of the body of the device.
To test the device there are two ways to use a pressurized capsule and read the pressure that varies and relate it to the pressure imposed on the capsule or take the device to points that have a different altitude and see the difference between the calculated height and the actual height of the point where you are for the tests carried out, the created device has an approximation of [ +- 50 m ]
Anyone is free to help improve the code or design of the device and do not hesitate to contact me if you have any questions about the project.
For this project I started using the examples provided by the reference libraries mentioned above and searching the web for the various approaches followed by others before me.