• Required reading for all forum users!!!

    Welcome!
    Register to access the full functionality of the GSResources forum. Until you register and activate your account you will not have full forum access, nor will you be able to post or reply to messages.

    A note to new registrants...
    All new forum registrations must be activated via email before you have full access to the forum.

    A Special Note about Email accounts!
    DO NOT SIGN UP USING hotmail, outlook, gmx, sbcglobal, att, bellsouth or email.com. They delete our forum signup emails.

    A note to old forum members...
    I receive numerous requests from people who can no longer log in because their accounts were deleted. As mentioned in the forum FAQ, user accounts are deleted if you haven't logged in for the past 6 months. If you can't log in, then create a new forum account. If you don't get an error message, then check your email account for an activation message. If you get a message stating that the email address is already in use, then your account still exists so follow the instructions in the forum FAQ for resetting your password.

    Have you forgotten your password or have a new email address? Then read the forum FAQ for details on how to reset it.

    Any email requests for "can't log in anymore" problems or "lost my password" problems will be deleted. Read the forum FAQ and follow the instructions there - that's what we have one for...

  • Returning Visitors

    If you are a returning visitor who never received your confirmation email, then odds are your email provider is blockinig emails from our server. The only thing that can be done to get around this is you will have to try creating another forum account using an email address from another domain.

    If you are a returning visitor to the forum and can't log in using your old forum name and password but used to be able to then chances are your account is deleted. Purges of the databases are done regularly. You will have to create a new forum account and you should be all set.

Gs500

  • Thread starter Thread starter Guest
  • Start date Start date
When programming microcontrollers, the golden rule usually is: if it works, it works! But of course, there's always room for improvement, right? (The forum software seems to have destroyed my indentation, so just imagine proper indentation below. Good indentation is very important!)

Gear selector pins could be an array, e.g.:

// Gear indicator pins, gear[0] is Neutral, gear[1] is first, etc
// Or you could make the order match the shift pattern (1N23456), but there's probably no real reason to
int gear[] = {40, 52, 50, 48, 46, 44, 42};

Be sure to make variable names descriptive, so instead of just "Delay":

int animationDelay = 200;

For loops are your friend:

int i; // declare this somewhere near the top of setup()

// Set LED segment pins mode
for (i = 2; i <= 0; i++) {
pinMode(i, OUTPUT);
}

// Set gear selector pins mode and pull HIGH
// (Building on the gear indicator pin array above)
for (i = 0; i < 7; i++) {
pinMode(gear, INPUT);
digitalWrite(gear, HIGH);
}

I'd stick all of the gear display stuff into a function. You just call the function with the gear to display as a parameter. That way, you don't have to write it twice and makes the main body of code much easier to read. This would be an excellent use of the "switch" statement.
 
Last edited:
Why do you have issues with oil coming from the vent?Blow by from bad rings?None of my GS engines blow oil out the breather hose.That pic I posted above is the dirtiest my filter has ever been and that's 3000 hard miles of riding.I live in an area where humidity is high year round.

I wouldn't say I have issues... it's incredibly minor in quantity, but as I say the condensation that builds up from the humidity is the issue, not so much oil.

Engine was rebuilt less than 15000km's ago and rings are new etc. so it's not an "issue", it really is just mainly condensation related. That's why it gets so messy... but with the catch tank on all is now good.

Same principles as a car. I'd like to add a vacuum pump, thats been proven to help performance.

In other news I've been trying to clean the gas tank. I used a liter of acetone and that wasn't enough to get it clean but it did show that my tank wasn't rusty, IT was full of varnished gas :eek: SO I'm left with cleaning it out with more acetone. I don't think I'll need to seal it because I can see nice metal material under it. I've tried to desolve the gunk in gas and it won't do a thing to it.

I know that at 7$ a liter its going to get expensive quick. I'm thinking this tank is going to cost me about 70$ when its done, with the stripper and acetone.

Ugh, but to be honest that's probably a lot less painful than having to de-rust and seal it...
 
Well the tank is looking allot better.

I cleaned it out with 4L of acetone, that worked great at dissolving the gas gunge :clap:

Then I could see some good metal, so I through in 5 pounds of screw and shook the bejesus out of it :cool:

That helped allot. Then I through in some magnets to retrieve the screws.

I thought I had gotten them all out but I guess I missed a few.

That was yesterday.

Today I bought 12L of white vinegar. Man that stuff is awesome at getting the rust off. I threw in a few magnets and collected most of the rust. It only took about 10 fill, drain, filter, refill, fish with magnets again .... to get it good looking.

Now its ready for the Kreem.

Or so I thought.

I thought it would be fun to play with the boroscope and see what the inside looked like.

I found 75c
A bolt,
3 more wood screws I missed from yesterday.
2 nails ,
and I got everything out except one bolt that is still stuck in a block of gunge.

I might just leave it there. Its been there for years and not hurting anything.

I even got a video of a daring rescue of one of the screws what was wedged in the side.

Now the tank is being rotated while the rest of the rust is being eaten away.

Hopefully tommorow I can start the Kreem and body work on it so I can get it to paint .


Acetone and vinegar, my new favorite cleaners :)
 
Now in step A Kreem. Phosphoric acid and 17L of hot water. So far it doesn't seem to be doing anything after 3 hours. I'll see what its like tomorrow. Could have just bought some Coke and filled it what that :P

Vinegar was by far the quickest, Less than 10 minutes from rust to clean metal.

Step B and C,the Kreem-ing have to be done together in quick succession before flash rusting occurs. Hopefully it will be complete tomorrow.


In other news I've finished the instrument cluster and all the wiring except the ardiuno. Need a hoby box to put it in and make a mount for it.

I think this thing will be ready next week.
 
When programming microcontrollers, the golden rule usually is: if it works, it works! But of course, there's always room for improvement, right? (The forum software seems to have destroyed my indentation, so just imagine proper indentation below. Good indentation is very important!)

Gear selector pins could be an array, e.g.:

// Gear indicator pins, gear[0] is Neutral, gear[1] is first, etc
// Or you could make the order match the shift pattern (1N23456), but there's probably no real reason to
int gear[] = {40, 52, 50, 48, 46, 44, 42};

Be sure to make variable names descriptive, so instead of just "Delay":

int animationDelay = 200;

For loops are your friend:

int i; // declare this somewhere near the top of setup()

// Set LED segment pins mode
for (i = 2; i <= 0; i++) {
pinMode(i, OUTPUT);
}

// Set gear selector pins mode and pull HIGH
// (Building on the gear indicator pin array above)
for (i = 0; i < 7; i++) {
pinMode(gear, INPUT);
digitalWrite(gear, HIGH);
}

I'd stick all of the gear display stuff into a function. You just call the function with the gear to display as a parameter. That way, you don't have to write it twice and makes the main body of code much easier to read. This would be an excellent use of the "switch" statement.



I had to stare at this for a while to get it. I really only knew of the long drawn out way to make it work and even that was by experimentation :P

Thanks
 
I had to stare at this for a while to get it. I really only knew of the long drawn out way to make it work and even that was by experimentation :P

Thanks

I just noticed a bug in my code. (And I figured out how to get proper indentation.) The for loop to set the mode of the pins connected to the LED segment should be:

Code:
int i; // declare this somewhere near the top of setup()

// Set LED segment pins mode
for (i = 2; i <= 9; i++) {
    pinMode(i, OUTPUT);
}

When you have an evening to kill, google for a C language programming tutorial. Learn about variables, data types, conditional statements, loops, and functions at a minimum. Arduino isn't exactly C (it's actually C++... ish), but the basics are identical. You'll be amazed at the doors this will open in your programming abilities!
 
Cool, I'm actually learning this stuff :D

I took your advice eil and learned a bit tonight.

I'm working on Bluetooth control and serial monitoring. So far I can turn on outputs and send feedback to the serial sender that the outputs are on.

Its a fancy nightlight at the moment :P The idea was to dim my cluster lights and turn on and off relay.s

I have one problem though, ( and I know my coding is still in the works)

But the problem is that I can sent anything from 0-9 and the arduino recognizes that and does what I want.

But what if I wanted to send something like "Light on"

I've tried changing
Code:
  if (in == '0'){ 
                 analogWrite (ledpin, 0);  
    Serial1.println("mode 0");
to
Code:
  if (in == 'light on') { analogWrite (ledpin, 0);  
    Serial1.println("Light on");
But If I send "light on" nothing happen's and i get an invalid return



Code:
int ledpin = 12; //output pin
int powerpin = 21;// power for BT module
int ground = 20;// Ground for BT module

void setup() {
  // initialize both serial ports:
  Serial.begin(9600);//this one for the USB connected computer
  Serial1.begin(9600);// This one for my phone using serial bluetooth connection
  pinMode (ledpin, OUTPUT);
  pinMode (powerpin, OUTPUT);
  pinMode (ground, OUTPUT) ;
    digitalWrite (powerpin, HIGH); //set power on for the BT module
    digitalWrite (ground, LOW); // set ground for the BT

  }

void loop() {
  // read from port 1 (BT module), do that , send a copy of the command to port 0 and port 1:

  if (Serial1.available()) {// anyone there ? 
    int in = Serial1.read();// declare the word "in" as the variable that I'm using to call the input
    Serial.write(in); // write whatever "in" receives to the computer screen
    
            {   // If the "in" = 0 , As in I sent 0 from my phone, do the folliwing,
                 analogWrite (ledpin, 0);  // turn on the output on pin 12 and set the pw, as low as it goes.  Or off 
    Serial1.println("mode 0");
              }else if (in =='1'){
                  analogWrite (ledpin, 25 );  // if its 1 that is received it sets the pwm to 25 out of 255
    Serial1.println("mode 1"); 
              } else if (in == '2'){
                  analogWrite (ledpin, 50); //and so on   up to 9
    Serial1.println("mode 2");    
              } else if (in == '3'){
                  analogWrite (ledpin, 75);
    Serial1.println("mode 3");
              } else if (in == '4'){
                   analogWrite (ledpin, 100);
    Serial1.println("mode 4");
              } else if (in == '5'){
                  analogWrite (ledpin, 125);
    Serial1.println("mode 5");
              } else if (in == '6'){
                  analogWrite (ledpin, 0150);
    Serial1.println("mode 6");
              } else if (in == '7'){
                  analogWrite (ledpin, 175);
    Serial1.println("mode 7");
              } else if (in == '8'){
                  analogWrite (ledpin, 200);
    Serial1.println("mode 8");
              } else if (in == '9'){
                  analogWrite (ledpin, 225);
    Serial1.println("mode 9");
              }  else {
             Serial1.println("INVALID");   // if I type something in besides 0-9 i get this back on the screed:D     
                  Serial.println("INVALID");
                  Serial.flush();
                  Serial1.flush();
}
 
  }  

delay (100);
}
 
In other new's the bike is done, all thats left is the paint and Arduino.
 
Alrighty, let's take a look-see here. I don't know if the forum or the act of cutting and pasting is messing up the indentation here, but be absolutely sure to keep your indentation and whitespace consistent in your editor. It makes many kinds of simple bugs _much_ easier to see right away. Use either tabs or spaces for indentation, never both.

Code:
            {   // If the "in" = 0 , As in I sent 0 from my phone, do the
Seem to be missing the "if" statement on this line?

Code:
                  analogWrite (ledpin, 0150);
Typo! You meant "150". But prefixing a number with a 0 tells the compiler to treat it as an octal number. 150 in octal is 226 in decimal!

But the problem is that I can sent anything from 0-9 and the arduino recognizes that and does what I want.

But what if I wanted to send something like "Light on"
That's because you've declared "in" to be of type "int", which is an integer. "Light on" however, is a string. Or in C-speak, an array of chars. What's probably happening is that "L" is getting stored in "in" and the rest is lost. (You can store a char into an int because an int is a larger data type. The compiler automatically does the conversion between the character "A" and it's numerical representation.)

The Serial.read() (http://arduino.cc/en/Serial/Read) function only returns one byte at a time. If you want to receive a string instead, you need to declare a character array and then use Serial.readBytes() or Serial.readBytesUntil() to read the bytes into it. See this for quick primer on dealing with strings: http://arduino.cc/en/Reference/String

Personally, I'd just toss integers around and be done with it. But I guess depending on the abilities of the application on your phone, you may have to deal with strings. It's a bit of a learning curve, but not bad once you get the hang of it.

And don't get discouraged if this programming business seems a little daunting. It is hard. You're actually doing really well!
 
Last edited:
Here is a page about exactly what you're trying to do: http://stackoverflow.com/questions/5697047/convert-serial-read-into-a-useable-string-using-arduino Only thing I would change is use Serial.readBytesUntil() rather than reinventing that particular wheel with a while loop.

Note that unlike most other programming languages, in C and C++ a string is not a fundamental data type. They therefore do not support direct string comparisons. This, for example, won't work:

Code:
if (var == "foobar") {
    /* do something*/
}

Instead you have to rely on a function, like:

Code:
if (strcmp(var, "foobar")) {
    /* do something */
}

This might be close to what you're trying to do as well: http://arduino.cc/en/Tutorial/ReadASCIIString
 
Ok I'm going to have to look at an Arduino at some point, just for the fun factor! I write heaps of scripts at work but in PowerShell, Perl, and VBScript/ASP and I'm... well... probably better than average but not brilliant.

Being able to put that into something like the Arduino to do cool stuff is... well... very cool!

Best wait 'til after my shed and the little Duc are finished and I have acquired my Kat...

Oh, and where are the obligatory "finished" pic's? Slack!
 
Ok I'm going to have to look at an Arduino at some point, just for the fun factor!

they're a good time, and cheap enough that it's not a budget buster to just fiddle around with them. I'm trying to figure out how i can interface mine with a narrow band O2 sensor to get a budget A/F ratio guage.

Mekanix said:
Cool, I'm actually learning this stuff

That Gauge cluster project is pretty sweet. You'll pick the code up slowly but surely. The rest is learning how to make it efficient, which is usually the harder part. Keep up the good work.
 
lol coming along pete.

Its just the bare bike with no plastics or tank.


8748447125_f5ee674e84_b.jpg



No way could I torque the rotor on, I tried with the break but it didn't matter no matter what gear I was in. The clutch couldn't take more than 40'lbs before it would slip. <might need some new springs for the clutch I think! >

SO I hit it with the impact gun and a 90'lbs torque bar. That seemed to work just fine. Also used red locktite. Although that's the first time I've ever used it

8748447531_0ab98b33cf_b.jpg



I'm also toying with a heated seat.

Thinking of setting up the arduino with a relay and temperature sensor to feedback to my phone, That way i t can turn the seat on and off and have it regulate depending on the temperature.


Everything you need to know is in the examples that come with the sketch program. You can see how its written and then just mess with it to get it to do what you want. That's how I started learning last month.

main site
http://arduino.cc/

download
http://arduino.cc/en/Main/Software



This is what I have thought of so far.

  • Gear position. Code does work but its pretty bulky. This can be put in just the way it is and It will work.
  • Rev limiter/ shift light.
  • Heated seat.
  • Dataloging. Realtime clock maybe for time stamps.
  • Serial output of all sensors ( gear position, rpm, seat temp, CHT) My code for this works and its pretty simple but I need to learn how to send meaningful information and scale it properly.
Thanks eil, I'm reading this tutorial.http://www.iu.hio.no/~mark/CTutorial/CTutorial.html


Only thing I need is the time :P





 
Last edited:
Noooooooooo! Naked bike pics. LOL She's looking good.I had no issues with the stock clutch holding 90ftlbs of torque.Has standard auto oil been used in the engine?That will cause the clutch to slip really bad.Synthetic oil will make it worse,if it's not designed for wet clutches.I use 15w40 Rotella T diesel oil.I have been surprised at how much it improved transmission shifting and clutch engagement.I am running a bastardized clutch.SV650 kevlar friction disc and Barnett racing springs.My left arm and hand is getting big from that stiff clutch.BTW,I just bought another bike,Yamaha V Star 650,I am going to try out some fully synthetic motorcycle wet clutch spec 20w50 that comes highly recommended for air cooled twins.i can't remember the brand right off.I'll have to check.I bought a bunch of tune up stuff for the new to me bike.I am keeping my six GS500's.Still building the big engine.Also got my touring GS project.
 
Mate good stuff, the Arduino looks very cool! Data logging would be very handy especially!

As for the clutch slipping... holding the back brake on to torque the sprocket nut up shouldn't even use the clutch...

Red locktite? Mate you're keen! Gonna need a heat gun to get that off next chain/sprocket change :eek:

But lookin' good all the same :D
 
Mate good stuff, the Arduino looks very cool! Data logging would be very handy especially!

As for the clutch slipping... holding the back brake on to torque the sprocket nut up shouldn't even use the clutch...

Red locktite? Mate you're keen! Gonna need a heat gun to get that off next chain/sprocket change :eek:

But lookin' good all the same :D


I meant the rotor for the stator :P

This thing has a circlip that holds on the front sprocket. Its one of the few differences from the 450.

The clutch is the stock one with 88000 on it. I know the plates and disks are in spec but who knows what's been run in this engine. I have a spare set to play with just in case. I started with 50' lbs in sixth gear and by the time I took up all the slack in the drive train it started slipping. So I dropped it to 40 and thats where it clicked. The clutch is dry though and hasn't been wet or worn in again yet. Looking forward to seeing if its going to slip or not.

I suppose I could shim the springs but I'll probably replace them. My other bike could barely handle the power in second gear and could slip occasionally.

Also checked the compression dry with the rings not fully seated and got 140, 145.

Bet that will go up with oil and wear in.
 
Aaaah ok! In that case red loctite is a good thing!

Compression figures sound quite good too...
 
Not too much to add.

Seat is done, just have to pick it up.

Paint is coming along nicely :)

Working on a good waterproof case for the arduino.

In the mean time I've been busy with a new project while waiting.


Picked up another GS :-D


I bought a 1996 Seadoo GSX 800.
8887456828_25722fb7de_c.jpg


Working on rebuilding the motor, Needed one cylinder redone so I'm doing both at the same time and collecting parts as I go.

Should be ready within the next few weeks.

Also Getting the head back for the 540 this week or next. So that project can resume.
 
Last edited:
Back
Top