rishikesh88
Posts: 4
Joined: Fri Jul 15, 2016 12:20 pm

Creating a Raspberry Pi Computer for tracking

Fri Jul 15, 2016 12:26 pm

Hi,

I am a beginner with no experience with Raspberry Pi.

As part of my project I want to create a small portable computer which fits on my custom made electric bicycle and reads the speed, distance, Battery percentage etc.

So basically I need a computer to measure the speed, distance and battery % attached to the computer.

How do I start? What materials do I need? What platform should I build the computer? Which language should I use?

Also please help me with the timelines of these projects.

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Creating a Raspberry Pi Computer for tracking

Fri Jul 15, 2016 2:39 pm

You can easily purchase a ready to go bicycle computer which does everything you mention except the battery.

Measuring the battery percentage is much more difficult than you may have imagined. Battery voltage alone is rarely an accurate indicator of its remaining usable charge. Ideally you need to measure the current in and out of the battery and then calibrate.

An unaided RPi has no means of measuring analogue voltages and currents. It needs an add-on A to D converter.

To have the RPi do the speed and distance stuff is relatively simple. A switch closure at each wheel revolution connected to a GPIO configured as input.

You also need a display of some sort and it should be sunlight readable.

All this could be taking a half to one amp or more at 5 volts.

As to timelines, someone with the right know-how could have something up and running within a day or two. Impossible to say how long it will take you.

rishikesh88
Posts: 4
Joined: Fri Jul 15, 2016 12:20 pm

Re: Creating a Raspberry Pi Computer for tracking

Mon Jul 18, 2016 4:09 am

@Drgeoff

Thank you for the feedback.

Yes I could buy a bike computer with a display which will give me the required information. But I am trying to get this information through my android/ios companion app as it is part of my e-bike project.

As it is a e-bike I would need to display the battery percentage. If that is not possible I would have to find another way to indicate it.

For other tracking like speed, distance which accelerometer module is suitable with RPi? It would be helpful.

Thanks again.

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Creating a Raspberry Pi Computer for tracking

Mon Jul 18, 2016 11:46 am

Why do you mention "accelerometer module"?

A typical bike computer uses a small magnet on a spoke making a reed switch close once per revolution. From counting and timing those closures sensed by a RPi GPIO you can calculate distance, speed and acceleration.

rishikesh88
Posts: 4
Joined: Fri Jul 15, 2016 12:20 pm

Re: Creating a Raspberry Pi Computer for tracking

Mon Jul 18, 2016 12:20 pm

Oh ok... I didn't know that.

Can you give me a link or detailed description on I can achieve that. It'll be great.

Thanks.

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Creating a Raspberry Pi Computer for tracking

Mon Jul 18, 2016 2:20 pm

rishikesh88 wrote:Oh ok... I didn't know that.

Can you give me a link or detailed description on I can achieve that. It'll be great.

Thanks.
I would have expected someone with enough brains to make an electric bicycle would know (or be able to find for himself) the maths behind computing distance, speed and acceleration from counting and timing wheel revolutions.

One wheel revolution gives a distance of pi times wheel diameter.

Distance divided by time gives speed.

Change in speed divided by time gives acceleration.

rishikesh88
Posts: 4
Joined: Fri Jul 15, 2016 12:20 pm

Re: Creating a Raspberry Pi Computer for tracking

Tue Jul 19, 2016 6:48 am

Sir,

I do know the logic behind calculating acceleration & distance based on rotations. What I am not familiar is how do I begin with RPi (beginner with no programming experience here)

Anyway thanks for the info.

Apologies if I have offended you in anyway.

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: Creating a Raspberry Pi Computer for tracking

Tue Jul 19, 2016 7:38 am

rishikesh88 wrote:Sir,

I do know the logic behind calculating acceleration & distance based on rotations. What I am not familiar is how do I begin with RPi (beginner with no programming experience here)

Anyway thanks for the info.

Apologies if I have offended you in anyway.
No offence taken.

You should get some programming experience with mainstream tutorials about reading inputs from switches, lighting LEDs etc. Read the back issues of Magpi. They are all on-line for free.

BMS Doug
Posts: 3824
Joined: Thu Mar 27, 2014 2:42 pm
Location: London, UK

Re: Creating a Raspberry Pi Computer for tracking

Tue Jul 19, 2016 7:40 am

The first step is to learn how to read a button push.
(your reed switch will act as a button).

Then you need to have a program that counts the inputs and does your calculations and logs the values.

some kind of display (perhaps E-Paper?)


analogue to digital converter for measuring battery.


Python is probably the best place for a novice to start for this type of application.
Doug.
Building Management Systems Engineer.

User avatar
bensimmo
Posts: 4622
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Creating a Raspberry Pi Computer for tracking

Tue Jul 19, 2016 8:53 am

O would use python3, mainly as that is what is on this websites help and tutorials. Have a look and play with them. You'll then get a feel, which is what I did.
If programming is completely new then you'll pick a bit of that up too.

Wheel, cadence in the traditional way are all done by reedswitches and magnets. You'll need to take into account tyre sag too (find old Cateye instructions on their site for why etc.)

OR the modern methods are GPS (phones/Garmin etc), now these are good for tracking, but I don't like them for speed, there are to many errors on a bike but do give a useful close overview.
Stick one of the apps (strava etc) and have a look.

See if your bikr has any communication abilities etc, you may be able to interface directly with it to read battery info if you are saying there is an android app?


If you have suspension and plotting travel.. have fun.
You can also read tyre pressure....

Return to “Beginners”