Skip to the content
2 layers74.2 × 78.1 mmPcb main, the printed circuit board in 3D

Open Source Motorcycle Tachometer

Size
74.2 × 78.1 mm
Copper layers
2
Thickness
1.6 mm
Parts
43
Nets
82
Pads
234
Tracks, vias
506, 41
Pours
1
Routed
Yes
KiCad
KiCad 6 (file 20211014)
Created
4 Sep 2021
Updated
4 Feb 2023

Overview

Pcb main 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 74.2 × 78.1 mm with 43 parts on 82 nets, routed with 506 tracks and 41 vias.

It is built around the ATMEGA328P-AU, PCF8563T/5 and WS2812B, with the Q13FC1350000400 and X322516MLB4SI among its other parts. Its parts include 16 diodes, 11 capacitors, 4 resistors, 4 ICs and 3 connectors. It belongs with the AVR (ATmega, ATtiny) boards of this library.

Main components

5

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

43
QtyValueFootprintReferences
9100nCapacitor_SMD:C_0805_2012MetricC1, C4, C5, C6, C7, C8, C9, C10, C11
81N4001Diode_SMD:D_1206_3216Metric_Pad1.42x1.75mm_HandSolderD1, D2, D3, D4, D5, D6, D7, D8
6WS2812BLED_SMD:LED_WS2812B_PLCC4_5.0x5.0mm_P3.2mmD9, D10, D11, D12, D13, D14
310kResistor_SMD:R_0805_2012MetricR2, R3, R7
21N4001Diode_SMD:D_SOD-323D15, D16
222pCapacitor_SMD:C_0805_2012MetricC2, C3
1100kResistor_SMD:R_0805_2012MetricR1
1ATmega328P-AUPackage_QFP:TQFP-32_7x7mm_P0.8mmU1
1AVR-ISP-6Connector_PinHeader_2.54mm:PinHeader_2x03_P2.54mm_VerticalJ1
1Battery_Cellfootprints:CR1220BT1
1Conn_01x02_MaleConnector_JST:JST_PH_S2B-PH-K_1x02_P2.00mm_HorizontalJ3
1Conn_02x06_Counter_ClockwiseConnector_PinHeader_2.00mm:PinHeader_2x06_P2.00mm_VerticalJ2
1HT1621B-LQFP-APackage_QFP:LQFP-48_7x7mm_P0.5mmU2
1PCF8563TPackage_SO:SOIC-8_3.9x4.9mm_P1.27mmU4
1Q13FC1350000400Crystal:Crystal_SMD_3215-2Pin_3.2x1.5mmY2
1SW_PushButton_Switch_SMD:SW_SPST_TL3342SW1
1Stepper_Motorfootprints:X27.168M1
1VIM878footprints:VIM878U3
1X322516MLB4SICrystal:Crystal_SMD_3225-4Pin_3.2x2.5mmY1

More from h4ctar/retro-gauge

1
  • 2 layers70.7 × 78.1 mmPcb sensor, the printed circuit board in 3D

    Pcb sensor

    h4ctar/retro-gauge

    Open Source Motorcycle Tachometer

    26 parts3GPL-3.0

Similar boards

  • 4 layers85 × 56 mmFsae pihat, the printed circuit board in 3D

    Fsae pihat

    picafe/fsae-daq-hat

    A Raspberry Pi 4B hat to help power analytics in a FSAE car ⚡

    73 parts
  • 4 layers29.5 × 16.8 mmPcf8563-breakout, the printed circuit board in 3D

    Pcf8563-breakout

    picafe/sensors-breakout

    Breakout board for variety of useful sensors in a tiny footprint!

    34 parts
  • 2 layers56.5 × 40 mmSenseBe rev4 main, the printed circuit board in 3D

    SenseBe rev4 main

    Appiko/sense_snap_hw

    This repository contains all the KiCad based PCB design and related documentation for all the PCBs developed at Appiko.

    64 parts2
  • 4 layers52 × 52 mmSpeedo pcb, the printed circuit board in 3D

    Speedo pcb

    h4ctar/motorbike-speedo

    Motorbike Speedo Gauge

    66 parts
  • 2 layers65 × 65.5 mmSchmatic, the printed circuit board in 3D

    Schmatic

    Yorha-7/Rocket

    in this repo we are simulating rocket basic physics and make a onboard flight computer which utilizes MCU, gyro, pressure sensor, fin servo controls, to get realtime target tracking abilities to a solid fuel rocket.

    77 parts
  • 4 layers155 × 69.8 mmDisplayunit, the printed circuit board in 3D

    Displayunit

    muccc/WomoLIN

    Open Source Steuerung von LIN Bus Geräten im Caravan Bereich.

    143 parts84GPL-3.0
  • 2 layers46.6 × 60.1 mmNovi, the printed circuit board in 3D

    Novi

    antonio1562000/PCB_scale

    70 parts
  • 2 layers65 × 35 mmJuksautin, the printed circuit board in 3D

    Juksautin

    zouppen/pumpunjuksautin

    Tricking NTC thermistor on a heat pump

    27 parts7GPL-3.0

Questions

How big is the Pcb main PCB?

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

What parts does the Pcb main use?

43 parts, built around the ATMEGA328P-AU, PCF8563T/5, WS2812B and Q13FC1350000400. 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 main KiCad files?

From the h4ctar/retro-gauge repository on GitHub, at the commit this page was made from: the board is pcb-main/pcb-main.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 main 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).