Author/Designer: Me
Project Description: K.I.T.T Replica???(Dont BOO me... just a start...) or something base on this idea using SK-40C + PIC 16F877A
Photo/Picture/Figure/Diagram/Flowchart: See Below
Compiler: PIC BASIC PRO
Source code: Upload later... just simple codes and still on the way to simplify them
Schematics & PCB Docs: See below pic... just a test circuit...
Hardware Drawing: Drawing??? no... got only photos...
This is My new (free time) project...
i had just learn to program microcontroller in my college by using Microcode studio... the codes are slightly different from c programming... as most of the sample codes i can get online and in cytron tutorial sites are c programming codes, i had to study to program using c language... this is far more complicated from the c++ i had studies before(but basic is the same)...
i had this idea to start this project after i had installed a new car alarm system with engine push start button into my car... yes... i install myself... the problem is my engine is modified and using custom ecu (MicroTech system)... this ecu does't have auto chock system that makes the engine very hard to be started especially on morning... i need to crank at least 3 to 4 sec to make the engine starts... the alarm set with push start will only crank for about 2.5 sec when i push the button and this makes me have to push again to start the engine... some times i had to push until three to four times to start the engine...
this is a basic function that solve the engine starting problem... as the microcontroller i used has many ports that i think on adding some features into it and also some bling bling effects(hahaha)...
there are many functions i plan to put into this project...
1. Crank the engine not base on the time set, but base on the sensor
this means that the microcontroller will act base on the RPM of the engine... the engine will stop cranking when the microcontroller sense the rpm
of the engine is more than 500rpm...
2. Auto engine recovery...
the system will crank the engine 1 sec after the engine dead when driving or at traffic light(the microcontroller senses 0rpm)... for manual
transmission car, a switch will be placed at the clutch pedal to make sure that the clutch is free before the engine is cranked...
3. Control the setting of the engine
i like the cruise mode of old KITT and also new KITT... i plan to make the microcontroller change the fuel map in my ecu(already set in ecu) and
also the boost controller setting... for "Normal Cruise", the microcontroller have to change the fuel map to economy one and set the boost
controller to abt 0.6bar... For "Attact Mode", the microcontroller have to set the fuel map to a more richer fuel map and set the electrioic boost
controller to 1bar... For "Attact Mode II" the microcintroller have to set the fuel map (actually is the same fuel map as 1 bar boost) and set the
elctronic boost controller to 1.2 bar...
4. K.I.T.T Sound and Light Effect...
For fun purpose, i think on to put the original K.I.T.T. sound effect such as the scanner sound and the kitt voice ... got saw the sound recorder
chip in cytron websites but haven't studied the datasheet yet...
5.??????
Will add when got ideas...
Below is the video of the beta version of my project:
this is the automatic start function once the engine start button was pressed... the system will delay the crank process 1 to 2 seconds and make the cranking time longer... the first tick-tok sound(relay ticking) is the original relay(alarm system) to crank the engine, but i revert it into the microcontroller as input to start the engine... the second tik-tok(relay ticking sound) is the 5v relay drive by the microcontroller to crank the engine... of course... microcontroller --> 5v relay --> 12v automotive relay (high current) --> starter...
this is the manual start function... the button on the pcb has to be pressed to crank the engine... the same button can be pressed to crank the engine once the engine died on the road...
this is the camera light off version in the dark with the kitt scanner light effect... tried to use software pwm and the result is slightly unsatisfied... will try another way to perform pwm for the light bar...
Some of the codes i copy from the samples get from my lecturer(most of the codes i had to figure out myself especially the pwm parts... my lecture says my method is abit wrong...hehe)... i had to modify the codes to suit the SK-40C especially the lcd ports... somepart still got the descriptions and i m lazy to delete them... lazy also that i always have to switch between Pic kit 2 and MicrocodeStudio so just use bootloader... haha...
- CODE: SELECT_ALL_CODE
define loader_used 1
define OSC 20
trisa=%00000000
porta=%00000000
trisb=%00000101
portb=%00000000
trisc=%00000000
Portc=%00000000
trisd=%00000000
portd=%00000000
DEFINE LCD_DREG PORTd ' Set LCD Data port to Port D of MCU
DEFINE LCD_DBIT 4 ' Set starting Data bit (0)
DEFINE LCD_RSREG PORTb ' Set LCD Register Select port
DEFINE LCD_RSBIT 4 ' Set LCD Register Select bit
DEFINE LCD_EREG PORTb ' Set LCD Enable port
DEFINE LCD_EBIT 5 ' Set LCD Enable bit.
DEFINE LCD_BITS 4 ' Set LCD bus size (4 bits)
i var byte
cl var byte
ST VAR BYTE
ST = 0
main:
high porta.0
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
if ST = 0 then
LCDOUT $FE,1, " K.I.T.T. "
LCDOUT $FE,$C0, " VER 2.0 BETA "
PAUSE 1000
ST = 1
endif
IF ST = 1 THEN
LCDOUT $FE,1, " INITIALIZE "
PAUSE 100
ST = 1
endif
IF ST = 3 THEN
portc=%00000000
portd=%00000000
LCDOUT $FE,1, "HYPERDRIVEngine"
LCDOUT $FE,$C0, " ACTIVATED "
PAUSE 4000
ST = 4
endif
if ST = 4 then
LCDOUT $FE,1, " SCANNER "
LCDOUT $FE,$C0, " ACTIVATED "
pause 2000
ST = 5
endif
if st = 5 then
LCDOUT $FE,1, " NORMAL "
LCDOUT $FE,$C0, " CRUISE "
pause 1
for i = 0 to 255 step 4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,i,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 0 to 255 step 4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,i,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 0 to 255 step 4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,i,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 0 to 255 step 4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,i,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 0 to 255 step 4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,i,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 0 to 255 step 4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,i,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 0 to 255 step 4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,i,1
pwm portd.1,0,1
next i
for i = 0 to 255 step 4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,i,1
next i
for i = 255 to 0 step -4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,i,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 255 to 0 step -4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,i,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 255 to 0 step -4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,i,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 255 to 0 step -4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,i,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 255 to 0 step -4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,i,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 255 to 0 step -4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,i,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 255 to 0 step -4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,i,1
pwm portd.1,255,1
next i
for i = 255 to 0 step -4
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,i,1
next i
for i = 0 to 255 step 20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,i,1
next i
for i = 0 to 255 step 20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,i,1
pwm portd.1,255,1
next i
for i = 0 to 255 step 20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,i,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 0 to 255 step 20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,i,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 0 to 255 step 20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,i,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 0 to 255 step 20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,0,1
pwm portc.2,i,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 0 to 255 step 20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,0,1
pwm portc.1,i,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 0 to 255 step 20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,i,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,255,1
next i
for i = 255 to 0 step -20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,255,1
pwm portd.1,i,1
next i
for i = 255 to 0 step -20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,255,1
pwm portd.0,i,1
pwm portd.1,0,1
next i
for i = 255 to 0 step -20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,255,1
pwm portc.5,i,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 255 to 0 step -20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,255,1
pwm portc.4,i,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 255 to 0 step -20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,255,1
pwm portc.3,i,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 255 to 0 step -20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,255,1
pwm portc.2,i,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 255 to 0 step -20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,255,1
pwm portc.1,i,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
for i = 255 to 0 step -20
BUTTON portb.0,0,255,1,cl,1,ON_ENGINE
pwm portc.0,i,1
pwm portc.1,0,1
pwm portc.2,0,1
pwm portc.3,0,1
pwm portc.4,0,1
pwm portc.5,0,1
pwm portd.0,0,1
pwm portd.1,0,1
next i
endif
goto main
ON_ENGINE:
low porta.0
LCDOUT $FE,1, " ACTIVATING "
PAUSE 1000
LCDOUT $FE,1, " HYPERDRIVE "
LCDOUT $FE,$C0, " ENGINE "
portc=%00111111
portd=%00000011
pause 2000
ST = 3
goto main
end