de de
BikeNav - Project
Open Source Bicycle Navigationsystem

BikeNav - Project

↪ Go to Content

Short Introduction

Goal of this Bike Navigation environment is to produce a bike navigation system which is easy as possible in use and cheap as possible in production price.


To keep the usage as simple as possible the correct direction of driving should be shown like on a compass. This has the effect that the bicycle driver just needs a short look at the 'display' and is not getting irritated by too complicated maneuver instructions. Based on this general Idea the displaying device is also not that sensitive for bad lightning conditions like normal car navigation systems which are using LCD / TFT displays.

To keep the price as low as possible we are using a smartphone as the 'brain' of the navigation device. Today's smartphones are containing a GPS module, a Bluetooth module and an internet connection, so the idea was to make it possible to create a route using internet based maps (e.g. Google Maps, Bing Maps, Here Maps, etc.) and bike routing optimized search engines (e.g. Berlin By Bike (BBBike)). The route should be created out of selected waypoints and the compass functionality is just showing the direction to the next waypoint. The calculations of the current GPS position and the expected position / position of the waypoint will be done on the phone too and just the calculated direction has to be send to the displaying device. For this communication between the phone and the displaying device a Bluetooth connection should be used. By this setup the (maybe) expensive smartphone can be stored in a backpack and if something happens only the cheaper navigation display is getting damaged.

Content

1 Basic Concepts and Definitions
1.1 Usability
1.2 Hardware
1.3 Phone Application

2. Hardware
2.1 Part list
2.2 Schematics
2.3 Driver
2.4 Communication

3. Phone Application
3.1 Platform
3.2 Mathematical Basics

4. Next Tasks / Milestones
4.1 Hardware
4.2 Driver
4.3 Phone Application


1 Basic Concepts and Definitions

1.1 Usability

To keep the usability as easy as possible, the decision was to create the whole system as a digital compass which is showing the right direction to previously searched way points. During Navigation the bike driver should be able to see additional info's about the distance to the next way point and his current speed. So an additional 'classic' bike computer will become an unnecessary equipment (for simple measurements).

1.2 Hardware

The System should be a cheap solution and small in size, so it won't be a standalone system. The measurements of the GPS position, the calculation of the distances to the next way point, speed etc. will not be executed on the navigation hardware itself, but a normal mobile smart phone should do this job. Task execution on the new developed target hardware will be limited to receiving data and visualizing it. The communication will be provided by a Bluetooth connection and the visualization by a Ring of LEDs (show direction) and a small OLED display (show distances, speed etc.).

Definitions (short):
- min. run time on standard Batteries > 6h
- max. 2 messages at the same time to prevent deflection
- no flickering/high speed blinking LEDs/display info's (turn on/off LED in <1 sec)
- the system has to prevent the user from dangerous blending effects from the display
- driver time-out >= 5 sec. for leak in Bluetooth data receiving

1.3 Phone Application

Definitions (short):
- Runs on Android, iOS and Windows Phone (WP8)
- as soon as the route is selected, the application should be able to run offline
- route search has to be possible:
- direct input/interaction to a map
- using the Berlin by Bike search engine
- selectable display options (as data for the external BikeNav system):
- bike speed
- distance to way points
- optional display options (as data for the external BikeNav system):
- total distance
- driven distance
- average speed
- priorities if multiple display options are selected e.g. distance is a priority
  in case the next way point is less than 250m away


2 Hardware

2.1 Partlist

Name Quantity Price in EUR
(03-01-2016)
Art No.
(reichelt.de)
Description Datasheet
LED, SMD 2012 (0805), 100 mcd, blau 16 0.19 SMD-LED 0805 BL LED 0805 SMD » here
HIGH-SPEED CMOS SO-16 2 0.20 SMD HC 595 8 Bit shift register » here
Chipwiderstand 0603, 27 Ohm, 1% 16 0.10 SMD-0603 27 Resistor 0603 SMD » here
SMD-Quarz, Grundton, 16,000000 MHz 1 0.29 16,0000-HC49-SMD CPU Clock Crytal » here
ATMega AVR-RISC-Controller, TQFP-32 1 3.20 ATMEGA 328P-AU standard Arduino Uno R3
µC CPU (SMD)
» here
Buchsenleisten 2,54 mm, 1X04, gerade 1 0.16 MPE 094-1-004 4x1 Pin header » here
SMD-Vielschicht-Keramikkondensator 22P, 5% 2 0.04 NPO-G0603 22P Capacitator 0603 SMD » here
Chipwiderstand 0603, 10 K-Ohm, 1% 2 0.10 SMD-0603 10K Resistor 0603 SMD » here
micro-USB-Einbaubuchse, Typ B, 5-pol, SMD 1 0.58 MIC USB BBU micro USB socket for
power supply
» here
Schiebeschalter-Miniatur, Lötanschluß, 1x UM 1 0.19 T 215 switch (power supply) » here
Batteriehalter für 3 Micro AAA, geschlossen 1 1.15 HALTER 3XAAA battery holder -
Fotowiderstand 1 1.10 A 906013 Photo resistor for
brightness control
» here
hc-06 Bluetooth module 1 ~ 5.00 - Serial Bluetooth Module » here
SSD1306 OLED Display 0.96" 1 ~ 7.00 - monochrome OLED display, 0.96 inch,
Resolution: 128x64px
» here

2.2 Schematics

Photo: Complete first prototype on a breadboard  Screenshot: Schematics in Fritzing 


Download: Fritzing file - BikeNav1.0.fzz - contains schematics and PCB layout (no breadboard layout).

Download (*.fzz)


Download: PCB layouts for production (file formats: gerber, PDF and SVG).

Download (*.zip)


2.3 Driver

The ATMEGA328P-PU is the standard CPU for the Arduino Uno R3 micro controller. This controller was also used as the main hardware during the whole development process. That also means it is possible to use the complete system as an Arduino hardware which is 100% compatible to the Arduino IDE, » see here.


Driver Source Code

Download (*.ino)


Required 'not default' Arduino Libraries

Download (*.zip)


2.4 Communication

The Navigation System always expects 4 values from the Application:
- option for OLED Display
- direction
- unit
- value for OLED Display (always metrical units)

Format:
d<a>,<b>,<c>,<d>

<a>
selection of display mode on sub screen
0 = distance
1 = speed

<b>
direction on main screen
Possible Directions: 0 - 15
Examples:
0 = behind
4 = left
8 = in front
12 = right

<c>
shown units on sub screen
0 ... 2
0 = metrical units (Distances: 1.0 km > 999 m)
1 = imperial untis (Distances: 1.0 mi > 0.5 mi > 900 yd)
2 = us units (Distances: 1.0 mi > 0.2 mi > 800 ft)

<d>
float value
value for sub screen (distance or speed) always im metrical units conversation will be done by BikeNav Device(!)
Distances or speed (legal values): 0 - 10000000 m (10k km)
Arrival Message: -1
GPS error Message: -2


Example (quotation marks not needed):
'd0,8,0,1200' ➠ Navigation system displays that the next way point is straight ahead of the driver (LED pin 8 active) in a distance of 1.2 km.
'd1,8,2,24.5' ➠ Navigation system displays that the next way point in straight ahead of the driver (LED pin 8 active) and the driver speed is 24.5 mph.

Graphic: Directions to LED pin 

- if the distance = -1m, show arrival message (for end of the whole route)
- if the distance = -2m, show message that no GPS position is present
Usually these values for distances are impossible to reach by measurement/calculation.


Small demo video of the first version on a breadboard (shown data communication is slightly outdated on video).

Download (*.mp4)


3 Phone Application

3.1 Platform / IDE

To make it possible that a huge group of people are able to use this system, the development of the Application has to be made using a cross platform approach which supports Android, iOS and Windows Phone (min. WP8).

On this definition the decision is made for Cordova/PhoneGap. This Platform supports:
- GPS position
- Bluetooth connection (external plug-in needed)
- multiple map services (Google Maps and OSM available, here maps unknown)
- support of native external code (e.g. own written C# based / Visual Studio code for WP8 support if missing)


3.2 Mathematical Basics


To calculate the distances on the curvature of the earth correctly it is not possible to use the standard formula:

distance = √(x1 - x2)² + (y1 - y2)²

This formula only calculates the direct way through the earth and not the real distance on the surface.

Graphic: Quick drawing way on earths surface 

Instead of that the following formula is the more accurate one (not 100% accurate too because of rounded up errors, lower accuracy of earth radius = 6378137m, etc.):


tempLat = rad · (Lat2 - Lat1)
tempLon = rad · (Lat2 - Lat1)

tempDistance = sin(tempLat / 2)² + cos(rad · (y1)) · cos (rad · (y2)) · sin (tempLon / 2)²

distance = 6378137 · (2 · atan2(√tempDistance,√1 - tempDistance))


On the calculation for the angle between the bike and the way point the fault of the sphere will be ignored because of the too small effect on the real world environment.

So the easiest way to do so, is calculate the three distances between the previously measured bike position, the current bike position and the way point. After that the normal cosine rule can be used and multiplied by the degree term:

α = ( acos(b² - c² - a²) / (-2 · c · a) ) · ( 180 / π )

All calculations written in JavaScript.

Download (*.zip)


4 Next Tasks / Milestones

4.1 Hardware

- production of the first PCB version (adding power switch)
- testing stability
- functionality tests
- build a case model for 3D printers


4.2 Driver

- change LED order in Driver for PCB


4.3 Phone Application



Phase 01

- Simple Input field with a Bluetooth background service to send dummy data (final SDK specification at this point)
- Add "About" screen with Version Number

Phase 02

- Adding a GPS service to get own Position
- type add the mathematical logic to calculate real logical data using a dummy way point (math. logic is already finished)
- change input field to a background string and send data via Bluetooth to BikeNav hardware

Phase 03

- Add a Map to the App with possibility to select a real waypoint

Phase 04

- Adding gestures to select multiple waypoints and to edit them
- Adding List for waypoints to create a first real route
- Adding Messages (Destination arrived, GPS position not available)

Phase 05

- Add BBBike search engine as a second option for route definition

Phase 06

- Add "save" and "load" route services

Phase 07

- Graphic layout (basic)

Phase 08

- test of first prototype in real world (beta test)

Phase 09

- Bug fixing and Feature request work
- additional design work (let's make it fancy)

Phase 10

- add a manual "How to build the hardware"

Phase 11

- final test and bug solving phase

Phase 12

- release of the first open version