Open Source DIY Electronic Ignition

Do you have all the header and library files for the Arduino? I plan to keeping to that format... just makes development so much easier...
 
Also... not sure the ATtiny has the required number of pins for what I eventually have in mind... Might need one micro for each cylinder? Does the 85 support an external clock?
 
It's very compact. 8 pin dip package, 6 I/O & calibrated int RC. I found the internal oscillator pretty accurate. But no ext osc. I am only planning one input & one output. A trigger for position (can use for rpm, acceleration & timing) and a fire for the coil.

http://www.atmel.com/devices/ATTINY85.aspx?tab=parameters
 
Hmmm... might able to just squeeze it all in there, then. I'm supposing that the chip can run at 16Mhz internally?
 
Depends on the prescale you use. Here is a clip of my code using BASCOM-AVR editor:
http://www.mcselec.com/?option=com_content&task=view&id=14&Itemid=41

' ########### MAIN ############################################################

Main:


Config Timer0 = , Prescale = 8
'1/8/64/256/1024, 1 == 0.125us, >>8==1us, 64==8us, 256==32us, 1024==128us
On Timer0 Tmr0_isr
Enable Timer0

On Int0 Eint0_isr
Enable Interrupts

Config Adc = Free , Prescaler = Auto , Reference = Avcc
Enable Adc


Do

Call Calculate_delay

If Rpm_period < Dead Then
If Rpm_period >= Redline Then
Call Set_advance
End If
End If


Loop

End

' _____________________________________________________________________________



' ########### TMR0_ISR ########################################################
' ### clock F = 8mhz,
' ### Divide clock by prescale.
' ### timer clock F / pf. main loop P = 1/F.
' ### Interrupts every 255 (overflow) loops OR
' ### 1 == 32us, >>8 == 255us, 64 == 2 ms, 256 == 8 ms, 1024 == 32ms

Tmr0_isr:

Incr Loop_timer
Incr Delay_timer


Return
' #######################################################################

If the prescale = 1, then it runs full speed at 8Mhz (this is the 10Mhz version). This should run up to the specified 10Mhz and ditto for the 20Mhz version. Why did you ask 16Mhz? Am I missing something? My code is at 8Mhz. Shouldn't I be able to set it to 10Mhz and ditto for the 20Mhz version?

On this code, the prescaler is at 8. So, the loop time for one iteration of the code is 1uSec and the interrupt from overflow happens at 255 loops or 255uS. If I set it to 1, then the timing is .125uS and 32uS respectively.

My external interrupt routine looks like this for the trigger input:
' ########### Eint0_isr ########################################################
' ### External interrupt. PD2 input. Rising edges only

Eint0_isr:

Stop Timer0
Start Timer0
'reset timer at every external interrupt

Rpm_period = Loop_timer
Loop_timer = 0
Delay_timer = 0



Return


You can see I set the interrupt registers to see only rising edges. This is so I measure the period only, disregarding the falling edges.
 
I've got mine set to rising edge only, as well. Same reason.

I asked about the clock speed because of the number of MIPS needed to get everything working well. I found at 8Mhz I was getting a bit of drift in the simulator. Starting at around 9000 RPM, the timing would start to retard due to the processing cycles needed to arrive at the correct calculated delays. That was with my old algorithm though, and may not apply to my new one (that uses mapping instead of calculations).
 
I was using MPLAB before I swapped over to Arduino. Now I'm using Atmel Studio for the code writing and Sketch for the upload.
 
I'll check into that. Right now, I use Bascom to edit & compile then studio just to flash. I hardly simulate. I just keep editing & trying until it works. I simulated at the beginning to understand what it was doing.
 
Any updates? Also, let me know if you need machining done, this might be a cool thing to stock once its done and tested
 
Pete is doing a bit of machining right now, but I definitely appreciate the offer, Sean. Thank you.

I got the ICs I need to actually drive the coils and I'm writing up a new bit of test code in order to see if they work out OK. I'll hopefully have something to report before the weekend is out.
 
I am tired of waiting for Pamco Pete to get us an ignition....Hope this one works ... Knowing you, I know it will....

I need to get rid of the points.
 
eyhonda is partnering with me on this one. He's a professional EE, so things are looking good.
 
Not to sidetrack or anything, but I'm wanting to use GM LS2 coils, so I'm thinking I can just drive them from the Arduino?
 
Possibly. I'm assuming they're a coil pack setup? One coil per plug?

You'll need to find out of they are setup to run on 12V or 5V. You can't drive 12V directly from the Arduino, but 5V will be OK. If I were to wager, I'd say they were 12V, but I haven't looked up the specs.
 
I'm running coil on plug now...
The LS coils are near plug coils, built in igniter, triggered by 5 volts. falling edge if I remember correctly.
 
I only just found this, wish you'd sent me link few weeks ago ;D
I found 3/16x1/16" magnets are not powerful enough to trigger hall sensor unless they are no more than 0.020" above face. I also found south pole instead of north triggering doesn't work so well ::)
I've now got 1/4"x1/8" neodymium magnets, they will trigger up to 3/16" away from sensor.
I've thought of a new way to make rotors, multi piece so they are
a. cheaper
b. easier to make and shim to best position

So far I've made a very basic set up using a 2" rotor and single magnet but I think 2-1/8" ~ 2-1/4" may be better (but will require balancing) Going to use 2 GM 4 pin igniter modules and standard advance unit to make sure the triggering is reliable on bike
I managed to loose the 1/4" collet for trim cutter so I will only be able to test to 10,000 rom (20,000 crank rpm)
The other thing I may do is make a holder for magnet then use a 'cutter' wheel with Hall sensor (instead of 'flying' magnet)
 
Hey,

Just read through this post, awesome project.

A couple of things come to mind that may help you...
1) Using the ATMega avoid floating point calculations at all cost, if I remember correctly a floating point multiply takes about 100 clock cycles on an ATMega, compared to a regular multiply that takes about 4. This is off the top of my head so the numbers may be off, but you get the idea.

2) The ATMega is an 8bit micro, anytime you use a 16bit variable it takes about twice as many clock cycles to do the calculation. 32bit are going to be four times.

3) If you do your RPM calculations in base 2 (e.g new timing at 256 rpm intervals) you can exploit the CPU a bit and do even faster look ups. Assuming you have a table called DELAY your code to look up the delay would look something like this:
DELAY[RPM>>8]
The RPM>>8 bit is a right shift which essentially divides RPM by 256 (2^8 = 256), on most micros a right shift takes a single operation (at least 2 in this case, but I don't recall exactly). This may even be optimized by the compiler to be 0 operations since it is actually using the high byte of a two byte variable but that's purely nerdy musings...
This would remove all of your index calculations, dropping a few calculations off of each loop.

Hopefully all of that makes sense, It certainly does in my head lol

Cheers
 
Back
Top Bottom