Toyota Yaris Forums - Ultimate Yaris Enthusiast Site
 

 


 
Go Back   Toyota Yaris Forums - Ultimate Yaris Enthusiast Site > Technical Forums > DIY / Maintenance / Service
  The Tire Rack

Reply
 
Thread Tools Display Modes
Old 12-07-2008, 05:41 PM   #1
metalshark
MetalShark
 
Drives: 2008 Yaris LB
Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
Source code for Yaris Tachometer

[IMG][/IMG]
If you want to build a tachometer using a BS2 micro-processor the following will help:
' {$STAMP BS2}
' {$PBASIC 2.5}
'************************************************* **************************************
'* TACHOMETER PROGRAM FOR 2008 TOYOTA YARIS. *
'* VERSON 2.0 BY STAN CLOYD 3/07/2009. *
'* THIS UPDATE EXPANDS TACHOMETER INDICATION RANGE TO 6,800 PLUS RPM AND RAISES RPM *
'*FLASH WARNING (4 hZ FLASH RATE) TO 6,000 RPM. THE YARIS ECU REPORTEDLY STARTS *
'*LIMITING RPM AT 6,400 RPM AND CAN KEEP CALCULATING ECU OUTPUT VALUES UP TO 7,000 RPM.*
'* PARALLAX BS2 PIN #15 IS USED TO READ TACH SIGNAL FROM THE OBD2 SERVICE CONNECTOR.*
'*INPUT SIGNAL IS ATTENUATED FROM A 0-12 VOLT SQUARE WAVE TO A 0-5 VOLT SQUARE WAVE BY *
'*A 100 K CURRENT LIMITING RESISTER AND A 5.01 VOLT ZENER DIODE. OUTPUT PINS #s 0-14 *
'*ARE IMPEDANCE MATCHED TO THE LED LOADS BY LM342-N OP-AMP QUAD PACKS IN A UNITY GAIN *
'*CONFIGURATION. *
'* PULL DOWN RESISTERS WITH A VALUE OF 47 K ARE USED TO KEEP THE PROCESSOR OUTPUTS *
'*FROM FLOATING HIGH WHEN THE LOGIC HAS THEM OFF. COMPARISON OF RPM TO A COMMERCIAL *
'*DIGITAL TACHOMETER SHOWED A 1 % DIFFERANCE AT 650 RPM AND A 1/2 % DIFFERANCE AT *
'*3,200 RPM. CALIBRATION INTEGERS USED ARE FOR A 4 CYLINDER 4-CYCLE ENGINE ONLY. *
'*EEPROM DATA BELOW STORES THE RPM LIMIT VALUES THAT TURN ON AND OFF EACH DISPLAY LED. *
'************************************************* **************************************
DATA Word 540, Word 950, Word 1400, Word 1850, Word 2300 'EPROM DATA
DATA Word 2750, Word 3200, Word 3650, Word 4100, Word 4550 'EPROM DATA
DATA Word 5000, Word 5450, Word 5900, Word 6350, Word 6800 'EPROM DATA

'************************************************* ***********
'* DECLARATIONS & INITIALIZATIONS *
SAMPLE_L VAR Word '*INPUT SQUARE WAVE TIME-LOW COUNT *
SAMPLE_H VAR Word '*INPUT SQUARE WAVE TIME-HIGH COUNT *
PERIOD VAR Word '*TOTAL SQUARE WAVE PERIOD COUNT (INVERSE OF FREQUENCY) *
RPM VAR Word '*REVOLUTIONS PER MINUTE (CRANKSHAFT RPM) *
RPM_L VAR Word '*RPM CELL LIMITS READ FROM EEPROM TABLE *
INDEX VAR Byte '*OUTPUT PIN INDEX # *
CAL1 VAR Byte '*SCALING CONSTANT TO KEEP CAL2 BELOW INTEGER OVERFLOW LIMIT*
CAL2 VAR Word '* *
CAL1=230 '*FOUR CYLINDER ENGINE-SPECIFIC CALIBRATION VALUE *
CAL2=63050 '*FOUR CYLINDER ENGINE-SPECIFIC CALIBRATION VALUE *
'************************************************* ***********

START: '************************************************* ***********
PERIOD = 0 '*RESET/CLEAR LAST SCAN-LOOP VALUES *
SAMPLE_L= 0 '* *
SAMPLE_H= 0 '* *
RPM = 0 '* *
'* *
PULSIN 15, 0, SAMPLE_L '*SAMPLE PIN #15 LOW COUNT AT ZERO VOLTS *
PULSIN 15, 1, SAMPLE_H '*SAMPLE PIN #15 HIGH COUNT AT 5 VOLTS *
PERIOD = SAMPLE_L+SAMPLE_H '*CALCULATE TOTAL PERIOD COUNT *
PERIOD = PERIOD/CAL1 '*SCALING FACTOR TO PREVENT POSITIVE INTEGER OVERFLOW *
RPM = CAL2/PERIOD '*CALULATE RPM *
'* *
IF RPM>6000 THEN '*FLASH LEDS ON AND OFF AT 4 HZ WHEN RPM EXCEEDS 6000 RPM *
'*(SHIFT WARNING). *
FOR INDEX=0 TO 14 '************************************************* ***********
LOW INDEX
NEXT
PAUSE 25
ENDIF






'********************************************
FOR INDEX=0 TO 28 STEP 2 '*TURN ON CORRECT LEDS FOR ANALOG DISPLAY *
READ INDEX, RPM_L.LOWBYTE '*INDICATION(ENGINE-RUNNING CONDITION ONLY).*
READ (INDEX+1), RPM_L.HIGHBYTE '********************************************
IF RPM>RPM_L THEN
HIGH (INDEX/2)
ELSEIF RPM<RPM_L THEN
LOW (INDEX/2)
ENDIF
NEXT
'********************************************
DO WHILE PERIOD=0 '*REVERSING STROBE FLASH SEQUENCE WHEN *
FOR INDEX=0 TO 14 '*IGNITION KEY IS ON BUT ENGINE IS NOT *
HIGH INDEX '*RUNNING (HARDWARE DIAGNOSTIC). *
PAUSE 20 '********************************************
LOW INDEX
PAUSE 20
NEXT
FOR INDEX=14 TO 0
HIGH INDEX
PAUSE 20
LOW INDEX
PAUSE 20
NEXT
LOOP
GOTO START
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header.

Last edited by metalshark; 04-07-2009 at 07:44 PM. Reason: Updated version 2
metalshark is offline   Reply With Quote
Old 12-07-2008, 06:15 PM   #2
custom Lftback
 
custom Lftback's Avatar
 
Drives: 2008 Toyota Yaris Liftback
Join Date: Oct 2008
Location: Houston, TX
Posts: 1,054
Send a message via Yahoo to custom Lftback
wow that makes no sense to me. lol
custom Lftback is offline   Reply With Quote
Old 12-07-2008, 08:08 PM   #3
metalshark
MetalShark
 
Drives: 2008 Yaris LB
Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
Cents

A smart alec would say its basic but actually its pBasic.
Quote:
Originally Posted by custom Lftback View Post
wow that makes no sense to me. lol
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header.
metalshark is offline   Reply With Quote
Old 12-07-2008, 08:12 PM   #4
auxmike
 
auxmike's Avatar
 
Drives: 2008 HB, A/T, Power W/L/M
Join Date: Oct 2008
Location: LI, New Yawk
Posts: 2,063
You are a mental giant!
auxmike is offline   Reply With Quote
Old 02-28-2009, 05:29 AM   #5
metalshark
MetalShark
 
Drives: 2008 Yaris LB
Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
Had to change jobs and be punished on day shift for a while. Here is the schematic from which I'm working on a 2-layer board layout.
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header.

Last edited by metalshark; 04-02-2009 at 05:44 PM.
metalshark is offline   Reply With Quote
Old 03-30-2009, 09:41 PM   #6
metalshark
MetalShark
 
Drives: 2008 Yaris LB
Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
Tachometer kit layout

Quote:
Originally Posted by metalshark View Post
Had to change jobs and be punished on day shift for a while. Here is the schematic from which I'm working on a 2-layer board layout.
http://s351.photobucket.com/albums/q443/scloyd_01/
I ordered 3 2-layer copper boards for this project today. Express should have them back Wednesday. These won't have a solder mask or silkscreen but may work.
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header.
metalshark is offline   Reply With Quote
Old 03-30-2009, 10:03 PM   #7
jkuchta
 
Drives: 2007 Yaris hatch (red)
Join Date: Sep 2007
Location: L.A.
Posts: 557
Can't wait to see how they come out...I have the plugs almost done for my steeringwheel project!
jkuchta is offline   Reply With Quote
Old 03-31-2009, 05:46 PM   #8
metalshark
MetalShark
 
Drives: 2008 Yaris LB
Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
Extra Boards

I will have 2 extra boards left over and some parts. I can solder in the parts I have and sell the extra boards with the schematic, bill of material, and source code listing if anyone is interested. I'll post all the pics here if it was laied out correctly. It was my first layout going to the etcher.
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header.
metalshark is offline   Reply With Quote
Old 04-02-2009, 02:39 AM   #9
jkuchta
 
Drives: 2007 Yaris hatch (red)
Join Date: Sep 2007
Location: L.A.
Posts: 557
My soldering abilities are good enough to connect wires, but not good enough to populate a board. What would one cost assembled (I can wire the thing into the car)?
jkuchta is offline   Reply With Quote
Old 04-02-2009, 02:52 AM   #10
CtrlAltDefeat
I ♥ Yaris
 
CtrlAltDefeat's Avatar
 
Drives: Black 08 LB MT & red 97 Miata
Join Date: Oct 2008
Location: Indianapolis IN
Posts: 1,313
I am very interested in this... If I read the schematics correctly it uses LEDs to show the revs... how responsive will this be? If it's cheaper then an aftermarket tach and can be made to look good I would love a DIY tach... trying to think of where would be best to put the LEDs...
__________________

The trouble with the world is that the stupid are cocksure
and the intelligent are full of doubt. - Bertrand Russell
CtrlAltDefeat is offline   Reply With Quote
Old 04-02-2009, 05:14 PM   #11
metalshark
MetalShark
 
Drives: 2008 Yaris LB
Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
Tach Board trial layout

http://i351.photobucket.com/albums/q...il209DL066.jpg
http://i351.photobucket.com/albums/q...oStichWire.jpg
http://i351.photobucket.com/albums/q...1/HPIM1368.jpg

The first picture is the trial layout.

The second picture is the stitch wire prototype I've used in the car for a year now.

The third picture is how I installed 15 LEDs in the dash. The display is currently set to start flashing all lit lites at 4 Hz when my revs hit my 6000 RPM shift point. The top red comes on at 6'800 RPM as programed and, yes the mill will make it.
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header.
metalshark is offline   Reply With Quote
Old 04-02-2009, 05:22 PM   #12
metalshark
MetalShark
 
Drives: 2008 Yaris LB
Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
Quote:
Originally Posted by jkuchta View Post
My soldering abilities are good enough to connect wires, but not good enough to populate a board. What would one cost assembled (I can wire the thing into the car)?
As beta test consumer I might be able to cost it low. The biggest problem is the BS2 chip costs $50. I need to re-prototype this project using the new Parallax Propeller chip since they just dropped the cost to $7.95. The propeller has so many beans you could put the entire Toyota engine management code on it if they would let you have a copy. The parts at-cost is roughly $80 without display LED's AND you'd want me to load the program into the BS2 EEPROM for you too. It is a neat integrated prototype though and cops always ask what it is because when the key is on and the motor dead the display chases left to right and right to left like the original KIT. The cops have to know its not an illegal mobile police scanner. They give it a thumbs up. In a Propeller version I would integrate the dash dimmer control into the unit.
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header.

Last edited by metalshark; 04-02-2009 at 05:31 PM. Reason: Inclusion of ball-park costing SWAG.
metalshark is offline   Reply With Quote
Old 04-02-2009, 06:10 PM   #13
POORSHA
 
POORSHA's Avatar
 
Drives: 2008 LB
Join Date: Nov 2008
Location: NE CT
Posts: 418
i would be interested in your extra board and parts. i have been looking for a tach like this for a while. pm me when you know more.
POORSHA is offline   Reply With Quote
Old 04-02-2009, 06:20 PM   #14
metalshark
MetalShark
 
Drives: 2008 Yaris LB
Join Date: Oct 2008
Location: Mesa, AZ
Posts: 104
How responsive is it?

Quote:
Originally Posted by CtrlAltDefeat View Post
I am very interested in this... If I read the schematics correctly it uses LEDs to show the revs... how responsive will this be? If it's cheaper then an aftermarket tach and can be made to look good I would love a DIY tach... trying to think of where would be best to put the LEDs...
The BS2 chip scans at 20,000 cycles per second on its clock. The entire code is less than 100 lines. The output display driver section is a rather primitive analog/linear op-amp arrangement but it is very fast. This design is WAY faster in its response than any mechanical tachometer needle can possibly be. The code uses the pulsein command for data and in a worst case situation will generate an accurate RPM number in one revolution of the crankshaft.
__________________
Absolutely red, Drawtite hitch, CAI, Insulated Header, Amsoil 5w-30, Mag-drain plug, Red-Line MT-90 tranny oil, Scotch-Guard, Window Tint, Dash rug, Custom short throw shifter, Lowered OEM arm rest, Super-Turbo muffler/w chrome slash cut tip., TRD rear sway bar, sticky pads, front shock tower bar, RS grill badge, VVT-i emblems, Second tire set from Tirerack.com, DISABLED DAY TIME RUNNING LIGHTS, platform- style locking custom bike rack. 86K miles so far. 5 years use now on ceramic wrapped insulated stainless-steel header.
metalshark is offline   Reply With Quote
Old 04-02-2009, 08:17 PM   #15
CTScott
ULTIMATE
 
CTScott's Avatar
 
Drives: 09 5dr LB, 2x 08 3dr LB
Join Date: Oct 2008
Location: USA, CT
Posts: 13,460
Quote:
Originally Posted by metalshark View Post
As beta test consumer I might be able to cost it low. The biggest problem is the BS2 chip costs $50. I need to re-prototype this project using the new Parallax Propeller chip since they just dropped the cost to $7.95. The propeller has so many beans you could put the entire Toyota engine management code on it if they would let you have a copy. The parts at-cost is roughly $80 without display LED's AND you'd want me to load the program into the BS2 EEPROM for you too. It is a neat integrated prototype though and cops always ask what it is because when the key is on and the motor dead the display chases left to right and right to left like the original KIT. The cops have to know its not an illegal mobile police scanner. They give it a thumbs up. In a Propeller version I would integrate the dash dimmer control into the unit.
Switch to a Microchip PIC microcontroller. Same or better functionality for <$5 max and many of the PICs can directly drive LEDs with the outputs.

For example the PIC16F57 is $1.55 and has 20 I/O Pins and runs at up to 20mHz. If you're not comfortable with C or assembly programming, there is even a basic compiler for the PICs.

http://search.digikey.com/scripts/Dk...IC16F57-I/P-ND
CTScott is offline   Reply With Quote
Old 04-02-2009, 09:12 PM   #16
fuji
 
fuji's Avatar
 
Drives: Polar White Yaris HB
Join Date: Dec 2008
Location: Honolulu
Posts: 263
This project has tons of potential and looks great! When will it be avaliable for the rest of us willing to pay?????
fuji is offline   Reply With Quote
Old 04-02-2009, 11:00 PM   #17
Shroomster
'07 to '12:2 wipers to 1?
 
Shroomster's Avatar
 
Drives: '12 5-door LE & '14 5-door LE
Join Date: Apr 2007
Location: Orlando
Posts: 1,999
lol might want to pm PK about this...I've been trying for months w/o success to procure a gauge cluster for him....
__________________
MicroImageonline forums - Shroomster
Xda Forums - Shroomster
Androidforums - Shroomster
I'm noticing a pattern......
Shroomster is offline   Reply With Quote
Old 04-03-2009, 02:33 AM   #18
CtrlAltDefeat
I ♥ Yaris
 
CtrlAltDefeat's Avatar
 
Drives: Black 08 LB MT & red 97 Miata
Join Date: Oct 2008
Location: Indianapolis IN
Posts: 1,313
Quote:
Originally Posted by metalshark View Post
The biggest problem is the BS2 chip costs $50. I need to re-prototype this project using the new Parallax Propeller chip since they just dropped the cost to $7.95.
yes, $50 for just the chip would be way too much, an aftermarket tach would cost less. The Propeller version, however, sounds right up my alley... I think it would look good with rectangle or square LEDs (or rectangle shaped covers) closely set together. It would be awesome to somehow incorporate it into the gauge cluster...
__________________

The trouble with the world is that the stupid are cocksure
and the intelligent are full of doubt. - Bertrand Russell
CtrlAltDefeat is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
P0456 OBD code? jlift DIY / Maintenance / Service 6 09-19-2007 03:28 PM
Anybody know the code? Driver New YARIS Purchase Forum 5 08-20-2006 06:56 PM


All times are GMT -4. The time now is 09:00 PM.




YarisWorld
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.