G oog le BadWeB | Login/out | Topics | Search | Custodians | Register | Edit Profile

Buell Forum » XBoard » Archive through June 12, 2012 » Anyone hookup ECM to LabVIEW/Arduino? » Archive through April 30, 2012 « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Greg_e
Posted on Tuesday, April 03, 2012 - 10:09 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

I should mention... That's $5 per square inch with three boards for that $5. So really $1.666666666 each square inch. And I think he only allows gold (ENIG) now.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Wednesday, April 04, 2012 - 03:42 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

I don't know anything about building all of that circuitry stuff. I didn't know anything about arduino stuff until I started this project, I only had a little background with programming.

I am excited to say that I found/derived the equations I need for calculating torque and horsepower on the bike. It is a combination of acceleration force, rolling resistance force, and drag force. I spoke with my engines professor and he said my equations are good. I am going to write them into the arduino and do some test runs this weekend. I will post videos of it in action. Hopefully it goes smoothly. I have to present the project on the 17th this month so I don't have much time left to pretty much finish it. Gotta make a trip to Radioshack for some prototyping board and ribbon wire.

Oh also, I was reading through the EcmSpy ECM Tuner Guide V2 and found 2 small things relating to our bikes that I have NEVER seen mentioned before that can be done to help get some power back on our bikes

Check my project blog post about it here: http://arduinobuell.blogspot.com/2012/04/i-was-reading-through-ecmspy-buell.html

(Message edited by Blaylock1988 on April 04, 2012)
Top of pagePrevious messageNext messageBottom of page Link to this message

Greg_e
Posted on Wednesday, April 04, 2012 - 10:06 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

You should also eventually advance this device to including an accelerometer, that might help with your above calculations as well as things like 0-60 times, etc.

When you get it all done I might check it out more, we should be able to convert this to a bare AVR (running the Arduino code) and the rest of the circuitry, then make a circuit board for it.
Top of pagePrevious messageNext messageBottom of page Link to this message

Reepicheep
Posted on Wednesday, April 04, 2012 - 11:05 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Thanks Greg!

That's a heated grip thermostat for cartridge heaters, sized to fit inside the bars beside the Polly heater. Working brilliantly now... just hook power to it, bury it in the bars, and when you need heat it is there, when you don't it's not, no switches or fussing. It took a very sophisticated algorithim to regulate the heat correctly... about a years worth of part time futzing.

That big thing is indeed a high current switch, a MOSFET. One of the "secret sauce" parts of the design to make the current handling high and the parts count low. There aren't many MOSFETS that will work right, it has to be able to be driven into saturation off a CMOS discrete output on the PIC. It was a fun and subtle part of my circuit.

I'm going to rework it again. The "in the bars" solved one packaging problem (just shrink tube the thing) but created too many other problems. It won't fit in all bars easily, and to have one controller drive two heaters (which it will do just fine) you then need to run three four big wires into the bars (two in, two out to the heater on the other side). I'm going to change it to put the controller under the flyscreen, but move the thermistor to a remote feed. Thats still four wires, but two of them can be really light and easy to route because they don't carry significant current. I built in a "smart idiot light" as well for voltage monitoring, and getting the controller out of the handlebars lets me use that again as well.

I'm not rigged for SMD, though that would make the whole thing really cool.

Sorry for the thread hijack! We need a microcontrollers and motorcycles knowledge vault topic... lots of synergy on the different projects we are doing.
Top of pagePrevious messageNext messageBottom of page Link to this message

Reepicheep
Posted on Wednesday, April 04, 2012 - 11:07 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Oh, and that dorkbot site is very cool! Thanks! That's exactly what I was looking for... I need the help getting the details down, and it looks like he is just the guy.
Top of pagePrevious messageNext messageBottom of page Link to this message

Greg_e
Posted on Wednesday, April 04, 2012 - 01:26 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Feel free to send me a message off list, I'm not an expert but I've done some fairly complex surface mounted things and used FreePCB to generate the board design. It can be one of those stress relievers that might be kind of handy right now so let me know if I can help. Designs will of course stay confidential.
Top of pagePrevious messageNext messageBottom of page Link to this message

Greg_e
Posted on Wednesday, April 04, 2012 - 01:28 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

And back the Arduino... My bother tells me there used to be a Arduino based mpg calculator that sampled the pulses from your fuel injection, since that info is available to the ECM it might make another neat feature to add to your project. Wish I could help with the programming instead of just adding work to your project with suggestions.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Wednesday, April 04, 2012 - 01:53 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Oh, that is a good suggestion! I am trying to think about the math in my head to figure out mpg.

You know mass from the pulsewidth of the two cylinders added together, we know density of fuel so we can get instantaneous volume. Multiply it by RPM so you have volume/min, then multiply by 60 and you have gallons/hour. Lastly, divide miles/hour by gallons/hour, and that gives you instantaneous MPG. I can take a running average of that to get average MPG.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Sunday, April 08, 2012 - 01:37 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Quick update, I got datalogging working on the Arduino. I am having some issues with getting the LCD screen to display stuff correctly. Hopefully I can get that fixed, but after Easter service tomorrow I am going to take the bike for a spin and see what kind of data the arduino puts out, and hopefully a video!
Top of pagePrevious messageNext messageBottom of page Link to this message

Reepicheep
Posted on Sunday, April 08, 2012 - 08:20 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Does the ECM get the speedo sensor output, or have an MPH parameter?

If you have a 16x2 LCD, remember the display buffer is actually 32 characters (if I recall correctly). So you need to leave a gap.

I can post some sample C if it would help. It's pure native PIC stuff, not Arduino stuff, but it is commented and you can follow what it does.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Sunday, April 08, 2012 - 12:42 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

The ECM has a speed output, but the EcmSpy reference doesn't say what units it is in. I am hoping it is im MPH because the logs that EcmSpy outputs has MPH (hopefully no conversion)

I found the problem was I accidentally put the LCD on the I2C pins on the arduino which was using the RTC and screwing up the signal. I should be set with the LCD, but feel free to post the code if you like.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Sunday, April 08, 2012 - 06:33 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Does anyone know the fuel flow rate for the stock XB9 injectors? Or where I can find the data sheet for them would work too.
Top of pagePrevious messageNext messageBottom of page Link to this message

Greg_e
Posted on Sunday, April 08, 2012 - 08:26 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Both my 03 long and later short injectors tested right around 30-31 pounds per hour at 45 psi when I sent them out to be serviced. Not sure what pressures the system runs at though.

What you should probably do is keep track of the miles and the gallons for several fill ups and let that set your baseline. If it logs the total amount of time the injectors are open and computes the amount of fuel used in that tank with the number of miles for that tank, it should get pretty accurate.

(Message edited by Greg_E on April 08, 2012)
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Sunday, April 08, 2012 - 09:41 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Thanks for the info. The Arduino doesn't request the data from the ECM fast enough, right now it reads data at 4-5Hz. It is slow because of how much other stuff I have going on in the program. The Arduino would have to sample every single rev and save every single pulsewidth in order to keep track of how much fuel has been used. I don't think the Arduino is robust enough for that. I do need to work on my code and see if I can get it running faster.

VIDEO:


I did a few runs and it records everything on the SD card. I need to work on how it computes power. The Speed is very jumpy because it is only in 1MPH increments, so acceleration really jumps, which makes power really jump as well.

I also have an issue with the arduino freezing randomly. I need to sort that out. I have a feeling it is because the ECM fails to send a response and then the program just stops working altogether, or I am maxing out my arduino RAM which would be very bad.

I think my O2 sensor might be broken too because the ECM is telling me it is 0 voltage....
Top of pagePrevious messageNext messageBottom of page Link to this message

Reepicheep
Posted on Monday, April 09, 2012 - 09:16 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

How many bytes are you reading, and what is the baud rate? The speed problem may not be the Audrino, you might just have maxed out the serial port. You might have to measure pulse width directly.

You could also just have it average, and just update slower. So it only updates once every 5 seconds. Less entertaining, but perhaps just as useful.
Top of pagePrevious messageNext messageBottom of page Link to this message

Greg_e
Posted on Monday, April 09, 2012 - 10:19 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Pretty sure Buell serial port should be 9600 8n1 so I doubt that is going to be the problem, even up to 115K should be fine unless it is trying to do a lot of other things.
Top of pagePrevious messageNext messageBottom of page Link to this message

Reepicheep
Posted on Monday, April 09, 2012 - 11:02 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

9600 baud is 9600 bits per second. Divide by 8, and that gives you 1200 bytes per second. Figure 250 bytes per ECM "dump", and you are down to 4.8 reads per second maximum...

Which is 4-5 Hz. ; )
Top of pagePrevious messageNext messageBottom of page Link to this message

Greg_e
Posted on Monday, April 09, 2012 - 12:43 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

I should open up a connector and toss a logic analyzer on my bike one of these days.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Monday, April 09, 2012 - 12:47 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

it does communicate at 9600 baud. You can see in my first video that shows TPS and engine temperature, that it reads and displays the info lightning fast. But you can also see in my new video, it is quite slow. It is doing a lot of other stuff, especially with the data logging. I am up to about 300 lines of code now. I don't know if my code just needs to be optimized/rearranged, or if I am maxing out the arduino's memory or what.

Take a look at my code here:http://arduinobuell.blogspot.com/p/code.html
and let me know what you think, maybe some suggestions for speeding it up?

(Message edited by Blaylock1988 on April 09, 2012)
Top of pagePrevious messageNext messageBottom of page Link to this message

Greg_e
Posted on Monday, April 09, 2012 - 01:08 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

One suggestion would be to either datalog or display details but not both at once.
Top of pagePrevious messageNext messageBottom of page Link to this message

Reepicheep
Posted on Monday, April 09, 2012 - 01:33 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

OK, looking at the source code, to request data you send 8 bytes... and you get 107 bytes back.

At 9600 baud, you can send 9600 zeros or ones per second.

You need to send 8 bytes (64 bits) and get back 107 bytes (856 bits). 856+64 = 920 bits.

9600 bits per second / 920 bits means you will get a theoretical maximum sample rate of 10 updates per second (10 Hz). Thats assuming everything else is infinitely fast (which it won't be).

For optimization, you could consider just dumping the raw block of return data to the file, then "post process" it when you want to convert it for viewing. Let the big machines do the heavy lifting. Recording the raw data gives you more leeway to make mistakes anyway.

Oh, and "foo" is just a variable name old farts like me use when writing sample code. We also use "bar". It comes from "fubar", an acronym for "fouled up beyond all recognition".

For your 02 voltage, did you mean to have a mixed mode operation? Multiplying a long int by a constant float? Mixed mode operations make me nervous in general, even more so with a Micro-controller. I don't trust (or perhaps understand) what voo-doo the compilers will do to try and do it right. I worry they will either do it efficiently but potentially wrong, or always right but inefficiently.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Tuesday, April 10, 2012 - 02:55 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

I need to do the conversion for some of the data on the fly to calculate power and torque because I need to display them as I ride, which are the only big calculations. I could try having a data log only mode maybe. The speed it operates at now works, but if I could double the speed it would be fantastic. I really need to figure out the program freezing issue.

For my O2 voltage, I am reading the Hex data stream directly from the ECM and every time it shows 0 and 0 for both bytes of data for the O2 voltage. It is either broken, or I accidentally turned it off while tuning in EcmSpy, so I need to check that.

I ordered a 3-axis accelerometer for assisting in power calculation. The precision of the speed from the ECM is way too low and lacking smoothness. Hopefully I can get that in time and hooked up so that I can get more accurate acceleration measurements and better force measurements.

Does anyone happen to know the factory specs on the bikes frontal area (cross sectional area) and the coefficient of drag? It would help a lot so I won't have to guesstimate those numbers.

(Message edited by Blaylock1988 on April 10, 2012)
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Tuesday, April 10, 2012 - 12:47 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

I got a reply back from EBR about calculating fuel flow:


quote:

Low pulse widths can be dominated by the dynamic flow duration; there is a dynamic and static flow rate so for short pulse widths you’ll be heavily into the dynamic flow portion of it and may not get an accurate calculation. We can probably dig up the spec, and it'll be something to get you in the neighborhood but more complicated analysis is needed to truly calculate a proper mass-fuel-injected value.




I am going to look into it and see if I can take a shot at the more complicated analysis. But at the minimum I should be able to get a rough estimate.
Top of pagePrevious messageNext messageBottom of page Link to this message

Xoptimizedrsx
Posted on Friday, April 13, 2012 - 11:26 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Blaylock


I little Bird sent you a file (check email). You now have data, it is a very good complete database on all the ecm values including what they are scalar wise and calculation/offset wise.

Regards,

Little Bird
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Monday, April 16, 2012 - 01:33 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Does anyone know how to program in a digital low pass filter in C/C++?

I hooked up an accelerometer to get more accurate acceleration readings, except the vibration of the bike creates an insane amount of high frequency noise and the accelerometer is nearly useless until I can filter it out.
Top of pagePrevious messageNext messageBottom of page Link to this message

Greg_e
Posted on Monday, April 16, 2012 - 10:02 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

I think you need to look at mechanical solutions to fix that problem first, it's a common issue with RC helicopters and pretty much every gyro comes with a "special" foam adhesive to damp some of these vibrations. Try something like this:
http://www.readyheli.com/MIK4272-Mikado-V-Bar-Doub le-Sided-Foam-Gyro-Tape_p_35456.html

Not sure if it really makes a difference over regular 3M foam tape but it might help.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Monday, April 16, 2012 - 11:47 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Ok thanks I will look into that. I will probably have to set up a simple RC circuit to filter out frequencies over maybe 10Hz. Since the arduino doesn't record data fast enough to correctly apply a filter without any aliasing.
Top of pagePrevious messageNext messageBottom of page Link to this message

Reepicheep
Posted on Monday, April 16, 2012 - 12:57 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Probably best to start with mechanical filtering, then go to electrical, then go to digital.

If you are driving the sensor near saturation, filtering it later won't help.
Top of pagePrevious messageNext messageBottom of page Link to this message

Greg_e
Posted on Monday, April 16, 2012 - 01:12 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

It may also turn out that the sensor just can not work on one of these cycles due to vibration. If you get it damped enough to work then it may not properly record the acceleration since the sensor will be moving until the isolation catches up.

You might want two layers of foam, a more simple test would be to wrap the proto board in some foam rubber and see what happens before buying adhesive foam. Gel material might also be worth having, and you might need to attach the sensor to a large weight to provide damping in addition to the foam or gel.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Monday, April 30, 2012 - 11:36 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Sorry I haven't updated in a while. School got crazy, and I just bought a new VW GTI.

I presented my project in class and did a 26 page report for it. My professor really liked my project, since it was the most similar to how real world engineering project work. The rest of the class did all research papers. Presentation went well too. I won't be able to do much work on it until after I move out to LA in June, but it isn't done yet. I have a huge list of things I want to do with it. The first thing is to replace the Arduino Uno with an Arduino Mega. That will fix my freezing issues. Let me know if you are interested in reading my report.
« Previous Next »

Topics | Last Day | Tree View | Search | User List | Help/Instructions | Rules | Program Credits Administration