Toyota A340 control

'Microsquirt' Transmission Control development and support.

Moderators: jsmcortina, muythaibxr

Post Reply
shocktower
MS/Extra Newbie
Posts: 10
Joined: Mon Apr 17, 2017 10:33 pm

Re: Toyota A340 control

Post by shocktower »

Harreh wrote:Just tested the circuit provided by Knightrous. Completely working. So for anyone using this in an A340 with a latching switch this is the way to go
Ok I am so lost, what is the latching, I have a A343F in my 1997 Land Cruiser, I am using a microsquirt to control the transmission ( and it works fair but not what I believe should be), I have a Cummins 6BT motor with a rotory pump, so it is all mechanical as far as fuel delivery, so I need better function of my tranny, on down shift and TC lock up when I really need it, also can I add a switch for the TC when I am driving slow through rock gardens and steep hills . Thank you for your time

Ok I figured out how to upload a my tune file
I did a swap with a Cummins 6bt diesel there is no electronic fuel injection, I am just using this to hand the job of shifting my A343F transmission, I have some what of a tune to it, but I want more out of it
Attachments
2017-11-12_13.19.15.msq
(25.93 KiB) Downloaded 193 times
Harreh
MS/Extra Newbie
Posts: 6
Joined: Fri Oct 06, 2017 11:26 pm

Re: Toyota A340 control

Post by Harreh »

The latching is the OD switch on most A340 toyota cars, it can always transmit its signal. If you read back through this thread as well as the firmware update one you'll understand if this does or doesn't apply to you
superdve
MS/Extra Newbie
Posts: 20
Joined: Mon Jan 06, 2014 8:51 pm

Re: Toyota A340 control

Post by superdve »

I've made up some boards. Thanks for the schematic adding the transistor.
I will share the spare boards I have for free.
Screen Shot 2018-03-21 at 7.27.38 PM.png
Screen Shot 2018-03-21 at 7.27.38 PM.png (112.08 KiB) Viewed 4688 times
Screen Shot 2018-03-21 at 7.26.28 PM.png
Screen Shot 2018-03-21 at 7.26.28 PM.png (64.22 KiB) Viewed 4688 times
superdve
MS/Extra Newbie
Posts: 20
Joined: Mon Jan 06, 2014 8:51 pm

Re: Toyota A340 control

Post by superdve »

Screen Shot 2018-03-31 at 5.14.59 PM.png
Screen Shot 2018-03-31 at 5.14.59 PM.png (320.68 KiB) Viewed 4658 times
10 days later, from across the world I have boards and parts.
TheTech78
MS/Extra Newbie
Posts: 6
Joined: Thu Aug 17, 2017 11:42 am

Re: Toyota A340 control

Post by TheTech78 »

Is there any plans of adding control for the accumulator back fill. Have a project coming up and am planning to use the Micro for transmission control in a Supra I will be doing. I see the output is available on the controller, and would really like to have proper control of that as the car will be primarily a cruiser.
superdve
MS/Extra Newbie
Posts: 20
Joined: Mon Jan 06, 2014 8:51 pm

Re: Toyota A340 control

Post by superdve »

I got a few PMs but replies are in the outbox for some reason. If you PM'd me for boards, I will get them on the site asap. detroittechnicalmedia.com - Dave
superdve
MS/Extra Newbie
Posts: 20
Joined: Mon Jan 06, 2014 8:51 pm

Re: Toyota A340 control

Post by superdve »

TheTech78 wrote:Is there any plans of adding control for the accumulator back fill. Have a project coming up and am planning to use the Micro for transmission control in a Supra I will be doing. I see the output is available on the controller, and would really like to have proper control of that as the car will be primarily a cruiser.
I sent James a note on this. All the A340E needs is a basic load/speed table to define this for backfill accumulator. I mapped a generic PWM from MS3pro such that we ran the solenoid with as much DC as possible at light loads to keep the shifts from getting too hard at low speeds and light loads. At wot we have 0 DC here. This solenoid is important as it acts like an accumulator spring.
Turbofreakdotcom
Experienced MS/Extra'er
Posts: 201
Joined: Mon Sep 15, 2008 9:29 pm

Re: Toyota A340 control

Post by Turbofreakdotcom »

I'm been staring at the code trying to work out what needs to be rewritten in the code to work other solenoids on an A340E/A341 variant 30-40LS JDM (6) solenoid trans.
I just talked a buddy into buying a Microsquirt for his JDM 97-05 Aristo trans so it will shift as good as my older A340 running the MS2. After buying the MicroS unit and high side drivers, I learned of the differences.

Can't find the documents for this trans in English so I am working to probe and activate the solenoids get it working on stand alone correctly.
I'll be probing this weekend. I assumed the 3 shift solenoids worked the same as my 3 1987 through 92 A340E and the line pressure solenoids (PWM lockup and PWM OD), but after all the research and photos from his valve body, it consists of:
(3) 12 volt shift solenoids
(1) PWM Backpsi accumulator sol
(1) Lockup sol + -
(1) PWM Line pressure sol + -
OD input speed sensor
VSS output speed sensor

There is somewhat of a pinout description that might be partially translated. It states S1 and S2 activate the same as my older A340E, though they question S3 or (SD) and S4 function.

Either way, would a large amount of code have to change when I break down the function of all solenoids? Looks like we can utilize all the other sol outputs to control everything correctly. Any input is welcomed..
Updated 6/20/18:
87 Supra-3.0 1.5JZ-A340 trans
MS2 ECU
MS2 Trans controller
Samiur_Rahman
MS/Extra Newbie
Posts: 1
Joined: Sun May 27, 2018 12:56 am

Re: Toyota A340 control

Post by Samiur_Rahman »

Turbofreakdotcom wrote:I'm been staring at the code trying to work out what needs to be rewritten in the code to work other solenoids on an A340E/A341 variant 30-40LS JDM (6) solenoid trans.
I just talked a buddy into buying a Microsquirt for his JDM 97-05 Aristo trans so it will shift as good as my older A340 running the MS2. After buying the MicroS unit and high side drivers, I learned of the differences.

Can't find the documents for this trans in English so I am working to probe and activate the solenoids get it working on stand alone correctly.
I'll be probing this weekend. I assumed the 3 shift solenoids worked the same as my 3 1987 through 92 A340E and the line pressure solenoids (PWM lockup and PWM OD), but after all the research and photos from his valve body, it consists of:
(3) 12 volt shift solenoids
(1) PWM Backpsi accumulator sol
(1) Lockup sol + -
(1) PWM Line pressure sol + -
OD input speed sensor
VSS output speed sensor

There is somewhat of a pinout description that might be partially translated. It states S1 and S2 activate the same as my older A340E, though they question S3 or (SD) and S4 function.

Either way, would a large amount of code have to change when I break down the function of all solenoids? Looks like we can utilize all the other sol outputs to control everything correctly. Any input is welcomed..
Hi TurboFreak,

I'm currently in the process of wiring up a 30-40LS behind an MS3X controlled 1UZFE. The transmission I've got is the 7 solenoid verison available in the JDM JZS161 Aristo. It has 2 supplementary solenoids for the tiptronic shift function. With 6 possible outputs from the Microsquirt in Trans Control configuration, 5 solenoids can easily be driven.
Attachments
A340E_1.pdf
30-40LS transmission with 5 solenoids
(515.3 KiB) Downloaded 349 times
A340E_2.pdf
30-40LS transmission with 5 solenoids
(657.29 KiB) Downloaded 237 times
A340E_3.pdf
30-40LS transmission with 5 solenoids
(388.1 KiB) Downloaded 219 times
A340E_4.pdf
30-40LS transmission with 5 solenoids
(628.3 KiB) Downloaded 223 times
Turbofreakdotcom
Experienced MS/Extra'er
Posts: 201
Joined: Mon Sep 15, 2008 9:29 pm

Re: Toyota A340 control

Post by Turbofreakdotcom »

Thank you very much for the manuals! Greatly appreciated.
I ran the 7 solenoid 98 up A340/A341 30-40ls last night for the first time on the road with the Microsquirt. Testing and speaking with my buddy that drove the car for years resulted in this info:

Setup and results:
Backfill accumulator SLN: Since there there is no revision from MS for this solenoid, I left this control on on stock ecu since the ecu controls this SLN sol at a steady rate of .6ms in drive and upwards of 1.5 to 2ms during stock upshift or downshift. Of course, the MS shifts aren't running the same schedule as the stock ECU so the backfill solenoid is sitting at the idle .6ms when MS changes gear. (Service manual for these year trans with backfill solenoid states lower PWM equals higher PSI on accumulator).

Line psi solenoid: I don't feel MS is controlling line psi solenoid very well. Testing the SLT sol in Test Outputs results in an odd high frequency noise that is not modulating the solenoid when engine not running. Only 0 or 100% gives solenoid a destinctive off/on solid sound. Anything between seems wrong.
I didn't get any screenshots, but the PWM from MS doesn't look quite right on the oscilloscope when it is hooked up to the SLT solenoid and appears inverted as well.
I still have the check more voltages, but on the stock ecu I measured 12 volts at SLT+ pin with key on and 2.4 volts after starting the engine while selector in PARK position.
Still need more testing on line psi PWM from stock ecu. When I measured the SLT+ and SLT- the other day on stock ecu while the car was in drive and shifting gears, I didn't get a pulewidth, just around 12 volts so something was weird.
When I swapped the Lockup output to Line PSI solenoid, the Solenoid modulated as I would expect, just like the Lockup solenoid. The Line PSI output on the Lockup solenoid responded with the same odd frequency noise as Line PSI output on Line PSI solenoid.

Results from driving:
I like very firm shifts from an auto, though upshifts and downshifts are pretty violent last night. As stated above, line psi changes didn't seem to have an effect.
My old 3 solenoid A340 has no engine breaking in 1st or 2nd when in DRIVE position and manually controlled by my MS2 which has been the experience by others when manually controlling these older A340's, but my buddy stated it wasn't normal when he felt the free revs (no engine breaking) on his 30-40ls last night when manually in 1st and 2nd. The Lexus came with manual steering wheel shift control from factory so it wasn't the first time he manually shifted this trans.
Nobody seems to know what the other 2 solenoids (sol3 and sol4) do on these transmissions. It came to mind this morning that it is possible these 2 solenoids might have fluid control to allow engine breaking in 1st and 2nd gears (will be testing this later). When I had the 4 channels connected to oscilloscope solenoid 4 would always be activated when in 1st gear in DRIVE position and off in other gears. Solenoid 3 never activated in any gear. (All testing in automatic mode)
An interesting observation that leads to this thought is the A650 5 speed original in his 2001 Lexus has the same (2) extra sol3 and sol4 solenoids. He is using the 4 speed from the 98-05 Toyota Aristo swap since he is using the ecu that came with the swap.

Either way, I looked at the firmware files for hours the other night and found some places in the code that could be changed for adding outputs for more solenoids, but I will need far more hours to change things, recompile, and test. The other problem I have is having to spend even more time to figure out how to add GUI variable windows/settings for Tuner Studio to be able to adjust any added outputs. I am a big fan of the MS trans control so would love to help develop these controllers further while I have a test bed instead of spending that time developing code on one of my Arduino controllers and building even more circuits to try to work along side the Micro/Megasquirt for the accumulator solenid and the other 2 solenoids.

Things that worked well,
Sol1 and Sol2 shifted the gears as expected with the same pattern as my old 3 solenoid A340. He was surprised with the quick shifting.

Lockup solenoid PWM control seems to work great as well. I would supply the PW time of the stock ecu, but they are not with me at the moment.

Questions for James or anyone else that knows the code,
Is there anything you can think of that causes this behavior with the line PSI solenoid?

Does the Microsquirt have a transistor for ignition coil that can be used for the PWM backfill accumulator solenoid?

Are there any other outputs that can be used to also control the other (2) non-PWM solenoids? (via high side drivers of course)

Thanks,
Chris
Updated 6/20/18:
87 Supra-3.0 1.5JZ-A340 trans
MS2 ECU
MS2 Trans controller
Turbofreakdotcom
Experienced MS/Extra'er
Posts: 201
Joined: Mon Sep 15, 2008 9:29 pm

Re: Toyota A340 control

Post by Turbofreakdotcom »

Still working out the issue with PWM on the 5 ohm Toyota solenoid. Everything on the lockup output works fine, anything on line psi output is a problem like there isn't enough current to control any solenoid I put on it.

Is the line psi output controlled differently at all or might there be a possible issue with the driver?

Using a current clamp on oscilloscope, the lockup output shows 3 amps at a certain percentage. The line psi output shows only 1 amp at the same percentage when attached to the same solenoid.
Updated 6/20/18:
87 Supra-3.0 1.5JZ-A340 trans
MS2 ECU
MS2 Trans controller
Turbofreakdotcom
Experienced MS/Extra'er
Posts: 201
Joined: Mon Sep 15, 2008 9:29 pm

Re: Toyota A340 control

Post by Turbofreakdotcom »

Just to again cover what we are working with:
Microsquirt Trans control 1.0.1 FW
Toyota A340/A341 1998-2005 JDM 4 speed transmission running A340 mode

The results after Microsquirt install that lead me to believe there is an issue on INJ2 circuit is below. All "audible" results are using Test Output, engine not running.

EPC solenoid (SLT+ & SLT- Toyota) had an odd frequency whine at any duty cycle while checking in test output mode with engine off, much like a solenoid with a frequency variable way off.
LU solenoid (SLU+ & SLU- Toyota) has a distinct pulse like a fuel injector.
While not in test mode engine running there is an audible whining from the hydraulics in the trans like a fluttering regulator psi issue.

If EPC DC% = 0 there is an audible snap from the solenoid and whine is gone, anywhere between 0 and 100 seems to make no difference in transmission feel, function, or whine (Adjusting EPC DC% changes audible whine pitch).
In troubleshooting the last couple weeks, any of the 3 PWM solenoids applied to the EPC/INJ2 circuit will whine the same.
INJ1 is controlling all solenoids with normal pulse.
All this testing was on transmission on the car and on solenoids on a spare transmission.

After looking back at my scope images I realized the difference between LU/INJ1 and EPC/INJ2 circuits and why LU/INJ1 circuit has hard injector like pulses and EPC/INJ2 line psi circuit doesn't respond the same to the solenoids.
I don't have labels in my scope screenshots to determine which circuit was which, but now I can see one circuit appears to be 30 Hz and the other 296 Hz which explains the difference in solenoid function. Both running close to 1.5 amps. No frequency specs found for Toyota solenoids.

I probed the line pressure circuit from the stock ECU (in limp mode default higher pressure) which shows a smooth 2.4 volts with no pulsewidth on the scope.
The Toyota service manual shows a different circuit diagram for the line psi solenoid than the other PWM circuits. It appears there are 2 additional resistors, diode, and I'm not sure about the box symbol and the batt+ connection with the strikethrough circle (a little similar to constant current diode symbol). See attachment.
We still need to connect psi sensor to ensure what is happening. The DC adjustment just doesn't to be making any difference with how very firm this trans goes into gear and shifts.

Is a line psi solenoid supossed to have a noticeable pulsewidth, or is the intention to control this solenoid with smooth regulated switching type voltage for smooth steady valve operation?
Would other components like diodes, added resistors, and/or small cap be necessary on this circuit?
How easy is to change the frequency of INJ1 and INJ2 and recompile FW to see what might work better?
Is there another output available (if CAN TPS, RPM, etc. is used) to build transistor circuit for PWM/DC% on the Accumulator Back pressure solenoid on these transmissions?
Attachments
rsz_sol5_toyota (1).jpg
rsz_sol5_toyota (1).jpg (58.84 KiB) Viewed 4203 times
Updated 6/20/18:
87 Supra-3.0 1.5JZ-A340 trans
MS2 ECU
MS2 Trans controller
Turbofreakdotcom
Experienced MS/Extra'er
Posts: 201
Joined: Mon Sep 15, 2008 9:29 pm

Re: Toyota A340 control

Post by Turbofreakdotcom »

James,
Going to have a more elaborate post when I get time tonight, but in the meantime I found that stock ecu for this A340 30-40LS is running the accumulator back pressure solenoid and lockup solenoid at exactly 300 Hz.
I was able to get a short half second reading of the Line psi solenoid PWM from what looks to be an "key on self check" which I assume is the maximum value of functioning the solenoids judged by watching the lock up sol fully open and slowly close at key on.

SLT line psi solenoid showed to run at 305 - 308 Hz.
In order to match the same current and close to the same voltage between the ecu at 308 Hz and Microsquirt 296 Hz at the same 2.06ms PW on time, a 15 Ohm resistor from LINE SOL (-) to 4001 diode with band toward 5.3-6 Ohm LINE SOL (+) was needed. 39% DC on Microsquirt resulted in the same 2.06 ms PW ON time with OFF time at 1.37 ms compared to stock ECU's 1.2 ms OFF time.

With that out of the way by 4am this morning, lol, is it possible to change the LU and EPC frequency in the FW and add an a340 30-40 LS selection.
Is it possible to also utilize another output for SLN accumulator back psi solenoid circuit that softens the blow of the gear change. I am not sure why Toyota would not have used EPC to control and if there is a problem doing it that way.
Thanks for any help with this.
Updated 6/20/18:
87 Supra-3.0 1.5JZ-A340 trans
MS2 ECU
MS2 Trans controller
Turbofreakdotcom
Experienced MS/Extra'er
Posts: 201
Joined: Mon Sep 15, 2008 9:29 pm

Re: Toyota A340 control

Post by Turbofreakdotcom »

Update:
I was able to drive the car tonight after the scope work all night long. I had no psi control on this trans when on initial install and would bang gears up or down violently. After adding the 1N4001 and 15 Ohm resistor it feels like a luxury car again with psi response when adjusted. It was a incredible change from what it was.
I had no resistors between 15 and 65 Ohm value and I feel like 20 to 30 Ohm would have matched the stock ecu control judging by the amperage at the same DC.
The Lock up still needs work, but ecu runs it at 300 Hz with very smooth sol control while MS runs at 30 Hz with fuel injector like function. Would be great to run the 300 Hz on LU.
Updated 6/20/18:
87 Supra-3.0 1.5JZ-A340 trans
MS2 ECU
MS2 Trans controller
Tico
MS/Extra Newbie
Posts: 2
Joined: Tue Jun 26, 2018 4:09 am

Re: Toyota A340 control

Post by Tico »

Turbofreakdotcom wrote:Update:
I was able to drive the car tonight after the scope work all night long. I had no psi control on this trans when on initial install and would bang gears up or down violently. After adding the 1N4001 and 15 Ohm resistor it feels like a luxury car again with psi response when adjusted. It was a incredible change from what it was.
I had no resistors between 15 and 65 Ohm value and I feel like 20 to 30 Ohm would have matched the stock ecu control judging by the amperage at the same DC.
The Lock up still needs work, but ecu runs it at 300 Hz with very smooth sol control while MS runs at 30 Hz with fuel injector like function. Would be great to run the 300 Hz on LU.
I have been wondering exactly the same issue with the line psi solenoid. The functionality is somewhat very weird. It seems to work sometimes when cold with 80 DC%, but as you also said it gives odd sound (especially when warm). Anything between 0 and 80 DC% won't do anything.

Could you sketch a simple drawing about the modification you did? I'm a bit uncertain how you did the installation and would like to get it working as well.

Thanks & greetings from Finland.
Turbofreakdotcom
Experienced MS/Extra'er
Posts: 201
Joined: Mon Sep 15, 2008 9:29 pm

Re: Toyota A340 control

Post by Turbofreakdotcom »

Tico wrote: I have been wondering exactly the same issue with the line psi solenoid. The functionality is somewhat very weird. It seems to work sometimes when cold with 80 DC%, but as you also said it gives odd sound (especially when warm). Anything between 0 and 80 DC% won't do anything.

Could you sketch a simple drawing about the modification you did? I'm a bit uncertain how you did the installation and would like to get it working as well.

Thanks & greetings from Finland.
Hi Tico,
Finland is one place I really want to visit. It would be better if I just came there for a week to fix it :).

Here is the diagram of what I used. 15 Ohm resistor to a 1N4001 (band toward +) on the Toyota 5.3 to 6 Ohm SLT (EPC) solenoid to replicate "close" to the same ON TIME volatage and amperage as stock ecu running at 305 Hz.
5.3 to 6 Ohm Toyota EPC solenoid
5.3 to 6 Ohm Toyota EPC solenoid
rsz_4line_psi_diagram.jpg (35.88 KiB) Viewed 4156 times
The Toyota service manual states during diagnostics to apply a variable power supply to the solenoid to test and "not to exceed 1 amp" so I took that as a limit of the this solenoid. With the 15 Ohm resistor on the diode, I've observed the solenoid at 1.1A at it's highest amperage at a specific DC%.

I started with a 1N4001 diode and worked from there. I didn't test only the diode since I had a scope and observed the stock ECU output to the solenoid, I just tried to get the PWM voltage peak and amperage close to the same as stock. The resistor adjusted the amplitude and quality of the PWM peak voltage along with the change in amperage. Try just a 1N4001 diode first with the band to 12v+ solenoid wire and the other end to solenoid negative and see what you get.
Updated 6/20/18:
87 Supra-3.0 1.5JZ-A340 trans
MS2 ECU
MS2 Trans controller
Tico
MS/Extra Newbie
Posts: 2
Joined: Tue Jun 26, 2018 4:09 am

Re: Toyota A340 control

Post by Tico »

Turbofreakdotcom wrote: Hi Tico,
Finland is one place I really want to visit. It would be better if I just came there for a week to fix it :).

Here is the diagram of what I used. 15 Ohm resistor to a 1N4001 (band toward +) on the Toyota 5.3 to 6 Ohm SLT (EPC) solenoid to replicate "close" to the same ON TIME volatage and amperage as stock ecu running at 305 Hz.
rsz_4line_psi_diagram.jpg
The Toyota service manual states during diagnostics to apply a variable power supply to the solenoid to test and "not to exceed 1 amp" so I took that as a limit of the this solenoid. With the 15 Ohm resistor on the diode, I've observed the solenoid at 1.1A at it's highest amperage at a specific DC%.

I started with a 1N4001 diode and worked from there. I didn't test only the diode since I had a scope and observed the stock ECU output to the solenoid, I just tried to get the PWM voltage peak and amperage close to the same as stock. The resistor adjusted the amplitude and quality of the PWM peak voltage along with the change in amperage. Try just a 1N4001 diode first with the band to 12v+ solenoid wire and the other end to solenoid negative and see what you get.
You are welcome anytime to fix it or of course just to visit :) Someone might say it is now the best time while the nature is green and it is warm summer time, but I'd say you should come to see the winter around February. It is something everyone should experience.

Excellent! Now it is clear as a blue sky! I will definitely do the mod in the following weeks and report here. Many thanks for the great support! :)
Turbofreakdotcom
Experienced MS/Extra'er
Posts: 201
Joined: Mon Sep 15, 2008 9:29 pm

Re: Toyota A340 control

Post by Turbofreakdotcom »

You're welcome and thanks for the invite! :)
Updated 6/20/18:
87 Supra-3.0 1.5JZ-A340 trans
MS2 ECU
MS2 Trans controller
EnergeticMotorsports
Helpful MS/Extra'er
Posts: 110
Joined: Sun Dec 31, 2017 5:59 pm

Re: Toyota A340 control

Post by EnergeticMotorsports »

I have built a module that turns the prnd21 signal from digital to an analog voltage to use less inputs I plan to dig thru code and make it work on the a340f setting as it reads fine one the 4r70w. I made .ini read it on a340f but I have to make firmware read it as well. Seems simple basically same setup as 4r70 w for range position.
EnergeticMotorsports
Helpful MS/Extra'er
Posts: 110
Joined: Sun Dec 31, 2017 5:59 pm

Re: Toyota A340 control

Post by EnergeticMotorsports »

I have wrote some arduino code to do the range position digitally and also it outputs signals for reverse lights and also allows use of a momentary overdrive cancel to work instead of a latching overdrive cancel as my factory shifter it is momentary on my a340f ..

I wrote this code to address my issues with the current firmware. i wish you could choose your outputs and inputs types instead of just the choose your transmission it would make things simpler especially if we are trying to do something slightly different. In the following code i also have pin outs and such to help wire it. i figured this is something that might help people create a solution that is simple digitally with out zener diodes and resistors. always a different way to do this. This code is simple and definitely can be modified to do more. I wish you all luck also this code was written for arduino uno how ever it will work on many other arduino devices. i used alot of digital io to make this happen. Saving space on microsquirt v3 is nice . I realized that i could just fix this in the firmware code but i would need to figure out how to compile it .thanks and best of luck on your a340 series swaps .

note you can also monitor the range you are in in arduino monitor at 9600 baud rate for diagnosis. if you are using the analog out the analog signal is monitored on analog A0 to see what it is output for voltage to verify it is working. This also has a output for a relay to trigger reverse lights in reverse from the digital 0 output.

Digital inputs arduino pin number
odcancel = 1 this is 5volt high when momentary od cancel is pressed
Park = 2 This is 5volt high when in park
Reverse = 3 This is 5volt high when in reverse
Neutral = 4 This is 5volt high when in neutral
Drive = 5 This is 5volt high when in drive
Second = 6 This is 5volt high when in second
First = 7 This is 5volt high when in first

Digital outputs
Reverselight = 0 This is grounded when it is in reverse
Analog out = 10 This is a pwm signal that pulls down 5volt thru a 5k 1/8watt resistor and is smoothed with a 1uf compasitor to make an analog out 0-5 volt range
SelectorA = 11 This is High or low depending on gear position
SelectorB = 12 This is High or low depending on gear position
SelectorC = 13 This is High or low depending on gear position

Analog input

Analog input A0 = A0 this is used for checking the pwm output of pin 10 this is only used for dianosis and can be viewed in arduino monitor or graphed in arduino software to make sure it works


Here is the code

/*This is a PRND21 a340f to 0- 5volt output and selector A B and C digital ouputs going hi
* the need for a input output convertor for the toyota range position is needed for use with the microsquirt v3
* trans controller as the controller doesnt have alot of inputs and software code is rusty in the trans code/
*
* the microsquirt needs 3 selector inputs to know what gear it is in with the a340 series the ecm exspects this
* configuration.
*
* Park R N OD D 2 1
* Selector A 0 1 0 0 0 0 1
* Selector B 1 1 1 1 0 0 0
* Selector C 0 0 0 1 1 0 0
*
* wiring the selector outputs into microsquirt
* pin name color in/out name
* Selector A 12 SPK A (IGN 1) Thick White In Selector pos A
* Selector B 11 SPK B (IGN2) Thick White/Red In Selector pos B
* Selector C 29 SPAREADC Orange/Green In Selector pos C or Analogue gear pos we use the selector thou
*
* sensor gnd 18 Sensor Ground white/black gnd sensor ground
* vref 28 TPS VREF (5V) Gray Out 5V supply for TPS
*
* The overdrive cancel is momentary but its state gets saved until button is pressed again.
*
* Park = digital 2 = 4.195 volts\
* Reverse = digtal 3 = 3.339 volts
* Neutral = digital 4 = 2.596 volts
* Drive = digital 5= 1.847 volts
* 2nd = digital 6 = 1.209 volts
* 1st = digital 7= .602 volts
*
* Connector pinout for a340f
* 1:not used
* 2:2nd gear position
* 3:1st gear position
* 4:5volt in // this pin has a 5k resistor as pullup so if it get shorted it wont pull down 5 volt much
* 5:nuetral safety switch // These are the big wires that the starter signal passes thru
* 6:nuetral safety switch // These are the big wires that the starter signal passes thru
* 7:park position
* 8:Revese position
* 9:Drive position
* 10:Neutral position
*
*
*this outputs data to microsquirt digital signals to an analog signal
* The output is done with a pwm output
*/
//these are used for caculating if overdrive cancel has been pressed as a momentary switch or not
int state = HIGH; //the current state of output pin
int reading; //the current state of input pin
int previous = LOW; //the previous state of input pin
//int outPin = 0; // Overdrive cancel light ouput if needed this is used to ground an led
int odcancel = 1; //this is the overdrive cancel input from 5 volt

//overdrive cancel needs to read low unless pressed and then and only thin it will need to read HIGH

// these are digital inputs from the range position switch These read 5 volt when in gear
int Park = 2;
int Reverse = 3;
int Neutral = 4;
int Drive = 5;
int Second = 6;
int First = 7;

//this are outputs for microsquirt a341 trans 1.0.3 code
int SelectorA = 11;
int SelectorB = 12;
int SelectorC = 13;

//this is a grounded output when in reverse
int reverselight = 0;

//this is pin used to make an analog signal
int voltageOut = 10; // This output will be a pwm out that is hooked to a 1uf compactor and a 5k 1/8watt ohm resistor from the 5 volt rail to make a analog signal instead of digital
float voltage;

// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0; // the last time the output pin was toggled
long debounce = 200; // the debounce time, increase if the output flickers


void setup()
{
//these are digital inputs used to read what gear is used
pinMode(odcancel, INPUT);
pinMode(Park, INPUT);
pinMode(Reverse, INPUT);
pinMode(Neutral, INPUT);
pinMode(Drive, INPUT);
pinMode(Second, INPUT);
pinMode(First, INPUT);

//these are digital ouputs they go hi 5 volt and low is ground
pinMode(SelectorA, OUTPUT);
pinMode(SelectorB, OUTPUT);
pinMode(SelectorC, OUTPUT);
// pinMode(outPin, OUTPUT); // this is overdrive cancel light Will ground light as output high side needs to be 5 volt from arduino as well
pinMode(reverselight,OUTPUT); //this is reverse light output it grounds in revese


//this is for computer serial dianosis it can be checked in arduino monitor to diagnosis it
Serial.begin(9600);

}

void loop()
{
reading = digitalRead(odcancel); // watching the for the overdrive button to be pressed
// if the input just went from LOW and HIGH and we've waited long enough
// to ignore any noise on the circuit, toggle the output pin and remember
// the time
if (reading == HIGH && previous == LOW && millis() - time > debounce) {
if (state == HIGH)
state = LOW;
else
state = HIGH;

time = millis();


// park range is applied
if (digitalRead(Park) == HIGH)
{ analogWrite(voltageOut, 214);
digitalWrite (SelectorA, LOW);
digitalWrite (SelectorB, HIGH);
digitalWrite (SelectorC, LOW);
digitalWrite (reverselight, HIGH);
Serial.println("Park");
}

//reverse range enabled
if (digitalRead(Reverse) == HIGH)
{ analogWrite(voltageOut, 170);
digitalWrite (SelectorA, HIGH);
digitalWrite (SelectorB, HIGH);
digitalWrite (SelectorC, LOW);
digitalWrite (reverselight, LOW);
Serial.println("Reverse");
}

// neutral range output based on if neutral is applyed
if (digitalRead(Neutral) == HIGH)
{ analogWrite(voltageOut, 132);
digitalWrite (SelectorA, LOW);
digitalWrite (SelectorB, HIGH);
digitalWrite (SelectorC, LOW);
digitalWrite (reverselight, HIGH);
Serial.println("Neutral");

}

// 4th gear reading or drive with cancel off
if (digitalRead((Drive) == HIGH )&(state == HIGH))
{ analogWrite(voltageOut, 94);
digitalWrite (SelectorA, LOW);
digitalWrite (SelectorB, HIGH);
digitalWrite (SelectorC, HIGH);
digitalWrite (reverselight, HIGH);
Serial.println("Drive");
}

// For overdrive cancel 3rd gear
if (digitalRead((Drive) == HIGH )&(state == LOW)) //basically it is in drive and it is in od cancel state
{ analogWrite(voltageOut, 94);
digitalWrite (SelectorA, LOW);
digitalWrite (SelectorB, LOW);
digitalWrite (SelectorC, HIGH);
digitalWrite (reverselight, HIGH);
Serial.println("Drive");
}

// 2nd gear range applyed
if (digitalRead(Second) == HIGH)
{ analogWrite(voltageOut, 62);
digitalWrite (SelectorA, LOW);
digitalWrite (SelectorB, LOW);
digitalWrite (SelectorC, LOW);
digitalWrite (reverselight, HIGH);
Serial.println("2nd");
}

// 1st gear range applyed
if (digitalRead(First) == HIGH)
{ analogWrite(voltageOut,31 );
digitalWrite (SelectorA, HIGH);
digitalWrite (SelectorB, LOW);
digitalWrite (SelectorC, LOW);
digitalWrite (reverselight, HIGH);
Serial.println("1st");
}

//we check the analog output by watching it on analog 0
int sensorRead = analogRead(A0);
float voltage = sensorRead * (5.0 / 1023.0); //apply math to the 10 bit ADC to convert it to voltage from 1024 bits
Serial.println(voltage); //read the output in the monitor in arduino

//output for overdrive cancel light
// digitalWrite(outPin, state);

// this is used for the next caculations of overdrive cancel
previous = reading;

}
}
Post Reply