• Steel Soldiers now has a few new forums, read more about it at: New Munitions Forums!

  • Microsoft MSN, Live, Hotmail, Outlook email users may not be receiving emails. We are working to resolve this issue. Please add support@steelsoldiers.com to your trusted contacts.

Arduino 4L80e controller

patracy

Administrator
Staff member
Administrator
14,639
4,811
113
Location
Buchanan, GA
I've pretty much decided that the 4L80e is the path I'm going to take with my CUCV. But the $600+ for a controller stings. I've been tinkering with a arduino to control it. Right now this is only a proof of concept. The LEDs would actually be IRF540's to control the solenoids. There actually needs to be a 4th as well for the line control, but I'll just live with firm shifts for now. What I have envisioned is to add a LCD screen (simple monochrome one) to display the transmission gear, mode, RPM, trans temp, maybe MPH. What will be needed for automatic shifting would be a TPS, engine RPM, and VSS. I know a 6.5TD TPS should be useable. The RPM could be had by swapping out the "distributor" with a 6.5TD as well. The VSS would probably need to be a inline adapter from dakota digital. Or if you're swapping in a later model t-case, you'd have a VSS. (But you'd need to deal with the speedo for a CUCV with either a GPS unit, a digital to cable adapter, or a speedo that uses a signal instead) I'd like to add a tow/haul button where 3rd gear also locks TCC after delay. As well as button to cycle through modes. (Auto/Manual) I'm wanting this to all be open source, so anyone else wanting to help on this, please feel free to help/share.

https://www.youtube.com/watch?v=FWxGnakPIFo

Here's the initial code:
Code:
#define NUM_FWD_GEARS               4       //#     number of forward speeds

#define BUTTON_READ_INTERVAL        50ul    //mS    time between up/down button reads

#define NO_PRESS                    0x00    //mask  bit mask for no buttons pressed
#define BUTTON_UP_PRESSED           0x01    //mask  bit mask for up button pressed
#define BUTTON_DOWN_PRESSED         0x02    //mask  bit mask for down button pressed

#define TCC_DELAY                   1000ul  //mS    after TCC is enabled, time delay before activation

const byte buttonUP = 2;                    //pin   Push Button for UP shift
const byte buttonDOWN = 4;                  //pin   Push Button for Down shift
const byte solA = 3;                        //pin   Solenoid A output
const byte solB = 5;                        //pin   Solenoid B output
const byte TCC  = 6;                        //pin   TCC output
const byte modeswitch = 7;                  //pin   Switch for tow/haul mode

byte
    gearSelection,
    lastGearSelection,
    lastUp,
    lastDn;
bool
    bTCCStatus;
unsigned long
    timeTCCSolenoid;

typedef struct structGearSolenoidProfiles
**
    byte    solenoid_A;
    byte    solenoid_B;
    bool    bEnableTCC;
   
}sGearSolenoidProfiles;

//
// How does Arduino know reverse, park or drive?
//
const sGearSolenoidProfiles GearSolenoidProfiles[NUM_FWD_GEARS] =
**
    **
        //1st
        .solenoid_A = HIGH,
        .solenoid_B = LOW,
        .bEnableTCC = false
    },
    **
        //2nd
        .solenoid_A = LOW,
        .solenoid_B = LOW,
        .bEnableTCC = false
    },
    **
        //3rd
        .solenoid_A = LOW,
        .solenoid_B = HIGH,
        .bEnableTCC = false
    },
    **
        //4th
        .solenoid_A = HIGH,
        .solenoid_B = HIGH,
        .bEnableTCC = true
    }
   
};//GearSolenoidProfiles[]

void setup()
**
    pinMode( buttonUP, INPUT_PULLUP );
    lastUp = digitalRead( buttonUP );       //set initial button state
    pinMode( buttonDOWN, INPUT_PULLUP );
    lastDn = digitalRead( buttonDOWN );     //set initial button state
   
    pinMode( modeswitch, INPUT );           //modeswitch set as input
   
    pinMode( solA, OUTPUT );                //Solenoid A set as output
    pinMode( solB, OUTPUT );                //Solenoid B set as output
    pinMode( TCC, OUTPUT );                 //TCC set as output

    digitalWrite( solA, LOW );             //set intital state as off
    digitalWrite( solB, LOW );
    digitalWrite( TCC, LOW );

    //internal flag for TCC status
    bTCCStatus = false;
    gearSelection = 0;          //start in "1st" gear for this test
    lastGearSelection = 0xff;   //ensure we change into correct gear first pass by making last != current
   
}//setup

void loop() 
**
    Gear_Selection_Control();
    Gear_Solenoid_Control();
    TCC_Control();
   
}//loop

void Gear_Selection_Control( void )
**
    byte
        btnState;
       
    btnState = ReadButtons();
    switch( btnState )
    **
        case    NO_PRESS:
            //nothing pressed or not read (interval not elapsed); no action
        break;

        case    BUTTON_UP_PRESSED:
            if( gearSelection < (NUM_FWD_GEARS-1) )
                gearSelection++;
           
        break;

        case    BUTTON_DOWN_PRESSED:
            if( gearSelection > 0 )
                gearSelection--;
               
        break;

        default:
            //only remaining possibility is both pressed; ignore with no action
        break;
       
    }//switch
   
}//void
   
void Gear_Solenoid_Control( void )
**
    if( gearSelection != lastGearSelection )
    **
        lastGearSelection = gearSelection;
        digitalWrite( solA, GearSolenoidProfiles[gearSelection].solenoid_A );
        digitalWrite( solB, GearSolenoidProfiles[gearSelection].solenoid_B );

        //if the gear just selected enables the TCC, start the hold-off timer
        if( GearSolenoidProfiles[gearSelection].bEnableTCC == true )
        **
            timeTCCSolenoid = millis();
           
        }//if
       
    }//if
   
}//Gear_Control

void TCC_Control( void )
**
    //is TCC now off?
    if( bTCCStatus == false  )
    **
        //is TCC enabled?
        if( GearSolenoidProfiles[gearSelection].bEnableTCC == true )
        **
            //has hold-off time passed?
            if( millis() - timeTCCSolenoid >= TCC_DELAY )
            **
                //turn on TCC
                digitalWrite( TCC, HIGH );
                bTCCStatus = true;
           
            }//if
           
        }//if
       
    }//if
    else
    **
        //TCC is on now; is TCC disabled now?
        if( GearSolenoidProfiles[gearSelection].bEnableTCC == false )
        **
            //turn off TCC
            digitalWrite( TCC, LOW );
            bTCCStatus = false;
           
        }//if
       
    }//else
   
}//TCC_Control

//returns a mask:
//0b00000000 - no buttons pressed
//0b00000001 - up pressed
//0b00000010 - down pressed
//0b00000011 - both pressed
//
byte ReadButtons( void )
**
    static unsigned long
        timeButton = 0;
    unsigned long
        tNow;
    byte
        retval,
        nowButton;

    retval = NO_PRESS;
   
    tNow = millis();
    if( (tNow - timeButton) >= BUTTON_READ_INTERVAL )
    **
        //set up for next read interval
        timeButton = tNow;

        //read the button and set the flags
        nowButton = digitalRead( buttonUP );
        if( nowButton != lastUp )
        **
            lastUp = nowButton;
            if( nowButton == LOW )
                retval |= BUTTON_UP_PRESSED;
               
        }//if
       
        nowButton = digitalRead( buttonDOWN );
        if( nowButton != lastDn )
        **
            lastDn = nowButton;
            if( nowButton == LOW )
                retval |= BUTTON_DOWN_PRESSED;
               
        }//if
       
    }//if
   
    return retval;
   
}//ReadButtons
 

patracy

Administrator
Staff member
Administrator
14,639
4,811
113
Location
Buchanan, GA
Also I'm going to post a link over in the HMMWV section since this could also be used there too.
 

richingalveston

Well-known member
1,715
120
63
Location
galveston/Texas
I have an early model US shift. I only use the TPS and the RPM. The RPM comes from the dakata digital. The 6.5 TPS works with the controler
It works really good but does have harder downshifts. To upgrade to the newer US shift controler I beleive I have to add the VSS signal and then I can adjust the down shifting to be softer.
 

jnissen

Member
42
28
18
Location
Austin/TX
I see a few others have tried to use an Arduino to control the transmission. I only caution you to filter your inputs both electrically and digitally (average readings). I’m a 30 year electrical engineer and have done plenty of Arduino projects. If this is your first or second project you will have a steep learning curve. Can certainly be done. Just look over plenty example code. Avoid the projects that simulated a transmission with switches or sensors. The real world can be cruel so your code has to be robust enough to handle that. Consider a watch dog timer in case you get a glitch and the controller looses its mind. Easy to reboot on a bench, quite another with 1000,s of pounds rolling down the highway!




Sent from my iPhone using Tapatalk
 

patracy

Administrator
Staff member
Administrator
14,639
4,811
113
Location
Buchanan, GA
I see a few others have tried to use an Arduino to control the transmission. I only caution you to filter your inputs both electrically and digitally (average readings). I’m a 30 year electrical engineer and have done plenty of Arduino projects. If this is your first or second project you will have a steep learning curve. Can certainly be done. Just look over plenty example code. Avoid the projects that simulated a transmission with switches or sensors. The real world can be cruel so your code has to be robust enough to handle that. Consider a watch dog timer in case you get a glitch and the controller looses its mind. Easy to reboot on a bench, quite another with 1000,s of pounds rolling down the highway!

Sent from my iPhone using Tapatalk
Certainly. The default start/failsafe setting will also be 2nd gear/TCC unlocked. But this code (and I can't stress it enough) is JUST for a proof of concept for now. The TPS, Engine RPM, and VSS will all be added onto this. So I'll probably end up using the 5V side of it for reference and use a lot of filtering caps on the voltage converter side of things. While things will share the chassis ground, that will help isolate it from the fluctuation of the 12v side of the vehicle. And certainly use twisted pair for the wiring of those input signals. It might be a good idea outside the failsafe to check VSS speed and spec a gear based on speed as well for the second default. The manual mode certainly needs some logic built out for the downshift. If RPM > X then disallow downshift until RPM < X, and the same applied to MPH.
 

jnissen

Member
42
28
18
Location
Austin/TX
Yeah good idea to validate on the bench first. If you have some experience with the Arduino then consider an ESP 8266 or ESP 32 for the controller. A lot faster and allows for WiFi and or Bluetooth control (in 32). After you have it in the vehicle you will want to tailor limits, observe operation, etc... The Standard Arduino works but having a serial/USB connection all the time can be problematic. Also consider the size of your final code. A Mega may be a better fit (256K I believe) or the ESP8266/32 as they have several MB of code storage.


Sent from my iPad using Tapatalk
 

patracy

Administrator
Staff member
Administrator
14,639
4,811
113
Location
Buchanan, GA
I might move up to the mega, but thus far at least for the manual control, the code takes up 4% of a uno. I'm sure when I start fleshing this out with more functions, that space will be gobbled up. I'm thinking about later versions with the LCD screen and having inputs to toggle through RPM shift point selections and such. This is all much further down the road of course. I'm working now on adding a tow/haul mode for this current version that will allow the TCC to lock in 3rd as well as 4th with the delay.

This project I guess will move along faster than I planned too in some aspects. I planned on having the controller 100% before I even got a transmission. But I've found a takeout locally for $500 with a warranty so I'll be picking it up in a week or so and starting the swap. At least with what I have I'll be able to manually drive the truck.

I've kinda had some other ideas too. Since I'll have the display, why not display RPM, TPS, Gear, Mode. But I could easily add on code to use the internal trans temp sensor. As well as use two other ports to add in a themocopule probe as well as a map sensor for boost. The display might end up going over to a OLED or something more than a 16x2 that I had planned. Heck, I could add a temp sender, oil pressure sender and monitor those values on the screen too. Maybe I should focus on the trans control first LOL.
 

sweetk30

Member
316
6
18
Location
horseheads,ny 14845
the usshift unit is a real nice setup for plug and play . the quick 4 unit gives you 4 pre saved shift programs and shift on the fly for changing them .

also as another member mentioned if you have a old quick 1 unit you can send it in and for a small fee it will be updated to the quick 4 system and shipped back .

the units have a LOT of options and the program for adjusting them is real nice . you can down load the program and play with it before you ever purchase the unit .

but PLEASE do keep us posted on this setup your playing with .
 

patracy

Administrator
Staff member
Administrator
14,639
4,811
113
Location
Buchanan, GA
Just looked at that kit.

$585 for the unit. $140 for the harness. $100 for the TPS.

Uno $10
3d printed case $0
LCD screen $10
4L80e plug/pigtail from junkyard $10
Shield prototype board $2
IRF540's $10
VR, buttons, misc $10
GM TPS $40

Basically about $100 in hardware.
 

sweetk30

Member
316
6
18
Location
horseheads,ny 14845
but how many people can put all that together and make it work ?

for a nice super kit the usshift i think has it covered .

your kit for the diy guy that can do it prob has it covered .
 

patracy

Administrator
Staff member
Administrator
14,639
4,811
113
Location
Buchanan, GA
I'm posting the code. I'll post the schematic as well when it's done. It's not complex at all. Not sure why you're pushing the us shift kit when the entire point of the thread is to open source/DIY.
 

jnissen

Member
42
28
18
Location
Austin/TX
I believe he’s just offering a commercial alternative. The headaches have already been encountered so there is a dollar amount for that!

I encourage you to go down the DIY path but in my opinion most DIY efforts often fall short. Not a reflection of you. Just in general I’ve seen few be as complete as commercial offerings. Then again some DIY blow away what may be commercially available. Let hope your the latter!


Sent from my iPhone using Tapatalk
 
Last edited:

wheelspinner

Well-known member
Steel Soldiers Supporter
3,748
1,519
113
Location
North Carolina - FINALLY !
Just looked at that kit.

$585 for the unit. $140 for the harness. $100 for the TPS.

Uno $10
3d printed case $0
LCD screen $10
4L80e plug/pigtail from junkyard $10
Shield prototype board $2
IRF540's $10
VR, buttons, misc $10
GM TPS $40

Basically about $100 in hardware.
Wow that's a huge leap. Build 2
 

richingalveston

Well-known member
1,715
120
63
Location
galveston/Texas
i have the us shift but look forward to seeing your finished product. I like to see do it yourself projects even if i do not use it.
just for the info., the us shift works fine with the gm TPS you do not have to buy theirs. Also you may want to check on the 4l80e wiring harness. There is an older and newer version. The older version was prone to leaking at the connection. I am pretty sure it is just the internal wiring harness and the external pig tails are the same but when you get your 4l80e built make sure they use the newer harness.

from what I understand, you can control the 4l80e manually with two switches. I have not done it yet but would like to know how to build it. I would like a small manual controller I can throw in the glove box just in case my controller fails. even if I have to run the wires though the window to the tranny, it would be nice not to have to limp home in second gear because my controller failed.

Thanks for the info you are posting.
Rich
 

Chaski

Active member
684
56
28
Location
Burney/CA
You could make input/output ratio based slip detection, temperature based failsafes, all kinds of cool stuff. I’ll probably go down the 4L80E path someday, after seeing how versatile and easily tuned electronic vs hydraulic transmissions are first hand I don’t ever want to mess with dropping a pan or fooling with governor springs and weights again for tuning. Keyboards are much cleaner...
 

cucvmule

collector of stuff
1,155
591
113
Location
Crystal City Mo
There are so many things that have been worked out with the 80 that have cost cash to fix when things went sour. The suggestion of buying the kit is just that, a suggestion. The problems have been for the most part re engineered to make the swap more trouble free.

There are different ways of really doing the same thing, but cost may be the real engineering factor. I like the idea of finding a different , or cheaper way of using more up to date hardware. However, to collect data that is useful without damaging the trans and continue to make headway will cost time, and parts if the processing data is not as useful as proposed.

There is a lot of information that has already been worked out by transmission companies that have ruined many transmissions in their quest to adapt the 80 into a more useful slushbox.

I say give it a go but be ready to change out e-parts when they get cooked.
 

patracy

Administrator
Staff member
Administrator
14,639
4,811
113
Location
Buchanan, GA
You could make input/output ratio based slip detection, temperature based failsafes, all kinds of cool stuff. I’ll probably go down the 4L80E path someday, after seeing how versatile and easily tuned electronic vs hydraulic transmissions are first hand I don’t ever want to mess with dropping a pan or fooling with governor springs and weights again for tuning. Keyboards are much cleaner...
Agreed! The older I get, the less I want to do things the hard way.
 

patracy

Administrator
Staff member
Administrator
14,639
4,811
113
Location
Buchanan, GA
The problems have been for the most part re engineered to make the swap more trouble free.
There's nothing done to the actual transmission or valve body for a 4l80e swap. Not sure what exactly you mean by re-engineered. None of the controllers out there have any special magic on how they control the transmission or in any way make it function differently.
There are different ways of really doing the same thing, but cost may be the real engineering factor. I like the idea of finding a different , or cheaper way of using more up to date hardware. However, to collect data that is useful without damaging the trans and continue to make headway will cost time, and parts if the processing data is not as useful as proposed.
There is a lot of information that has already been worked out by transmission companies that have ruined many transmissions in their quest to adapt the 80 into a more useful slushbox. [/QUOTE]

Good thing I get to skip over that part. www.alldata.com has all the shift information already documented.

I say give it a go but be ready to change out e-parts when they get cooked.
Glad that buying company X's controller will absolutely insure that nothing bad could possibly happen.
 
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features of our website like our supporting vendors. Their ads help keep Steel Soldiers going. Please consider disabling your ad blockers for the site. Thanks!

I've Disabled AdBlock
No Thanks