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 03, 2012 « Previous Next »

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

Blaylock1988
Posted on Sunday, March 11, 2012 - 11:49 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

I'm back. I used the checksum 0xFD. It seemed to partially work. The ECM sent back a 64 byte code instead of the 10 byte error that I was getting before. I was able to concatenate the multi-byte numbers and read them in real time. The problem I had though was every value seemed to be double what it should be. For example, I was getting 25 volts from the battery and 120 degrees from the engine temperature (engine off). It is a step in the right direction but only having 64 of the first 107 offsets isn't enough. I don't know why I am missing so much data and why the data I do have is doubled.

What do you guys think is causing the problem?
Top of pagePrevious messageNext messageBottom of page Link to this message

Msamuels0
Posted on Monday, March 12, 2012 - 01:14 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Can you post the entire response that you're receiving, exactly as you're receiving it?

Might help to see what you're seeing.

-Mark
Top of pagePrevious messageNext messageBottom of page Link to this message

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

Sure, here is what I recorded:

OffsetValue (HEX)
01
142
20
364
4FF
52
66
77B
8B
90
100
110
120
130
140
150
160
17BB
1820
19BB
2020
21FA
2238
23FA
2438
2533
260
27F
28C4
294
3038
312
325D
332
340
350
363A
372
3868
396
40FC
413
420
430
44E8
453
46E8
473
48E8
493
50E8
513
5230
534
5430
554
560
5780
580
590
600
610
620


Everything after offset 62 is blank (FF)

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

Msamuels0
Posted on Monday, March 12, 2012 - 12:40 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Things look good in the response.

It says it's sending a total of 107 bytes ("length" byte is 0x64 (100), plus 7 bytes of header info), and the one thing I checked based on your earlier comment was the battery voltage:
Two bytes at offset 28, 0x04C4 = 12.20V

I'd take a look at the serial receive side of things. Is there a buffer that you have to set up somewhere? Is it only set to 100 bytes? Is there some other hard-set maximum set up somewhere else?

My guess is that the ECM is indeed sending everything out, but for whatever reason, your serial routine/buffer isn't catching it all.

-Mark
Top of pagePrevious messageNext messageBottom of page Link to this message

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

I think I might know what is causing it.
The The header is saying the length of the response is supposed to be 100 bytes. I think I remember reading somewhere that the Arduino Uno Serial buffer size is 62 bytes. This might be an issue with the Arduino that I need to look up how to get around.

Let me know if you have any ideas how to get around the buffer limit.

Also, did you combine it as 29, then 28? That was opposite of what I though it was supposed to do.

I tried combining them using
Value = Array[28] << 8 | Array[29]

How should I concatenate them?

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

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

Do a google search for "big-endian" versus "little-endian". That's what describes the byte order for values larger than one byte.

In this case, use the same instruction you're using, but swap "28" and "29". I didn't remember the "endian-ness" off the top of my head, so I checked both ways, and 12.20V (0x04C4) sure made a lot more sense than 501.80V (0xC404) ; )

As far as the built-in serial buffer size being 62 bytes, I've never used an arduino, so unfortunately, I have no clue, other than rolling your own.

-Mark
Top of pagePrevious messageNext messageBottom of page Link to this message

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

Ok, the buffer size is 64 bytes, I am not sure why I am getting 62.

I think my problem was that I was writing the entire buffer to outArray, instead of writing the first byte of the buffer to the outArray[i] for i=0 to i=107 as the stream came in.

I will have to wait until Thursday night when I go home to see if this works.
Top of pagePrevious messageNext messageBottom of page Link to this message

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

I messed with it a bit today. I got it to concatenate correctly and read temperature perfectly.

I discovered that my buffer is overflowing. The limit is 64 bytes. I rearranged my code and got it to read 67 bytes, which is a little better, but I think I am reading the information to slowly now and the buffer fills up faster than I can read it. I wish I knew more people that had experience with Arduinos.

Also, I need to get mass air flow from the bike, but I don't have the money for a wideband O2 sensor, and I don't know how to install a MAF sensor into my intake manifold. I already have injector pulsewidth so I can calculate how much fuel I am using.

Does anyone have any other suggestions for getting either A/F or mass air flow?

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

Djohnk
Posted on Friday, March 16, 2012 - 04:31 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

I hope you keep at it, and document what you do here. I for one, have been watching this tread with great interest. That Arduino platform is pretty neat.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Saturday, March 17, 2012 - 02:55 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 interest! I am documenting the project as I go on my project blog.

http://arduinobuell.blogspot.com/

Feel free to comment and/or subscribe.

I also post my code on it for anyone that wants to use it.
Top of pagePrevious messageNext messageBottom of page Link to this message

Starwolve
Posted on Monday, March 26, 2012 - 07:28 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

This post has me seriously intrigued to start working with Arduinos.

I found this comic, which I thought did a great job of explaining the basics.

Now I really want to find a basic arduino kit to get started. The author of the comic had a site in her links that had a basic starter kit:
http://www.adafruit.com/products/170

What do you guys think of this to get started? Is there a better "starter" kit out there?

I should add that I have a BS in Computer Science, so I don't think the programming portion will be too difficult to pick up. I really love tinkering with mechanical things, and would love to be able to combine my computer skills and mechanical skills to create some interesting electronics for the Buell...

(Sorry if I'm hijacking this post, but I figured you guys would be the right people to ask about getting started with Arduinos)
Top of pagePrevious messageNext messageBottom of page Link to this message

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

If programming is not going to be an issue then you should probably start with and AVR development system and just program in raw C for AVR. All tool chain applications are free, just need a programmer if the dev. board doesn't include one. STK600 or STK500 would be logical places to start though you might want to go with the cheaper Butterfly:
http://www.smileymicros.com/index.php?module=pagem aster&PAGE_user_op=view_page&PAGE_id=41
Top of pagePrevious messageNext messageBottom of page Link to this message

Starwolve
Posted on Monday, March 26, 2012 - 12:05 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

Greg - do you do any of this programming or have an electrical background? I'd love to find someone local who I could talk to about this stuff. I really did pick the wrong career field - I should have gone Mech E or Comp E instead of Comp Sci!

I've always wanted to learn this stuff, but have very limited background with electrical, except for wiring motorcycles. I'm thinking of picking up the Arduino kit just to get my feet wet with this, and using the Buell as a test bed... similar to what Blaylock1988 has been doing.
Top of pagePrevious messageNext messageBottom of page Link to this message

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

At the other end of the spectrum, you can get started with this stuff for about $8 worth of parts and some soldering / time with a breadboard.

I went that way, because my goal was a dirt cheap way to do anything anywhere. So a $25 Aurduino board was too expensive. I got the PIC's and figured out how to program them in C (nice tools available), played around with different schematics, and have a design now that can control current or blink an LED based on analog inputs for about $8 worth of hardware. Add $8 to $15 if you want a 16x2 character LCD included.

If you want to go that route, let me know, and I can give you my schematic and some source code. You can use MPLab and a couple of different C compilers to program them (and they work great).
Top of pagePrevious messageNext messageBottom of page Link to this message

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

I think the $99 Butterfly kit would do more for you in the long run. I have it but haven't had a lot of time to devote to learning C. The $99 kit gives you the entire learning lab with jumper wires, bread board, motor, LEDs, etc. It's a good starter kit that covers a lot of fundamentals.

AVRFreaks is the forum of choice for the bare AVR dev. kits (and other AVR stuff), not sure what is out there for Arduino but I'm sure there is a large community on the web.
Top of pagePrevious messageNext messageBottom of page Link to this message

Starwolve
Posted on Monday, March 26, 2012 - 02:27 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

I guess I have some more research to do in determining which route would be best.

This stuff is all new to me, so I don't know if the "start from scratch" routine would work. I haven't played with a breadboard since I was a kid and had one of those Radioshack Electronic Learning Kits... but it was fun building motion sensor alarms and scaring my siblings.
Top of pagePrevious messageNext messageBottom of page Link to this message

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

I didn't get that butterfly kit, I got the kit that was the next step down from adafruit. I also saw that Radioshack carries arduinos and some arduino shields for the same price as at adafruit.

The nice thing with arduino is that it is open source and a HUGE arduino forum that is very active. If you can't figure something out, there are tons of people out there that can help through the forum, or youtube, or project sites because the arduino following is so big.

I am heading home today so I can work on my bike some more, I am getting very close to reading all 107 bytes. Then I will be able to start writing the meat of the code.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Monday, March 26, 2012 - 07:18 pm:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

I finally got the Arduino to read all 107 bytes of data. My question now is does the ECM keep sending this stream of data or do I get one stream per request?
Top of pagePrevious messageNext messageBottom of page Link to this message

Starwolve
Posted on Tuesday, March 27, 2012 - 12:19 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

What forum are you using for the Arduino info? I would like to do a bit more reading before I get something.
Top of pagePrevious messageNext messageBottom of page Link to this message

Blaylock1988
Posted on Tuesday, March 27, 2012 - 04:24 am:   Edit Post Delete Post View Post/Check IP Print Post    Move Post (Custodian/Admin Only) Ban Poster IP (Custodian/Admin only)

This is the official arduino forums that I have been posting in.

http://arduino.cc/forum/index.php?action=forum

Msamuels0, could I possibly take a look at your code that you used? I am having a hard time figuring out how to write the program to request and read the data from the ECM continuously while still performing other operations.

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

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

Good news!

I finally got the arduino to read all 107 bytes of data in real-time. No delays, no stops, no cutting off data, it works like a dream. Check out the video:

Top of pagePrevious messageNext messageBottom of page Link to this message

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

That's really cool.

You haven't even finished your project, but I would already like to take what you have so far off your hands ... so I could install it on my bike.
Top of pagePrevious messageNext messageBottom of page Link to this message

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

lol, you can have all the code, I posted it for anyone that wants to use it. You just have to get your own arduino though :P
Top of pagePrevious messageNext messageBottom of page Link to this message

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

Michael - that's awesome. What you'be been posting here has inspired me to pick an an arduino when I get home from this deployment. I've been reading up on them for a couple weeks now and I'm convinced that it would be a fun gadget to play with, and the Buell is a good test-bed for projects!

I might also pick up a Raspberry Pi when they're available again - plenty of uses for that as well!
Top of pagePrevious messageNext messageBottom of page Link to this message

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

The pi will be waiting for FCC certification before you can get it here, not cheap and not quick.
Top of pagePrevious messageNext messageBottom of page Link to this message

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

Thanks, I have been searching through my engines notes from the past 2 semesters for equations I can use (piece together) to calculate power. I am going to add case structures to the code so I can tab through different information to display on the LCD. Eventually I will make a shift indicator on it too. During the summer I will pick up a big touch screen like Msamuels0 has on his and make a custom interface for everything.
Top of pagePrevious messageNext messageBottom of page Link to this message

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

Greg - I saw that it was also waiting CE certification as well. They weren't selling it as an assembled product, so they didn't think they needed it there. Plenty of time though - I won't be home from Afghanistan until August, and in the mean time I can brush up on basic electronics with the Arduino.

Michael - please keep posting your progress. I'd like to help out if I could, but can't do much 7000 miles away from home!
Top of pagePrevious messageNext messageBottom of page Link to this message

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

Not to take this too far off, but the pi is much too assembled to be called a kit, so it must be certified before they can risk selling it. If not and it turns out that the FCC buys one, and it doesn't pass, then Newark will be on the hook for the fines and may need to buy back each device sold or face higher fines of $10,000 per unit sold. It probably wouldn't go that high and I doubt it would happen, but they could still be hit for a small fine or a cease and desist since it has not been certified. I'm fairly confident that the board will pass the most basic tests needed to sell it here, just that time and money are involved. And yes I would like to get at least one for my self and play with it.

This Arduino stuff is very interesting, would be great to get to the point of having full diagnostics, data logging, fuel map correction and upload, etc. Wish I could help more but I'm not very experienced and stuffed with other things I need to do. If you get down to a schematic of what you need, I can probably help by designing the circuit boards and point ot a board making service.
Top of pagePrevious messageNext messageBottom of page Link to this message

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

How much for a a 3x2" two sided board in quantities of 100? Through hole design, no surface mount.

It would be an updated version of this, but pretty much the same parts and same number of holes.


board
Top of pagePrevious messageNext messageBottom of page Link to this message

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

http://dorkbotpdx.org/wiki/pcb_order

You might have enough for his middle volume orders that go our about once a month.
http://dementeddiode.org/blog/2011/03/a-medium-run -service-for-open-source-hardware/
Boards are good quality and made in USA if that matters at all, I know to some of the guys doing low volume it does matter. I have several different designs that I've run through the service and for the above it should come out perfect.

Man that design could be shrunk to half the size with surface mount components, might almost double the time to assemble though unless you build an oven or maybe temp. controlled hot plate, or preheater and low volume hot air. What's the TO-220 device? Looks like some kind of high current driver.
« Previous Next »

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