Pages: [1]   Go Down
Author Topic: Comparing data  (Read 646 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, new to Arduino. I am working on a bike computer, I have the basics worked out on speed, time etc... I have a cycle counter for every time the wheel sensor is made. I want to record the time at lets say every 5 rotations, I believe is is not a problem with an SD card shield. What I want to do is compare an old ride to a new ride. I would like the cycle counter to pull data from the SD card and compare the old time vs the new time. eg start riding, after 5 wheel rotations look up time for the previous recorded 5th cycle of the wheel and compare. Then do this for 10,15,20 etc. Is this possible? and is there any example code for this?

Thanks for your help.
Logged

New Hampshire
Offline Offline
Full Member
***
Karma: 4
Posts: 179
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

On the reading bike wheel revolutions, your probably not going to be able to choose to do it once every 5 turns. More like once per turn with some kind of Hall effect sensor. Or more if you have an encoder. Recording data to an SD card is easy enough with the SD library. Easy enough to just write the current time, and number of revolutions so far, to the SD card as comma delineated, or tab delineated (programs like excel can recognize the comma and tab formatting as a spreadsheet and open them).

As far as comparing the 2 times of your previous rides with the current one on the arduino, while your riding... i guess its doable, but id say you want to get some of your data, and results into excel to work before going too far ahead of yourself.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My issue is how do i pickup the specific data based on the cycle #. As for a test I could put different integers in, but not sure how to increment the int name. eg
int C1 = 22.34
int C2 = 18.45
etc...

so when the cycle count = 1 read C1 and compare
on the next loop read C2
but i can't put something like (c1 +cycle) = c2
Logged

California
Offline Offline
Faraday Member
**
Karma: 88
Posts: 3364
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My issue is how do i pickup the specific data based on the cycle #. As for a test I could put different integers in, but not sure how to increment the int name. eg
int C1 = 22.34
int C2 = 18.45

If you need decimal places, you shouldn't be using ints.

Quote
so when the cycle count = 1 read C1 and compare
on the next loop read C2
but i can't put something like (c1 +cycle) = c2

Sounds like you need an array (and a more descriptive variable name).
Logged

UK
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12557
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What I want to do is compare an old ride to a new ride. I would like the cycle counter to pull data from the SD card and compare the old time vs the new time. eg start riding, after 5 wheel rotations look up time for the previous recorded 5th cycle of the wheel and compare. Then do this for 10,15,20 etc. Is this possible?

In its simplest form, it's easy. But to produce anything meaningful I think would be quite hard. I suppose you want to do some sort of comparison of speed versus distance so you can tell whether you went up that hill any faster today than yesterday. The problem is that the start points and distance traveled each time are unlikely to match exactly in the real world, so getting anything more than a rough comparison would be tricky. Your best bet I think would be to save the log of each journey in a CSV file and then load that up to a PC where you can compare and graph the results in a spreadsheet. Make sure you make your sample interval long enough so that you can hold a useful number of logs of your desired length on an SD card.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PeterH you are right I want to look down at the display and have it tell me if I am ahead or behind of a previous ride. If i record my speed or time from each wheel rotation, in general i should have a good indication of where i am at. I have a bike computer that logs my rides now, but there is nothing that gives me a real time update that reads off a wheel sensor.
Waiting for my SD shield now, just was hoping someone knew how to compare the data in real time.
Logged

Saskatchewan
Offline Offline
Sr. Member
****
Karma: 19
Posts: 362
When the going gets weird, the weird turn pro. - Hunter S. Thompson
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You don't need the speed to know where you're at. Just count wheel rotations and multiply by the circumference to get distance travelled. Your speed tells you when you're at. 100 wheel rotations will get you to roughly the same place each time regardless of how fast or slow you go.

If you started the bike ride from exactly the same spot each day wheel rotations should be reasonably accurate but certainly not totally accurate.

Maybe GPS is the solution.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 222
Posts: 12557
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

PeterH you are right I want to look down at the display and have it tell me if I am ahead or behind of a previous ride.

Well, if that's all you want then it wouldn't be hard to have it display how many seconds you are ahead or behind relative to a previously recorded baseline.
Logged

I only provide help via the forum - please do not contact me for private consultancy.

Pages: [1]   Go Up
Jump to: