G-meter =]

wolfmankurd

Track Warrior
Points
92
Location
London
Car
Renault Clio 1.2
I wasn't sure if this was the right section for this but while watching jonathan creek on iplayer I thought I'd make a g-meter I had all the stuff here it is:

It uses a 3.3v arduino mini pro with Atmega386 so loads of room for adding more functions. And a MM7260 (only the x-axis output though it's 3axis so I can add g's during acceleration and falling?!:blink1:). Set to 0-1.5g (can also be set to 3g and 6g)

The wiring is self explainitory here's a pic:
output.jpg

The offset there is due to gravity :) I'm not sure if it's reversed or that's the proper orientation?

I'd imagine this costs more than a g-meter for a car would usually?

Needs a video really to show it off really quite pretty when you wave it about. The USB is just there for power which could be supplied by anything really =]

Edit:
Here's the code =]
#include <LiquidCrystal.h>
const int x=0;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
pinMode(x,INPUT);
lcd.begin(16, 2);
lcd.print(" -=Gmeter=- ");
}

void loop() {
int v=map(analogRead(x),0,1023,0,16);
int i=0;
if(v<8){
while(i<v){
lcd.print(" ");
i++;
}
while(i<8){
lcd.print("#");
i++;
}
lcd.print(" ");
}else if(v>8){
i=8;
lcd.print(" ");
while(i<v){
lcd.print("#");
i++;
}
while(i<8){
lcd.print(" ");
i++;
}
}
delay(100);
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,1);
}
 
Last edited:
Found a temp/humidity sensor will be adding that soon =] not sure it'll be really useful but meh.
 
It's a HD44870 16x2 lcd =] hopefully I can add more stuff or at least more useful stuff once I think of it! Needs some buttons so I can configure the display though.
 
This version has a temp sensor, (it finally arrived!) and hopefully a humidity sensor soon (idk know why it will by why not?)
Here's the new simpler code which just outputs a value (mostly for debug and cause it took me ages to move it to the bigger board before I realised I needn't have) my windows are open so my room is 18°C...
sensor.jpg

#include#!<LiquidCrystal.h>
const#!int x=0;//x-axisADC
const#!int t=2;//TempADC
const#!float g=0.00322;//ADCmax/3.3v
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
#!#!pinMode(x,INPUT);
#!#!lcd.begin(16, 2);
#!#!Serial.begin(9600);
}

void loop() {
#!#!int v=(g*analogRead(x)-0.5/0.8);
#!#!Serial.println(analogRead(x));
#!#!lcd.print("G-meter: ");
#!#!lcd.print(v);
#!#!lcd.setCursor(0,1);
#!#!lcd.print("Temp: ");
#!#!int T=(g*analogRead(t)-0.424)/0.0625;
#!#!lcd.print(T);
#!#!lcd.print("C");
#!#!lcd.setCursor(0,0);
}

Anyways back to revision =[
 
Last edited:
Similar threads
Thread starter Title Forum Replies Date
N Air/Fuel Meter Technical forum 2

Similar threads


Please watch this on my YouTube channel & Subscribe.


Back
Top