Help with Bike speedo

headshot_deluxe

New Member
Hi, im making a bike speedo for a school project and im not sure how to do the programming. i am completely new to picaxe. i am making a bike speedo using a hall effect sensor and a magnet and im not sure how to use it properly. The only thing i can do is make an led turn on when the magnet is near the hall effect. im using a picaxe-08m chip thing. please help :)
 

manuka

Senior Member
What level/time/budget/resources? Where are you in NZ? This could be more involved & costly than you think, especially when safety & a LCD display is involved. Perhaps instead consider using an off the shelf bike speedo/odo- such as the popular "Cat Eye". When PICAXE driven this may make a nifty "engine" for other applications! Check the Amp.Hour meter => http://picaxe.orconhosting.net.nz/bikeamph.jpg & => http://www.picaxe.orconhosting.net.nz/bikepcfb.jpg Stan. (Wellington-NZ)
 

headshot_deluxe

New Member
This is for level 2 electronics and im in christchurch. For the project i have to make it myself to gain the credits and i thought it would be fun to make a simple bike speedo. i have the whole term to make it and im not sure about budget
 

manuka

Senior Member
I assume hence NCET 2 Year 12? Which school ? You really first need more PICAXE experience for such a quest I'd say. Bike speedos are very compact,cheap & abundant items anyway- I'd worry that a bulky PICAXE version mounted on a bike may be prone to wheel tangling etc while you're fine tuning. This is no idle concern- I had similar happen myself (as a teenager) with a dynamo driven electronic project! The sudden jolt threw me off the bike onto a gravel road. Even worse fates may occur in traffic... Can't you alter the project scope ?

The code for the Ah meter was deceptively simple-
Code:
'bikeamph.bas for Picaxe-08M driven 'CATEYE Velo1' bike computer conversion.
'Suits educational output current monitoring of small 1W PV or wind gene 
'via simple 1W 1 Ohm supply shunt resistor, with voltage readadc10 measured.
'Schematic (draft)=> www.picaxe.orcon.net.nz/bikeamph.gif -suits breadboard!
'Initial solderless small PV layout =>www.picaxe.orcon.net.nz/bikeamph.jpg
'Thanks to Glen's A1 wind gene site => www.thebackshed.com for initial ideas
'For 'Silicon Chip' article Feb. 2007. Via=> stan.swan@gmail.com 23/12/2006

shunt:  
readadc10 1, w1      ' approx w1 range 1 at 5mA to 30 at 100mA thru' 1 Ohm
'sertxd (#w1,13,10)  ' useful w1 'F8' check point-comment in/out as need be
if w1 <=1 then shunt ' gives bike comp. zero reading on very low I (~<5mA)

w2=600/w1            ' adjust top '600'for Picaxe supply calib. (600=~4.5V) 

 high 4		     ' Output pulse code for bike computer,fed to pin 4
 pause w2            ' via 100nF capacitor & parallel LED. Some scope for 
 low 4               ' tweaking,but bike comp.times out if pause >~1000ms 
 pause w2            ' and upper detection range ~30mS (~100km/hr)

goto shunt
 
Last edited:

gbrusseau

Senior Member
First, you may want to consider using more than one magnet on the bike wheel. Say 12 magnets evenly spaced on the wheel will give you 12 speed updates per wheel revolution instead of one speed update per revolution with just one magnet. Count the time between each magnet sensed by the hall sensor. Have the PICAXE translate that time between magnet sensing to speed (km/hr) and have the PICAXE display the speed on two very bright 7 segment displays using a BCD to 7 segment display chip like the 7448. Take a look at the COUNT and PULSIN commands for reading the time between magnet sensing. You might be able to use one of those back wheel electric generators to power the device too. That should give you enough info to get started. Do the research from there. You will find that the more research and leg work you do, the more likely people here are willing to help you along if they see you are making the effort.
 
Last edited:

boriz

Senior Member
I usually like to design things ‘backwards’. That is, I start with what I want to see when I look at the finished project.

So what do YOU want to see? How do you want to display the speed? What controls will the speedo have? Etc.
 

headshot_deluxe

New Member
safety wont be a problem because i only plan to make the speedo for the credits and to test it at low speeds and not actually use it. also how do i use the COUNT command? ive tried many times everytime failing
 

gbrusseau

Senior Member
From this forum, click on the main menu item "PICAXE Manual" and select "PICAXE Manual 2 (Basic Commands)". This will display a pdf document with a list of all the Basic commands listed on the left side of the documnet. Click on any of the commands from the left and an explaination of the command and an example of the syntax will be displayed. You can also access this document from the PICAXE Programming Editor program from the main Help menu.
 

Attachments

gbrusseau

Senior Member
Besides the COUNT and PULSIN commands, another approach for this application might be to use the DO-LOOP command.

BEGIN:

DO WHILE pin3=0 (sync program with magnet position)
LOOP

DO WHILE pin3=1 (sync program with magnet position)
LOOP

DO (increment variable W0 until magnet is detected)
INC W0
LOOP WHILE pin3 =0

(code to convert the number in W0 to km/hr and display the speed)

W0=0 (reset variable W0 to zero)
GOTO BEGIN

Assuming the hall sensor is connected to pin 3 of the 08M PICAXE and the hall sensor output is high when a magnet is detected, then the code above will loop and increment variable W0 with each loop until the magnet is detected. When the magnet is detected, pin 3 will go high and the program will exit the loop with the number of times the program looped between magnets. The faster the bike wheel turns, the smaller the number will be in the variable W0.
The first two loops simply makes sure the incrementing of W0 begins at the very point when a magnet has just passed the sensor.
 
Top