CDI-2012

Copyright 2012 Jake Stewart

Contact email: jakestew{at}mail{dot}com

License: This code is free for personal and limited commercial use. You may use and modify it as you see fit as long as you do not sell the code or any derivative work, or any product containing the above, without written permission. If you would like to use this in a commercial product please contact me for affordable licensing.

Unless you somehow consider your ignition curve and settings to be confidential secrets, please send me off a copy of the source, compiled hex, and spreadsheet whenever you find a good running/starting combination.  I'll collect these and make them available for people who want premade hex files or ignition curves.  I ask for the spreadsheet since the way I did the excel sheet I don't think it will be easy to paste the table from the source back into the spreadsheet.

Description: Timer1 is used to time the revolutions. Time base is the internal RC oscillator (8MHz). Timer1 compare mode is used to time the spark delay. Delay is loaded from the DegDelay[] table. Rev times larger than the table are calculated on the fly.


Joining the project: If you can help out please send me an email or join in the discussion at RCU.  We need electronics people to help with board/electronics design and putting schematics into Eagle, programmers to help work on the code, motor heads to help tell us what to do with the engines, writers to help with documentation, and webpage designers to help with the website (obviously).  Many people have put a lot of time into this project and it already works very well, but there are a lot of things left to be done before it's ready for the masses.


Credits... Special thanks to:

This project has been ongoing for at least the past several years. The vast majority of information on this project is contained in threads on rcgroups.com and rcuniverse.com. It's also the best place to ask questions and get help with the project.

Link to the new RCG discussion thread
Link to the OLD RCU discussion thread

Note: We switched from RCuniverse to RCgroups because of a number of server problems, image posting/uploading, and file posting problems there. RCgroups is a much better forum for us, and has a special forum dedicated to "DIY Electronics". Following the switch, a number of my posts were censored and/or deleted from RCuniverse, especially any mention of the switch or reasons for the switch. Personally, I will not tollerate censorship and heavy-handed moderation, and I suggest that you don't either. I'll try to occasionally check back there to avoid leaving anyone behind and point new people to the new thread location, but for the most part I'm boycotting RCuniverse.


Features...


Downloads...

Releases... (Use with the new spreadsheet versions below!)
CDI-2012_v1.0.zip  This file contains the Excel spreadsheet for generating the advance curves and project files for MPLAB X. The Excel sheet also contains the code for both 12F683 and 12F1840 processors.

CDI-2012_v1.0_B.xlsm  This is the Excel spreadsheet for Rob's (Gompy) version B timer board. Pull-ups are turned off for the switches and the polarities are reversed. Otherwise it's the same code. If you want the MPLAB project files and instructions download the above version and just remember to use this spreadsheet.

New Spreadsheet Versions!
A big thanks goes out to Ray Richter (Nav_Aids) for creating these versions!

Ray created these versions to fix a number of bugs in my spreadsheets. The v1.0 spreadsheets work great for me, running Excel 2007 on Windows XP SP3. However, it seems that several bugs crop up when using different Excel versions, and/or OS versions, and/or VB runtimes, and/or .Net framework versions. I have no way to test all these configurations, and I certainly can't fix all of Micro$oft's bugs, so Ray's mastery of VBA and Excel macros, and knowledge of the many version compatibility problems, have really helped the project. All future spreadsheets will be based off of these.

CDI-2012_v1.0-F1.1.xlsm  - This is the Excel spreadsheet for John's (gr8flyer55) timer board. Pull-ups are on for the switches and grounding the switch pin activates them.

CDI-2012_v1.0_B-F1.1.xlsm  - This is the Excel spreadsheet for Rob's (Gompy) version B timer board. Pull-ups are turned off for the switches and the polarities are reversed.

Important Note!!! The "kill switch" is just a handy feature. Do NOT rely on this as your only engine kill method! The current hardware may generate one spark on power up, and one spark on power down (even several minutes AFTER power down). ALWAYS have another method to kill the engine and NEVER allow any part of your body anywhere near the prop or engine without a reliable hardware/physical method of making sure the engine doesn't fire. If you don't have another switch, just pull the plug wire first!

I publish this open source software as an excercise of my right to free speech. Open source software is constitutionally protected free speech. I have NO liability for damages or injury resulting from how YOU decide to use this software!

There is no password on the file. All you have to do is go to...
- "Home -> Format -> UnProtect Sheet" to unprotect the sheet. You have to do this to each sheet you want to change.
- "Home -> Format -> Hide & Unhide -> Unhide Sheet" will let you unhide the hidden sheets.
- Ctrl-F1 will switch the ribbon between normal and auto-hide modes.
- Click "View -> Headings/Formula bar" to make headings and formula bar show back up.

Notice: This code works fine in the simulator, and will throw sparks when programmed on the chip in the actual circuit. John has even tested the code on a real engine. But, I take no responsibility for any damage caused. It is your responsibility to ensure that you are using proper settings for your engine and that you test the functioning of the CDI and program BEFORE you use it on an engine.

CDI-2012.zip This is the timer and HV board schematics.
These are preliminary schematics only! The board files are not included, as they don't exist yet.


The CDI in action! Special thanks to John for testing the program and making this video!


Getting Started with compiling for the PIC...
I've tried to make things as easy as possible, but it still takes a little doing to get your own custom CDI firmware up and running.  Unfortunately, I don't have any compiled versions that I actually know to work, so if you work out a good curve and settings please post it here or send it to me at my email.  Hopefully we can get prefab versions ready for the common engines out there.

#1.  Go to http://www.microchip.com/pagehandler/en-us/family/mplabx/#downloads 
#2.  Download the "MPLAB X IDE" and "MPLAB XC8 Compiler" for your operating system.
#3.  Install the IDE and compiler.  Default settings should be fine.
#4.  Open the IDE and...

-Select File->New Project
-Choose "Standalone Project", click next.
-Select Family -> Mid-Range 8-bit MCUs (PIC12/16/MCP)
-Select Device -> PIC12F683  Click next.
-Debug header does not matter, I usually select the one you can choose, now click next.
-Select "Simulator" under hardware tools, or choose the programming device you use. Click next.
-Select "XC8" under XC8, click next.
-Choose a project name and location.  I usually use a more convienient location than the default.  You might use "12F683_v0.9b" for the name.
-Check "Set as main project" and click next.
-Copy the source file "12F683_v0.9b.c" into your project directory.
-On the left hand side of the MPLAB X IDE screen right-click on "Source Files" under your project name and select "Add Existing Item".
-Select the source file "12F683_v0.9b.c" and hit OK.
-Double click the  12F683_v0.9b.c source file that now shows up.  This should bring up the source code.
-Select Run -> Build Main Project, from the menu.  Source should compile with no errors.
-Congrats!  You just compiled the code!  You know things are working, so any new errors are your own doing.

-Now edit the source file, adding your custom table and the settings you want.
-Use the included spreadsheet to make your advance table and help figure out the settings.
-Build the project again and the .hex file should be in [Project Directory]\dist\default\production
-Now you can program the .hex file into your processor via whatever method you prefer.
 
NOTE:  If you get an error like "JVM creation failed" when you try to launch MPLAB try the following steps...
1. Open "C:\Program Files\Microchip\MPLABX\mplab_ide\etc\mplab_ide.conf" in a text editor.
2. Change "-J-XX:MaxPermSize=384m" in that file to "-J-XX:MaxPermSize=128m", or delete that option alltogether. 

I realize this is a lot of downloading and hassle if you're not into this sort of thing, so I'm happy to compile for people if you email me exactly what you want compiled.  You can edit the source with just a text editor and send it to me and I'll do the work for you.