ECUs and Tuning Discuss Engine Management, Tuning, & Programming

Arduino as ECU?

Thread Tools
 
Search this Thread
 
Old 08-16-2010, 11:00 PM
  #1  
Junior Member
Thread Starter
iTrader: (3)
 
ctxspy's Avatar
 
Join Date: Jun 2008
Location: NJ
Posts: 428
Total Cats: 0
Default Arduino as ECU?

Disclaimer: I know next to nothing about this stuff.

Anyone ever think about using an Arduino as an ECU?
http://arduino.cc/en/Main/ArduinoBoardMega

The Mega is coincidental, has nothing to do with megasquirt ( i think ).

Some potential benefits to using this as a platform to build onto:
  • not patent encumbered
  • very cheap
  • huge user community
  • many extensions "shields" as they call them
  • several built in serial ports
  • easy to program & extend

Now feel free to tell me why this won't work
ctxspy is offline  
Old 08-16-2010, 11:34 PM
  #2  
Elite Member
iTrader: (12)
 
neogenesis2004's Avatar
 
Join Date: Aug 2006
Posts: 4,413
Total Cats: 20
Default

probably not enough program memory. also the 8bit mcu is less powerful than a ms2. Now if you start talking about like a avr32 then you are talking. Have fun writing it from scratch though.
neogenesis2004 is offline  
Old 08-16-2010, 11:36 PM
  #3  
Elite Member
iTrader: (10)
 
Jeff_Ciesielski's Avatar
 
Join Date: Oct 2008
Location: Rhode Island
Posts: 1,770
Total Cats: 31
Default

Parallax propeller could probably get the job done. Nifty little microcontroller. However, once you take the price and the amount of work into account, MS looks pretty awesome
Jeff_Ciesielski is offline  
Old 08-17-2010, 12:37 AM
  #4  
Junior Member
iTrader: (4)
 
redrider706's Avatar
 
Join Date: May 2009
Location: Athens GA
Posts: 440
Total Cats: 6
Default

There is another ECU project which uses a cpu from the same cpu family. http://www.vems.hu/

-Raj
redrider706 is offline  
Old 08-17-2010, 12:51 AM
  #5  
Boost Pope
iTrader: (8)
 
Joe Perez's Avatar
 
Join Date: Sep 2005
Location: Chicago. (The less-murder part.)
Posts: 33,019
Total Cats: 6,587
Default

Originally Posted by Jeff_Ciesielski
Parallax propeller could probably get the job done. Nifty little microcontroller.
Yeah, I've got one lying around, haven't taken the time to really learn it. The BS2 has always been enough for the little stuff I need to do. Still, an 8 core, 32 bit uC is pretty awesome.

Originally Posted by neogenesis2004
probably not enough program memory.
The 68HC908 CPU in the MS1 has 512 bytes of RAM. Not 512k, 512 bytes.

I'm sure the Arduino is plenty powerful, I just can't personally imagine wanting to spend the time it would take, when the MS2/3 codebase is already so well developed. Just wish they'd ******* let us see the ******* schematics for the ******* MS3 and the ******* MS3X that they've been keeping so ******* secretive on fear that some ****** will clone the ******* thing, with no regard for all the ******* people out there who don't give a **** about copycats and just want to be able to properly optimize their ******* I/O circuits.

*******...
Joe Perez is offline  
Old 08-17-2010, 02:01 AM
  #6  
Elite Member
iTrader: (1)
 
Full_Tilt_Boogie's Avatar
 
Join Date: May 2009
Location: Jacksonville, FL
Posts: 5,155
Total Cats: 406
Default

I saw the title of this thread and said aloud "Holy ****"

I wouldnt want to program that ****
Full_Tilt_Boogie is offline  
Old 08-17-2010, 03:07 AM
  #7  
Junior Member
 
NickC's Avatar
 
Join Date: Jul 2008
Posts: 113
Total Cats: 1
Default

Not with an Arduino, but the "megasquirt project" started out as a more open-source code on a simple microcontroller.

PS- I love Arduinos
NickC is offline  
Old 08-17-2010, 01:27 PM
  #8  
Elite Member
iTrader: (12)
 
neogenesis2004's Avatar
 
Join Date: Aug 2006
Posts: 4,413
Total Cats: 20
Default

Originally Posted by Joe Perez
I'm sure the Arduino is plenty powerful, I just can't personally imagine wanting to spend the time it would take, when the MS2/3 codebase is already so well developed. Just wish they'd ******* let us see the ******* schematics for the ******* MS3 and the ******* MS3X that they've been keeping so ******* secretive on fear that some ****** will clone the ******* thing, with no regard for all the ******* people out there who don't give a **** about copycats and just want to be able to properly optimize their ******* I/O circuits.

*******...
**** the ******* *******!!!
neogenesis2004 is offline  
Old 08-17-2010, 01:39 PM
  #9  
Junior Member
 
JustinHoMi's Avatar
 
Join Date: Jul 2005
Location: Hillsborough, NC
Posts: 273
Total Cats: 1
Default

The difference between the arduino and the 68HC908 is that the Arduino language is a varient of c, while the 68HC908 used assembly language. It would take a whole lot more memory, flash, cpu cycles to accomplish the same thing on an Arduino.

Of course the MS-II was written in c, and has a similar amount of ram and a similar cpu. However the MS-II's cpu has twice the flash (64k) as the Arduino (32k). So your code would have to be approx half the length of the MS-II. It would be a little bit worse than that since the Arduino language has so much abstraction going on.

Then again... you could use an Arduino Mega, which has 128k of flash.

The other issue you might have with the Arduino is timing. I'm not sure that the Arduino's timing is fine grained and accurate enough, and I'm not sure that the Analog inputs are fast enough (with the abstraction). Even the MS-II had to use assembly language for reading the analog inputs. You could use straight c or assembly language on the arduino... but then it wouldn't really be an arduino.
JustinHoMi is offline  
Old 08-17-2010, 01:46 PM
  #10  
Junior Member
 
JustinHoMi's Avatar
 
Join Date: Jul 2005
Location: Hillsborough, NC
Posts: 273
Total Cats: 1
Default

That said... I do have an Arduino in the proto area of my megasquirt =)
JustinHoMi is offline  
Old 08-17-2010, 01:52 PM
  #11  
Elite Member
iTrader: (12)
 
neogenesis2004's Avatar
 
Join Date: Aug 2006
Posts: 4,413
Total Cats: 20
Default

The arduino "language" is just c++ functions that have been premade to help nubs. You can still code in its simple compiler using c++ only, giving you a finer control. The compiler still converts it to assembly so both still get their bits set from assembly inthe end.

Additionally, the arduino just uses a Atmel AVR chip while the MS chip is a freescale chip. Both have C++ compilers available, and both can also be coded solely in assembly. Both are VERY similar chips, main difference actually being 8bit on the AVR and I believe the MS2 is 16bit. The MS3 is 32bit so the comparable Atmel chip would be from the AVR32 family.

A large reason AVR chips are so massively used is because a great open source GCC compiler exists for it and it also has a tremendous forum support. Freescale and other chips often require more expensive toolchains in order to fully utilize high level languages like C++.
neogenesis2004 is offline  
Old 08-17-2010, 09:29 PM
  #12  
Junior Member
 
rb26dett's Avatar
 
Join Date: Feb 2007
Location: 11368 miles from where i would like to be
Posts: 269
Total Cats: 92
Default

I know a guy working on a FOSS ECU for the duinos. If I can get hold of him again, I can try to put you in touch, if you're any good as a dev.

MS3 - it's worse than you think. There is self destruct code built into the thing such that if you do certain things that might be indicative of trying to clone it, it deletes everything and bricks it, yay.

LOL @ neo's comment "**** the ******* *******!!!"

Re propeller chips, there is a guy obsessed with them on diyefi.org/forum with a thread and project using 2 chips to produce an EMS.

Finally, FreeEMS isn't dead despite the total lack of updates to the website and any information on what has been happening. Here is an out of date thread on it :

https://www.miataturbo.net/megasquirt-18/diyefi-org-freeems-future-true-diy-engine-management-19077/

I got a car running and m2cupcar tuned it (fuel only) by feel, picking up midrange and 5mph top speed on the flat. I did that 8 or 9 months ago in the US of A. First run and drives were in Florida at the end of a 13500 mile road trip that started in California with AbeFM :-) I guess I started and ended the trip with miata guys!

In any case, I've been doing some closed source EMS work for a guy from the US who flew me in to do it, and then into China for a month each. There is a video of that here :

http://www.youtube.com/watch?v=QvJgyuzoako

Lots of good things are coming from us soon (where soon is a relative term).

Fred.
rb26dett is offline  
Old 08-17-2010, 09:54 PM
  #13  
Elite Member
iTrader: (12)
 
neogenesis2004's Avatar
 
Join Date: Aug 2006
Posts: 4,413
Total Cats: 20
Default

Hippy fred with long hair is lulz.
neogenesis2004 is offline  
Old 08-20-2010, 12:50 AM
  #14  
Junior Member
Thread Starter
iTrader: (3)
 
ctxspy's Avatar
 
Join Date: Jun 2008
Location: NJ
Posts: 428
Total Cats: 0
Default

Originally Posted by rb26dett
I know a guy working on a FOSS ECU for the duinos. If I can get hold of him again, I can try to put you in touch, if you're any good as a dev.

MS3 - it's worse than you think. There is self destruct code built into the thing such that if you do certain things that might be indicative of trying to clone it, it deletes everything and bricks it, yay.

LOL @ neo's comment "**** the ******* *******!!!"

Re propeller chips, there is a guy obsessed with them on diyefi.org/forum with a thread and project using 2 chips to produce an EMS.

Finally, FreeEMS isn't dead despite the total lack of updates to the website and any information on what has been happening. Here is an out of date thread on it :

https://www.miataturbo.net/showthread.php?t=19077

I got a car running and m2cupcar tuned it (fuel only) by feel, picking up midrange and 5mph top speed on the flat. I did that 8 or 9 months ago in the US of A. First run and drives were in Florida at the end of a 13500 mile road trip that started in California with AbeFM :-) I guess I started and ended the trip with miata guys!

In any case, I've been doing some closed source EMS work for a guy from the US who flew me in to do it, and then into China for a month each. There is a video of that here :

http://www.youtube.com/watch?v=QvJgyuzoako

Lots of good things are coming from us soon (where soon is a relative term).

Fred.
Fred,

I read your thread about the free ems, seems interesting.

I have no relevant abilities myself (my experience is with php, perl .NET and a little Java, no nuts and bolts programming really), but i figured the arduino could be a good base to work off of (especially the 'mega') due to the large number of inputs, wide availability, low cost, and support base.

-Tomaj
ctxspy is offline  
Old 08-20-2010, 08:05 AM
  #15  
Elite Member
iTrader: (12)
 
neogenesis2004's Avatar
 
Join Date: Aug 2006
Posts: 4,413
Total Cats: 20
Default

Oh, it's definitely a GREAT base to get into embedded programming. Once you get it down you can move into AVR programming in general and use the regular GCC AVR compiler with something like Programmer's Notepad (my personal fav). The compiler has all the MCU bits built in, so when you look at the datasheet and you see say a timer called TIM1 or something, you can directly set those bits, clear them, or use them in a function.

Once you can code for the AVR in straight C++ you can translate that into programming for basically any MCU.
neogenesis2004 is offline  
Old 09-20-2010, 09:26 AM
  #16  
Junior Member
 
bloodline's Avatar
 
Join Date: Sep 2010
Location: London, England
Posts: 91
Total Cats: 0
Default

Originally Posted by ctxspy
Disclaimer: I know next to nothing about this stuff.

Anyone ever think about using an Arduino as an ECU?
http://arduino.cc/en/Main/ArduinoBoardMega

The Mega is coincidental, has nothing to do with megasquirt ( i think ).

Some potential benefits to using this as a platform to build onto:
  • not patent encumbered
  • very cheap
  • huge user community
  • many extensions "shields" as they call them
  • several built in serial ports
  • easy to program & extend

Now feel free to tell me why this won't work

Hi there, I'm currently working on using a Arduino - "Duemilanove" as a custom ECU.

let me know if you want to share ideas! Software is my area, so the hardware side is quite a learning curve!
bloodline is offline  
Old 09-20-2010, 12:24 PM
  #17  
Elite Member
 
JasonC SBB's Avatar
 
Join Date: Jul 2005
Posts: 6,420
Total Cats: 84
Default

I have an AEM ECU running in "parallel mode". My NB factory ECU is doing idle, emissions, etc. I recently installed a 12 tooth Trackspeed trigger wheel for better ignition accuracy.

I have a Dueminalove for generating an NB crank signal, and the AFM signal it expects. I agree with what neogen and Joe wrote above....

If you want to dabble in what it takes to write ECU code, go browse diyefi.com.
JasonC SBB is offline  
Old 09-20-2010, 05:00 PM
  #18  
Newb
 
flyrdm's Avatar
 
Join Date: Sep 2010
Location: LA
Posts: 4
Total Cats: 0
Default Arduino ECU hardware shield prototypes

I have had an "very alpha" Arduino Mega ECU shield designed and have two prototypes. I started to test basic functionality of sensors, VR decoding etc, but I haven't progressed very far from that due to work getting in the way. I will post all the Eagle files and pics of prototype h/w to start discussion if anyone wants me to.
flyrdm is offline  
Old 09-21-2010, 11:34 AM
  #19  
Junior Member
 
bloodline's Avatar
 
Join Date: Sep 2010
Location: London, England
Posts: 91
Total Cats: 0
Default

I have been reading ECU theory and the software seems pretty straightforward. My hope would be to make a direct drop in replacement for the existing ECU for my '91 Miata.

The AVR328 is a lot more powerful and has a lot more memory than the existing 6800 based ECU. The AVR is a very strong math performer and also includes a hardware multiplier so with it we can be less reliant upon precomputed tables (which the existing unit uses almost exclusively).

I decided to use the Arduino "Duemilanove", as it offers 6 Analogue inputs and 14 Digital I/O (6 of which have been set up for PWM), this seems to be enough to monitor and control the Miata engine. It also has a built in USB transceiver, which allows for simple debuging and also direct control of the board while in use via any laptop with a terminal (I use a custom AT command set to control the board).

My first port of call, is to use the Arduino as a data capture device, as I need to know what the existing ECU is seeing from the Engine, and consequently what signals it sends back and when. Has anyone already tried this? I can't seem to find any Miata ECU data captures.

Also, looking at the engine diagram, it looks like my version of the ECU doesn't control the ignition timing (the ignitors seem to handle that themselves), is that right?

Many thanks for your help!
bloodline is offline  
Old 09-21-2010, 05:15 PM
  #20  
Junior Member
 
rb26dett's Avatar
 
Join Date: Feb 2007
Location: 11368 miles from where i would like to be
Posts: 269
Total Cats: 92
Default

You need to think about IO and accuracy of IO. IE, you need to think about timers, in particular, hardware timers! Without massive CPU speed, these are critical in getting accurate RPM/Position inputs and accurate ignition angle outputs and fuel pulsewidths. Without those things, you may as well have MegaSquirt 1 :-p
rb26dett is offline  


Quick Reply: Arduino as ECU?



All times are GMT -4. The time now is 12:16 PM.