Arduino go kart EMS

Free Open Source Firmware project discussion forum. Post your Free Open Source firmware projects here!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Arduino go kart EMS

Post by Fred »

The range check is a very weird and nonsensical idea. For a start you're inferring that the table goes to near-zero RPM, or that the engine is never at near-zero RPM and in need of some love. Or that it's an error to be cranking. You're also suggesting putting the upper bound at or above the rev limit, usually a brain-dead thing to do. Especially on a resource-limited device where you want to stretch your data all you can by putting the end RPMs approximately a half gap away from each extreme.

Re the double check, good spotting, here's my broken impl, for what it's worth, lines 133 - 149 http://builds.freeems.org/firmware/mast ... tml#l00133

There are some bugs outside of that line range.

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
noisymime
DIP8 - Involved
Posts: 29
Joined: Wed Feb 06, 2013 4:12 am

Re: Arduino go kart EMS

Post by noisymime »

Thanks guys, that does seem really obvious in hindsight :oops:
Too much late night coding!

That whole table area definitely needs a good going over as there's multiple areas where things can break or do less than desirable things under certain circumstances. The goal at this point is really just to get it into a state that will actually run an engine and then start reviewing things in more detail.

Thanks for the code link also, very useful!
MotoFab
1N4001 - Signed up
Posts: 307
Joined: Thu May 29, 2008 1:23 am
Location: Long Beach CA

Re: Arduino go kart EMS

Post by MotoFab »

Regarding the math processing time on an Arduino, set a timer and measure the function. Send the result through the environment's serial monitor. At 10,000 revs a combustion cycle happens every 0.006 seconds. That's quite a long time to figure out a shot of fuel I think.

If measurement proves not enough clocks between combustion cycles, there are some division shortcuts to be had with interpolation. In addition to the bin values in the fuel table, make two more tables containing the slope value between bins. One table for the slope between column entries, the other for the slope between row entries. All values converted to integer of course.

To explain that a little, if the fuel table is 8x8, then the column slope table will 7x8 and the row slope table will be 8x7. I may have that backwards but you get the idea. There's one fewer slope bin than there are fuel bins. Like one fewer spaces than pickets in a fence.

Regarding figuring out new slope values each time a fuel bin is changed, I'm somewhat confident the slope values can be determined automatically with some sort of preprocess directive for the compiler.
Last edited by Fred on Tue Feb 19, 2013 11:32 am, edited 1 time in total.
Reason: Remove noise from noisymime's thread.
noisymime
DIP8 - Involved
Posts: 29
Joined: Wed Feb 06, 2013 4:12 am

Re: Arduino go kart EMS

Post by noisymime »

MotoFab wrote:Regarding the math processing time on an Arduino, set a timer and measure the function. Send the result through the environment's serial monitor. At 10,000 revs a combustion cycle happens every 0.006 seconds. That's quite a long time to figure out a shot of fuel I think.
Currently performing 2 squirts per cycle as I don't plan on having any phase info available, so that further cuts the time between squirts down to 0.003. The math is definitely a concern, but it's also things like an analog read from the MAP sensor that are chewing up the time. Hell, even flipping digital IO pins comes with a small delay :(
I've been using the serial monitor for some basic benchmarking, learned very early on that it is a seriously slow piece of work, so need to be careful to make sure it's not interfering with things at all.
crazyafrican
DIP8 - Involved
Posts: 24
Joined: Fri May 10, 2013 5:43 am
Location: Auckland, New Zealand

Re: Arduino go kart EMS

Post by crazyafrican »

OP you might be interested in this

http://sourceforge.net/projects/arduems/

I did not write the code, just made it work on arduino.

Only uses 12kb program memory so the ATmega328 is not even half full.
Not quite ready for use as I'm sorting out hardware at the moment, but almost there :D
noisymime
DIP8 - Involved
Posts: 29
Joined: Wed Feb 06, 2013 4:12 am

Re: Arduino go kart EMS

Post by noisymime »

That's a pretty nifty bit of code, certainly looks very feature complete. What was the source for it?
crazyafrican
DIP8 - Involved
Posts: 24
Joined: Fri May 10, 2013 5:43 am
Location: Auckland, New Zealand

Re: Arduino go kart EMS

Post by crazyafrican »

the original source is in the downloads area. was for atmega128

The newest code I have of msavr has an event queue where you insert events into a binary heap. It makes it a lot easier to insert and schedule events, but it compiled to ~54kb so won't fit on the atmega328. It also has EDIS control which is easy once you have a relatively high precision event queue

The code is supper messy tho, don't blame me lol
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Arduino go kart EMS

Post by Fred »

noisymime wrote:That's a pretty nifty bit of code, certainly looks very feature complete. What was the source for it?
Noisymime, it's the old MS AVR project code, IE, VEMS early code. It's a direct clone of MS1 in C, really. It's probably patent encumbered too, though the patents are laughable. For pretty much every reason, I'd not touch it with a barge pole.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
crazyafrican
DIP8 - Involved
Posts: 24
Joined: Fri May 10, 2013 5:43 am
Location: Auckland, New Zealand

Re: Arduino go kart EMS

Post by crazyafrican »

noisymime did you get it working without floats? do you mind posting up your final interpolation code?
noisymime
DIP8 - Involved
Posts: 29
Joined: Wed Feb 06, 2013 4:12 am

Re: Arduino go kart EMS

Post by noisymime »

crazyafrican wrote:noisymime did you get it working without floats? do you mind posting up your final interpolation code?
I haven't got my whole thing up and running yet (Though it is syncing with a 12-1 wheel on the bench. Not huge I know, but a milestone)

The float free interpolation code though is definitely working. It probably has a few edge case bugs, but feel free to check it out: https://github.com/noisymime/Kartduino/ ... er/table.h
Post Reply