![]() |
Re: N900 as bike computer?
Quote:
How would you design the software to minimize battery use? I expect sound processing is a bit cycle intensive (pun intended). |
Re: N900 as bike computer?
Quote:
Quote:
P.S. I usually don't cycle more than for two hours. And, anyway, its fun. |
Re: N900 as bike computer?
Well, I've finished soldering. Hardware works and "clicks" are recorded by maemo-recorder. More detailed description will be available soon.
|
Re: N900 as bike computer?
Quote:
Polling this device node shows the status: http://talk.maemo.org/showpost.php?p...5&postcount=64 If you want i can make some code to do it and show the frequency. The only potential problem is see is device file not being updated at a high enough frequency to be accurate, but it's worth a try since it's easy and you've already got the hardware bit. We've lost the mic usage by your method so no additional lost functionality (i think). The only thing a quick google about how the button is wired turned up is this: http://webcache.googleusercontent.co...ient=firefox-a Whether it's the same for the N900 headset i couldn't say, but i could check it out at work with a multimeter on Monday. I might actually have to make one of these myself. :) |
Re: N900 as bike computer?
Quote:
Through, it should be safe to short mic wires because this is how headphones are detected. When I disassembled mic module I already had working scheme, and I decided to stick to it. And I don't have 50 Om resistor near me. So, button sensing could be as power consuming, as sound analysis. Mic is connected to two contacts on the jack which are closer to wire. Outer one is ground, inner is mic. If they are shorted phone thinks, that headphones are connected, if there is resistance about 1 kOm (it should be less, than 1.5 kOm, I didn't search lower bound) phone thinks, that headset is connected. P.S. If you don't want to loose your headset I can make photos of mine. |
Re: N900 as bike computer?
Flandry, thanks, with my schematic
cat /sys/devices/platform/nokia-av/detect gives 4 when reed is not shorted and 0 if it is shorted. So it is possible to poll /sys/devices/platform/nokia-av/detect or, may be, if for this file urgent reed events are generated, we could even make this effective. |
Re: N900 as bike computer?
Quote:
The trick here is going to be to balance poll frequency and update interval to avoid killing battery life. I still think there's no way audio analysis will be able to compete for battery usage, but the active polling could be a drain just because it doesn't allow the processor to enter sleep state Edit: Have a project due this week so no more time on this for now, but i will try to get a functional app out next week to test it. If you could post a photo or two of your setup, i'd appreciate it. It seems like it would be best to wire up an adaptor with a lead running off for the switch. * ~Smallest non-recumbent adult bike tire is probably 1" (2.54 cm) mountain bike (26") tire, which has a 1913 mm circumference (1). Using a very generous 100 km/hr = 27.8 m/s as top speed, the maximum frequency is 27.8/1.913 = 14.5 Hz.The lowest practical frequency is around 0.5 Hz (4 km/hr with 700 X 44 (2244 mm circumference) tire. It seems there may have to be a tradeoff on accuracy at one end or the other for practical reasons. |
Re: N900 as bike computer?
No time towrite normal text now, may be tomorrow. So just several photos with needed details, scheme and resulting construction. I didn't added headphones nest because appropriate part was absent in a shop.
http://kibergus.su/?q=gallery&g2_itemId=183 P.S. I don't have phone mount yet. Don't askabout it. Flandry, should I bother with writing software or you already did it? |
Re: N900 as bike computer?
Quote:
As i mentioned, i've got a project due this week so it will be a few days before i can deliver a complete app to test it. It appears that ~15 Hz is the best that the sensor device file can manage, so that might be a problem. There are still some things to try, though. 7 Hz wheel rotation is still about 50 km/hr, so still useful IMO. It remains to be seen if it will miss really short presses with a slow poll rate. Will update the thread when i have an app to test with. |
Re: N900 as bike computer?
Here is a description, how to make a sensor.
http://kibergus.su/en/node/39 By the way, doesn't maemo emit dbus signals, when buttons on headset are pressed? We need to start dbus-monitor --system and check. Some events are generated, vhen headphones are inserted and uplugged. I can't make tests with the sensor or headset because they are about 50 km from me now. |
Re: N900 as bike computer?
Yeah, feel free to read through that thread that i linked with the post about the device node. The dbus implementation of it is pretty bad and requires some hacks to work at all. Far easier and more efficient to read the device node.
|
Re: N900 as bike computer?
Yeah, but if you can only poll at 15 Hz, I'd be fairly certain you're gonna get a lot of missed pulses.
I have to wonder if using the mic channel isn't going to be the only reliable way. :( On the hardware side -- if you're hooking a phone jack to the N900, and need some sort of battery anyway for the sensor, it seems a shame just to pipe it back to earphones. Kick the battery capacity up a bit (7.4V, 10Ah or so), add a charger for the N900 (now we don't worry as much about excess drain of monitoring mic channel), some powered speakers, and wire my (~30W of LED) headlights in... I do like where this is going. :D I'll just need to resurrect my old N810-era plan of sticking a USB webcam under the saddle for rearview mirror (now that we have OTG support coming soon), and we're good to go... |
Re: N900 as bike computer?
Benson, battery is not needed. Only dry reed and two resistors. Link to description and photos are in my previous post.
|
Re: N900 as bike computer?
Quote:
|
Re: N900 as bike computer?
1 Attachment(s)
So, there's some strange behavior. It seems the refresh rate of the device file increases as the button press-rate increases, but to what extent i don't know because i can only press the button so fast.
So, here's a very basic app to poll presses and report the frequency and approximate speed (based on 2m/revolutiion). Do you have a "real" bike computer to test its accuracy? If not then if you could check to see that it seems to scale up to higher than 5 Hz accurately, it may be worth putting more time into (i.e. GUI etc). :D I ended up stripping out everything besides a basic polling loop, so it's very simple right now. Suggested means of basic testing (in absence of "real" bike computer): flip bike and spin wheel. Note speed reported. Increase speed of spin slightly and check that reported speed increases slightly. Repeat... Oops, to run the app, type /opt/maemo/usr/bin/maebike.sh. I forgot to take out the trigger file so you have to run that script twice after you kill the app (ctrl-c) to run it again. |
Re: N900 as bike computer?
Flandry, unfortunately it misses most part of signals, especially on high speed. I think that only one of 50 is detected They are very very short. Can you please publish sources, so as I would be able to make more tests.
|
Re: N900 as bike computer?
1 Attachment(s)
It's a mess of commented-out code right now but if it doesn't work, that's a dead end. :(
It takes an initial time, polls the device file in a tight loop 60 times, takes the end time, and then divides the detected presses by the difference in time and prints it. Then it does it all over again. If it's missing presses in a tight loop, i don't think we can do any better using that resource. Back to the audio approach? I'll copy and paste the snippet of code that actually does the relevant stuff when i get home from the lab. Edit: Looking through that, i think i accidentally uploaded a version that calls nanosleep, so it might not be optimal. Try the version attached to see if it's any better. Code:
#include <sys/time.h> |
Re: N900 as bike computer?
No it still misses pulses. So I'll try audio. It shouldn't be so much power consuming because it is many times simpler, than decoding audio when playing audio. So it should live longer, than audioplayer with switched on screen.
|
Re: N900 as bike computer?
I've tried sound approach. It works well. Python implementation eats about 30% of CPU. I would like to rewrite it in C, python was chosen because I've found good example if reading sound via gstreamer.
Right now I'm going to test it on the street. |
Re: N900 as bike computer?
The script itself and battery usage measurements.
http://kibergus.su/node/45 I hope, that C variant would consume less CPU. |
Re: N900 as bike computer?
I've rewritten it in C
Result is 50% CPU load (25% my application, 25% pulseaudio) while CPU is at 250 Mhz (the lower bound). Python variant consumes 60% CPU (40% my application and 13% pulseaudio) while CPU is at 500 Mhz. So reimplementing in C give significant performance advantages. Now it is time for making GUI. |
Re: N900 as bike computer?
GUI is out. I hadn't opportunity to test it on a bike, but it should work.
http://kibergus.su/node/46 By the way, is anybody interested in it or am I the only idiot, who wants to use $700 phone instead of $20 device? |
Re: N900 as bike computer?
No, you're not the only one -- I just got some gear in this past week, so I may start experimenting soon.
My setup so far:
So I gotta wire up a permanent power setup, with a tap from the speaker to the N900, and a 4-pole cable from the N900 to the speakers, then run the reed switch down to the wheel. May not happen until next weekend, but I am getting there... FWIW, I'm not especially interested in the speed, as I find the GPS speed reading good enough. What I want is reliable odometry, that doesn't add up random GPS drift/jitter while I'm parked, doesn't skip or reset when I lose GPS in a tunnel, etc. A less-ticklish speed readout is cool, but not enough to get me excited -- I think that may be why you're not seeing more interest. As for the addons you mention, a couple thoughts: Slope detection with accelerometer -- maybe the roads around here are just horrible, and it would be fine where you are, but I can't see this working well at all. IMO, though, integration of GPS would be great -- plot altitude every 20m or so, plot altitude/slope history from that. (GPSjinni does similar using GPS only, but it does speed vs. time and altitude vs. time -- I want x vs. distance.) Anyway, I'm sure I'll have more thoughts, and maybe a few patches, once my hardware comes together. Still hoping for some OTG/webcam goodness -- I'd kill to see your speedo display overlaid on a live rearview cam! |
Re: N900 as bike computer?
Quote:
|
Re: N900 as bike computer?
Quote:
P.S. But I've rebuilt it for QT 4.7 which is now in repositories. |
Re: N900 as bike computer?
My use case is the same as Benson's, but I haven't got my hardware set up yet.
Quote:
|
Re: N900 as bike computer?
Quote:
Actually, one of the reasons for writing this application was to take a look at QML. |
Re: N900 as bike computer?
I use eCoach application for cycling, running, walking etc...
http://maemo.org/downloads/product/Maemo5/ecoach/ |
Re: N900 as bike computer?
Quote:
Anyway you're obviously free to do with it as you want. Actually, the navit gui developer is doing the same thing with QML, but the dependence on 4.7 of his packages is a hindrance to that app's adoption by end users. |
Re: N900 as bike computer?
To me the idea of this program I like.
Within six months, when I recover from the accident, I would like to have to try. |
Re: N900 as bike computer?
Quote:
http://maemo.org/packages/view/libqt...5-declarative/ |
Re: N900 as bike computer?
New version. Most changes are for future development and UI for them is not implemented yet. I would like to discuss how user interface should look like. Would such UI be confortable for you?
http://kibergus.su/node/51 |
Re: N900 as bike computer?
Quote:
I'm trying to decide what mount to get for my bike. Anyone who has a mount that works with their N900, please share your experience. |
Re: N900 as bike computer?
Quote:
Quote:
Labeling of counters can be useful, but not for the first version. P.S. Todays trip showed that there is an error in current version which makes speed about 10 times smaller. I need to check coefficients again. |
Re: N900 as bike computer?
@KiberGus: Looks quite good to me, I'll see what I think when I start riding with it...
Quote:
So now I'm using a custom plastic holder, basically just a pocket the size and shape of an N900 w/extended back milled in a block of plastic; it's not finished yet, but it'll soon offer fat-buttons for the volume rocker, power, and shutter buttons, as well as direct access to the USB and AV jacks and the unlock slider. (Doesn't do a thing for the rest of you without access to a machine shop, though. :p) Since I'm posting, here's my install status, if anyone cares: I'm now at a standstill as I got caught out in a sudden rainstorm and didn't stop to unmount/cover my N900; now I have a dead digitizer. (The above-mentioned speaker did fairly well, though -- some water in the audio jack messed up contact until I blew it out with compressed air, but when converted with all cables siliconed in, it should be ok for typical rain -- so far I think I can recommend it for anyone considering a full-bore setup like I'm doing.) So now I'm just waiting on shipping for both the new digitizer and a cheap headset (to snip the TRRS plug and cable from). I picked up a $10 cycle computer to get the magnet and more importantly the reed switch, already in a waterproof housing w/ mounting bracket and cable. *hates slow shipping from China* :mad: |
Re: N900 as bike computer?
Quote:
Quote:
If the dang thing had a standard camera mount it would really solve a lot of problems. :/ Quote:
|
Re: N900 as bike computer?
is it in extra-testing repos or ti's only on your website, if so, you should up to maemo's repos. спасибо =)
|
Re: N900 as bike computer?
Quote:
|
Re: N900 as bike computer?
I cant make it work so ill just wait until its in etras-testing. When I try to lauch it i get:
Nokia-N900-02-8:/home/user# ./bike Unsupported date format character at 1 (%-d.%-m.) ./bike: symbol lookup error: ./bike: undefined symbol: _ZN7QmlViewC1EP7QWidget Anyway. What I wish there should be: Total kilometers and also Trip kilometers. Also some way to reset total. So you could reset it once a year or so. And is it possible so you could and another mode. Like another Total kilometers so you could have 2 different excrcises. cycle and running. That app looks excellent and Im really waiting for it. I think this could actually be good running/cycling carrying case for n900. Its n900 compatibility. http://europe.nokia.com/find-product...ng-case-cp-402 |
Re: N900 as bike computer?
I thought I'd share my experiences with making a bike mount for my n900.
I started off with this monstrosity from ebay: http://cgi.ebay.com.au/ws/eBayISAPI....m=120473810311 I'd never trust my phone in that, but wanted the clamp/tilting part of it. Next up was this one: http://cgi.ebay.com.au/ws/eBayISAPI....m=150448766031 It's actually black, not that brown color in their photographs, and holds the n900 snuggly. Here's my starting point: http://img411.imageshack.us/img411/7356/20100729001.jpg Next I dismantled both bits to get just the bike mount and n900 holder: http://img24.imageshack.us/img24/8932/20100729002.jpg I was originally hoping these two parts would have the same size mounting clamps (it looked like it was possible in the ebay photos), but no such luck. So I did a bit of a hack job removing some of the clips and widening the holes in the other part: http://img529.imageshack.us/img529/994/20100729003.jpg Then these two bits were clipped together and a whole stack of glue used for more strength: http://img707.imageshack.us/img707/7053/20100729004.jpg I deliberately attached the mount off-center so the phone will sit more-or-less in the middle of the handlebars. Here's what it looks like attached to my bike: http://img828.imageshack.us/img828/1876/20100729005.jpg And finally with my n900 in place: http://img201.imageshack.us/img201/1470/dsc0742b.jpg Now I've just got to wait for a sunny day to give it a real test! :) |
| All times are GMT. The time now is 06:19. |
vBulletin® Version 3.8.8