Board logo

Rasperry Pi vs Megajolt
mikeb - 21/3/12 at 11:00 AM

I'm not aware of anyone making one into a cheap ignition controller... yet
Just wondered how they can make the Pi for £25 with a lot more functionality than we get for £200 megajolt.
I know some of it is down to large volumes but I doubt the pi will sell that many once hte hype has died down.

I'm not a electrical person, but would there be a way to conver the pi for use as a cheap ignition controller? I guessing any system that has to load a OS isn't going to be suitable.

[Edited on 21/3/12 by mikeb]


blakep82 - 21/3/12 at 11:40 AM

raspberry pi was developed for teaching kids computer programming in schools and colleges, so is probably sold at almost cost plus £1 or £2 for profits, where megajolt is a business, and their proifit margins are probably much higher, and probably much less demand than the the raspberry pi will get, at least initially anyway.
once all the schools and colleges have them, prices will probably creep up a bit


matt_gsxr - 21/3/12 at 11:41 AM

Pi does seem to fit the revised national curriculum on IT so I suspect it might actually make it.

Pricing comes down to units shipped. If you ship a lot then the raw components also get cheaper.

Compare the cost of a mobile phone (GPS, screen, phone, wifi, memory, shiny case, battery, all ~£100) and a Megajolt.


FuryRebuild - 21/3/12 at 11:57 AM

There are other aspects to this as well.

it's all in the software - for most projects the price is by far and away the cost of the software: researching it, writing it, testing it, and then field testing it. This is real-time control software with aspects of closed-loop control as well, which requires a special set of skills, and a lot of run-of-the-mill software developers can't get their heads around it, or don't go there because the money's not there.

When you also factor in the fact that there's a lot of custom interfacing hardware involved as well (driving outputs at a certain level, isolating inputs so it doesn't go up in smoke when it's not wired correctly), finding out that it needs a separate supply to the battery than the coils because a dirty power signal causes it havoc, etc. then you can see where the money goes.

Then it has to be made rugged - cars are an awful environment for electronics.

I don't deny the Pi is a great little device, as are the arduino microcontrollers, and as is the megajolt. I think once you took the PI to the place the megajolt is, the costs would be similar. However, the advantage is that the pi (IIRC) is a linux machine, so there's lots of scope to extend it fairly painlessly.

when you look at the fact that a fully ready-to-go megaquirt only costs £400, I think it's a bargain.


RK - 21/3/12 at 12:03 PM

one day, we'll be programming our cars with our phones.


mikeb - 21/3/12 at 12:12 PM

What about labour costs to build the units.
Assuming the pi is built somewhere cheap. where as megajolt is Uk cottage industry.
I thought megajolt was based on shareware so is any software cost actually included in the price?

I build a megajolt from bits for £85 only 3 years ago but sold it when I sold up my first build.
My only option now seems to be a £200 pre built unit from trigger wheels.
Why did they stop the supply of the cheap self build option? it seems to have moved on from its initial business concept of self built units which is a shame.


David Jenkins - 21/3/12 at 12:22 PM

Megajolt is a commercial product from the USA - Autosport Labs. I don't believe any part of that is open-source.

You're not confusing MJ with Megasquirt (the fuel injection system) are you? That certainly does have open-source stuff in it.


MikeRJ - 21/3/12 at 12:29 PM

quote:
Originally posted by David Jenkins
Megajolt is a commercial product from the USA - Autosport Labs. I don't believe any part of that is open-source.

You're not confusing MJ with Megasquirt (the fuel injection system) are you? That certainly does have open-source stuff in it.


The EDIS based Megajolt up to V3 is open source; the hardware design, firmware source code and interface API are all published. The V4 doesn't seem to have source code available yet.


mikeb - 21/3/12 at 12:34 PM

not really sure, at one point I thought megajolt and megasquirt were from the same place., but all seems to have moved on in the past couple of years.
My point was I'm looking for a cheap ignition controller, have settled for the fact I'm going to have to pay £200 from trigger wheels, but thought it made an interesting comparison that the Pi is £25 for something with very different spec processors memory etc.

[Edited on 21/3/12 by mikeb]


MikeRJ - 21/3/12 at 12:39 PM

quote:
Originally posted by mikeb
I'm not a electrical person, but would there be a way to conver the pi for use as a cheap ignition controller? I guessing any system that has to load a OS isn't going to be suitable.


Rasberry Pi could potentially be used as an ignition controller, though I don't know what timer resources the Broadcom CPU has. However, even one of the embedded Linux versions is not really a suitable basis for the very hard real-time demands that an ignition controller demands. You might be able to use the Pi without Linux (i.e. a "bare metal" approach), though it would be an uphill struggle as Broadcom are notorious for withholding the kind of datasheets you would need to do this. Ultimately it would not be worth the effort.

A modern 8/16 or even 32 bit micro controller with plenty of timer resources would be a better platform for this. You can buy a basic STM32 development board for around £10 which gives you a 32 bit ARM Cortex based micro with loads of timers, UARTS, USB and numerous other peripherals. There are also free development tools available, either "lite" versions of commercial tools or properly free GCC based tools.

quote:
Originally posted by mikeb
not really sure, at one point I thought megajolt and megasquirt were from the same place., but all seems to have moved on in the past couple of years.
My point was I'm looking for a cheap ignition controller, have settled for the fact I'm going to have to pay £200 from trigger wheels, but thought it made an interesting comparison that the Pi is £25 for something with very different spec processors memory etc.



Megajolt and Megasquirt are two entirely separate projects, developed by separate people.

Don't forget that the microcontroller is a relatively small aspect of an ignition controller. You still need to provide all the signal conditioning for variable reluctance or hall based sensors, some form of load sensing (e.g. vacuum) and the coil drivers.

[Edited on 21/3/12 by MikeRJ]


hughpinder - 21/3/12 at 12:40 PM

The Pi has no inputs/outputs (eg for crank position, to drive the spark etc) so can't be used. As said before the cost is the design/ancillary circuits, cases , warranty, advetising, marketing, low production count etc, not the hardware.
If you are really interested in some real time control, look at PIC18/24 microcontrollers (about £1 to 10 for the chip)
If you follow this link
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2846
You'll see a range of the sorts of things you can do with these controllers. There are free to download development environments and compilers etc there. The real cost/skill is not connecting up the chip and writing the code, but designing the peripheral drivers to send the pulse to the coil while not giving RF pulses etc etc..... There are real examples of circuits and code on the microchip site. If you get into it, you could certainly do spark control, gear indicators, displays, light controllers, security systems etc with this sort of kit. I use one to control my heating system!

Regards
Hugh


dhutch - 21/3/12 at 12:42 PM

I found a secondhand but unused megajolt the owner kept as a spare, with hard cut limiter, which I bought for £80 and then bought the rest from scrapyards and a £15 trigger wheel of the bay.

In hinds sight i got a good price, that was two years ago, as you say, much more than that new now.


Daniel


mikeb - 21/3/12 at 12:44 PM

Not really my bag to develop one.
Shame someone hasn't developed a replacement built it your self version around one of these £10 boards.


MikeRJ - 21/3/12 at 12:44 PM

quote:
Originally posted by hughpinder
The Pi has no inputs/outputs (eg for crank position, to drive the spark etc) so can't be used.


Yes it does. They are made available on a GPIO connector and include a handfull of digital IO pins, an SPI bus, an I2C bus and a UART.


coyoteboy - 21/3/12 at 12:49 PM

Pi does have general purpose IO and there's an interface board to deal with it too but as said it's linux based and so the hard real-time functionality of the core processor is going to be harder to access. I've got one on order and will be attempting to see if I can get RTAI onto it, if it can it's a pretty good fun project but it's simply not designed to do that job, end of story. The raw processing power required to run a car is pretty minimal, ignition timing only is even simpler, you could do it with about £15 of components, it's just the packaging and software devel that takes a bit of time. In reality the cost of the megasquirt parts don't even come close to the price of a kit (though the PCB is a hefty chunk of the cost), it's the time and effort people put in to develop code to do every possible engine etc that you're paying for.

[Edited on 21/3/12 by coyoteboy]


mikeb - 21/3/12 at 12:49 PM

quote:
Originally posted by hughpinder
The Pi has no inputs/outputs (eg for crank position, to drive the spark etc) so can't be used. As said before the cost is the design/ancillary circuits, cases , warranty, advetising, marketing, low production count etc, not the hardware.

Regards
Hugh


I get all this but thought the orignal megajolt/megasquirt wasn't a proper commercial venture and was more open source orientated, from recollection the orginal design was a uni project etc so a lot of those factors don't count other than the low production cost.
I guess the increase in price is due to it now being a proper commercial venture.


coyoteboy - 21/3/12 at 12:53 PM

TBH I'd quite happily fire up an open-hardware venture to work alongside megasquirt - I've found the massive recent increase in costs of the MS3 with all additional driver bits a bit staggering (putting it up there with other "proper" manufacturers, or at least out of the reach of the starter folk). I've got a specific use for the product and it lends itself to open-source solution. Not sure I really have the time though, to be fair.


hughpinder - 21/3/12 at 01:09 PM

Oooh I didn't realise the PI was going to have an IO system, sorry for that misinformation - I will have to have a look at one in more detail. I suppose the io from a megasquirt/jolt for temperature/pressure/trigger input/condtioning and spark output could be fairly easily pinched and used on a PIC. The code to for a PIC to use that information wouldnt be too hard.

Regards
Hugh


mcerd1 - 21/3/12 at 01:18 PM

quote:
Originally posted by mikeb
My point was I'm looking for a cheap ignition controller, have settled for the fact I'm going to have to pay £200 from trigger wheels...

I'm not sure which one your looking at on the trigger wheels site, but as far as I can see your looking at £129.99 +P&P for the TPS version of the ECU itself:
http://www.trigger-wheels.com/store/contents/en-uk/d59.html

if you start buying all the other bits and bobs from them instead of doing the leg work yourself (scrapyards etc..) then that'll cost you a fair bit extra....


or get it from the states direct for $151.90 + $37p&p (approx. £119.20) thats the TPS version with no hard revlimiter
http://www.autosportlabs.com/megajolte-p-41.html

still more than your £85 DIY kit, but not £200!





Re: DIY MJ kits
there are a number of resons why they stopped selling them as DIY kits (discussed at length on the autosports lab forum), but mostly because they upgraded to more modern surface mount components that alot of folk had problems building at home


they deleted the link to the V4 assembly guide, but its still there if you know where to look
http://www.autosportlabs.net/MJLJ_V4_kit_assembly_guide

compare that to the old V3 one:
http://www.autosportlabs.net/MJLJ_V3_kit_assembly_guide


if you've got the time there is vast amounts of information on the autosports site along with lots of discussion about the development of the products

[Edited on 21/3/2012 by mcerd1]


coyoteboy - 21/3/12 at 01:22 PM

The interface circuitry is pretty simple and would port across pretty much pin for pin, the biggest issue really is the code. The code to cover so many variations in sensor arrangements takes a lot of devel time and testing. Also the processor used by MS (particularly the MS3, multi-core, CAN enabled etc) is really quite nice - im sure microchip have an equiv but I've not hunted. We were looking at using the same processor as the MS3 and just writing our own code and throwing in some RF telemetry and electronic shift control and a few other bits and bobs into one case but alas the usual lack of time forces a re-think because B&G don't want the software running on non-B&G hardware and won't release the bootloader/monitor code.

[Edited on 21/3/12 by coyoteboy]


mad4x4 - 21/3/12 at 01:39 PM

someone above mentioned PIC what about Arduino - Onboard I/O can get a Nokia LCD screen with Joystick for £10 Software (c++) free.....

http://www.arduino.cc/

From £16 Quid for the CPU

------------->Basic Board
------------->LCD Screen

Currently Trying to Write a MicroDash for my landrover ( Speed/ Water Temp/ Oil Temp / Oil Press.

[Edited on 21/303/12 by mad4x4]


coyoteboy - 21/3/12 at 07:06 PM

Again the 'duino is a crippled processor. Cracking for learning and can do some neat stuff, but I'm not sure it's fast enough in it's standard form to operate as an ignition controller - you really need microsecond reliable control or you scrap your £1000 engine for a saving of £100. And learning C and programming a PIC isn't much different to arduino, maybe an extra nights learning and a few tutorials. Unless you want to write it in assembly, in which case you need about an extra months learning and you'll still get yourself tied in knots but it'll be the fastest damn ignition controller And ultimately the complexity of a project like this doesn't come from the actual unit itself, it comes from the tuning software. From my own position (diddle with embedded stuff all the time) making a GUI for a windows based system is remarkably hard. Not sure if I'm just retarded in that respect, but I can code most stuff but I struggle with GUI concepts

[Edited on 21/3/12 by coyoteboy]


mikeb - 21/3/12 at 07:56 PM

£1000 engine , not in my car fella, it came with the donor pack so arguably about £50. So a saving of £100 is good!
Dont forget you can build a whole car for £250 quid
Again I thought all the megajolt tuning stuff was open source stuff, so I'm still not getting why the megajolt is now £200 when you could buy it as a bag of bits for £85. They changed the design to surface mount then stop selling the DIY kits.


MikeRJ - 21/3/12 at 07:57 PM

quote:
Originally posted by coyoteboy
Again the 'duino is a crippled processor.



It's hardly crippled, it kicks the arse of many 8 bit microcontrollers.

quote:
Originally posted by coyoteboy
Cracking for learning and can do some neat stuff, but I'm not sure it's fast enough in it's standard form to operate as an ignition controller - you really need microsecond reliable control or you scrap your £1000 engine for a saving of £100.



I'm certain it would be fast enough - it's faster than the equivalent 18F PIC's in most situations (don't forget most instructions complete in 1 clock cycle compared to 4 on the PIC).

The main problem with the standard Arduino (Atmega168/328 based) for this application is that it has only one 16 bit timer with compare/capture which isn't ideal, but probably workable. The Arduino Mega uses the Atmega1280/2560 which is a newer and better version of the micro used in VEMS and the short lived MS AVR project. In VEMS this micro runs at the exact same clock rate as it does in the Arduino (16MHz) so you could implement a full engine controller on that.

quote:
Originally posted by coyoteboy
And learning C and programming a PIC isn't much different to arduino, maybe an extra nights learning and a few tutorials.



The Arduino is already programmed in C and/or C++, it just has a few subtle differences, like splitting up main() into an initialisation function and an endless loop function. It's trivial to revert back to full ANSI C however, it uses the same compiler underneath (GCC). Unless you are going straight to the 24F or 33F PIC's there's no significant advantages over the 8 bit Atmel parts, in the same way that if you are familiar with the 8bit PIC's there's probably not much incentive to move to the Atmel parts.

Personally I'm quite enamoured with the modern ARM Cortex devices - for the price of an 18F PIC you get a 72MHz 32 bit powerhouse, and debugging on them is a dream compared to the old 8 bitters. Even better the Cortex core is used by numerous vendors, so if you want to move to another part it's really only the peripheral differences you have to worry about.


quote:
Originally posted by coyoteboy
From my own position (diddle with embedded stuff all the time) making a GUI for a windows based system is remarkably hard. Not sure if I'm just retarded in that respect, but I can code most stuff but I struggle with GUI concepts



Me too. I can make functional GUI's, but I struggle to make them pretty as I just don't have that artistic flair.


paulf - 21/3/12 at 11:24 PM

I used to build a lot of megajolts and sold them for about £75 towards the end of the earlier V3.0 units, I did build a couple of the surface mount V4 units as they were sold as kits when first introduced but then with drawn from sale as kits.The surface mount version does not really have any advantages over the earlier versions apart from it is not as easy to build at home and was a good reason to stop supplying kits, the software etc had no real advantages over the last V3.0 model.
The original processor became unavailable in a 16 pin DIL version but was still available in SOIC package and there were a couple of other options last time I looked, I considered designing a cut down version but with Edis units becoming rarer in the scrapyards never bothered, as I thought the way forward was to build a self contained controller but have never got around to it yet.
It would be possible to use a cut down mega squirt with the ignition firmware and no fuel support but it may not work out that much cheaper than a fully functioning MS.
I have even thought about producing a basic Edis version that just has a preloaded zetec ignition map and no facility to modify it and no extra outputs, I could probably do these for less than £50 but don't know if there would be enough demand?
Paul

quote:
Originally posted by mikeb
£1000 engine , not in my car fella, it came with the donor pack so arguably about £50. So a saving of £100 is good!
Dont forget you can build a whole car for £250 quid
Again I thought all the megajolt tuning stuff was open source stuff, so I'm still not getting why the megajolt is now £200 when you could buy it as a bag of bits for £85. They changed the design to surface mount then stop selling the DIY kits.


mad4x4 - 22/3/12 at 08:54 AM

quote:
Originally posted by MikeRJ
quote:
Originally posted by coyoteboy
Again the 'duino is a crippled processor.



It's hardly crippled, it kicks the arse of many 8 bit microcontrollers.

quote:
Originally posted by coyoteboy
Cracking for learning and can do some neat stuff, but I'm not sure it's fast enough in it's standard form to operate as an ignition controller - you really need microsecond reliable control or you scrap your £1000 engine for a saving of £100.



I'm certain it would be fast enough - it's faster than the equivalent 18F PIC's in most situations (don't forget most instructions complete in 1 clock cycle compared to 4 on the PIC).

The main problem with the standard Arduino (Atmega168/328 based) for this application is that it has only one 16 bit timer with compare/capture which isn't ideal, but probably workable. The Arduino Mega uses the Atmega1280/2560 which is a newer and better version of the micro used in VEMS and the short lived MS AVR project. In VEMS this micro runs at the exact same clock rate as it does in the Arduino (16MHz) so you could implement a full engine controller on that.

quote:
Originally posted by coyoteboy
And learning C and programming a PIC isn't much different to arduino, maybe an extra nights learning and a few tutorials.



The Arduino is already programmed in C and/or C++, it just has a few subtle differences, like splitting up main() into an initialisation function and an endless loop function. It's trivial to revert back to full ANSI C however, it uses the same compiler underneath (GCC). Unless you are going straight to the 24F or 33F PIC's there's no significant advantages over the 8 bit Atmel parts, in the same way that if you are familiar with the 8bit PIC's there's probably not much incentive to move to the Atmel parts.

Personally I'm quite enamoured with the modern ARM Cortex devices - for the price of an 18F PIC you get a 72MHz 32 bit powerhouse, and debugging on them is a dream compared to the old 8 bitters. Even better the Cortex core is used by numerous vendors, so if you want to move to another part it's really only the peripheral differences you have to worry about.


quote:
Originally posted by coyoteboy
From my own position (diddle with embedded stuff all the time) making a GUI for a windows based system is remarkably hard. Not sure if I'm just retarded in that respect, but I can code most stuff but I struggle with GUI concepts



Me too. I can make functional GUI's, but I struggle to make them pretty as I just don't have that artistic flair.


Agree

another advantage is that the AVR support floating poitn maths where when I looked at PIC's some years ago you had to go round the houses and do allsorts of wierd crap to get it to do floating point.

Arduino is a PIC that is user friendly.


coyoteboy - 22/3/12 at 10:54 AM

My point was not that the processor was useless (or the line of processors), more that in it's form (as an arduino) it's limited and mainly useful as a learning tool. As I said, it can do plenty, but there's better options (i.e. different products and not used in the arduino platform) if you're going to start a project like this. Have you guys played with Freescale products? They've got some rather tasty items out at the moment.

[Edited on 22/3/12 by coyoteboy]


MikeRJ - 22/3/12 at 12:27 PM

quote:
Originally posted by coyoteboy
My point was not that the processor was useless (or the line of processors), more that in it's form (as an arduino) it's limited and mainly useful as a learning tool.


I see what you mean, though I wouldn't say they are limited only as a learning tool. I've used Arduinos (using standard C rather than the "processing" language) for prototyping simply because they are very inexpensive, and the "shield" concept works pretty well to create a robust prototype compared to a breadboard etc. You can now get Arduino clones using PIC and STM32 ARM Coretx micro's (and probably others) so there is a reasonable choice of target device. I would agree the form factor is ultimately rather limiting however.


dhutch - 22/3/12 at 01:03 PM

I was far to slow, and its now sold, but one has just gone up sale for £70 on wscc.

http://forum.wscc.co.uk/forum/index.php?/topic/93473-megajolt/page__fromsearch__1


Daniel


Slimy38 - 22/3/12 at 01:45 PM

I was trying to work out whether these prototype boards are actually fast enough. I see that there are references to clock cycles et al, but from what I know about processors clock cycles do not 100% relate to activity. Even from my early processor experiences (Z80!), you had to use a handful of clock cycles to handle a single assembler command, it must be even more to do the equivalent of a C command?

Looking at it from the other direction, how often would these devices have to sample the inputs with which to calculate whether the injectors are open or shut, and when to light the sparkplugs? I'm guessing it is down to the millisecond interval, if not quicker?

Using some (pretty rough) maths, a car at 7000 rpm and being capable of responding to a resolution of 1 degree on the crankshaft, the device would have to respond 42 times per millisecond? (7000*360/60/1000)

Am I talking nonsense?


coyoteboy - 22/3/12 at 02:01 PM

You're not wrong, and you must also add in the fact that most engine management systems work to decimals on the ignition timing these days. Plus, on top of all that, you want to knock sense which may involve some on-processor sampling and filtering. But none of that's outside the scope of a decent micro with a reasonable clock rate and good coding. The MS2 has more than enough timing capability and it's fairly old hardware these days. Slower processes like boost control, fueling calcs etc, are not run every n uS, they're run far less frequently and almost as a background process, with the *timing* of fuel and ignition taking the primary interrupt driven role for good accuracy.

MS1 runs an engine fairly well, even a highly strung fast engine, and it's only re-calculates ignition timing once per revolution, but it's accurate to ~1 degree based off that one calculation. Rapid transients see timing errors but theyr'e relatively small.

[Edited on 22/3/12 by coyoteboy]


Slimy38 - 22/3/12 at 02:42 PM

quote:
Originally posted by coyoteboy
with the *timing* of fuel and ignition taking the primary interrupt driven role for good accuracy.


That interrupt driven role, is that some sort of trigger wheel on the crank?


coyoteboy - 22/3/12 at 03:44 PM

Yeah, working from the MS code IIRC the teeth on the crank wheel are decoded by triggering an int and syncing when the between-tooth time is longer than 1.5x the last few times (assumes it's the missing tooth), then it calculates the nearest tooth to the desired ign angle and when it reaches it it uses timer-int to get the last few degrees accurate. MS1 uses the timer from one specific tooth per rotation, MS2 counts the teeth up to just before so as to get better accuracy on the timer (i.e. engine may be speeding up notably between tooth 1 and tooth 10 so timing error may be large if it's based on tooth 1+time)


MikeRJ - 22/3/12 at 07:43 PM

If you have sufficient timers with compare/capture, then the CPU speed requirements are significantly reduced, to the point you can run an engine in steady state with negligible CPU overhead.

The original megasquirt has a pretty awful software architecture where a very large interrupt service routine is run every 0.1ms to test whether to start or stop injectors etc. and even with it's relatively slow micro (much slower than an AVR @ 16MHz) it managed to do this ok.


coyoteboy - 22/3/12 at 11:47 PM

Have you checked out the MPC5676R for the opposite end of the spectrum to the MS1...

"The MPC5676R offers significant performance and enhanced powertrain functionality, such as eTPU2, on-chip knock control and the peripherals needed to meet extreme regulatory and environmental needs.
Features

Dual Power Architecture® 200z7 (32 bit) cores 2 x 180MHz
SPE1.1 / SIMD module for DSP and floating point operations
Core: Operating Frequency Max - Max (MHz) 184
Internal Flash (kByte) 6000
Total DMA Channels 128
Serial Interface - Type CAN, SPI, SCI
Timers - Number of Timers 3
Timers - Size (bit) 24
A/D Converter - Bits (bit) 12
A/D Converter - Channels 64


Shame the dev board and a processor is £700 and it's BGA