ninjette.org

Go Back   ninjette.org > 2008 - 2012 Ninja 250R > 2008 - 2012 Ninja 250R Farkles

Reply
 
Thread Tools
Old January 11th, 2010, 10:33 PM   #1
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Home brew electronic lean gauge

This project has now advanced into a shift gear display gauge. See here for the latest details.

Well, all this microcontroller talk lately has got me going I must admit. A lean gauge sounded like a fun project for my bike. I spent the last hour throwing together this project cause I was bored.

Fortunately I had most of the stuff on hand. All I need is an accelerometer from Fry's electronics for my basic stamp. I have a nice little "project box" I'd like to sandwhich the circuit into.

The idea is to start the unit when you start your run, then when you stop your run it holds the furthest lean accomplished. During the run it will also display current lean angle (although you won't be looking at it while you are leaning!)

Here's a picture of the test microcontroller circuit.
Like I said I need an accelerometer, and then I have to program it and stuff it in a box and velcro it to the dashboard and I get to try it out.

I have a video uploading shortly of the test circuitry blinking some LED's. I suppose I could put an LCD on but I want to keep it simple and small to fit my project box.

You can see the project box (small black garage remote looking thing on the bottom left corner of the picture) that I plan to stuff the lean gauge in.

This circuit only uses about half of the output pins of the microcontroller to drive the LEDs. I suppose I could put other projects or code onto the circuit as well.. even though this is a very minor and limited MCU. Maybe a button to press to select from a menu of options.

The row of LED's indicates how much lean. Each LED will stand for a certain amount of lean once I get the accelerometer and program the unit. There is also a power LED and you can see the programming wires going to my PC serial port.

Too be continued.. I have lots of other projects going on at the moment as well.




Last futzed with by ninja250; February 20th, 2010 at 10:42 AM. Reason: changed title and project goals
ninja250 is offline   Reply With Quote




Old January 11th, 2010, 10:42 PM   #2
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
I guess if I ran a tiny switch to my gear shift lever I could probably put a button on this thing to switch from a lean gauge to a gear indicator..
ninja250 is offline   Reply With Quote


Old January 11th, 2010, 11:50 PM   #3
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Here's the accelerometer I plan to use.
http://www.parallax.com/Store/Sensor...%2cProductName

Think I will also add a potentiometer for adjusting the range of the lean gauge.
ninja250 is offline   Reply With Quote


Old January 12th, 2010, 01:05 AM   #4
Betlog
ninjette.org guru
 
Betlog's Avatar
 
Name: Dude!!
Location: Southern California
Join Date: Dec 2009

Motorcycle(s): 2009 250r

Posts: 443
Sweet. Subscribed....
Betlog is offline   Reply With Quote


Old January 12th, 2010, 06:54 AM   #5
Snake
ninjette.org certified postwhore
 
Snake's Avatar
 
Name: Rick
Location: Alexandria, Louisiana
Join Date: Jan 2009

Motorcycle(s): 05 Blue Ninja 250

Posts: Too much.
MOTY - 2017, MOTM - Jan '19, Oct '16, May '14
Sweet...onother cool electronic's project.
Snake is offline   Reply With Quote


Old January 12th, 2010, 07:35 AM   #6
Timm3h
ninjette.org member
 
Name: Tim
Location: Ottawa
Join Date: Jun 2009

Motorcycle(s): 2009 Ninja 250R

Posts: 60
Nice!

Are you going to factor in the angle of the road as well? This could be done with another accelerometer, with a weight attached to it that could move freely. You could then subtract the difference.
Timm3h is offline   Reply With Quote


Old January 12th, 2010, 07:55 AM   #7
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Thanks for stopping by guys and thanks for the inspiration Timm3h and binlagin.

I'll see what I can do.
I don't have as much time as I used to, to break out the C compilers and bootloaders and such for my AVR's and PIC's, but I can probably program a little MCU basic stamp thingy to blink some LED's according to an accelerometer and an adjusment potentiometer.

I think all I will have to do is have someone help me calibrate the unit by helping me lean my bike over to where it touches the peg and then adjust the potentiometer to get the LED's in the limit/red zone just before the peg hits.

The potentiometer will basically adjust the maximum over all lean variable displayed on the LEDs.

Also, to calibrate the gauge to level ground, you'll have to start it with the bike 90 degrees to the ground. (perhaps I can stick a small sticky bubble level on the unit to start it) I'm not so sure about adding another sensor yet to over complicate things for me. Let's see if I can get the simple task of one sensor to relay lean angle via the LED HUD. I'm gettin' too distracted and busy with other things as I age.

Maybe since you can start the gauge and then it relays lean, you can use it to check your oil level without having someone sit on the bike and stand it straight up for you too.
ninja250 is offline   Reply With Quote


Old January 12th, 2010, 03:30 PM   #8
Sailariel
ninjette.org certified postwhore
 
Sailariel's Avatar
 
Name: Alex
Location: Belfast, ME
Join Date: Jul 2008

Motorcycle(s): 2010 Honda NT-700-V, formerly, Green 2008 Ninja 250R

Posts: A lot.
KC, You can get a Bubble Inclinometer calibrated in degrees at any Marine Supply that also sells sailboat hardware. Tese things are real inexpensive and very accurate. Mine is made by Davis--and is on my sailboat not the MC. All you need is a vertical surface to stick it on. Comes with double sided tape.
Sailariel is offline   Reply With Quote


Old January 12th, 2010, 03:50 PM   #9
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Doh! You mean I could buy a leaning gauge ready made?
I figured I might be overlooking something like so.
My iPhone does angles in degrees as well with one of it's applications so I guess I could even use that too!

Perhaps I can use one of those to help calibrate this gauge.

Agh well, a fun little project for my down time anyways.

I added a button earlier today and got the brains running two separate selectable programs now with the button. (gear shift and lean gauge with the touch of a button)

Just gotta get the sensors and make it happen.
Will need a little time on this one.
ninja250 is offline   Reply With Quote


Old January 16th, 2010, 06:01 AM   #10
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
ETA until I obtain an accelerometer.. 4 days. Should have it by the 20th..
All programming from there.
Will update within a week or so.
ninja250 is offline   Reply With Quote


Old January 16th, 2010, 07:26 AM   #11
binlagin
ninjette.org member
 
binlagin's Avatar
 
Name: Ben
Location: Ottawa
Join Date: Jul 2009

Motorcycle(s): 2005 CBR600RR

Posts: 132
Hey Ninja250... awesome project so far! Thanks for the support and the awesome posts you bring to this board. Ninjette is defiantly one of my favourite web homes because of the CONTRIBUTORS like you! :P. Any other motorcycle board, we may have been laughed off for trying to introduce some new electronics on our bikes :P.

I have done some quick research but I have found that there is currently NO open source motorcycle computer out there. I think we might be onto something.

A commercial grade bike PC is redonculasly expensive... If we all worked together I think we could come up with a fairly full featured "product" that people could piece together themselves... or eventually one day... purchase an assembled product from someone whos part of the project.

I personally think the software behind the hardware is the most difficult part. But with so many people with experience and interest.... I defiantly think we could get something off the ground like that.

I think a good name would be: "Open Moto".

But maybe thats something Timm3h and I should speak over and decide if it's something we want to commit ourself to.

There defiantly seems to be the interest... what do you think?
__________________________________________________
2005 CBR600RR - 2:19 Calabogie Motorsports Park, Ontario, Canada
binlagin is offline   Reply With Quote


Old January 16th, 2010, 07:49 AM   #12
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
I am game to help.

I think I may be geared toward simplicity though.
Programming is not my best aspect, but I can get by when I need to.
I have won several physical awards for my robotics and programming in the past. (pictures of my awards and robots to come later when I get home)

I'm definitely not trying to steal anyone's ideas. Anything I do will not be for sale unless in combination with you guys. If you'd like me to keep away from your project as well, as it seems you have somewhat of a business proposal, I do not mind that at all. It seems as though you guys are after more of a full featured computer while I will be attempting to make one small gadget work at a time and building upon that base.

I will monitor your progress and add any input I can. My little dealy here shouldn't be anything more than a few LEDs blinking some info to the end user, which will likely only be me. I will post my source code and schematic when I am done for anyone to use free.

Also, this is only a little "basic stamp".
When you see me get out the AVR ISP or my SMT soldering equipment to solder TQFP packaged 3x3mm processors by cygnal, then you know I mean business. lol You will see my surface mount inch cubed (yes! really!) self contained autonomous robots very soon when I have the time to post them.

One thing I can do for you guys though is run the PCB's. I have many years experience in drawing and fabbing printed circuit boards from schematics.

Any way I can be of help, just let me know. I'm not asking for anything in return. Seems like the more ideas the better.. I would guess.
I'll keep you guys update on what I have over here too.


PS..
the 'bot below was completely custom by me. Gearboxes, PCB's, SMT soldering and all. It sumo fights other robots I made of the same size in a ring lined with a white edge. Which ever bot pushes the other out first wins. they sense the edge and turn away from it and sense each other and ram each other out of the ring.

It uses an ATMega8 processor, which you may know as Atmel and programmed in C via AVR ISP.
The same chip could handle this bike computer application and costs $4 ea.. but may be a bit outdated by now.
Attached Images
File Type: jpg nano scoop.jpg (69.5 KB, 11 views)
ninja250 is offline   Reply With Quote


Old January 16th, 2010, 09:03 AM   #13
binlagin
ninjette.org member
 
binlagin's Avatar
 
Name: Ben
Location: Ottawa
Join Date: Jul 2009

Motorcycle(s): 2005 CBR600RR

Posts: 132
Yea... I like to follow the KISS principle. If we where to actually start something like this...we would need to define some clear requirements for version 1, setup a website and a whole bunch of other stuff to keep everything organized.

I believe Ideas are the easy part... being able to see an idea all the way through to a complete project is something completely different!

I don't really want to run a business or try and make money selling these things. I just want a place where the goal of the community is to build a CHEAP and opensourced motocycle PC.

I've seen many random motorcycle electronics projects on the Internet that If we pooled our collective knowledge together, we could build a bike PC that might make the commercial market do something new.

That little bot is awsome! I bet he would be equally or MORE difficult to build/design then some advanced features possible on a bike PC! :P
__________________________________________________
2005 CBR600RR - 2:19 Calabogie Motorsports Park, Ontario, Canada
binlagin is offline   Reply With Quote


Old January 16th, 2010, 03:41 PM   #14
Timm3h
ninjette.org member
 
Name: Tim
Location: Ottawa
Join Date: Jun 2009

Motorcycle(s): 2009 Ninja 250R

Posts: 60
Funny thing is I was thinkng about the whole open source idea myself. With the amount of different custom setups out there it might get hard to support all of them from a business perspective. For some people it might be an easy way to get into electronics and programming
Posted via Mobile Device
Timm3h is offline   Reply With Quote


Old January 20th, 2010, 07:17 PM   #15
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Well, no accelerometer today but I promised an update.
Here's some of my old robot awards and trophies.. some of which were very honorable and named after recently deceased robot event participants at the time. Very sentimental to me. I worked hard and basically ruined my back making some of the robots that deserved those awards.

An 1.5"x1.5" M&M candies color sorting robot took that Most Innovative award.
Picture of that robot to come soon. You might not believe it..
Another robot I made took the first place open class.

Funny thing about those 2nd and third place trophies too, I lost to a robot I built that took first place that I sold to the owner who won. lol Talk about buying your way to victory. All that matters is I know I really built the winning robot and the second and third place robots.
Some of my robots have been in magazines too.

At any rate, should be able to pick up the accelerometer tomorrow. Weather has been crazy here and slowing me down a bit.

__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 20th, 2010, 07:30 PM   #16
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Aw screw it,.
Some of my award winning robots.

One of them was 12x12mm's but didn't have it's own onboard lithium power supply like the rest of them do. It had a tether.
Another of them was designed to fit into a 25mm size constraint (white empty cube) and 25 grams max weight and was the first fully functioning nano sumo robot in the world that was actually competition worthy (has a jr sticker on it)
I even custom poured the urethane tires on the printed circuit board wheels designed to fit on my custom gearbox output shafts. lol


Here's the one that I made to sort M&M mini's candy in a tube into different piles by color. I also designed the color sensor.
Yes, this one had an onboard lithium power supply and charging circuitry.. along with many other features.




As you can see, I could likely fit this tiny robot leaning gauge onto a keychain if need be when done. I even do my own SMT circuitry. I'm just getting warmed up.
__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 20th, 2010, 09:17 PM   #17
Rayme
ninjette.org guru
 
Rayme's Avatar
 
Name: Remy
Location: Moncton
Join Date: Apr 2009

Motorcycle(s): '04 sv650s

Posts: 438
This is freakin awesome man. Think about selling some of those custom electronic, theres a bit of money to be making, even on a small site like here ! I love your robots...so tiny!
__________________________________________________
There's 2 types of people in this world, those who complain and those who act.
Rayme is offline   Reply With Quote


Old January 20th, 2010, 09:49 PM   #18
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Unfortunately,
My back won't let me make money off of this hobby or I would have by now.
It literally hurts too much to sit here bent over soldering and programming.
I have to take it easy on it and just use it as a play thing in my spare time.
I hurt my back pretty bad designing some of those robots above and some other hobby stuff. I don't know how to stop when I get started on a project and usually go overboard. My gift is cursed.

Dangerous little things too being as how they have lithium batteries that are years old and unknown condition glued to them. I'm gonna have to destroy them 'bots one day before they catch my house on fire.

For now I just have a fire extinguisher by their dusty old shelf. Guess I'm a pack rat.
__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 21st, 2010, 02:49 PM   #19
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Doh!
Small setback.
Fry's was fresh out of stock on the accelerometers. They had them a few weeks ago but apparently they are hot items.
I did see the GPS module but no use for that when I have an iphone on my bike already.

Too bad they didn't have the accelerometers.

I just had to place an order for the accelerometer, despite wanting to get started on my programming today.
It should be here within another week or so.


__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 26th, 2010, 05:33 PM   #20
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Chip to measure my lean angle showed up today.
Also picked up a few potentiometers to play with adjusting the lean display variable. Will start on this sooner than later now that I have all the electronics..
Hopefully the bike isn't too bumpy or I can dampen any unwanted vibrations.


__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 26th, 2010, 09:00 PM   #21
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
whew!
Little bit of frustrations later and I am debugging readout variables from the sensor already! I have x and Y angle and I guess there is an onboard temp sensor and you can read gravity and acceleration from this.

Now that I have the sensor, the brains and the pc all connected and working, time to choose an output device (LCD or LED bar graph display or similar) to display the lean angle.

I suppose first I'll do a quick rough draft of a program just as an example and get it on video. Another day or two and I should have some LED's leaning according to the lean angle of the sensor. I want to have the LED's hold the last greatest lean angle achieved for an additional two seconds or so, so that after you make the turn you still have time to look down and see how far you actually leaned. (Like the koso gauges that hold the RPM achieved for a few moments after you decelerate so you can see how high it went)

Kinda confusing now but it'll all come together. I basically just gained control of the sensor within hours of receiving it. Now for the real programming. Video update shortly.
__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 26th, 2010, 10:12 PM   #22
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Well I got the LEDs reading along with the lean angle.
Very crude for now though. Needs more refinement.
Few more days of playing with the sensor should do it.

I just need to program them to hold the furthest lean for 2-3 seconds.
Then need to add the potentiometer and have that adjust the max displayed lean angle.
Then put it all inside a small plastic case and have a friend help me lean my bike over to the peg and adjust the potentiometer.

Then it's done! Might need to adjust some variables for vibrations though first.

Here's some video of what I have so far. Almost done!

Agh for some reason the camera thinks the LED's are going crazy blinking.
Had to struggle to turn on power with one hand too since there is no connector for now.

Link to original page on YouTube.

After this I can work on incorporating a shift gauge. Just as easy..

__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 26th, 2010, 11:25 PM   #23
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
So addictive.
This kind of thing will make you ruin your back and your girlfriend leave.

Cleaned up the program a bit. Looks a little more presentable now.
That was a lot for one afternoon for me. I'm done for the night.

The sensor will obviously have to be mounted in some foam inside of the enclosure for dampening and I might even write a little debounce into the program to help if necessary. Lots of adjustments to be made.

Link to original page on YouTube.

__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 27th, 2010, 05:37 AM   #24
Alex
ninjette.org dude
 
Alex's Avatar
 
Name: 1 guess :-)
Location: SF Bay Area
Join Date: Jun 2008

Motorcycle(s): '13 Ninja 300 (white, the fastest color!), '13 R1200RT, '14 CRF250L, '12 TT-R125LE

Posts: Too much.
Blog Entries: 7
Really enjoying this thread!
__________________________________________________
Montgomery Street Motorcycle Club / cal24.com / crf250l.org / ninjette.org

ninjette.org Terms of Service

Shopping for motorcycle parts or equipment? Come here first.

The friendliest Ninja 250R/300/400 forum on the internet! (especially Unregistered)
Alex is offline   Reply With Quote


Old January 27th, 2010, 06:39 AM   #25
rockNroll
.
 
rockNroll's Avatar
 
Name: rock
Location: greenville, south carolina
Join Date: Jun 2009

Motorcycle(s): black

Posts: A lot.
Very cool stuff, KC!
__________________________________________________
Always get a second opinion because most of these people are makin' this stuff up
rockNroll is offline   Reply With Quote


Old January 27th, 2010, 07:13 AM   #26
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Funny thing about these projects is you think about them in your sleep. lol
I swear if I sleep talked last night it would have sounded like "11000101001001".

I thought I might add a "numerical LED display" for a gear shift indicator.
I'm hoping I have enough input/output pins left on the MCU.
So this still has a chance of becoming that two in one lean gauge/gear shift indicator.

You will notice a small button in the videos above on the bread board. (small square to the left of the LEDs)
I have that there to select between two program functions. AKA, press the button and you are in leaning mode. Press the button again and you are in shifting mode.

I'm going to go by an electronics store this afternoon on the way home from work to see about one or two more small spiffy electrical additions as far as the output display goes. I might also tap into the neutral sensor on the bike just to see what the output looks like for that (probabaly 12v on/off signal).

Lots of ideas flowing in now that this has started. Might actually be able to finish it too sooner than later. We'll see how it progresses. I'm gonna try and get the hardware additions built and tested quickly.
Attached Images
File Type: jpg 7-segment-led-display-led-numeric-display-428560.jpg (20.1 KB, 2 views)
__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 27th, 2010, 09:14 AM   #27
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Playing around with the enclosure a bit.
It has a small pcb in there and I put a chip socket on for the processor.
It also has a AA battery slot, but I think I'll need a more powerful 12V battery like shown in the picture for this.

I think the LED's will pop out of holes in the front plastic wall as shown.
Not sure how I'll mount the 7 segment LED numerical display for shifting if I decide to yet. Too many options. Fun to ponder.
If I mount the LED numerical display towards the windscreen, it might reflect off the windscreen like a HUD. That's a long shot though and probably won't work in all lighting situations.
Better get to work for now...



__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 27th, 2010, 09:25 AM   #28
binlagin
ninjette.org member
 
binlagin's Avatar
 
Name: Ben
Location: Ottawa
Join Date: Jul 2009

Motorcycle(s): 2005 CBR600RR

Posts: 132
I'm just reading on lunch break... but awesome work man, keep it up!

I will return and give a more detailed read tonight.
__________________________________________________
2005 CBR600RR - 2:19 Calabogie Motorsports Park, Ontario, Canada
binlagin is offline   Reply With Quote


Old January 27th, 2010, 06:19 PM   #29
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Small amount of progress..
Button selects between lean gauge and shift indicator. Two separate subroutines.
that was a little trickier than I thought it would be.

I just need some switches wired to my shift lever with a bracket coming off the sprocket cover bolt and this puppy is counting gears and sensing lean angle.

Afterward the potentiometer adjustment and actually assembling the entire working unit onto my bike for program debugging.
(if you can't see the vid yet try again later)

Link to original page on YouTube.

__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 27th, 2010, 06:39 PM   #30
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Here's the weak code I wrote for the BS2 module.
It's basically a simplified version of programming. If you could even call it that. haha

This whole thing would have to be redesigned with an atmel controller anyways for a production unit and rewritten in C. Not a problem at all, This way is just quicker/funner/easier for prototypes.

All that is missing from the program below is the gear increment and decrement algorithms. Would look something similar to the lean angle routine.
The 7 segment display outputs are already referenced and the delays can be adjusted to suit. Ah yes, the potentiometer variables are missing still too. The part that makes the whole thing adjust to fit on any bike.

Probably not the most efficient way to do things though. I'm not a good programmer. lol
It will start to get more twisted as the features pack on.

Quote:
' {$STAMP BS2}
' {$PBASIC 2.5}

x VAR Word
y VAR Word

main:
IF (IN7 = 0) THEN shift
GOSUB lean
GOTO main

lean:

PULSIN 8, 1, x
DEBUG CLS, ?x
IF (x < 2300) THEN L3
IF (x < 2400) THEN l2
IF (x < 2500) THEN l1
IF (x < 2550) THEN middle
IF (x < 2600) THEN r1
IF (x < 2700) THEN r2
IF (x < 2800) THEN r3
RETURN

middle:
LOW 0
LOW 1
LOW 2
HIGH 3
LOW 4
LOW 5
LOW 6
RETURN

r1:
LOW 0
LOW 1
HIGH 2
HIGH 3
LOW 4
LOW 5
LOW 6
RETURN

r2:
LOW 0
HIGH 1
HIGH 2
HIGH 3
LOW 4
LOW 5
LOW 6
RETURN

r3:
HIGH 0
HIGH 1
HIGH 2
LOW 3
LOW 4
LOW 5
LOW 6
GOSUB rrr
RETURN

l1:
LOW 0
LOW 1
LOW 2
HIGH 3
HIGH 4
LOW 5
LOW 6
RETURN

l2:
LOW 0
LOW 1
LOW 2
HIGH 3
HIGH 4
HIGH 5
LOW 6
RETURN

l3:
LOW 0
LOW 1
LOW 2
LOW 3
HIGH 4
HIGH 5
HIGH 6
GOSUB lll
RETURN

shift:
LOW 3
GOSUB first
IF (IN7 = 0) THEN buttonbreak
GOSUB neutral
IF (IN7 = 0) THEN buttonbreak
GOSUB second
IF (IN7 = 0) THEN buttonbreak
GOSUB third
IF (IN7 = 0) THEN buttonbreak
GOSUB fourth
IF (IN7 = 0) THEN buttonbreak
GOSUB fifth
IF (IN7 = 0) THEN buttonbreak
GOSUB sixth
IF (IN7 = 0) THEN buttonbreak
GOSUB fifth
IF (IN7 = 0) THEN buttonbreak
GOSUB fourth
IF (IN7 = 0) THEN buttonbreak
GOSUB third
IF (IN7 = 0) THEN buttonbreak
GOSUB second
IF (IN7 = 0) THEN buttonbreak
GOSUB neutral
IF (IN7 = 0) THEN buttonbreak
GOTO shift

buttonbreak:
PAUSE 500
IF (IN7 = 0) THEN main
RETURN

first:
HIGH 0
HIGH 11
HIGH 9
HIGH 15
HIGH 10
HIGH 12
LOW 14
LOW 13
PAUSE 1000
LOW 0
HIGH 11
HIGH 9
HIGH 15
HIGH 10
HIGH 12
HIGH 14
HIGH 13
PAUSE 500
RETURN

neutral:
HIGH 1
LOW 9
LOW 10
LOW 14
HIGH 15
HIGH 11
HIGH 13
HIGH 12
PAUSE 1000
LOW 1
HIGH 9
HIGH 10
HIGH 11
HIGH 12
HIGH 13
HIGH 14
HIGH 15
PAUSE 500
RETURN

second:
HIGH 2
LOW 12
LOW 13
LOW 10
LOW 9
LOW 15
HIGH 14
HIGH 11
PAUSE 1000
LOW 2
HIGH 9
HIGH 10
HIGH 11
HIGH 12
HIGH 13
HIGH 14
HIGH 15
PAUSE 500
RETURN

third:
HIGH 3
LOW 12
LOW 13
LOW 10
LOW 14
LOW 15
HIGH 9
HIGH 11
PAUSE 1000
LOW 3
HIGH 9
HIGH 10
HIGH 11
HIGH 12
HIGH 13
HIGH 14
HIGH 15
PAUSE 500
RETURN

fourth:
HIGH 4
LOW 11
LOW 10
LOW 13
LOW 14
HIGH 15
HIGH 9
HIGH 12
PAUSE 1000
LOW 4
HIGH 9
HIGH 10
HIGH 11
HIGH 12
HIGH 13
HIGH 14
HIGH 15
PAUSE 500
RETURN

fifth:
HIGH 5
LOW 12
LOW 11
LOW 10
LOW 14
LOW 15
HIGH 9
HIGH 13
PAUSE 1000
LOW 5
HIGH 9
HIGH 10
HIGH 11
HIGH 12
HIGH 13
HIGH 14
HIGH 15
PAUSE 500
RETURN

sixth:
HIGH 6
LOW 12
LOW 11
LOW 10
LOW 14
LOW 15
LOW 9
HIGH 13
PAUSE 1000
LOW 6
HIGH 9
HIGH 10
HIGH 11
HIGH 12
HIGH 13
HIGH 14
HIGH 15
PAUSE 500
RETURN

lll:
LOW 11
LOW 9
LOW 10
HIGH 14
HIGH 13
HIGH 15
HIGH 12
PAUSE 50
HIGH 9
HIGH 10
HIGH 11
HIGH 12
HIGH 13
HIGH 14
HIGH 15
PAUSE 50
RETURN

rrr:
LOW 13
LOW 10
LOW 14
HIGH 15
HIGH 9
HIGH 12
HIGH 11
PAUSE 50
HIGH 9
HIGH 10
HIGH 11
HIGH 12
HIGH 13
HIGH 14
HIGH 15
PAUSE 50
RETURN
__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 27th, 2010, 08:15 PM   #31
Momaru
ninjette.org certified postwhore
 
Momaru's Avatar
 
Name: Paul
Location: Roanoke, VA
Join Date: Jun 2009

Motorcycle(s): 2008 Candy Plasma Blue 250R

Posts: A lot.
You mention all these to-dos and all I can think of is 'wish I had the time to go back and get an electrical engineering/programming degree'.

Love the thread and drooling for more. Excuse me while I go mop off my keyboard...
__________________________________________________
Proud member of the Blue Army
Momaru is offline   Reply With Quote


Old January 28th, 2010, 08:24 AM   #32
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Don't be mad when I tell you I've never, ever once, taken a lick of school for electronics then.
Hey wouldn't mind some help for figuring out how to wire a pair of roller switches to the cam of my gear shifter output arm so I can get a gear shifter reading though. I need to figure out how I'm going to go about that. A little bolt on bracket would be perfect but I'm not so good at fabricating metal.

I need to give the project a few day's break and come back to it or my back will start killing me.
Updates do no longer than a week out. I've already progressed more than I thought I would at this point so I'm ahead of myself again as usual. lol
__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 28th, 2010, 12:59 PM   #33
rockNroll
.
 
rockNroll's Avatar
 
Name: rock
Location: greenville, south carolina
Join Date: Jun 2009

Motorcycle(s): black

Posts: A lot.
You do realize that using your knee as your lean gauge would be a lot easier.... right?
__________________________________________________
Always get a second opinion because most of these people are makin' this stuff up
rockNroll is offline   Reply With Quote


Old January 28th, 2010, 04:57 PM   #34
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Not if it never touches the ground.
Eh, just a lil toy and more blinky lights on the bike.
Might help me level the bike when checking oil.. although I don't really need help doing that.

Also my knee can't tell me what gear I'm in (technically speaking)
See gear shift display update.

I might have to remove an LED or two from the lean angle gauge to provide input pull up switches to the gear shifter.
I don't have driver chips to drive that big gear shift display from one input pin on the controller so it takes up like 7 pins to make that puppy make any digit.

I was thinking of just displaying lean in a numerical form instead now to free up more pins. So many ways this can be done.. an LCD screen even. I just think it would be easier to glance down and see a big ol bright 7 segment LED number.

I suppose the most important thing I need to work on to get this finished is putting those pull up switches on the shift lever. The rest is easy. Once I get passed that small-ish hump I can actually put this thing on the bike.
__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 28th, 2010, 09:01 PM   #35
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
For the sake of getting this done sooner than later..
I have started on the hardware part of the project.
No more programming until this thing is mounted on the bike since I know I can program everything already no problems. That won't do me any good if I don't get it on the bike.

Mission: get the lean gauge and shift indicator in the case and wired to the bike: In progress.

Also, we are down to 5 leaning LED's from 7, to make room in the circuit for the switches to the shifting lever. I will still be able to convey the point of lean with the help of the 7 segment LED display along with the leaning LEDs.



__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 29th, 2010, 07:51 AM   #36
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Almost done with the actual unit that is going on the bike!
Finished the prototype PCB and schematic. Also inserted the chips into the prototype PCB and adjusted the program to suit the new schematic!
This thing isn't very far away from being installed on the bike!
I need to run 5 wires out of the unit. I believe I am going to power the unit from the bike instead of from a battery! Which means I need to go get a voltage regulator and a fuse holder..

I have to finish closing it up in the case and adding protective padding around the PCB, then velcro it onto the dash board and wire it to the bike with those switches I talked about earlier.





sloppy schematic (one or two things might change very slightly)




Quick video of the gauge still working after adjusting the program, number of LED's and squishing the whole thing onto the PCB..

Link to original page on YouTube.

__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 29th, 2010, 08:00 AM   #37
Snake
ninjette.org certified postwhore
 
Snake's Avatar
 
Name: Rick
Location: Alexandria, Louisiana
Join Date: Jan 2009

Motorcycle(s): 05 Blue Ninja 250

Posts: Too much.
MOTY - 2017, MOTM - Jan '19, Oct '16, May '14
Your electronic lean guage is better than those new Metzler tires. Your's gives you real time results.
Snake is offline   Reply With Quote


Old January 29th, 2010, 08:11 AM   #38
ninja250
You are sleeping
 
ninja250's Avatar
 
Name: Casey
Location: LMFAO!!!
Join Date: Nov 2009

Motorcycle(s): 2

Posts: A lot.
Lol I just replied to the tire thread the second you replied here.

This thing would probably cost less than those tires! About the price of one or less!

It would appear there is some sort of market for gauging lean after all. I know for sure there's a market for a cheap easy shift gauge too.

Also, this lean gauge can be adjustable to where it knows how far your bike can lean before something hits. Those tires can't.
__________________________________________________
http://www.ninjette.org/forums/signaturepics/sigpic2121_4.gif <Yeah, it's a 250.
LMFAO!
Weaksauce
ninja250 is offline   Reply With Quote


Old January 29th, 2010, 10:05 AM   #39
Snake
ninjette.org certified postwhore
 
Snake's Avatar
 
Name: Rick
Location: Alexandria, Louisiana
Join Date: Jan 2009

Motorcycle(s): 05 Blue Ninja 250

Posts: Too much.
MOTY - 2017, MOTM - Jan '19, Oct '16, May '14
I think thats a great safety feature of your product. Letting the rider know how far NOT to lean in order to stay safe is much more important than testing the limits and crashing.
Snake is offline   Reply With Quote


Old January 29th, 2010, 10:06 AM   #40
binlagin
ninjette.org member
 
binlagin's Avatar
 
Name: Ben
Location: Ottawa
Join Date: Jul 2009

Motorcycle(s): 2005 CBR600RR

Posts: 132
I know you where thinking of using an Atmel microprocessor... that is what the Arduinos are powered from(i think, or atmega? who knows lol).

Have you considered picking up an Arduino for development in preparation to moving it to a stand alone microprocessor? I really like the idea of this lean gauge and gear counter, But I lack the experience of real microprocessor programing.

The Arduino takes care of 99% of the BS that I don't want to know anyways :P

You can get alot more analog and digital terminals and there might be more community support
binlagin is offline   Reply With Quote


Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
[topix.net] - BREW Bikes featured in magazines Ninjette Newsbot Motorcycling News 0 August 12th, 2012 02:00 AM
Any home brewers here keg your brew? headshrink Off-Topic 2 August 27th, 2011 06:40 PM
[motorcycle.com] - H-D teams up with the Brew Crew Ninjette Newsbot Motorcycling News 0 September 4th, 2008 08:09 PM



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Motorcycle Safety Foundation

All times are GMT -7. The time now is 04:28 AM.


Website uptime monitoring Host-tracker.com
Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
User Alert System provided by Advanced User Tagging (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Except where otherwise noted, all site contents are © Copyright 2022 ninjette.org, All rights reserved.