Motorcycle Data Logger: Counting Digital Pulses From Three Sensors?


hi all,

i'm building data logger motorcycle , first real foray electronics. have uno r3 a4 digit 7segment display , 2 neopixel sticks displaying tach , settings. i'm sensing rpm's ?rc low pass filter? directly ignition circuit interrupt increments counter read , rest in loop , it works great.

now, i'm adding gyroscope/accell breakout board, gps(i'd read gps @ 10hz), , sd card log data sensors to.  using of examples, tested , work independently.

as can guess, i'm out of sram. while wait on mega (tried pairing down libs, made progress not enough. sd / gps shield example took ~1800 bytes before added else; realllly poor starting point , c++ nothing write home about) i'm planning next steps. use hall effect sensors count rpm's on each wheel calculate slippage, , allow me calculate gear i'm in combining rpm , wheelspeed. hall sensors should ~16hz max(18inch radius, top speed <100mph). in addition add throttle , brake position sensors (two brake sensors 1 front , 1 rear). i'm not sure how yet i'm thinking type of potentiometer analog signal.

now have context, problem:
i need count pulses 3 inputs, rpm, front wheel hall, rear wheel hall.

my tentative solution take 3 shift registers(sensor buffers), attach of outputs 1 shift register in reverse(ardy interface), tell buffer register dump it's contents latch on shift registery setup in reverse doing parallel read, read signal pin of shift register count, reset everything, move next sensor lather, rinse repeat. overlooking simpler solution? seems doing digital, read on counts digital input pulses shouldn't difficult offload?

assuming can quit using interupts, , rely using gps in soft serial buffer it's output (big question). pseduo code loop this:
code: [select]

void loop(){
//currently dataloopinterval 10ms, may not work write sd + reads
//as long takes less 100ms, should fine i'll adjust multiple of 100 needed
//this method drift, should use timer interupt?
if(currenttime >= (looptime + dataloopinterval )){ //10ms

//update rolling average of last 25 ticks rpms happened in last ~10ms tick
updaterpm();

if (gps.newnmeareceived()) char *gpssentence = readgps();

lsm.read(); // put recent gyro / accel data respective buffers properties

//accel info
int ax = lsm.acceldata.x;
int ay = lsm.acceldata.y;
int az = lsm.acceldata.z;

//lean angle info
int gx = lsm.gyrodata.x;
int gy = lsm.gyrodata.y;
int gz = lsm.gyrodata.z;

//frontwheel digital pin connected shift reg buffering rear wheel
byte fw = shiftregread(frontwheel);

//rearwheel digital pin connected shift reg buffering front wheel
byte rw = shiftregread(rearwheel);

logdata(gpssentence, rpm, gx, gy, gz, ax, ay, az, rw, fw); //save sd; rpm global
looptime = currenttime;
}
//every 100ms write current rpm's out displays
if(currenttime >= (displaytime + renderloopinterval)){ //100ms
writelightbar();
    writesegdisplay();
    displaytime = currenttime;
}
}


sorry wall of text , thank taking time read far if made it! if have feedback approach i'd apprecate it! (even if have googled xyz? don't know i'm missing)

from brief snippit of code, there's not can say.  did notice, however, not following standard practice of using subtraction in time calculations.

this article explains issue pretty well.


Arduino Forum > Using Arduino > Project Guidance > Motorcycle Data Logger: Counting Digital Pulses From Three Sensors?


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code