Jens
Published © GPL3+

Bicycle Computer on Spresense

A connected dash cam bicycle computer that collects your sensor data like heart rate and guides you to the nearest ice cream shop.

ExpertWork in progress1,831

Things used in this project

Hardware components

Spresense LTE extension board
Sony Spresense LTE extension board
Spresense Main board and LTE extension board
×1
Spresense camera board
Sony Spresense camera board
×1
XIAO BLE Sense
Seeed Studio XIAO BLE Sense
This board will add Bluetooth Low Energy (BLE) functionality. Any nRF52840 or nRF5340 board will do the job. I chose this one because it is small and has TELEC certification.
×1
Adafruit 1.3" 240x240 Wide Angle TFT LCD
Any ST7789 or ILI9341 screen will do the job. Just take into account that the bigger the screen is, the less the refresh rate will be.
×1
Adafruit 10-DOF IMU Breakout L3GD20H LSM303 BMP180
Optional. Integrated, but not yet fully in use. I used this because I had it available. It is discontinued. You should be able to easily replace it with any other Adafruit 9-DOF board due to their universal drivers.
×1
Qwiic adapter for Spresense
By Switch Science. This adapter includes level shifting between 1.8V and 3.3V and fits onto the Spresense board like an extension board. It provides a Qwiic or STEMMA QT port for convenience. Unfortunately only available in Japan. As an alternative I would suggest a "4-channel I2C-safe Bi-directional Logic Level Converter - BSS138" by Adafruit Product ID: 757. (Not tried out)
×1
Mic-kit for SPRESENSE_LTE
Optional. Integrated, but not yet fully in use. By AUTOLAB Co., Ltd. distributed via Switch Science. This adapter converts the pins to a 3.5mm jack. Analog mics are included. Unfortunately only available in Japan. As an alternative attach analog mics according to the documentation. This kit just saved me from soldering parts.
×1
Adafruit Passive GPS Antenna uFL - 15mm x 15mm 1 dBi gain
Optional. You can use the internal antenna. If you think performance in insufficient, consider attaching an external antenna.
×1
Hirose Connector U.FL-R-SMT
Optional. The tiny connection you need to solder to use an external GPS Antenna. In Japan both the connector and antenna are available at Akizukidenshi.
×1
LTE-M SIM Card
Get a LTE-M SIM Card from your local provider. In Japan IoT SIM (plan-D) by Soracom seems to be most reasonable.
×1
Micro SD Card
Get a FAT32 formatted micro SD or SDHC Card with max. 32GB to store certificates, images from the camera, GPS data, diagnostic data and audio from the mic. Take care that the max is
×1
PH Male Connector
Japan Crimp Terminal Mfg. Co., Ltd. S2B-PH-K-S PH male connector to connect a Lithium polymer battery.
×1
Adafruit Lithium polymer battery
Not sure which size is best yet. Use a battery with protection circuit. LiPO batteries can be dangerous. If you are using one for the first time, read a guide first. (https://learn.adafruit.com/li-ion-and-lipoly-batteries?view=all)
×1
Adafruit 4-channel I2C-safe Bi-directional Logic Level Converter - BSS138
Used to connect the interrupt pins of the IMU to the Spresense main board.
×1

Software apps and online services

AWS IoT
Amazon Web Services AWS IoT
Choose the MQTT Server of your choice. Reason for AWS IoT was that it accepts also image data up to 200kB and can save all data in a database. However AWS IoT free tier is only for 12 months.
Visual Studio Code Extension for Arduino
Microsoft Visual Studio Code Extension for Arduino
Choose the Arduino environment of your choice. Reason for VS Code was that you can navigate and search easily, add any folders and it feels faster for compilation.
Sony Spresense Arduino SDK
We will recompile the Spresense SDK with a different configuration and create a custom Spresense Arduino SDK. We will use several Arduino Libraries from this SDK.
Sony Spresense SDK
We will recompile the Spresense SDK with a different configuration and create a custom Spresense Arduino SDK.
Yahoo! Japan APIs
They are used to retrieve weather data and POIs nearby. Unfortunately only available in Japan. You will need to find an alternative for your region. I will give some instructions in the story.
ArduinoBLE
Arduino library by Arduino Version 1.3.1 Install via Arduino Library Manager. Modified this library. See story section.
ArduinoJSON
Arduino library by Benoit Blanchon Version 6.18.4 Install via Arduino Library Manager.
ArduinoLog
Arduino library by Thijs Elenbaas Version 6.18.4 Install via Arduino Library Manager.
TFT_eSPI
Arduino library by Bodmer Version 2.4.61 Install via Arduino Library Manager. Modified this library. See story section.
lvgl
Arduino library by kisvegabor, embeddedt, pete-pjb Version 8.2.0 Install via Arduino Library Manager. Configured this library. See story section. Names taken from Arduino library manager. There are much more contributors. https://lvgl.io/about mentions also Amir Gonnen, Vitaly Puzrin and Carlos Diaz.
Adafruit 10-DOF drivers for Arduino
Summarizing several libraries here used for 10-DOF. Install via Arduino Library Manager *with dependencies*. Adafruit 10DOF Version 1.1.1 (includes Adafruit BMP085 U, Adafruit L3GD20 U, Adafruit LSM303 U, Adafruit Sensor) Adafruit AHRS 2.3.2 Adafruit Sensor Calibration 1.1.3
Arduino EventManager
Arduino Library. Integrated into the project and heavily adapted for my needs. Copyright (c) 2016 Igor Mikolic-Torreira Portions are Copyright (c) 2010 OTTOTECNICA Italy
SimpleSerialShell
Arduino library by Phil Jansen Version 0.9.2 Install via Arduino Library Manager. Modified this library. See story section.
Robot Framework
The test framework
StrictDoc
Framework for requirements tracing
Plantuml
Tool to create diagrams
libogg
Library to package opus encoded audio with Ogg container format
liboggz
Library to package opus encoded audio with Ogg container format
libopus
Library to encode audio with OPUS codec

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
I used the following parts. Choose whatever you have or prefer. * Hakko FX-600 Soldering iron * The smallest tip I found: T18-I * An iron stand (something cheap) * (thin) soldering lead * A stand to fix the parts with a magnifying glass (something cheap) * Tweezers to hold the tiny hirose connector * some glue to fix the GPS connector cable * a fan to keep the smell away from me
Drill, saw, driver
Something to cut your sheets / plates to a good size and add holes into them for screws and spacers. A driver to fix screws and spacers.
Acrylic sheet, aluminum plate with 90 degree angle, screws, spacers
For my prototype I just used parts I had nearby or found in the nearby home center. I doubt you want exactly the same as it is a prototype currently. Take the info as a reference. Could be anything similar. * Acrylic sheet: A thin transparent one. * Aluminum plate: Anything that provides you a 90 degree change. * Screws: What fits your hole size. * Spacers: Litorange M2 Nylon Hex Spacers (https://www.amazon.co.jp/-/en/gp/product/B07V2M4H5M)
PhoneBag Comfort S
I took off the adapter from the bag and attached it to my prototype. I bought such a bag over 10 years ago. The attached link is the current model. I could remove the adapter without destroying the bag (wow, surprise, a well thought design)

Story

Read more

Schematics

Software Architecture

The original drawio file is inside the repository's doc folder.

Schematics and Software Architecture

The original drawio file is inside the repository's doc folder.

Code

Bicycle computer on Spresense

This is the main project

Spresense BLE with XIAO BLE

This explains how to use the ArduinoBLE library with a BLE HCI compatible firmware and how to create such a BLE HCI compatible device.

Credits

Jens

Jens

3 projects • 4 followers
Studied Computational Linguistics with machine learning focus and Japan Studies. Working on AOSP (Android) in the automotive industry.

Comments