Arduino as CDI (Ignition system) unit?

Hello everyone.

I'm new here, to this awesome forum, and I wanted to ask for your opinions. I recently bought a scooter and I was thinking about the feasibility of using Arduino (I have almost unused duemilanove) as a CDI unit (Capacitor Discharge Ignition system controller). Projects like Scooterputer and Speedoino have given me ideas for dashboards for a scooter. And GPS GSM locator if the scooter is stolen.
Then I thought, why not go all the way and have the Arduino control everything; the dashboard, speedometer, engine ignition, rev counter, temp gauge, fuel gauge, lights and even the turn signals? It could even be set up to measure the rear wheel speed and limit the top speed (all the time or maybe when a switch is thrown or if I would use, let's say, RFID card instead of keys, it would limit speeds differently depending on what card is used).

The Arduino CDI would have to read the signal from the Hall effect sensor, next to the flywheel, to measure the just before Top Dead Center (TDC) of the piston. It would have to charge a capacitor and then discharge that capacitor, probably through some FETs, through a step up transformer (better known as ignition coil) causing the spark plug to fire. It would be good if it would advance the timing of the engine when the engine is turning faster. Maybe by calculating or measuring the time between the TDC.

My concerns are mostly if the Arduino is fast enough and can it multitask enough to be a CDI unit and have a graphical display and maybe do more.

EDIT.
Working attempt with code. https://github.com/jbaum81/Arduino-electronic-ignition/blob/master/newignition.pde

I suppose you could do all of that, but bear in mind that the Arduino-based solution for running the dashboard, lights etc will be considerably more complex and less reliable that the existing plain old hard-wired version. The fact that you could doesn't mean that you should.

I like ambitious newbies! :slight_smile:

andsetinn:
My concerns are mostly if the Arduino is fast enough and can it multitask enough to be a CDI unit and have a graphical display and maybe do more.

Most, if not all, of what you want to do seems possible with a duemilanove, though almost certainly it would be easier with a Mega board (and if go that route you might want to look at some Mega variants, like the Mega ADK if you have an Android device). Just don't get discourged if you have to go back to the drawing board a few times, this isn't going to be a project you can expect to complete over a weekend or two. Overall, you'll want to divide up the project into sub-systems and try to get one sub-system working fairly well before moving on to the next.

As far as processing power concerns, doing everything but the graphical display shouldn't overly tax microprocessor but none of the Arduino boards are capable of any true graphics processing. However, the good news is there are sheilds/display modules available with dedicated graphics processors and serial communication (e.g. like this shield from Adafruit or this one from 4D), so all the actual graphics processing can be off loaded to an IC designed to handle it. The not so good news is that they will usually be at least a few times the cost of just the screens.

Thank you Peter and Far-seeker.

I do realize that it will be much more expensive and time consuming to build my own system than buying ready made (why do you think I have almost unused duvemilanove lying around :blush:). I was also thinking that it might be wiser to use separate Arduino for the CDI and other for the display. It would be interesting if the engine died, because of software error, each time I used the horn. :slight_smile:

My idea was to replace the dashboard completely with a small monitor (I happen to have one almost unused 7 inch (with a touchscreen) lying around :blush:) and have the same Arduino also drive the engine, but I realize it will take months of testing and designing before anything close to a optimum (or should I say working) solution is found.

andsetinn:
I was also thinking that it might be wiser to use separate Arduino for the CDI and other for the display. It would be interesting if the engine died, because of software error, each time I used the horn. :slight_smile:

I was just going to reply and encourage that -- not because of the horn so much but rather that mixing serial communication activities with time critical ignition timing activities can make things quite a bit messier.

There have been a few other projects I've seen where an Arduino driven ignition (and EFI) was created. You appear to be on the right track but from what I've read you will need accuracy in timing the flywheel speed if you want to do spark advance. You need a sensor that will provide you with a point of reference for the crankshaft position (i.e. the flywheel magnet) and a second sensor reading multiple points around the flywheel (e.g. the teeth on the gear) for accurate RPM measurement. You might also be able to chop/condition the alternator output for that purpose... or at least that's where I'd start.

1 Like

Here are plans for an MSCDI that http://www.not2fast.com/ignition/cap-dis-ignit-cdi.pdf just make sure to set up the input side correctly to take the input from an arduino. You might look at this one also as it is probably better suited to your use. http://www.docstoc.com/docs/122474315/Make-your-CDI

Thank you for the links Nic579, just what I was looking for.

Thank you for the advice Chagrin. My idea was to use the flywheel sensor that the original CDI uses. Then I would measure the time between pulses and the shorter the time, the more advanced the timing would be. The advance would be in steps, maybe starting at 1 millisecond at 3-4000 rpm and advancing one or two milliseconds for each 1000 rpm.

As I wrote earlier this will be more expensive solution than just buying original, or even aftermarket, CDI unit. If this is even possible. But having a whole electronic control unit with tracking possibilities is tempting. Just imagine, if your scooter is stolen, to be able to have the dashboard display the message "This scooter is stolen, I know where you are, the Police are on their way.". :slight_smile:

Also an Arduino newbie, I've been thinking along similar lines. I've just started designing a system which would use an electric motor, purely as a proof of concept. I was planning to do a very basic job using a small clock dial attached to the motor shaft to use as an encoder (being a tightwad I don't want to spend too much money until I know if it's practical). Using the minute marks I figured that a small slot (out with the Dremel) every half a minute to interrupt a light beam would be good if coupled to a digital counter. Refreshed every 500mS, this should give a count of 6000 for every 6000 RPM.

A single hole allowing interruption of a second light beam could be used to simulate bottom dead centre (BDC). Using that as a trigger it should be possible to keep track of RPM, and adjust timing to advance or retard ignition. With 120 slots per revolution you would be able to count the pulses and advance or retard in steps of 3 degrees. Starting at BDC a count of 60 pulses would be 180 degrees or top dead centre (TDC). 50 pulses would be 30 degrees before TDC 55 pulses 15 degrees before TDC etc. Assuming the system works properly at this point it would be time to consider a more accurate shaft encoder.

If I haven't done something totally stupid this should work as a proof of concept, with output pins being used to turn on LEDs to simulate triggering the spark, and also controlling fuel injection at the appropriate pint in the cycle if required.

I'm sure that If I've got something wrong someone out there will let me know. Polite suggestions, corrections and or criticism would be welcome.

More useful, I would imagine, than a message letting the thief know such a system is on board, would be a hidden system with GSM/SMS connection that silently texted you if the vehicle was being tampered with or stolen. Add a small camera (mobile phone type resolution) hidden in the dash and it could send you a photo of the thief as well as the location being trackable.

Good ideas Bill.
Especially the test idea, using electric motor for testing ignition advance or retard. I have an Radio Control car motor with variable speed Electronic Speed Control unit that I would use to vary the speed. I would attach a paper-disk (with lines from the center to the edge and a hole or dot for sensing) to the end of the RC motor shaft, have sensor and the LED point to the disk and see how the LED would light the lines when the speed varies. This would also test if the Arduino has steady enough Constant Latency, meaning if it always fires the LED at the same exact point of rotation. If the lines appear fuzzy under the LED (in the dark) the Arduino isn't accurate enough.

My theft protection idea was, similar to the ScooterPuter project, being able to send an SMS, or call, to the GSM unit in the scooter and have it send the GPS position back.

The author of ScooterPuter is planning on updating the webpage, around the middle of September, with the latest updates of his project.

andsetinn:
EDIT.
Working attempt with code. https://github.com/jbaum81/Arduino-electronic-ignition/blob/master/newignition.pde

My code Lives!!!! Wooohooo

On a side note, Try to use a cam angle sensor instead of crank, will be easier to determine what stroke your on so your not firing on the exhaust stroke too.

So you are wiring the hall effect sensor in direct? What is between the output of the Arduino and the coil?

I am just as interested as everyone else.

I want to make a programable CDI, and I found maybe some interesting info

Did you knew about this site yet?

limit the top speed

.... of a scooter?

JimboZA:

limit the top speed

.... of a scooter?

We should avoid off topic the thread. In my country we do have to limit top speed of Scooters in order to comply with the anual (or bi-anual) inspection. Max speed in speed for a >50cm3 is 45 kmph. This is a secondary feature that is important to me too.

We should avoid off topic the thread.

You're absolutely right, but on the other hand it's sometimes good to see the lighter side. Chill.....

In case you are interested and still working on this project, I have a fully working Arduino ECU for a single cylinder engine, would probably be suitable for a scooter.

There's lots of details, videos and links to code here: http://scottsnowden.co.uk/?cat=34

1 Like

Thanks Gadgit, I like your projects :).
Thanks Darbiter for the link.
Aftershock, I would've put a big FET between the Arduino output and the coil.
JumboZA, in many countries in Europe, speed of 50 cc scooters is limited because they are used by very young people. Youngsters can usually get license to drive a scooter couple of years before they get license to drive a car. Severally restricting those scooters gives them change to judge traffic without going dangerously fast. The police often does spot checks, plus the annual inspection, to see if the restrictions have been removed. Hidden switch, to limit speed, would allow you to get the most out of the scooter while still passing inspection. Removing the restriction is in my opinion not really dangerous because 50 cc scooter will never be a speed demon, no matter what you do. I also think that 3-6 months is enough to learn to drive a scooter so why restrict it for the rest of the time.

I have sold my scooter and don't have finances to replace it for at least a year so my project is on hold, my job is also uncertain at the moment.

I am still on it. I will apreciate any info or help you could gave me.

I will also be following this closely as im thinking about doing the same things (both a new cdi, and instruments, although i was planning to use a w8 smartphone as a graphical interface) for my '81 bicilindrical motorcycle. I am a complete beginner to arduino and electronics, but as soon as my kit arrives and ive tinkered around, ill float the idea around my motorcycle's forum (specific for the model) since its full of tech and modding enthusiasts.

You might want to look up "Zip Sp" video's and reconsider the speed demon remark :d. Sorry for ot.

Good morning,
I stumbled upon your project in the way that people do.

I was wondering with regards to the cdi project if you ever got your cdi unit running?

Regards
Dafyddclaud.