G-Force Meter Project

The aim is to build a meter which measures the lateral acceleration force in car, also called g-force or centrifugal force. This is the force which pushes the driver or passenger to the left in a fast right hand turn. The force is normally expressed in g, 1 g (9.8 m/s/s) corresponds to the acceleration due to gravity.
A normal car can handle approximately 0.8 g, above this values, the tires cannot handle the sideways force anymore and the car will move sideways. The best sports cars can handle up to approximately 1 g. A very interesting discussion on the forces in a car can be found here.

The idea

The g-force will be measured with an accelerometer mounted with its sensitive axis perpendicular to the driving direction. The sensor will be read out using a microcontroller. 30 LEDs are used to indicate the current g-force.

I have chosen the Atmel ATtiny26 microcontroller. It has some interesting features for this project:
  • small and cheap
  • 10 bit ADC
  • sufficient IO pins, which can source and sink 20mA; LEDs can be driven directly
  • Possibility to use the internal oscillator, no Crystal needed
  • Free development tools (C compiler) available for windows, Linux, OS X etc.
  • Programming can be done using inexpensive hardware and free programming software
To measure the G-force, I use the Analog Devices ADXL103. This is a high accuracy accelerometer, which is not really necessary for this project. The ADXL311 seems pin compatible to the ADXL103 and is cheaper. Furthermore, I designed the board such that also a Freescale accelerometer can be used (not tested).

The board


This is version 2 of the board made using Eagle, the first version had the option to use a Freescale accelerometer also, but I needed the space for the logo :-):

top   bottom

The following parts are can be seen:
  • The 30 LED array. Because I do not have 30 IO pins available on the ATtiny26, I decided to create 6 groups of 5 LEDs. 6 pins are needed to indicate the group, and 5 to indicate which LED in the group should be turned on (I hope you get the idea).  Extra bonus: only 5 resistors are needed. As a result only 1 LED can be turned on at the same time. This is not a real problem; The impression of multiple burning LEDs can be given by turning them on sequentially quickly.
  • Voltage regulator, needed because I want to run the meter from a car battery.
  • 10 pin header for In System Programming

Of course the board could be improved with a proper ground plane etc., but this is the first board that I ever made. Also a very good accuracy is not needed.

Part list:
  • ADXL103
  • ATtiny26
  • 3x 10 LED bar
  • 4x 0.1uF Ceramic Capcitor
  • 5x 360 Ohm Resistor (exact value not so important)
  • 10uF Capacitor.
  • 5x double male header (for ISP)
  • Voltage regulator regultor 7805, this size is probably an overkill
Building is straightforward. All parts are through hole components except for the accelerometer, but soldering it is not a real problem. Even I could do it with my huge (relatively) iron.

The eagle brd file can be found here

The Software

The software for the ATtiny26 was written in C and is rather straightforward. There is a lookup table which indicate the needed values of P1 and P2 to light one of the 30 LEDs. In the main loop the ADC is read out and the value is converted to a LED number. LED 1 corresponds to 1 g to the left, LED 30 to 1 g to the right. The maximum and minimum LEDs are remembered and also lit.

The hex file can be found here



The result

foto

This is Version 1 of the board (without Hack A Day logo). The middle LED indicates the current G-force, the left and right the maximum values to the left and right.
In the car, the G-force meter functioned well. You do not need to keep an eye on the meter all the time because the maximum values are kept. It is a lot of fun, trying to improve the maximum values.

Possible improvements:
  • Reduction of noise due to vibrations by filtering the ADC output over a longer time (in software).
  • Reset button to reset the maximum values.
  • Non-linear scaling. The first part of the scale is not so important. Maybe it is interesting to let the first 5 LEDs cover the first 0.5 g, the next 10 LEDs from 0.5 till 1 g.

    Ideas
  • This design, or a similar design with more LEDS could be used as a Spoke POV. The accelerometer can detect the orientation of the wheel.


  • Remarks or questions? Send me a mail

    - Find motorcycle friendly hotels in Europe on www.motor-hotels.eu -