Skip to the content
2 layers70.7 × 78.1 mmPcb sensor, the printed circuit board in 3D

Open Source Motorcycle Tachometer

Size
70.7 × 78.1 mm
Copper layers
2
Thickness
1.6 mm
Parts
26
Nets
23
Pads
82
Tracks, vias
134, 12
Pours
1
Routed
Yes
KiCad
KiCad 6 (file 20211014)
Created
4 Sep 2021
Updated
4 Feb 2023

Overview

Pcb sensor is an open-source printed circuit board by h4ctar, from the h4ctar/retro-gauge repository on GitHub, published under the GPL-3.0 licence. It is a 2-layer board of 70.7 × 78.1 mm with 26 parts on 23 nets, routed with 134 tracks and 12 vias.

It is built around the SFH617A-2X009T and LM340MP-5.0. Its parts include 11 resistors, 6 diodes, 4 capacitors, 3 ICs and 2 connectors. It belongs with the sensors and measurement boards of this library.

Main components

2

README

README.md

Retro Gauge

Introduction

This is an open source motorcycle tacho project with the following features:

  • Analog tachometer
  • Digital speedometer
  • Odometer
  • Trip meter
  • Battery voltage
  • Standard indicators (turn signals, oil pressure, neutral and high beam)
  • Clock

It is housed in a classic round casing, with a retro looking 8 digit starburst LCD.

The toolchain is all open source; the PCB's are designed with KiCad and the case is designed in FreeCAD.

Assembly

System Design

The system design is simple, the only interesting decision is that the indicators all go via the microcontroller, this lets us do fun things with the indicators (test them when powered on or reuse the oil pressure indicator for other warnings).

System Design

Microcontroller

An ATmega328P-PU microcontroller will be used to process all the inputs, and drive the outputs.

Here are all the required inputs and outputs:

FunctionTypeNumber of pins
TachoDigital input1
SpeedoDigital input1
Oil pressureDigital input1
Turn signalsDigital input1
NeutralDigital input1
High beamDigital input1
Mode buttonDigital input1
Battery voltageAnalog input1
Stepper motorDigital output4 (could be 3)
RBG LEDsDigital output1
LCDDigital output3
ISPDigital IO3 (can be shared)
Real time clockDigital IO2

For a total of 18 digital IOs and one analog input, the ATmega328P-PU has more than enough at 23 programmable IO lines.

The ATmega328P-PU also has 1024 bytes of EEPROM which can be used to store the configuration, trip and odometer values.

An external 16 MHz crystal will be used to run the ATmega328P-PU at it's fastest clock speed.

The microcontroller will be programmed with an in-circuit serial programmer (ICSP). A bootloader doesnt need to be burned when using ICSP.

ATmega328P

The low byte fuses configure the clock:

BitNameDescriptionValue
7CKDIV8When set, divides the clock speed by 81
6CKOUTWhen set, the clock pulse is output on PB01
5SUT1Sets start up delay time1
4SUT01
3CKSEL3Sets the clock source1
2CKSEL21
1CKSEL11
0CKSEL01

The high byte fuses:

BitNameDescriptionValue
7RSTDISBLExternal reset disable1
6DWENDebug wire enable1
5SPIENEnable serial programming0
4WDTONWatchdog timer always on1
3EESAVEPreserve EEPROM memory through chip erase0
2EBOOTSZ1Sets the bootloder size memory1
1EBOOTSZ01
0BOOTRSTSelect the reset vector0

The extended fuses:

BitNameDescriptionValue
7Not used1
61
51
41
31
2BODLEVEL2Sets the brown-out detector level1
1BODLEVEL10
0BODLEVEL01

There is a simple Makefile that compiles and links the code and has targets to burn the fuses and the code.

Power Supply

A linear voltage regulator will be used to convert the bikes rough 14V down to a smooth 5V for the rest of the system. A smoothing capacitor is added on the bikes side to help smooth out the input before it gets to the regulator.

Power Supply

Indicator Lights

There are indicator lights for low oil pressure, neutral, high beam and turn signals.

The oil pressure and neutral sensors are simple switches to ground. So these will be directly connected to digital input pins. I'm not sure if the internal pull ups will be good enough so there will be provision on the PCB for external pull up resistors. There will be a diode to protect against connecting this pin to 12V on the bike.

Neutral

The highbeam and turn signals indicators should light up when they see 12V. We'll use an optocoupler to give some extra protection. The left and right turn signals need to go through diodes to stop them turning each other on.

Turn Signals

text
Diode forward voltage: 0.715V
Photodiode forward voltage: 1.3V
Photodiode forward current: 10mA
R1 = (14V - 0.715V - 1.3V) / 10mA = 1200 ohm ~= 1k ohm
text
CTR: 50%
Output current: 50% of 10mA = 5mA
Output voltage: 4V
R2 = (5V - 4V) / 5mA = 200 ohm

Tachometer

There are a few choices for the tachometer pickup, an inductive or capacitive pickup on one of the spark plug wires, or a hall effect sensor on a rotating part of the engine. The most robust solution is to go with the hall effect sensor, and the most universal location for it is in replacement of the mechanical drive off the camshaft of the original tachometer.

Tachometer

Speedometer

The speedometer will also be a hall effect pickup, but will be a simpler design with a few magnets on the wheel and an NPN hall effect sensor mounted on an axel spacer.

Speed Pickup

Real Time Clock

A PCF8563T RTC module will be used to keep the time for the clock. It will have a coin cell to keep the clock ticking when the key is off.

RTC

LCD

The VIM-878-DP-FC-S-LV LCD display will be used. It is a transflective LCD so works well in both bright sunlight and at night with a backlight. It is an 8 character 14 (plus 2) segment "starburst" display. It has a total of (14 + 2) * 8 = 128 segments and uses 4 backplanes.

LCD Segment Names

The HT1621B will be used to drive the LCD. There are some existing Arduino libraries to interface with it. It can drive 32 segments by 4 commons which is exactly what is required to drive the selected LCD.

The schematic of the driver to the display follows the application notes in the datasheet and is optimised for the PCB layout. It is controlled with 3 pins that are also used by the ICSP.

LCD Schematic

LCD PCB

This table has the LCD segments from the datasheet and what memory address they are according to the PCB layout:

LCD PinCOM0COM1COM2COM3Memory address
11D1E1FCA131
21L1K1J1I30
32D2E2FCA229
42L2K2J2I27
53D3E3FCA328
63L3K3J3I26
74D4E4FCA425
84L4K4J4I24
95D5E5FCA523
105L5K5J5I22
116D6E6FCA621
126L6K6J6I20
137D7E7FCA719
147L7K7J7I18
158D8E8FCA817
168L8K8J8I16
17COM0
18COM1
19COM2
20COM3
21DP88C8B8A15
228M8N8G8H14
23DP77C7B7A13
247M7N7G7H12
25DP66C6B6A11
266M6N6G6H10
27DP55C5B5A9
285M5N5G5H8
29DP44C4B4A7
304M4N4G4H6
31DP33C3B3A5
323M3N3G3H4
33DP22C2B2A3
342M2N2G2H2
35DP11C1B1A1
361M1N1G1H0

From this table we can see that each digit is powered by 4 LCD pins that map to 4 memory addresses. For example digit 1 is LCD pins 35, 1, 2 and 36, which map to memory address' 1, 31, 30 and 0.

The font maps ASCII characters to the segments in order CA,F,E,D,I,J,K,L,A,B,C,DP,H,G,N,M. The segments are in this order so the nibbles match the memory layout of the driver.

The address mapping maps digits to the 4 memory addresses that the font nibbles should be written to.

DigitAddress'
11,31,30, 0
23,29,27, 2
35,28,26, 4
47,25,24, 6
59,23,22, 8
611,21,20,10
713,19,18,12
815,17,16,14

This font table and address mapping should be enough to display text on the LCD.

Stepper motor

The X27.168 stepper motor will be used, it is designed for gauges and can be directly driven from a microcontroller.

People on the internet say that clamping diodes are required, so they will be added.

Motor

The X25 datasheet shows the required pattern to step the motor.

Step Pattern

Indicators

Neopixels

PCB Design

There are three PCBs: the main board, the sensor board and the face board. The boards are stacked using standoffs and are connected together with 2.54mm stacking header pins.

The main board has the microcontroller, stepper motor, LCD, real time clock and indicators. The sensor board has the power supply and the signal conditioning. The face board is the dial face and has transparent icons for the indicators.

Main PCB

Case Design

The case is 3D printed out of ASA.

Case

EEPROM

The ODO, trip and configuration will be stored in EEPROM.

EEPROM has like 100,000 writes before it wears out, so in order to be able to store the ODO and trip we will need to be able to rotate to new address'. To do this we will have a table at the start of the EEPROM that stores the address of each value and if the EEPROM gets corrupt we will find a new place to store it and update the table.

AddressSizeDescription
08ODO Address
18Trip Address
28Wheel diameter
158Next available address
1632ODO value
2032Trip value

Firmware

The source code is in the firmware/src directory.

There is a makefile with a default target to compile and link the source into a hex file; a burn target to burn this hex to the micro and a fuses target to write the fuses. It is configured to use avrdude and a usbtiny programmer to talk to the microcontroller, but it should be possible to modify it to use other methods. The code is compiled with clang. There is a compile_flags.txt file that is used to configure a language server so that Vim or Visual Studio Code can give nice completion and code navigation.

On Arch linux I install the following tools and dependencies:

  • llvm
  • clang
  • avrdude
  • avr-libc
  • lib32-glibc

Datasheets

Parts

26
QtyValueFootprintReferences
510kResistor_SMD:R_1206_3216Metric_Pad1.30x1.75mm_HandSolderR2, R3, R5, R8, R10
41N4001Diode_SMD:D_1206_3216Metric_Pad1.42x1.75mm_HandSolderD1, D2, D3, D4
41kResistor_SMD:R_1206_3216Metric_Pad1.30x1.75mm_HandSolderR1, R4, R9, R11
2DDiode_SMD:D_1206_3216Metric_Pad1.42x1.75mm_HandSolderD5, D6
2SFH617A-2X009TPackage_DIP:SMDIP-4_W7.62mmU2, U4
10.1uCapacitor_SMD:C_1206_3216Metric_Pad1.33x1.80mm_HandSolderC4
10.22uCapacitor_SMD:C_1206_3216Metric_Pad1.33x1.80mm_HandSolderC3
1100nCapacitor_SMD:C_1206_3216Metric_Pad1.33x1.80mm_HandSolderC1
1100uCapacitor_THT:CP_Radial_D8.0mm_P3.80mmC2
14.7kResistor_SMD:R_1206_3216Metric_Pad1.30x1.75mm_HandSolderR6
147kResistor_SMD:R_1206_3216Metric_Pad1.30x1.75mm_HandSolderR7
1Conn_02x06_Counter_ClockwiseConnector_PinSocket_2.00mm:PinSocket_2x06_P2.00mm_VerticalJ1
1Conn_02x08_Top_BottomConnector_Molex:Molex_Mini-Fit_Jr_5566-16A_2x08_P4.20mm_VerticalJ7
1LM340MPPackage_TO_SOT_SMD:SOT-223U1

More from h4ctar/retro-gauge

1
  • 2 layers74.2 × 78.1 mmPcb main, the printed circuit board in 3D

    Pcb main

    h4ctar/retro-gauge

    Open Source Motorcycle Tachometer

    43 parts3GPL-3.0

Similar boards

  • 2 layers115 × 95 mmVXDash RemoteECU, the printed circuit board in 3D

    VXDash RemoteECU

    martinroger/VXDash

    An instrument cluster for the VX220

    370 parts3CERN-OHL-S-2.0
  • 2 layers49 × 49 mmSPINE Cortex, the printed circuit board in 3D

    SPINE Cortex

    ManhTi3012/SPINE

    Stackable Power Integration & Network Electronics

    99 parts2
  • 2 layers135.1 × 159.4 mmBMS Master, the printed circuit board in 3D

    BMS Master

    UCDFS/Circuits

    KiCad projects and PCB designs for UCDFS electronic circuits.

    220 parts1
  • 2 layers157.4 × 59 mmAvionicsBoard, the printed circuit board in 3D

    AvionicsBoard

    djmallek/CycloneRocketry

    Some work I do for CycloneRocketry

    85 parts1
  • 2 layers139 × 34 mmControllerBoardSMDPSU, the printed circuit board in 3D

    ControllerBoardSMDPSU

    Fredovsky/B13B-Nixie-clock

    Nixie clock made from F9057 Nixie tubes (B13B sockets).

    57 parts
  • 2 layers116.8 × 116.8 mmBentoboard, the printed circuit board in 3D

    Bentoboard

    torbers/bentoboard

    as many ready-to-use electronics as i could fit on a 4"x4" PCB.

    381 parts
  • 2 layers100 × 93 mmSpeeduino base, the printed circuit board in 3D

    Speeduino base

    Tjeerdie/SPECTRE

    Speeduino compatible engine control unit (ECU) based around black STM32F407VET6 board.

    161 parts59GPL-3.0
  • 2 layers145 × 118 mmM52, the printed circuit board in 3D

    M52

    rusefi/hw_legacy

    In this repo we archive rusEfi-related abandoned hardware files

    224 parts2

Questions

How big is the Pcb sensor PCB?

It measures 70.7 × 78.1 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Pcb sensor use?

26 parts, built around the SFH617A-2X009T and LM340MP-5.0. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Pcb sensor KiCad files?

From the h4ctar/retro-gauge repository on GitHub, at the commit this page was made from: the board is pcb-sensor/pcb-sensor.kicad_pcb and its schematic pcb-main/pcb-main.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Pcb sensor design in my own project?

Its repository publishes it under the GPL-3.0 licence: you may reuse it on that licence's terms (keep the author's notice, and for a copyleft licence share your changes alike).