Lil' Blackbox

Coding => v1.0 - v1.1 => Topic started by: Rx7man on May 27, 2015, 09:09:36 AM

Title: My life, My coding
Post by: Rx7man on May 27, 2015, 09:09:36 AM
OK, since I have ADD when it comes to coding, and always float around in my projects, here's a place I'll be posting my code, whatever section of project it belongs to

This morning's breakthrough.. I got a preliminary working test of my live tuning working... I was able to change the map values over the serial port.. it takes a lot of parsing.. and I will yet set some of the parameters in stone.

Attached is the project, I have it set to not read from EEPROM at this point because you won't have any valid data in there to load anyhow.
So here's how I have the data structure laid out so far when sent from the serial monitor

int Command, int Address, int Value
to read a variable, the low bit of Command is 0, to write the bit is 1
The high byte of the address currently refers to which data structure to read from (0000 0001 for Boostmap), and the low byte the address of the map (0 to 9*14)

So to write 60 to map address 4 (Row 0, column 4) send the following via the serial monitor
1,260,60
to read it
0,260,0

When reading, it is still required to specify the value, but it is ignored
Title: Re: My life, My coding
Post by: Rx7man on May 31, 2015, 11:43:09 AM
Update... VB now populates the cell values and correctly writes updated values to the map.. it is certainly a beta version, and I will *try* to find a better programatic way of addressing, either with bitflags or something to reduce the number of if-then-else and switch/case statements to reduce Arduino load, but this works for now.. I will also have to look at setting up an interrupt to write to the CAN bus, but that's a ways off yet.

I had a bit of an issue because I still wanted to print out debug statements to the serial port, but be able to separate the debugging lines from the data lines, so for now I have data lines starting with "Data:" and it's parsed out in the VB code easily enough.  I will also have to figure out how to switch between different maps, and maps of different sizes... I currently have a control array of textboxes, I may have to try and use datagrids instead
Title: Re: My life, My coding
Post by: Rx7man on June 01, 2015, 01:01:20 AM
Still to be tested, I put this in a function that will be used when reading in most analog inputs, and probably some outputs as well.. I just find it ties everything into one neat little function, even though it does take a bit of time to execute, it may be worth it.

Code: [Select]
float GetSmoothedValue(float Newvalue, float NewvalueOldvalue, float smoothing, float Minchange, float Maxchange) {
  //provides a decaying infinite average.. Smoothing goes from 0 to 1, where 0 will yield an unchanging output! (you have been warned)
  //depending on read frequency and desired aggressiveness  The benefit to this method
  //is it doesn't require an array to hold the history
  //The Deadband will prevent any change at all below a certain value (You have been warned)
  //MaxChange will limit the maximum change any given iteration... Make sure it is bigger than the deadband (You have been warned)

  smoothing = constrain(smoothing, 0, 1); //funky stuff can happen if we're not within bounds

  float returnval = (Newvalue * smoothing) + (Oldvalue * (1 - smoothing));

  float change  = abs(returnval - Oldvalue);

  if (change < Minchange) {
    return Oldvalue; //If the change isn't big enough, return the old value
  }
  else if ( change > Maxchange) {
    returnval = constrain(Newvalue, Oldvalue - Maxchange, Oldvalue + Maxchange); //otherwise constrain it to the max values
  }

  return returnval;
}

then I have different smoothing, minchange and maxchange values for every different input to tailor the response curve.


Next I will work on a function to linearize/delinearize, which I have used before.. it's especially handy when you have something you'd like to look linear which isn't.. perfect example is the VGT nozzle size where a small change at wide open is negligible, while a small change near closed is significant.. I'll just have to port it out to C++.
Title: Re: My life, My coding
Post by: Rx7man on June 02, 2015, 09:28:12 AM
Here's the code for recurving

Code: [Select]
float MyVar::RecurvedValue() {
  //Returns a recurved value between Min and Max
  float tempval = mapf(Storage, MinValue, MaxValue, 0, 1); //remap from min -> max to 0->1
  tempval = pow(tempval, Response);                  //recurve
  tempval = mapf(tempval, 0, 1, MinValue, MaxValue); //unmap it back from 0->1 to min->max
  return tempval;
}


To prevent getting huge numbers, overflows, etc, I map the value so it can only fall between 0 and 1, which makes the output of the power function fall between 0 and 1 as well, after that I remap it back to it's original bounds.
if you want a quick response at the top end, use a Response value of about 2 (squaring it).. A linear response uses 1, and a Square root response (quick near 0) is 0.5

I have all this in a class right now, but I'm fighting another weird bug in the arduino.. my loop times are wildly varying... Sometimes it's doing 60000 loops per second, then it'll fall on it's face and only do 60... don't know what gives yet.
Title: Re: My life, My coding
Post by: hakcenter on June 02, 2015, 09:57:37 AM
What is your full arduino code ?
Title: Re: My life, My coding
Post by: Rx7man on June 02, 2015, 11:30:28 AM
I'll post it when it's a bit more completed, and commented.. Right now I'm just trying ideas out for certain things
Title: Re: My life, My coding
Post by: Rx7man on June 02, 2015, 12:06:02 PM
Oh, and I should mention something too.. Not to be offensive, but I'm only glancing over the code you folk are posting here, the reason being I'd like to write something unique, problem-solve (at this point only in theory since I don't have the hardware yet), and try to find other ways to do things... Once I get my software a little more ironed out, and at least basically functional, I'll gladly try and study other code.
Cheers :)
Title: Re: My life, My coding
Post by: Rx7man on June 02, 2015, 01:57:46 PM
Oh the joys of OO programming, when you get it to work!

So all my input variables, as well as some of the output variables (like VGT position, AFC position) are of my own data type.. a type which keeps track of the update times, smooths out the jitter, limits the rate of change (min and max), and limits the extents..  It also recurves from linear to non-linear, so you can get a faster response at one end than the other.  Not only that, but it also calculates the acceleration and rate of acceleration, which could be very handy later when optimizing VGT nozzle size for best spoolup.. but I'm not at that point yet.. for now it's just really neat.

For example with the minimum change, you apply a deadband, so it won't move unless it's a certain amount greater than the last value, excellent for minimizing VGT workload, the maximum change is good to prevent overshooting a target and preventing hunting for a setpoint.  VGT example of that would be greater motion when it's wide open than when it's near closed, despite the rest of the code staying linear (which is easier that way)

I know that if I did have everything set up in my truck, I wouldn't be playing around with the code so much and adding so many features :P (aka bugs)
Title: Re: My life, My coding
Post by: Rx7man on June 02, 2015, 02:58:21 PM
OK, so here's a sneak peek...

digital pins 2 and 3 are for RPM sensors, I have them wired to pins 12 and 13 that I toggle on and off to simulate an input.

Analog pin 0 is wired to a 0-5V pot and simulates TPS position, this you will see in the serial monitor (115200 baud) when you sweep the pot.. you will see the raw TPS value, smoothed value, as well as the slope and rate of change of slope...

I commented out some parts in the Constants file that are incompatible with non-Mega2560's... specifically the definition of analog input pins A8-15

To play with the smoothing settings, look in the "Initialization" tab, modify whatever.. I haven't implemented "Multiplier" yet though.

I also just added a bunch of boolean checks in "MyVar.h" that can disable deadband and limit enforcing, as well as disabling the slope calculations to save some CPU cycles on variables that really don't need it.

You will notice I also only read my analog inputs once, but do a bit of stuff between reads.. It appears to be pretty steady, on my pot on A0 I get at most a 1 ADC point fluctuation, and that's to be expected really
Title: Re: My life, My coding
Post by: hakcenter on June 02, 2015, 08:14:22 PM
Semi complicated.

Remember division is slow, so avoid it and use bitwise if at all possible.
Title: Re: My life, My coding
Post by: Rx7man on June 02, 2015, 09:20:21 PM
it is, but unless you just happen to be dividing by 2, you gotta do it the long way...

I also read somewhere that as long as the code fits onto the unit, and can keep up with what it needs to do, optimizing more than that is a waste of energy... Of course you don't want to deliberately write bloated or inefficient code, but there comes a time when you shouldn't worry too much about it


Semi-complicated... that's because I'm not done with it yet :P
Title: Re: My life, My coding
Post by: hakcenter on June 02, 2015, 10:20:52 PM
Division is so much slower, it isn't funny. If you land in a spot where you're doing a ton of division in 1 iteration, that could very well be where the super slow down is. It is multitudes slower.

You can do, divide by 6, multiply by 2. to get division of 3. So there are sneaky ways to do bitwise.

x / 3 = ((x >> 2 + x >> 1) << 1) as an example. ( x / 6 ) * 2

Which if you add up the time, 7,792 us is faster than 153,236 us

Faster code Fridays: Understand division and speed of operations | EngBlaze (http://www.engblaze.com/faster-code-fridays-understand-division-and-speed-of-operations/)
Quote
[...]
Running the division test again, we reach completion in 153236 us, the same as our original case. This makes sense; if the compiler wasn’t optimizing the division code to begin with, adding an empty assembly instruction wouldn’t affect the compiled code at all.

For the multiplication test, each run now completes in 3896 us. Holy difference-maker, Batman. That’s blazing fast. It also is much more realistic than the first case, suggesting that our compiler trick worked and the loops are no longer being optimized away.

The end result is that multiplication is 97.46% quicker, or alternatively, 39.3x faster than division in this case. Interestingly, results for addition and subtraction were exactly the same: 3896 us per test.
Title: Re: My life, My coding
Post by: Rx7man on June 02, 2015, 11:30:47 PM
If working with floats... is division still slower than multiplication?

I guess the best way to minimize divisions is to refactor your code to minimize them...

Such as 1/10+2/10+3/10 would be the same as (1+2+3)/10... However.. lets say it's (1.0+2.0+3.0)/10.0.. would you gain much by getting rid of the division, and writing (1.0+2.0+3.0)*0.1 ?


Oh, I forgot to mention.. I found my terrible slowdown... it's amazing how much you can optimize your code and still have it run slow when you forgot about a delay(100) in it!!


Meanwhile, I've made a very preliminary  VGT logic, which doesn't do braking yet..

Code: [Select]
//the following values are all wild guesses..  There's a CERTAINTY that some will need to be negative, and some may be zero
//for example with the EGPV we aren't concerned about what the actual number is, but rather to maximize it, in which case
//the slope and rate of change of slope may be of greater interest... at least in theory

float MAPsensitivity = .1;
float MAPslopeSensitivity = .1;
//float MAPdeltaSlopeSensitivity = .1; //I don't think I'll need this here

float DPRsensitivity = .1;
float DPRslopeSensitivity = .1;
float DPRdeltaSlopeSensitivity = .1;

float EGPVsensitivity = .1;
float EGPVslopeSensitivity = .1;
float EGPVdeltaSlopeSensitivity = .1;

float TSSoverRevSensitivity = 10;
float TSSunderRevSensitivity = 10;

float TSSoverRevSlopeSensitivity = 10;
float TSSunderRevSlopeSensitivity = 10;

float TSSmaxShaftSpeed = 150000;
float TSSminShaftSpeed = 60000;
int GetNewVGTposition() {


  //This is the main component controlling the VGT, thus the largest values ought to be for this
  float BoostCompensation = (MAP.Value() - DesiredBoost.Value() * 4) * MAPsensitivity + (MAP.Slope - DesiredBoost.Slope * 4) * MAPslopeSensitivity;

  //Seems as though Drive pressure ratio is a big deal, and should be kept around 1.0, so I'd expect moderate values
  float DPRcompensation = (1 - DPR.Value()) * DPRsensitivity + DPR.Slope * DPRslopeSensitivity + DPR.DeltaSlope * DPRdeltaSlopeSensitivity;

  //Exhaust gas pressure*volume/nozzle size... the hope here is to maximize it thus maximizing acceleration of the turbine
  float EGPVcompensation = EGPV.Value() * EGPVsensitivity + EGPV.Slope * EGPVslopeSensitivity + EGPV.DeltaSlope * EGPVdeltaSlopeSensitivity;



  float TSScompensation;
  //A little more complicated is the turbine shaft speed limits
 if (TSS.Value() > (TSSmaxShaftSpeed -10000)) {
    TSScompensation = mapf(TSS.Value(), TSS.MaxValue-10000, TSS.MaxValue, 0, TSSoverRevSensitivity);
    TSScompensation += TSS.Slope*TSSoverRevSlopeSensitivity;
   
 }else if (TSS.Value() < TSSminShaftSpeed){
    TSScompensation = mapf(TSS.Value(), TSSminShaftSpeed, TSSminShaftSpeed/2, 0, TSSunderRevSensitivity);
    TSScompensation += TSS.Slope*TSSunderRevSlopeSensitivity;
 }
   
  int NewVGT = VGT.Value() + BoostCompensation + DPRcompensation + EGPVcompensation + TSScompensation;

  VGT.UpdateValue(NewVGT);
}

float GetNozzleSize(int VGTposition) {
  //returns the nozzle size in Cm^2
  //so a VGT position of 458 will return 15
  return mapf(VGTposition, 40, 960, 25, 3);
}


And on the bright side, I'm starting to be able to write more than one line of code at a time without screwing up the syntax... though to go as far as to say "C++ is growing on me" would be a stretch.
Title: Re: My life, My coding
Post by: hakcenter on June 03, 2015, 12:50:22 AM
The  AVR simply doesn't have any division help at all,  regardless of type.

Floats / doubles same size and speed of eacb other...  I think floats end up still being as accurate as doubles actually.


But ya if you're doing division of 10,  x >> 4 + x >> 2 + x >> 1.

I don't think fraction multipication is any faster...  Would have to time it. And add an empty opcode to make sure code optimiser ignores to verify speed
Title: Re: My life, My coding
Post by: Rx7man on June 03, 2015, 08:30:19 PM
According to the arduino documentation I read, floats ARE doubles.. Same structure with a different name..

I wish they had 16 bit floats though.. that would be good enough for me in ALL my calculations.. ALAS.. no such luck.. I'll have to write my own!


Meanwhile, we had some rainy weather here and I took advantage of that to work on more code...
Trailer brake controller is done.
VGT control is done, but evidently will need tweaking.. lots of it
VGT has normal mode, warmup mode (increases backpressure), and jake mode

AFC control is done.. again lots of tweaking will need to happen
Cruise control is in progress, will be done once I stop surfing... I'm getting the hang of these outputs.. they all have PID controls on them and feedback loops, greatly facilitated with the "MyVar" class that calculates slope over time regardless of when you're updated it (it keeps track of the last update time).

I'll post an update tonight.
Title: Re: My life, My coding
Post by: Rx7man on June 03, 2015, 09:35:24 PM
I also want to change a bunch of the program flow... for example I have a whole bunch of stuff I want to do every 100millis.. but I think it would help the processor if I didn't do them all on the same 100 millisecond interval.. so I'll split it into 10 millis and do something different every time.

I'm still trying to wrap my head around how I'm going to update this all via serial.. especially the floating point stuff.. Just keeping track if it is going to be a nightmare, so I think I'm going to start a new minor version soon.. I'll have an array of ints that will hold ALL the global ints, with an enumerator so i can keep track mentally of which is which..  Repeat for the floats and bytes.. that will make serial parsing SO much easier as I'll just be able to reference it by index rather than having a million damn "if" statements... Another good thing is the enumerators copy over to VB very nicely, just have to remove the semicolons and you have the VB version, so I don't get confused that way either.
Title: Re: My life, My coding
Post by: Rx7man on June 03, 2015, 10:42:26 PM
OK, here's 1500 lines of code so far, and I don't have the serial parsing done yet or the EEPROM saving.. I forecast another 500 lines for that, but that'll only happen after the rewrite I mentioned before.




Take a look at it and tell me what you think
Title: Re: My life, My coding
Post by: Rx7man on June 08, 2015, 12:47:53 AM
You folks have sure been quiet recently..

Anyhow, I have a ton of outdoor work to do.. like going around a field 100 times cutting hay.. It gives me lots of time to think about how I'm going to solve a problem.

So I put pretty much all my global float typed variables into an array that I'm accessing by using an enumerator.. It is not helping readability on things that span 2 lines as it is, but I think in the long run it'll pay off, especially when trying to update stuff over serial port, and getting information back to the laptop.. I don't think I'll have the arduino send much periodic information over the serial port by default.. perhaps a few basics, RPM, boost, VGT position, but all the other advanced stuff the laptop will send a request for.  I really want to see how the PID system I have works, all I can say is I'm hopeful!...

The math is really complicated, and a lot of the PID components will probably be unnecessary in the final version, but it's easier to put them all in and set their sensitivity to 0.. I think for tuning I will start with all Proportional sensitivities at 1, and integral and derivative sensitivities at 0, then if it's too laggy, overshoots, or doesn't ever get to the setpoints, I can play with the 'I' and 'D' components
Title: Re: My life, My coding
Post by: hakcenter on June 08, 2015, 05:46:17 PM
sometimes life gets you down haha
Title: Re: My life, My coding
Post by: Rx7man on June 08, 2015, 10:04:36 PM
Yep, life gets in the way of doing what you want to do

I bought the  piece of tubing today I'm going to use to make my downpipe.. 4" all the way.. the turbo V band flange I'm going to cut myself on the lathe so it fits nice, and then I should be ready for the physical installation.. Yes, I need to get more stuff :rolleyes:
Title: Re: My life, My coding
Post by: hakcenter on June 09, 2015, 01:45:35 PM
The 4" i got from DAP, barely BARELY fits. I mean like 1/16" between frame and transmission!
Title: Re: My life, My coding
Post by: Rx7man on June 09, 2015, 01:57:25 PM
On mine all but the very first part of the DP is 4", and it fits nicely.. perhaps the routing is a bit different?
Title: Re: My life, My coding
Post by: Rx7man on June 09, 2015, 01:59:58 PM
damn it's been hot here.. we had 100F in the shade yesterday, about 96 today, I was up til 4AM baling hay and in a T shirt the whole night.. was hoping for a touch of dew but that wasn't happening.. another couple days of this grind and it's done for a while.. then the irrigation goes like mad again
Title: Re: My life, My coding
Post by: Rx7man on June 10, 2015, 05:24:48 PM
Well, I ran into something that is going to cause me problems down the road with the serial interface... not sure how I'm going to deal with it yet.. Serial.parseInt is a blocking function, which will wreak havoc in the timing of everything else, so I may have to do some serious thinking about how I'm going to work around it.. *grumbles*

I'm thinking of sending everything in binary format, but that makes for unreadable transfers, and in integer form I run into problems too
Title: Re: My life, My coding
Post by: hakcenter on June 10, 2015, 05:38:42 PM
but blocking is super cool  :o
Title: Re: My life, My coding
Post by: Rx7man on June 10, 2015, 07:50:37 PM
I hear Lego blocks too

it was another day of 96F, I was up til 4 am last night, and will be again tonight... and tomorrow night.. *sigh*...
Title: Re: My life, My coding
Post by: Rx7man on June 15, 2015, 02:44:14 PM
Well, the haying is done.. now it's back to watering...

I spent a couple hours today on the lathe, I made my downpipe adapter, looks pretty good, and fits properly.. 4" is going to look huge in comparison to the 2 1/2 or whatever the HX35 is... I'll try and post a pic later.
Title: Re: My life, My coding
Post by: hakcenter on June 15, 2015, 06:49:26 PM
Oh it's massive! I think the stock dp is like 3" at best.

You might want to like... make more on the lathe for other people that can't actually get a 351ve v-band cause all anyone sells is the cw's and calls it he351.

Btw you make me peanut butter and jelly having a lathe. I need a mill first... but damnit I should have a lathe too
Title: Re: My life, My coding
Post by: Rx7man on June 15, 2015, 07:21:24 PM
The lathe is so nice to have.. I probably spend 100 hours on it a year.. and I'm supposedly a farmer... The adapter I made doesn't have a perfectly smooth finish like a CNC lath would have, but it'll do the job.  The lathe I have is a 40" bed, 10" max swing.. it's a taiwanese lathe, it came from the high school I went to... I have a VFD controlling the 3hp motor on it.. we don't have 3 phase power here, so we needed a drive for it anyhow, and well.. a nice Allen Bradley wasn't needed at a jobsite and it found it's way home here.. SUPER nice to get just the right cutting speed... though I do have to invest in more tooling for it, especially boring bars and carbide tool holders.

Since the mandrel bends aren't actually 4" OD on the bend, I tapered where the DP fits on from 4.05" to 3.9" so you have a good fit whatever the size is, and you have a groove to weld in. 
Title: Re: My life, My coding
Post by: Rx7man on June 15, 2015, 07:27:31 PM
Here's some of the pictures attached
Title: Re: My life, My coding
Post by: hakcenter on June 15, 2015, 10:31:21 PM
I won't lie, I'm even more jelly now
Title: Re: My life, My coding
Post by: Rx7man on June 15, 2015, 11:27:52 PM
Just keep your jelly to yourself :P
Title: Re: My life, My coding
Post by: Rx7man on July 01, 2015, 10:02:20 PM
Well, I mocked up the turbo on my old dead engine.. I had to make the oil feed lines (stainless braided), oil drain line looks like it'll work if I just rotate the spigot on the engine to the side... still will have to figure out the coolant hoses... for summertime I might just bypass the heater in the cab and run it, but I'll have to T into the lines there somehow later.
Title: Re: My life, My coding
Post by: hakcenter on July 02, 2015, 04:37:24 AM
Still haven't ran coolant to mine.. maybe one day.

Made my own oil drain from 1/2" EMT bent it up and made a flange from steel.. lol.
Title: Re: My life, My coding
Post by: me78569 on July 02, 2015, 08:10:37 AM
Just get a couple 5/8 coolant hose t's and splice into the feed and return of the heater core.  very easy to do an cost less than $20 for all the hose, t's, and clamps.

(http://i879.photobucket.com/albums/ab360/me78569/he351ve%20turbo%20install/20150619_172152_zpsow8xz2jm.jpg) (http://s879.photobucket.com/user/me78569/media/he351ve%20turbo%20install/20150619_172152_zpsow8xz2jm.jpg.html)
Title: Re: My life, My coding
Post by: Rx7man on July 02, 2015, 08:53:45 AM
I'm trying to make it look neat... if I'm gonna try and sell this idea to BD, I kinda have to.

What kind of sensor are you using for exhaust gas pressure?

I'll try and get a pic of my mockup here at some point
Title: Re: My life, My coding
Post by: hakcenter on July 02, 2015, 09:35:06 PM
You need to clock that turbo so the oil drain is straight down
Title: Re: My life, My coding
Post by: me78569 on July 02, 2015, 09:39:39 PM
It's under the 30* spec'd by cummins at this point. 

I've clocked it down more after altering the shock mount some  ;D

The exhaust sensor is just a 0-100psi sensor that farm dude linked to on the cf.
Title: Re: My life, My coding
Post by: Rx7man on July 02, 2015, 11:26:24 PM
What was the price of it?  any chance on a part number?   I'm hoping for an alternative to the $100 ones I'm looking at
Title: Re: My life, My coding
Post by: me78569 on July 03, 2015, 08:38:06 AM
http://www.auberins.com/index.php?main_page=product_info&cPath=5_23&products_id=271
Title: Re: My life, My coding
Post by: Rx7man on July 03, 2015, 11:01:13 AM
Thanks, it looks like a good unit.. I'll see about cdn delivery :)
Title: Re: My life, My coding
Post by: Rx7man on July 03, 2015, 11:16:22 AM
My only gripe about it is the ratiometric output, so a fluctuation in the input voltage will show up on the output voltage...

The plus side is they come with the connector and cable, but once I really do all the math, they aren't all that much cheaper... I'm on the fence about them for now

*hums and haws*
Title: Re: My life, My coding
Post by: Rx7man on July 05, 2015, 12:08:27 PM
OK, here's a pic of what I've got so far.. will have to do the coolant lines yet.. you think the drain line will work OK? (yes I know the hose has to be 2" longer!)
Title: Re: My life, My coding
Post by: hakcenter on July 05, 2015, 02:14:11 PM
can you get a better sweep radius out of it ? if not still looks fine though.
Title: Re: My life, My coding
Post by: Rx7man on July 05, 2015, 05:45:26 PM
not really, much more radius on it and I'm going to end up too low too quick
Title: Re: My life, My coding
Post by: Rx7man on July 13, 2015, 10:11:01 PM
In case you're wondering, I'm still here.. I check in often, but while I'm waiting to get my Robotshop stuff from my buddy so I can start experimenting with the stepper motor, I've gotten a little sidetracked...

I found another forum with about 3 members and a total of 10 posts between them all.. It's more coding and fabrication... I don't know if I mentioned I build and modify chainsaws (yes, more power out of them too!), and 2 stroke engines are very dependent on their exhaust systems to make power.

Since they have no valves and a lot of processes happen at the same time, they have expansion chambers in the exhaust system.. so as the piston opens the exhaust port, there's a sudden strong pulse sent down the header, as the diameter suddenly increases in the expansion chamber, a negative pressure wave is reflected back to the piston.. this helps suck the last bit of exhaust out, and helps it draw fuel in... As the original high pressure wave continues, it meets the decreasing size of the end expansion chamber, this time the wave reflected is positive pressure, and it travels back to the piston as well,.. IF it's timed just right, it'll get there just as the piston closes the exhaust port, and will effectively ram extra air back into the cylinder....
So there's LOTS of math, a fellow made a very good effort with a spreadsheet, and I'm trying to take it one step further and put it into a VB program that will give a neater user interface and be a lot more powerful too.

If anyone feels like snooping and learning
How an expansion chamber works (http://www.dragonfly75.com/motorbike/ECtheory.html)
Free forum : Expansion Chamber Design Forum (http://xpipes.forum.net.bz/)

Title: Re: My life, My coding
Post by: hakcenter on July 14, 2015, 04:55:58 PM
Now we should get into the, can you turbo a 2 stroke
Title: Re: My life, My coding
Post by: Rx7man on July 14, 2015, 06:16:59 PM
I want a he351VGT on my chainsaw!

a tuned pipe is essentially a turbo as far as a 2 stroke goes.. it helps draw fresh fuel in, and increases cylinder pressure
Title: Re: My life, My coding
Post by: hakcenter on July 14, 2015, 10:57:20 PM
without valves how do you pressurize the cylinder
Title: Re: My life, My coding
Post by: Rx7man on July 15, 2015, 01:10:57 AM
I'm not quite sure how it works in turbo applications...

but the tuned pipe pressurizes the cylinder using sound waves just before the piston closes the port
Title: Re: My life, My coding
Post by: hakcenter on July 15, 2015, 08:08:05 AM
Ya that was always a topic of debate.

I would imagine a super charger would be the best application, then you could actually have a tuned pipe setup for it, otherwise I imagine you're just tossing out the intake charge once rpm climbs.

The 2 stroke detroit diesels had no intake valves but had exhaust valves, which made sense. Used a roots blower for exhaust scavenging since no intake valves.. but exhaust it needed something to drive the charge in.

Now if someone could design a boosted system that as rpm rose, boost lowered, you could have an almost static output off idle power response.. but obviously a topic for later discussions :D
Title: Re: My life, My coding
Post by: Rx7man on July 15, 2015, 07:12:04 PM
some detroit diesels were v16's with twin superchargers and quad turbos.. I saw one on a genset.. probably 1000-2000 hp.. I guess since the turbo probably has about a 1.2:1 drive pressure ratio, the extra exhaust pressure itself keep it from blowing all the fresh charge out the exhaust?
Title: Re: My life, My coding
Post by: hakcenter on July 15, 2015, 09:37:58 PM
The 6v71 / 8v71 / 10v71 etc series of detroits had exhaust valves just no intake
Title: Re: My life, My coding
Post by: Rx7man on July 15, 2015, 10:16:49 PM
I think all the detroits had exhaust valves and ported intakes..
Title: Re: My life, My coding
Post by: Rx7man on July 17, 2015, 12:39:57 AM
Here's a screenshot of the program I'm working on for the expansion chamber... I've gotten the worst of it done, I still have some math problems to work out with the temperature drop as the gas expands... I'll see what I can do to figure it out
Title: Re: My life, My coding
Post by: Rx7man on July 22, 2015, 12:08:41 AM
OK, I decided I needed to get *something* done I can talk about here...

So I have a sparkfun arduino breadboard, and since the smartlynx motor controller uses a totally incompatible cable, I broke the cable out on the breadboard.. the pins I know (MOSI, MISO, Clock, 5V and Ground) I wired directly to the right pins, and those that may change I put a male header on so I can jumper them to whatever I choose.. I'll also need to put a 12V supply on it, and then do the code behind it, but I should have this thing up and running this weekend at least.. I'm not going to put it in the truck right away, but at least I can start fiddling... Still haven't put my Mouser order in, since it's free shipping over $200 and I have $600 worth of stuff, I might be a pain in their butt and split it into a couple orders so I can add/remove stuff later and still get it shipped free.

I really need to get a better soldering iron, this industrial sized thing isn't meant for  .100" spacing and tiny wires...

Oh, and just a tip to all of you, don't use gray jumper wire on a spool... you don't know how many times I picked up that spool instead of the solder!
Title: Re: My life, My coding
Post by: Rx7man on July 31, 2015, 12:18:48 AM
OK, except for a lack of torque at higher speeds (I'll be contacting STmicro about this), I have the stepper working decently, and by some sort of funky luck, using 1/32 steps, I have 64000 steps between full travel stops, which is a very nice number for binary math :)

Some of my machining wasn't quite on center so it wobbles a little, but it'll do for a test run methinks... I guess I should order the Mouser stuff now so I can install it with some pressure sensors. 
One more thing I need to do on the hardware side of it is to make some internal electrical switches that ground at a certain point so that I can zero it without stalling it for 2-3 seconds... I also am getting some copper clad board from mouser and will be making an internal switch that the rack 'feeler' touches and grounds out on a digital pullup input, so I can know when it's on an AFC limit or governor limit.... just some nice things to be able to know... Heck I might even be able to make it so that it doesn't rely on the pressure sensors at all, it just move forward at a given rate as soon as the governor arm touches it and tells it that it's limiting fuel... so you can adjust the forward rate to give the turbo time to spool, and to heck with the pressure.... it would be a poor man's way of doing it

Title: Re: My life, My coding
Post by: hakcenter on August 06, 2015, 08:33:32 AM
Anymore news ?
Title: Re: My life, My coding
Post by: Rx7man on August 06, 2015, 08:57:10 AM
STmicro took a week to even acknowledge the receipt of my email.. maybe next week?  damned slow if you ask me
Title: Re: My life, My coding
Post by: Rx7man on August 14, 2015, 10:12:27 PM
Wel...

ST micro is STILL apparently working on it.. SLOWEST TECH SUPPORT EVER!!!

I was gone last weekend to a friends party, had a good time, got 500 miles on a tank and I was driving pretty hard.. works out to a little over 18 mpg, which is decent in my books with 4.10 gears... Injector pump seems to have smartened up and isn't hunting for idle anymore.. .hopefully when the weather cools off is stays smart.

It's currently raining on my hay :'(.. oh well, the cows will eat it anyhow
Title: Re: My life, My coding
Post by: hakcenter on August 15, 2015, 12:25:19 AM
I feel like I don't actually have a 32gal tank
Title: Re: My life, My coding
Post by: Rx7man on August 15, 2015, 12:18:44 PM
you mean you're filling up more often than you figure you should?
Title: Re: My life, My coding
Post by: hakcenter on August 15, 2015, 02:57:01 PM
I get absolute ass distance from my tank. My hand calcs get me around 16.7 - 17.3 I rarely see long long long freeways to get into the 20s. But at best I'm down to 1/8th @ 380 on the trip meter... fill up at best 22gal sometimes rare 23
Title: Re: My life, My coding
Post by: Rx7man on August 15, 2015, 04:13:00 PM
what gears do you have? 3.55's I'm going to guess? you ought to be doing much better.. How was it before the VGT? 

If you can hook up a exhaust gas pressure guage (if you don't have one), see what your cruising backpressure is... I found if my backpressure is under 10 psi my mileage goes up... a lot of people think the turbo is turned by "free" energy... that's a lie.. it's just more efficient than using a supercharger.. the less you have to spin the turbo, the less backpressure you make, and the more efficient you'll run... Once I get things hooked up, I'm going to do some testing and see on steady cruising just how big I can open the VGT before I get either smoke or high EGT's... I may be able to have it pretty much wide open for 1800RPM cruise at low throttle positions, though I'll have to make it kinda snap closed if I put my foot down so it come back alive quickly
Title: Re: My life, My coding
Post by: hakcenter on August 15, 2015, 10:34:00 PM
I'm guessing its just air in my fuel lines. Everytime I go to bleed them, there is always a ton of air, and it takes forever to bleed it all out. It never prevents it from starting.. no matter how long I go between bleeding, its just a total pain in the ass. The longer it stays running the more there seems to be.

I used to get 18-19 before I started tinkering with crap, then the lift pump died, etc
Title: Re: My life, My coding
Post by: Rx7man on August 16, 2015, 01:15:05 AM
for the air, check the fuel heater, I've seen them leak at the electrical connections, also check the hose from the fuel heater to the lift pump... those are the most likely suspects.

Living in cali, you can just delete the fuel heater altogether.. you'll never gel fuel down there.. I think it takes a 17mm to unscrew the sediment bowl, then a 5/16th (8mm) allen key to unscrew the fuel heater, then you put the sediment bowl back on without the heater... and clean out the screen while you're at it!

air in the fuel lines doesn't explain the bad mileage though.
Title: Re: My life, My coding
Post by: hakcenter on August 16, 2015, 09:01:25 AM
I ditched the entire fuel heater setup last year. I'm going to try to fass this year and hope it works out cause that's all I got left.

When I bleed the injectors all but cylinder 1 bleed well. First nothing but the low growl. Then a bit of foam eventually. Then fuel shoots out in a nice controlled spray. If I come back to the same injector after going down the line it still sprays great.

All except #1. To bleed that injector I actually have to close and open the nut. If I leave it open it actually seems to bleed down and get zero pressure though the truck still rumbles like normal when bleeding them and goes away when I close it.

Always bothered me. It was a fleet truck, no crazy mods.. Pretty much untouched minus a few weird repairs. No cranked barrels, stock fuel plate etc.

Even put in new injectors 6mo ago just because.
Title: Re: My life, My coding
Post by: Rx7man on August 16, 2015, 08:34:37 PM
that's weird...

On a different site I got an offer on injector pumps that seems too good to be true.. P pumps for $400, new, made in mexico
Title: Re: My life, My coding
Post by: hakcenter on August 17, 2015, 01:28:46 PM
I don't know about mexico
Title: Re: My life, My coding
Post by: Rx7man on August 17, 2015, 09:05:18 PM
Yeah, that's what I'm kinda wondering about... apparently it's a BDS pump?
Title: Re: My life, My coding
Post by: Rx7man on August 20, 2015, 10:11:26 PM
Been doing some work with chainsaws again... the saw you see here is about 40 years old... and I've ported it pretty much to the max.. It's a Husqvarna L65, originally rated at 3.8hp, I think I'm close to 6 hp now, it's a whole different animal.

Here's a vid of my buddy's Jonsered 920 I ported for him, narrated by a fellow I was giving a demo for, he sounds like a play-by-play announcer at a hockey game.
don't know how to embed youtube here, so here's a link
https://www.youtube.com/watch?v=sy7IE3cm4rM

And relating to the farm, Here's a steer I really think ought to go to a 4H project or FFA.. really nice guy that with a little prissying up might just win a kid a show :)
https://www.youtube.com/watch?v=r5DgVoecp_E

At my buddy's place (who bought this bull from me 3 years ago), Hector seems to remember me just fine
https://www.youtube.com/watch?v=vj3vC0oLJY0

I've got another couple vids to upload (of the Husky saw).  As fall time rolls around I'll get more into coding again for the VGT, as well as doing the hardware install.
Title: Re: My life, My coding
Post by: Rx7man on August 20, 2015, 11:20:20 PM
And I placed my Mouser order.. pocketbook is a little lighter now but I should have (most) everything I need for a few projects
Title: Re: My life, My coding
Post by: hakcenter on August 21, 2015, 09:36:40 AM
Boy I bet
Title: Re: My life, My coding
Post by: Rx7man on September 04, 2015, 08:59:34 AM
couple parts are on backorder for my Mouser order.. they're taking their sweet time about it.

Did a head gasket on my buddy's truck last night, was up til 3 am.. and damn am I sore from sitting under that hood for 5 hours... all said and done, my buddy is really happy it's leak free and he can go hunting with peace of mind.

hakcenter, have you ever changed the timing on your truck?  coming to think of it that could be a part of the problem it runs like ass when it's cold, and gets crappy mileage too... I find about 1/4" to 5/16" of additional advance (on the edge of the harmonic balancer) over and above the 'pin timing' is good for most stock-ish setups...
Title: Re: My life, My coding
Post by: hakcenter on September 04, 2015, 07:06:51 PM
I made my own plunger setup from a 6$ oil pan bolt from vatozone. Added a set screw to my drop plunger and measure the lift on the pump.

I've set my timing all over the place, and nada. 13*, 10* 16*, nothing really helps. I did install a FASS 150 last week. I get some weird cavitating noises from it, going to call them eventually when I have time. Tried of getting soaked in diesel fuel figuring it out myself.

Truck runs amazingly better. No injector bleed problem anymore. Just installed the OFV060HP from torktek to get pressure up. I may have a restriction in the return line. Using a DS1, with everything going to it.
Title: Re: My life, My coding
Post by: Rx7man on September 04, 2015, 08:14:00 PM
I usually set mine somewhere around 15-16*... I just add a bit to the stock 'pin timing', start it up and see how it likes it, rinse, repeat until I find what I'm looking for.. there's a distinct change in the smell of the exhaust as you get it advanced a few degrees, it goes from being a eye-watering acid and thick black to a little more grayish and less irritating.

At least you got the air in the system out
Title: Re: My life, My coding
Post by: Rx7man on September 11, 2015, 12:19:57 PM
Mouser just contacted me saying  a part number and pricing has changed.. told the to just ship the damn thing.

In other news, I'm working on a Husky 61 chainsaw, MAJOR machine work on it, I'm putting a big bore and making my own stroker crank.. it's going from 48mm x 36mm to 52mm x38mm for a 77 cc displacement.. It'll take some fiddling, but it should be a wicked saw when it's done
Title: Re: My life, My coding
Post by: Rx7man on September 11, 2015, 07:07:44 PM
OK, my order has shipped... I should have it next week... Yippee!
Title: Re: My life, My coding
Post by: Rx7man on October 02, 2015, 05:59:09 PM
buddy I got the stuff shipped to was out of town for a couple weeks.. I should have my stuff monday.. yeah, I been waiting a while!

Been doing lots of farm work, and I finished my 'manhattan project' chainsaw, runs good.. ready to cut some firewood now.. we'll see if it lasts!
Title: Re: My life, My coding
Post by: hakcenter on October 03, 2015, 01:01:54 AM
saweet
Title: Re: My life, My coding
Post by: Rx7man on October 18, 2015, 06:01:41 PM
Well.. haven't really done much more work on the Dodge.. I'll need to do brake rotors (one has a crack in it suddenly).

But I did get my chainsaw bored, stroked, ported and piped!!  the thing is crazy fast
Title: Re: My life, My coding
Post by: Rx7man on October 18, 2015, 06:02:07 PM
https://www.youtube.com/watch?v=FBnPjkSUAiM
Title: Re: My life, My coding
Post by: Rx7man on November 07, 2015, 04:45:38 PM
Well, I'm getting back into code mode... A buddy of mine has a TPS sensor he doesn't need, so I'll take that off his hands...

I've got my stuff from Mouser, I think I have most everything except etching fluid for the raw board I have... I have lots of trim pots, caps, and resistors, zener diodes and power transistors.

I got the comms to the turbo working, it responds well.. in another thread I mentioned my turbo firmware may be a little different from other models... as well as the wiring colors.. it doesn't timeout until 75ms have passed with no command, and it has a safety that slows it down if it moves too far in a certain amount of time. 

I'm also working on reading the CAN messages, it seems that you can at least read the actual vane position (bytes 6 and 7), and I'm going to work on seeing if I can read any temps or pressures from it.. The more data I can get from it the better.. can implement some other controls :)
Title: Re: My life, My coding
Post by: Rx7man on November 08, 2015, 09:33:19 AM
Wow.. the Uno boards sure don't have much memory... as far as I can tell, for what I need the processing speed is plenty, but it sure doesn't take much to run out of memory.

Currently, it takes 1100microseconds to read the values from the analog inputs, and about the same to calculate (though that will increase as it gets more complex)... I seem to have plenty of time to work with, but the Uno is definitely not capable of controlling the AFC.. nevermind it doesn't have the pinouts needed
Title: Re: My life, My coding
Post by: Rx7man on November 08, 2015, 11:49:51 PM
Well, I think I've got the basics done for this

Reading (including smoothing) the inputs takes 1300 microseconds
Calculating the vane position take 900 microseconds.. I'm surprised it's pretty quick!

I rewrote most everything from the ground up, the Uno is rather less capable than the Mega.. I'm pushing the limits on memory, but it fits!

I currently have a spare analog input, not sure what I'll use it for, but I'm mounting 2 of them perhaps with some LED's on my dash where my cupholder was (it broke the mounts).  I even found the knobs for them on an old stereo!

I've even got warmup mode and a bunch of other little goodies in there
Title: Re: My life, My coding
Post by: Rx7man on November 09, 2015, 10:22:53 PM
Well, my piece of exhaust pipe and a coupler come in tomorrow (I'll get them thursday probably).. I think I'm close to ready to install this thing.. just gotta mount it in a box and find a place to mount it.. drill a hole in the firewall too.  I got a TPS sensor from a friend, and am going to look for the wiring harness for it now... that'll complete the parts list I hope
Title: Re: My life, My coding
Post by: Rx7man on November 11, 2015, 05:22:41 PM
Update :)

I made a sparkfun protoboard into a "mega" adapter, so I can use the arduino Mega now.. lots more memory for me.. YAY!

Of course that means I have to make use of it.. There's now a bunch more modes
Idle mode, where it'll open up if the idle falls too much below the setpoint
Warmup mode, where it'll attempt to keep XX PSI of boost as long as the idle doesn't drop too much
Startup mode, where it'll be fully open while cranking, then creep it's way closed to normal mode
Jake mode, where it'll keep a certain amount of exhaust pressure
Turbine overspeed mode comes on top of all of those since you never want to overspeed, and that works in 2 ways, the first method as you exceedd the "yellow line" it works off acceleration only, and gets more aggressive the closer it gets to "orange line"... and continues on from "orange line" to redline, except in addition to that it will force the VGT open more the closer it gets based on actual RPM as well.. this should make it come up in speed at the top end smoothly, while not affecting normal driving or being too noticeable.

I am going to hack into my cruise control system as well to give me a fast idle I can use whether I'm driving or not... again very nice for warming up in cold weather, jumpstarting Fords, etc

Currently at 800 lines of code, but that's with generous white lines and moderate commenting.
Title: Re: My life, My coding
Post by: Rx7man on November 11, 2015, 10:59:53 PM
Update :)

Turbo is mounted on the engine now, now comes the plumbing... and then the wiring.  I will probably be driveable by tomorrow night, at least in 'manual mode' where it doesn't take any sensor inputs other than shaft speed. 
Title: Re: My life, My coding
Post by: hakcenter on November 12, 2015, 07:57:34 AM
Pretty sure this is the elbow I used, I got mine for like 6$.. preeeetty sure its 2.5 on the compressor and definitely 3" on the intercooler piping.

 2 1 2&quot; 2 5&quot; to 3&quot; 64mm 76mm Silicone 45 Degree Elbow Reducer Pipe Hose Black | eBay  (http://www.ebay.com/itm/2-1-2-2-5-to-3-64mm-76mm-Silicone-45-Degree-Elbow-Reducer-Pipe-Hose-BLACK-/271833356705?hash=item3f4a87d9a1:g:76QAAMXQTZhR0o2D&vxp=mtr)

I had to cut the length down to make it fit thou.
Title: Re: My life, My coding
Post by: Rx7man on November 12, 2015, 01:53:46 PM
I managed (at least temporarily) to use the 3-3" boot with some heavy clamping.. it didn't kink up so it might work.  I extended the charge pipe by about 6 1/2" with one from a parts truck, it had just the right bends in it. 

I think the turbo outlet is 2 3/4, I'd never have been able to fit it if it was 2 1/2.

Do you have any way of reading the engine RPM on your system?
The hall effect sensor has an 8V supply to it, so perhaps it's outputting a 5v square wave?  Another option is to tap into the tach signal, but I don't know if that's a 12V square wave, 0-12V analog, or 0-5V analog... I might make an arduino oscilloscope to figure it all out... if I tap into the hall sensor side of it I have the benefit of exact readings, while if I use an tach signal I have less math to do (if it's analog).
Title: Re: My life, My coding
Post by: Rx7man on November 13, 2015, 04:33:32 PM
Well, I'm getting there... underhood wiring is done and I put a BIG hole in the firewall just under the heater... I'll have to find a good grommet to plug it, but I wanted to be able to pass any size wiring or connector through it.... 2.5" seems to work, it's the only hole saw I had so it had to work.

Meanwhile I pored over the wiring diagrams and writeup in the dodge manual... found out the tach gets a square wave, but they said nothing more about it, so I had to make an oscilloscope to figure it out.. an arduino with a protoboard and a bunch of variable resistors hooked to the analog inputs... that way I could set it so I got about 3.5V when the input was 12V, giving me safety of being able to read up to 16.5V.  Then made a windows program to read the serial data (2 bytes per channel per sample).. it was a bit of a job, but I got it and it can log to a CSV file, I might make it able to log raw data for very slow computers, so you can decode it later.  Anyhow, I got the program working just fine on my desktop, put it on my laptop and no way it would read the serial port in that program.. arduino IDE could open the port just fine and read it.. so I reinstalled drivers until I was blue in the face.. nothing would work.. so I dug out my VERY OLD Toshiba A40 (go look up it's age... ~12+ years old) with WinXP, of course I had to install VB.net, Atmel Studio, Arduino IDE, etc, but finally I got it up and running, and despite being slow, it did what I needed it to do.. I fired the truck up an ran it for a little bit to get the data flowing, and then opened my log file... found out the tach signal is a nice clean 5V square wave, but with a very short pulsewidth (<3ms)

Title: Re: My life, My coding
Post by: Rx7man on November 13, 2015, 11:51:34 PM
YESSSSSSS!!!!

What I was hoping would work, did!
The RPM and turbine speed sensor work fine the way I wired them and programmed it (even worked the FIRST time!)

Still having laptop troubles... the Old one just won't run Atmel studio at all, and with arduino IDE it doesn't want to program the Mega (haven't tried the others)...can't remember the error.    The new one doesn't program anything with either IDE.. Com port shows up and is correct, just doesn't do it for me... going to try a couple other things yet.. but I've wasted SOOOO much time with this crap.

I think my assumption was correct about the VGT temperature offset.... gauge was just starting to rise when it read 40C (105F), and it was 'very warm' to the touch when it read 57C ~130F.


I think i just got my driver problem figured out in the new laptop so I can program a little more effectively.
Title: Re: My life, My coding
Post by: Rx7man on November 14, 2015, 09:17:57 PM
As I was running it last night, I came to a conclusion.. I don't think I'll be able to use boost pressure as much in the calculations, and I will have to switch to turbine speed.. mostly to prevent it from hunting since there's no delay, though I may still be able to use a max boost pressure compensation somewhere in there.

Underhood installation is finished, control box is mounted on the passenger kick panel, fit really nice too... Arduino is mounted in the box, with a relay.   Just have to get the manual controls mounted and the deck cleared off and it's good to go.. I'll be going for a test drive tonight for sure!
Title: Re: My life, My coding
Post by: me78569 on November 15, 2015, 07:42:42 AM
I use boost as a way to determine if the turbo is at the top of it's map.

IE:
Overrun stuff
Code: [Select]
      if (turbo_rpm > 145000 ){  // 145,000 rpms is where I get worried about shaft speed. 
        if (turbo_accel[2] > 0 && BoostPressure > 25) {vane_position = last_vane_position - 2;}         //this will creep the vane position more open each code cycle if turbo rpms are above 150,000 if not in curvea ( perf mode defined by "F_watchpot" tab)
        else if (turbo_accel[2] > 0 && BoostPressure < 25) {vane_position = last_vane_position - 1;}
        else {vane_position = last_vane_position;}

Code: [Select]
  if (timer % 200) {
     if (ThrottlePosition <= 25) {TPS_low = true;} else {TPS_low = false;}
     if (ThrottlePosition <= 45 && ThrottlePosition > 25) {TPS_midlow = true;} else {TPS_midlow = false;}// watches throttle input to increase or decrease vane position.  Vane position mapping is based on low throttle input.
     if (ThrottlePosition <= 70 && ThrottlePosition > 45) {TPS_mid = true;} else {TPS_mid = false;}
     if (ThrottlePosition > 70)  {TPS_high = true;} else {TPS_high = false;}

     if (TPS_low) {TPS_range = 0;} //supports low throttle cruise. if under %25 don't change vanes
     
     if (TPS_midlow){ //25<tps>45
      if ( BoostPressure < 5) {TPS_range = -40;} //it will try and spool the turbo if tps is 25><45 calc section "-" the tops_range so setting number here to - means housing size shrinks.
      else if ( BoostPressure < 10) {TPS_range = -20;} // 25<tps>45 and boost less than 10 half cm smaller
      else {TPS_range = 0;} //other wise leave vanes
     }
     
     if (TPS_mid){ //45<tps>70
      if (BoostPressure < 10) {TPS_range =  -20;}
      else if (BoostPressure < 20) {TPS_range = 0;}
      else {TPS_range = 20;}
     }
     
     if (TPS_high){ //70<tps>100
      if (BoostPressure < 20) {TPS_range = 0;}
      else if (BoostPressure < 30) {TPS_range = 20;}
      else {TPS_range = 40;}
     }
  }

I have been trying to get it more into the  code, as it is helpful to adjust the end value of the turbo.  IE: the vanes will need to be bigger at 120,000 & 30 psi than 120,000 & 10 psi.

I did find that I needed to limit the turbo movement on each send to + - 5 this really helps the "sling shot" effect I was seeing in the turbo.
Code: [Select]
        if (vane_position >= last_vane_position + 5) {  //limits turbo movement to 5 increasing or decreasing.
          final_vane_position = last_vane_position + 5;
        } else if (vane_position <= last_vane_position - 5) {
            final_vane_position = last_vane_position - 5;
Title: Re: My life, My coding
Post by: Rx7man on November 16, 2015, 12:42:22 AM
Well, I took it on it's maiden voyage... I'm impressed so far.  EGT's went down 300F at both cruise and WOT.. WOT egt's are now 1000F, so of course that means I just need to feed it more fuel!

Right now I just have a map of TPS position vs RPM, and get the position directly from that, in the future I think I will have a map of TPS vs Boost as well, so I can 'know' where I should be for steady state operation, but if boost isn't at target I can modify the response from that.  Right now I have a boost limit where it opens up the vanes by 30 points (over the 'base position) for every PSI over target it is, which works pretty good, my peak boost is 30psi, but since my EGT's are so low I think I'll drop it down to 20-25PSI until I feed it more fuel.
For a very crude program it works alright.  I'm smilin'
Title: Re: My life, My coding
Post by: me78569 on November 16, 2015, 08:07:56 AM
Very cool!

Thing I noticed with the turbo is it is easy to get egts to about 900-1000, but very hard to get egts above 1300*,  I am very impressed with the turbo and what it can do for what it is.
Title: Re: My life, My coding
Post by: Rx7man on November 16, 2015, 09:42:25 AM
You have much bigger injectors than I do.. I'm going to look into bigger ones soon.. I think my buddy has some 65hp sticks that he isn't using.. toss those on and see what happens.. I think I might go to a 0 fuel plate too
Title: Re: My life, My coding
Post by: me78569 on November 16, 2015, 11:27:30 AM
I think I have 400-450hp worth of fuel total.  Maybe a touch more, but doubt it.
Title: Re: My life, My coding
Post by: Rx7man on November 16, 2015, 01:36:47 PM
I figure I'm in the 300's somewhere... I'd love to think it's higher but its unlikely.. I might put the truck on a dyno in a while
Title: Re: My life, My coding
Post by: Rx7man on November 16, 2015, 06:13:12 PM
OK, here's a log file of my drive into town.. I haven't studied it.

I noticed my TPS increments very slowly at low throttle positions.. what is actually about 25% reads as about 10%, so I had to fiddle a little with my maps.. currently they are 4 rows for TPS positions, and 10 columns for RPM.. I can increase it easily if I feel like it.

I'm working on more code now, sitting at the bar having a beer and will be playing some darts in an hour
Title: Re: My life, My coding
Post by: me78569 on November 20, 2015, 04:26:29 PM
I am curious how you are calc'ing your map.  Care to share you position calc section?  I am in the middle of redesigning my code for the OBD adapter I am getting and I figure if I am "under the hood" of the code I might as well see how I can make it better haha.
Title: Re: My life, My coding
Post by: Rx7man on November 20, 2015, 06:03:25 PM
Sending PM... I don't think this is pretty enough to make it public.
Title: Re: My life, My coding
Post by: Rx7man on November 21, 2015, 09:18:30 PM
OK, installed my line-lock on the front brakes (awesome for some smokeshows, and holding on a hill), as well as installed my brake pressure sensor, and it's all hooked up and reading... I think I'm going to hack my brake controller apart and see if I can bypass the accelerometer and give it a signal from a PWM output.. it would save me the trouble of making a driver circuit...
Title: Re: My life, My coding
Post by: Rx7man on November 25, 2015, 09:36:11 AM
I still have a pesky exhaust leak I just CAN'T find... thanks to the 2 1/2" hole in the firewall I haven't found a grommet for yet, I can hear it pretty good.. it sounds like a squeaky chirp under heavy boost, and a hiss under braking, but other than a TINY bit of blackness on the band clamp between the hot side housing and center section of the turbo I'm not seeing where it could be from...  (and knowing the tight clearances there I really don't think it could bleed that much pressure off)
I retorqued all the bolts and they all seem good.. it's getting to be one of those frustrating, nagging things.

Last night I spent fighting my tires.. trying to break the beads was a MISERY.. I want to install my new studded winter tires here soon.. conditions last trip into town would warrant them
Title: Re: My life, My coding
Post by: hakcenter on November 26, 2015, 10:36:14 PM
I'm pretty sure I found a tps plug in my engine bay.

Black,  black white, and red plug near the front of the injection pump (unplugged).

Never had a cap on it so it's in pretty bad shape but do those colors match up to yours?
Title: Re: My life, My coding
Post by: Rx7man on November 27, 2015, 12:10:26 AM
it's not sounding right... it should be
black/light blue (gnd), orange/dark blue(signal), Violet/white (+5V), and this seems to hold true for all dodges of the era.. gas or diesels...

I can guess the black/white you see is actually black/light blue... a straight orange is an +8V supply, for the hall effect sensor on the front of the engine and vehicle speed sensor on the tranny.  I'm not seeing anything in the diagrams of a red wire that is in a 3 pin plug.
Title: Re: My life, My coding
Post by: hakcenter on November 27, 2015, 08:32:39 AM
Pretty sure it is it!

Google image
(https://lh4.googleusercontent.com/-gH6d4gtiI1A/UJm7h78rozI/AAAAAAAADpI/J70yVABtmEI/s720/IMG_3443.JPG)

I have a Black, Red/Black and, Violet/White. Verified 5v on the Violet so I'm guess it is the plug, looks just like it in the picture with the a/b/c
Title: Re: My life, My coding
Post by: Rx7man on November 27, 2015, 09:21:00 AM
Red/black is really hard to tell apart from Orange/Dark blue on old wiring.. If it looks like that plug, it probably is....

You will need the bracket to hold it from an auto tranny truck as well, and there might be some other little tab or something needed to actuate it.. the tab you see on the linkage isn't big enough to do any good, I had to weld a piece onto mine to make it work
Title: Re: My life, My coding
Post by: hakcenter on November 27, 2015, 11:24:54 AM
Ok cool then it's time to eBay
Title: Re: My life, My coding
Post by: Rx7man on November 27, 2015, 12:08:32 PM
or perhaps find a wrecker?  craigslist parts truck?
Title: Re: My life, My coding
Post by: Rx7man on December 03, 2015, 11:19:54 AM
Well, I've been playing with the truck a little more.. I seem to be getting good mileage on this tank... and it's a lot of city driving too.  I open the vanes quite wide when I'm on the highway... running 2600 RPM, 75MPH, I'm only at about 5 PSI, truck sounds like it's happy as heck, virtually no backpressure... truck is all sideways in 4th on wet roads at 50 mph.. I still have some tweaks to do in the mapping, but I'm getting some good results so far.

One problem I'm having is my exhaust pressure is VERY uneven.. bounces all over the place despite anything I try to do to smooth it... I'll look into that a little more too.
Title: Re: My life, My coding
Post by: Rx7man on December 03, 2015, 11:41:16 AM
I also bought (because I just stumbled on it) some REALLY fine soldering wire.. 0.3mm or .015", as well as flux for it too
Title: Re: My life, My coding
Post by: me78569 on December 03, 2015, 12:11:30 PM
Slow your vane adjustment down.  I am now never moving my vanes more than 5.  I found that if the vanes jumped more than that backpressure was VERY unstable. 

I am thinking of reducing it even more. 
Title: Re: My life, My coding
Post by: Rx7man on December 04, 2015, 12:47:08 AM
and how often are you adjusting the vane position? 20ms?  I might try that..

Truck is running good.. there was a car riding my ass on a highway on-ramp, I tromped on it heavily and smoked them badly.. both literally and figuratively speaking... went from 35mph to 75mph by the time I merged... cruise is working nicely, holding steady at 5 psi, and jumping to 20 as soon as you demand power.. off idle is pretty good too, getting 20 PSI by 1500 RPM in lower gears, 30 is no sweat by about 1800.  Buddy at BD diesel loves it.. I have yet to take him for a rip in it though
Title: Re: My life, My coding
Post by: Rx7man on December 09, 2015, 11:34:00 AM
I changed a little of the logic for vane movement.. it won't move unless it has to move at least 5 points, and is limited to 20 points ever 20ms.. I can definitely feel the slower reaction, I might speed it up a touch, but I want to totally rethink the logic and have the movement based on a curve.. so the further away it is from where it's supposed to be the faster it reacts, which will help prevent unnecessary motion on small changes, but still react quickly to large changes.

I also have a little bit of an issue I have to try and figure out, when it's cold out it seems like the VGT opens up against it's command.. at first I thought it was the voltage drop caused by the grid heaters, but then it happened once long after they quit cycling.. kinda hard to tell what's going on while you're driving, but it came back after 5 seconds or so... I'll have to figure out if it's the controller telling it do do something wrong, of the comms are cutting out, or a voltage supply problem
Title: Re: My life, My coding
Post by: hakcenter on December 09, 2015, 02:35:33 PM
Unplug your USB cable while you're not connected and see if it goes away
Title: Re: My life, My coding
Post by: me78569 on December 09, 2015, 08:33:32 PM
I honestly think that any movement over 5 is too much.  For my truck it seems that it will always overshoot the vane position truly needed to control shaft speed, drive pressure drops and shaft speed falls.    I seen a huge reduction in drive pressure jumping as soon as I made that change. 

I am running the send Vane position every 2 ms.
Title: Re: My life, My coding
Post by: Rx7man on December 11, 2015, 11:29:05 AM
I think I got it.. I had a drive pressure ratio limiter, and changed it so it doesn't act at 0% TPS and come to full at about 40% TPS... so far it seems to have fixed it.

I also bought a Garmin GPS for cheap.. I'm wondering if I can somehow hack it and turn it into a touchscreen... It has a good controller in it, GPS, bluetooth (for serial comms??) etc... I would just have to find a way to put my own firmware in it and probably have it talk to the Arduino over I2C or something
Title: Re: My life, My coding
Post by: Rx7man on December 11, 2015, 11:36:27 AM
I am getting a pretty good tune into it otherwise.. I cruise at 75mph with the turbo pretty much wide open, I have it at about 870 at idle which just keeps it spinning without putting a whole lot of backpressure, so that helps city mileage where I do a lot of putzing around... it flashes up pretty quick.. at 2500 RPM it happens *really* fast!
Title: Re: My life, My coding
Post by: Rx7man on December 18, 2015, 02:20:17 PM
Well.. I've put a lot of miles on it now, things are working pretty good.. still doing some fine tuning, after which I will need to make a better monitoring system for the final touches so I can datalog effectively and hopefully display in graphical form.. with any luck I can do it on the GPS unit I got, but if all else fails I can do it on the laptop.

I was towing the trailer home, and I was fighting a 30mph headwind, and my mileage sucked some serious arse (1/4 tank for 80 miles) but apart from that I was getting about 400 miles to a tank without running on fumes in combined city/highway driving while empty.. I think that will improve when I get the 3.55 gears in (I just got my rear diff, front will here soon)... I have to put new brake rotors and U joints in the front axle as well as most of the driveshafts, so I'll do it all at once.

Some features I've been playing with are a TPS rate based vane closing algorithm.. basically when you mash the throttle, or when you're frequently changing throttle position, it closes the vanes, and has a time-based re-opening, which increases boost when you're going through the gears, but backs off for good mileage when you're doing steady cruising.. I have to play with the limits on it a bit, but it's showing promise so far... I may have to change it from an absolute position to a percentage since 100 VGT points when you're close to closed is much more serious than from near wide-open.. I may have to do this on several 'compensating' variables.

When I get to the point I feel like most anyone could plug-and-play what I've made, I'll post a full copy of the sketch
Title: Re: My life, My coding
Post by: Rx7man on December 22, 2015, 01:08:06 PM
OK, I've finally gotten the courage to commit to a data transfer method and start writing a VB program that will read the serial port for the current status of the program and display it in a manner you can view while driving without having to squint and take your eyes off the road for too long.. this will help me figure out what's going on at critical times, and will help greatly with tuning...

I'm kinda fighting the low-RPM, high TPS response, I think it's closing too much in some instances and because of that, it's not spooling well and it's putting a huge load on the engine in the form of backpressure... which just makes it react sluggishly.

I'm trying to make an Uno compatible version, but since I have a lot of text strings I'm having memory issues.. I will have to see what I can do about putting it in program memory or something.. it'll increase complexity and decrease readability.. but we'll have to see where it goes.

Merry christmas y'all
Title: Re: My life, My coding
Post by: Rx7man on December 28, 2015, 01:56:41 PM
Well, over christmas I had lots of time, and as much as my energy would allow me, I slaved away at making something I could look at while driving, displaying things in nice fat bold fonts with a 'gauge' style visualizer.. I haven't quite gotten that mastered yet, but it does display trackbars and labels.

I had to FIGHT LIKE HELL to get VB to read the serial port in a timely manner.. it turns out "Serial.Readline" is a blocking function, which hangs the Arduino connected to it as well.. I had to use "Serial.ReadAvailable", make my own buffer, then parse the data after I didn't get any new data for about 5ms, that fixed everything.  I have it set to update every 1/4 second, which is pretty quick, and it's easy to slow down if I feel like it

Here's a sneak peak at a very preliminary version
Title: Re: My life, My coding
Post by: Rx7man on December 28, 2015, 01:58:44 PM
Oh.. and here's a cold start on my truck, about 10F  -15C

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

LOVE the sound when it starts spooling
Title: Re: My life, My coding
Post by: Rx7man on January 05, 2016, 03:36:46 PM
OK, I got the turbine speed sensor back up and running... Just in time for my exhaust pressure sensor to pack it in... I double checked it and there's no 2 ways about it.. keeps reading about 20 PSI no matter the pressure I apply to it, and I swapped it to the intake side connector to make sure it wasn't a wiring problem... nope.

At this point I'm not relying on it much anyhow... it's one of those things that would be 'nice to have' but I can run pretty well without... it's more of a diagnostic/tuning tool than a necessity to run.

I've taken a few people for a ride in my truck, they're pretty impressed with it... If I have a load on, I can quite easily get 15 PSI by 1300 RPM, or 20psi by 1500... I will say that's darned close to the surge line though, and certainly not in it's efficiency area... nevertheless, it's pretty cool.
As for power.. it's doing pretty good there too.. we got some snow here, and driving to town in 4x4.. studded tires all around, it'll go squirrely in 5th at 70mph.. your butthole puckers up pretty good when it does that.
Title: Re: My life, My coding
Post by: hakcenter on January 05, 2016, 05:54:01 PM
So that VR ended up kaputting ? :(
Title: Re: My life, My coding
Post by: Rx7man on January 05, 2016, 06:22:54 PM
I guess it did. I didn't change anything else... *shrug*  who knows what the gremlins were doing
Title: Re: My life, My coding
Post by: 65fpvmustang on January 11, 2016, 10:46:45 AM
your display looks really nice. right there with steeds $700 controller.
Title: Re: My life, My coding
Post by: Rx7man on January 11, 2016, 12:04:33 PM
Thanks, it gives me motivation to keep going!  I do want to make some improvements to it yet for readability in light/dark, but the basics are coming along... it's at least functional and enables me to do the tuning.

I'm also still working on the theory to redo some of my logic, changing the 'compensations' from absolute position to a percentage, since a 100 point change when you're near closed is drastic while when you're near open it's only mild.. I think once I implement that I will be able to get a quicker spoolup.  Exhaust pressure gauge would help with that as well, but no such luck... I found a fuel pressure gauge from my Rx7 I may be able to adapt... worth a shot I guess.

Title: Re: My life, My coding
Post by: 65fpvmustang on January 11, 2016, 12:19:26 PM
retired oil pressure gauge is what i put on my dash.
but these senders are dirt cheap. I got one to put on falcon to monitor oil pressure.
ms3 has check engine light for oil pressure curve high or low settings.

http://www.ebay.com/itm/271763798948?_trksid=p2060353.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT (http://www.ebay.com/itm/271763798948?_trksid=p2060353.m1438.l2649&ssPageName=STRK%3AMEBIDX%3AIT)
Title: Re: My life, My coding
Post by: Rx7man on January 11, 2016, 12:31:45 PM
That looks pretty good!.. I see a 100PSI version which I'd probably get because it's plug-and-play with what I already have

 Pressure Transducer or Sender 100 PSI Stainless Steel for Oil Fuel Air Water | eBay  (http://www.ebay.com/itm/Pressure-transducer-or-sender-100-psi-stainless-steel-for-oil-fuel-air-water/271576977896?_trksid=p2047675.c100005.m1851&_trkparms=aid%3D222007%26algo%3DSIC.MBE%26ao%3D1%26asc%3D20131003132420%26meid%3D93ce184e50824f10bd397266f1f9f831%26pid%3D100005%26rk%3D1%26rkt%3D6%26sd%3D271763798948)

I'd probably just get a bunch of them for doing other things with in other scales. they're handy to have.. thanks for the link
Title: Re: My life, My coding
Post by: 65fpvmustang on January 11, 2016, 02:07:32 PM
Yeah i was looking at the 60 psi versions for my lpg pressure and EBP.
Title: Re: My life, My coding
Post by: Rx7man on January 11, 2016, 05:51:40 PM
For the exhaust I'd go with 100 PSI, for manifold pressure I'd go with 50 PSI for my purposes, given the choice.. I just wen with 100PSI all around.  I put a 1000 PSI for my brake pressure and that works pretty slick too.



In other news I finally got to test out my turbine shaft speed sensor and coding.. I had a small glitch I found and corrected quickly... I had used an unsigned integer where I should have used a long, and as such my indicated speed only got to about 64,000 RPM.. fixed that and tromped on it hard in 5th, pretty much redlining the engine at 30 PSI, my peak shaft speed was 114,000 RPM, so I have nothing to worry about there... Temps are pretty cool right now though, and as things warm up I'm sure that will change.  my peak acceleration I think is about 50,000 RPM/second.

I have more bugs to work out on the logging side of it before it works right.. I'll get to it and post up some logs soon.. perhaps I even get it done between dart games tonight
Title: Re: My life, My coding
Post by: Rx7man on January 16, 2016, 02:26:21 PM
OK, I'm working on V1.3 now... big change is the compensators will  affect the percentage of nozzle size opening rather than an absolute position, this should help prevent the bog from closing too far at low RPM.  Took a major rewrite and I change the program flow a little bit too... I'm going to try it so that all compensators are summed together and then applied
Title: Re: My life, My coding
Post by: Rx7man on February 05, 2016, 11:43:15 PM
Well, a few updates I guess I should mention...
I did implement the changes I spoke of, it is definitely better using a percentage compensation than an absolute position compensation, and it's completely logical too.. it's just harder to implement and it took a little fiddling to get right..  With a heavy load I got 18 PSI @ 1400 RPM, and capable of 35 @ 2000, though I usually start limiting it before then..
Truck pulls darned good anyhow.

Meanwhile, I finally got around to chasing down exhaust leaks, pulled the turbo off, EGR delete caps, etc.. didn't go as far as the manifold, but I can fiddle with that one later if I still have problems..
So as it turns out I didn't get the center section clocked onto the pin right, and smushed the pin, which left a tiny little hump, and that was the reason for a very small leak from that area.. ground the pin flush, cleaned it all, never seized it and put it back together.. Rear EGR delete cap was definitely a bad leak, gooped the gasket with muffler cement and put it back on.. did the front while I was at it but I don't think it was bad.
Will test it out tomorrow on the drive to town, I'm guessing my exhaust brake will be far more effective and it'll build boost even better...

It's super warm here today, about 45F (9C), was windy, then suddenly the wind quit and it started pizzing rain... Driving to town tomorrow will be like driving on a bar of soap, ice about 1 or 2" under some real goopy mud... I'm sure I'll find a way to have fun in that.

Other news (just so I can find it again) is here.. Merritt's governor spring install and Tommy's upcoming timing cover gasket fix.. (not really looking forward to it, even though the money is good) Satisfied customer (http://community.lilbb.com/general-discussion/satisfied-customer/)
Title: Re: My life, My coding
Post by: Rx7man on February 14, 2016, 12:16:09 AM
Well,.. I'm looking at the 3.2" TFT touchscreen I got, and the Mega that it's mounted to, and I'm really wondering about how I should connect it to the Mega on the other end.. is I2C usable for intercommunication?

Then there's the question of the transfer protocol... I'm really wondering how I'm going to go about that so it's flexible enough, error recovering, etc and doesn't take massive effort to parse.

You guys have any ideas?
Title: Re: My life, My coding
Post by: Rx7man on February 29, 2016, 05:07:58 PM
OK, I'm getting close to ready to start working with the Raspberry Pi... I just got it today, but haven't got the display for it yet... I'm going to have to tinker with it a little I'm sure.. especially don't know how it's going to be do the GUI... time will tell... I think I will 'integrate' it into my truck and essentially it will replace my stereo head unit... Wonder what sort of GPS apps are available for it... I'll have to try all the different OS options.. I think Android might be an option, and is one I would seriously consider since I could develop an Android app that does the same thing and communicates over Bluetooth, with the added benefit that some people wouldn't need to get any additional hardware...

I'm excited about this, but I don't know how much time i'll have in the coming months to work on it.. things are warming up here and it's going to get busy
Title: Re: My life, My coding
Post by: Bdubb'z on February 29, 2016, 07:29:08 PM

It will be interesting to see what you come up with.  I've looked into the Pi before and was a bit hesitant about choosing/creating an OS.  Seems like its right up your alley!!
Title: Re: My life, My coding
Post by: Rx7man on February 29, 2016, 11:11:56 PM
umm.. it's WAY up my alley.. as in it's going to be ANOTHER steep learning curve...  It's been about 15 years since I've fiddled with and linux machines, and I have NO idea how the programming interface is going to be, especially for graphical stuff.. At least with arduino I've gotten my feet wet, so to speak.

I should also have a replacement exhaust pressure sensor coming in by next week.. I bought 3 of them this time from a guy on ebay.. $18 each, and they're just about identical to the Honeywells.. I also bought a 0inHg - 30 PSI one in case I ever do a gasser, that was $33..
Title: Re: My life, My coding
Post by: hakcenter on March 02, 2016, 08:14:06 AM
I've got a pi here running Gentoo.. man that literally took a week to compile haha.
Title: Re: My life, My coding
Post by: Rx7man on March 02, 2016, 08:36:59 AM
I haven't played with *nix in so long... I did run an Open BSD server for a while.. I think I got up to 600 days uptime, and a power outage killed that.  I think that at least for now I'll just run Raspbian... But I'll have to figure out how to do GUI programming.

Title: Re: My life, My coding
Post by: Rx7man on March 03, 2016, 02:04:38 AM
Well, the X300 expansion board for the Pi has a dead short in it, prevents the pi from powering up and heats the fuse... Talked to the seller, they're sending a replacement, and not asking for the old one back.. Thumbs up to Maplectronic :)
Title: Re: My life, My coding
Post by: Rx7man on March 03, 2016, 10:15:20 AM
OK. Here's the current version of my program.. it'll be WILDLY different than Curtis's version, and I did want it that way, I deliberately didn't look at his code while I built mine (no offense) because I wanted to learn it all myself and come to my own conclusions about everything.  I have it somewhat commented.

Biggest things I did differently is I have some classes of commonly used objects... I'll go through them briefly

Map2d:  a 2 dimensional map, good for TPS/RPM.. I have more work to do on it.  Currently implemented as an array of bytes, with the indexes as arrays of long Ints.. Map1d is the same idea, useful for things like mapping temp sender outputs to temperatures..  BOTH of these are subject to change!!, I want to streamline them into one, and add some features, remove redundancy, and make it easy to use other types of numbers, as well as make it easy to load and save to EEPROM.

MyVar.. still haven't figured out a better name for it.  takes care of applying smoothing when "updateValue" is called.. also calculates the slope in units/second.  Both the value and the slope are smoothed by a factor.. The possible values are 0-1 inclusive, 1 being an unchanging value, 0 being unsmoothed.



Title: Re: My life, My coding
Post by: Rx7man on March 10, 2016, 12:50:48 AM
Well, doing some more work on program flow.. I'm changing it so it doesn't read all the inputs at once (since it takes a while to read 10 analog inputs and do the smoothing math).  Instead of calling "read inputs" before the "calculate position" function, it continually reads 1 input at a time, then checks the timers to see if they've elapsed.  I plan on doing something similar for the serial writes as well so it pretty much means the serial port will update at 'live' speed, yet not interfere with program flow and timing since I don't have to send a ton of information through it at once.
Title: Re: My life, My coding
Post by: Rx7man on March 10, 2016, 12:53:44 AM
Got the touchscreen in.. really good color and resolution on it, touch input works well (multitouch capable if OS supports it).. what they call a case for it pretty sad though.. I might call it a frame at best.

Trying to figure out what programming language to use to do the UI... I'm debating between Java and Python
Title: Re: My life, My coding
Post by: hakcenter on March 10, 2016, 09:52:42 AM
Well, doing some more work on program flow.. I'm changing it so it doesn't read all the inputs at once (since it takes a while to read 10 analog inputs and do the smoothing math).  Instead of calling "read inputs" before the "calculate position" function, it continually reads 1 input at a time, then checks the timers to see if they've elapsed.  I plan on doing something similar for the serial writes as well so it pretty much means the serial port will update at 'live' speed, yet not interfere with program flow and timing since I don't have to send a ton of information through it at once.

sounds familiar... where did I see this before :)
Title: Re: My life, My coding
Post by: Rx7man on March 10, 2016, 10:05:27 AM
I think you saw it in your programming thread :P

I just figure if I do the time consuming things incrementally I can maximize CPU usage without bogging down any time sensitive stuff.  The serial display portion of it is going to be harder to do since I'm going to have to store a whack of global variables or something and keeping track of them will be tedious.. Probably going to use an array and a #define for each function return value.

I did find a peculiar thing about switch statements.. seems as though you can't define a variable within a Case branch.. Before, I was reading the raw ADC value into an integer, then doing the math on it, which made for readable code.. Now I have to put the analogRead in the middle of my math, sometimes more than once to work around it.. just a PITA
Title: Re: My life, My coding
Post by: Rx7man on March 12, 2016, 10:19:23 AM
Well, I've been playing with this a little more.. I got Arduino programming environment working on the Pi.. I have a lot more setup to do on it.
My new X300 expansion board came in to replace the one that was fried, seller fed-ex'd it to me and didn't require the old one back, very pleased with them and will deal with them again for sure.  I did a bit of troubleshooting on the old board.. first by plugging it's 8-20V source into a powerful 4A 12V supply, which promptly blew up the dc-dc convertor chip.. I desoldered it, and things *kinda* work again.. it boots up, but creates a lot of heat from a small inducer on the bottom side of the board..  Once I get the software properly set up for the new board (so that ALL components work), I'll plug the old one back in and see if any component is messing up, which might give me some clues on where a problem lies. 

On the Pi, I'm getting the hang of working in linux again.. after 15 years away from it, it takes a little bit to get used to, and a lot has changed since then.. Thankfully some has stayed the same.. I managed to get windows file sharing going (samba), as well as vnc (essentially Remote desktop).  I have yet to start playing with any programming..
Title: Re: My life, My coding
Post by: Rx7man on March 15, 2016, 10:29:57 AM
Added a drive pressure compensation on the program now.. It's set so that it will start to open up if drive pressure exceeds boost pressure by a given amount.. I have it set at 15psi now.. still need to do tuning on it as it affects other parameters, but should help with spoolup.. preventing "engine braking" while trying to accelerate.
Title: Re: My life, My coding
Post by: me78569 on March 15, 2016, 12:57:23 PM
Do you currently have DP issues or are you just writing that Boost + 15psi as a safeguard?
Title: Re: My life, My coding
Post by: Rx7man on March 15, 2016, 01:38:51 PM
I'm hoping to make tuning easier in the long run if I can set an abnormally small nozzle size and let that compensator limit drive pressure.. It'll remain to be seen how well that works.  At cruise, etc you should be reasonably close to a 1:1 pressure anyhow so it shouldn't be active except for when you tromp on it
Title: Re: My life, My coding
Post by: Rx7man on March 18, 2016, 01:15:26 PM
Well, I've been doing a serious rewrite of the program.. changing many things from functions that return a value to methods that modify one in the hopes I can speed everything up.. I think I rewrote most of it twice or thrice before I was content with it, and I am not done yet.. I'm hoping I didn't totally break it (it compiles, and I don't think I changed the logic.. I'll find out)... I haven't yet implemented the EEPROM parameter saving/loading, but all my efforts so far have been to make that part of it much easier.
So far, all my modifiers, inputs, etc have changed to floating point, and they're all in 1 global array which is indexed by a named enumerator... I have a little more work to do on that side of it, but when I'm done it'll be much easier to transfer them all over the serial port... about 1-200 bytes of data should transfer ALL parameters to the Pi or Laptop.
At this point, I'm looking at the following
1 array for ALL the running parameters.. probably about 30 or so, at 4 bytes each that's 120 bytes
1 array for each 'map'.. those are 'byte' type, so again it'll be right around 100 bytes each for a 10x10 map which more than plenty
1 array for all the inputs
1 array for all the compensators and function outputs.

I will put a small toggle switch on the box that determines at bootup time whether to read the data from EEPROM or just go with what's hard-coded (might be handy to have something to fall back on)
Title: Re: My life, My coding
Post by: Rx7man on March 20, 2016, 01:11:30 AM
Well.. broke another bike today.. this time I know it wasn't my fault and can prove it.  I did a bit of an excessive wheelie.. nice soft dirt, and the bike laid over and quit.. that was all she wrote, she was nearly seized.. I managed to roll it over and it didn't sound good at all.. it sounded like a valve was hitting the piston lightly... then I had it in gear and there was no way to move it even with the clutch disengaged, so I knew it wasn't in the top end.
Take it apart, and found that a part of the decompression lever inside had been broken off, there's no way this breaks off except excessive force during assembly (kinda like you gotta line up the dowel pins on the bell housing before cranking it in).. and the piece that had broken off went through the gear between the crank and clutch, mangling it pretty good.
So I tore my old bike apart and stole the parts I needed, turns out the crankshaft got a little bit of a tweak too.. not a whole lot, but enough to cause gear whine... Oh well.. I'll run it this way until it blows up... I know where this engine was rebuilt, and despite warranty being out of the question, I'm probably going to give them a piece of my mind... there were all sorts of bolts that didn't get tightened either... rocker pivots, exhaust studs, valve covers... it was a screwup from start to finish.
Title: Re: My life, My coding
Post by: Rx7man on March 26, 2016, 01:59:40 AM
Haven't posted much about farm life these days.. got 12 calves and probably will have another by morning... the watched pot never boils.
They're a fun little posse, a whole whack of attention whores, all of them come up to me and lick my boot laces, pull on my shirt tails, etc.. it's a fun time of year, and there's nothing quite like it.. definitely feels like spring.
Title: Re: My life, My coding
Post by: Rx7man on April 06, 2016, 10:39:09 PM
I've been doing some more coding, putting together a single library that does everything.. CAN, MAX31856, etc all in one.. so far so good.

I need to quit fiddling with the logic of my code so I can keep a tune... I keep doing stuff that kinda require retuning.. on the other hand, I'm getting better at it.

Got some more thermocouple probes in, I think some have longer wires which I need to get to the air horn.  At the price of them I'm glad i picked up a pile.

Not everything around here as been rosey though.. Lost a calf on Monday, had to get the vet out to do a ceasarian, and I got the bill for that.. OUCH.. $966.. would have hurt a little less if I had a live calf.  Momma is doing alright though, and the rest of the calves are growing like weeds (they gain weight at a rate of 4-5 lbs per day right now), and they're a really friendly bunch.. well.. they're just plain attention whores actually!
Title: Re: My life, My coding
Post by: Rx7man on April 06, 2016, 10:43:58 PM
Here's a couple pics.. First one is infatuated with my camera strap.. just had to chew on it.. Second one is taking his first steps.. he's about 20 minutes old
Title: Re: My life, My coding
Post by: Rx7man on April 21, 2016, 11:20:37 AM
Sooo.. Had a bit a rough spell with the cows.. One of the first time calvers needed a cesarian,.. Lost the calf and it cost me $1000.. Cow is doing well at least, despite a rather huge scar.  The rest of the calves are doing well.. they're gaining about 4 lbs of weight a day, the heaviest is over 200 lbs, and the little guy pictured above is about 150 lbs already... They're all full of piss and vinegar, playing every evening before bedtime, and mobbing me when I go say hello.

The truck, well, I'm getting things done slowly... tuning is coming along, I'm no longer drastically changing the curves, but it's in little increments now here and there... Haven't done anything with the Raspberry pi yet, it seems like a steep enough learning curve to do anything with it that it's going to wait until winter time unless there's no farm work to be done (that absolutely will not happen!).. Still trying to figure out what method is best to transfer data over serial so I do that work once and do it right, and it's modular enough to accommodate new features. 
I have to do some more tuning to the backpressure compensation, it's currently set to open up when drive pressure exceeds compressor pressure by 15PSI.. I also have to work on the pressure setpoints, but that's proving much harder than anticipated... it would really help spoolup once I got it figured out though.  I'm having a little bit of trouble not having it 'hunt' for the right pressure, so I'll probably have to add a deadband to it, as well as perhaps factor in turbine speed (or at least turbine acceleration), or scrap the whole idea of pressure control and do it exclusively by shaft speed.  Another option is to make a 3D map where it reads the position from a combination of engine RPM, TPS and current boost level, but that will quickly bloat memory usage something fierce.. it's currently 100 bytes for a 2D map, if I have a 3rd dimension of 10 levels that's 1KB, or half my EEPROM, and it'll add a TON of tuning of course, which doesn't sound good to me.
Title: Re: My life, My coding
Post by: hakcenter on April 22, 2016, 07:18:17 AM
PROGMEM
Title: Re: My life, My coding
Post by: Rx7man on April 22, 2016, 10:11:10 AM
Progmem is fine if you're always uploading a sketch from computer or something, i want to be able to change the program and keep settings in eeprom so that I can change the parameters on the fly and have them there next time I reboot it.. From what I have seen, it's not possible to do this with Progmem
Title: Re: My life, My coding
Post by: hakcenter on April 22, 2016, 06:54:29 PM
progmem stores it in eeprom, you can read it, at +3 more cycles, than ram speed.

You could also write a protocol, to update the progmem areas... ?
Title: Re: My life, My coding
Post by: Rx7man on April 23, 2016, 08:57:35 AM
If that's possible, sure, it sounds good.. except I have no idea how to write that protocol.. Wouldn't it also get erased when you upload a new sketch though?

I think progmem is a good place to store long, static strings, etc,  but if there's any way I can pull it off, I'll keep my engine parameters in EEPROM only.
Title: Re: My life, My coding
Post by: hakcenter on April 24, 2016, 01:56:20 PM
Code: [Select]
const PROGMEM  uint16_t charSet[]  = { 65000, 32796, 16843, 10, 11234};

for (k = 0; k < 5; k++)
  {
    displayInt = pgm_read_word_near(charSet + k);
    Serial.println(displayInt);
  }
  Serial.println();

How to use it simply. That'll save you ton's of memory.

If you want to read/write eeprom
Code: [Select]
int adr = 0;
byte val = 120;
EEPROM.write(addr, val);

byte value = EEPROM.read(adr);
Serial.println(value);

In terms of speed, the flash is only a few cycles slower than SRAM, but the EEPROM is in milliseconds. EEPROM you get like 100,000 writes, flash like 10,000.

You cannot update the flash after you've uploaded the program. You can update the eeprom while the Arduino is up and running, so it's your pick.
Title: Re: My life, My coding
Post by: Rx7man on April 24, 2016, 06:33:57 PM
That was my point.. flash can't be rewritten by the program, and will be overwritten by a new sketch upload if you could.  EEPROM, though slow, doesn't have that problem.. In most cases it will only be reading from EEPROM at boot time, and perhaps writing to it when you change parameters and decide to save it.

If you really want to read/write stuff, put it on an SD card!

IN other news, saw a guy on CF (Dan123dbl) who also lives in BC and has a lil'bb on a first gen... when I go down there I might meet up with him and have a beer and chit chat
Title: Re: My life, My coding
Post by: hakcenter on April 25, 2016, 10:37:30 PM
Using flash one values that don't change is a great way to save memory though. Who cares if it gets overwritten on a new upload.. every upload you update code anyways, it does the rest.

I saved 500bytes of ram moving just one time strings from Serial.print to useing F().
Title: Re: My life, My coding
Post by: Rx7man on April 26, 2016, 06:09:48 AM
Yes, that is what it's well suited for, but engine parameters that you want to change without a laptop (what I've been working on) not so much.
On the Mega you aren't quite as RAM restricted so I haven't bothered much with progmem except for a couple things
Title: Re: My life, My coding
Post by: Rx7man on May 14, 2016, 09:46:31 AM
Well, things have been quiet around here.. I've been really busy with farm work, also think I fractured a bone on my foot, which doesn't make getting things done any easier or faster...

Also found out my clutch is packing it in, a piece of it was dangling out of the space between the tranny and engine.. it's a piece of the shim in the hub, so it's not a structural piece, but it is a sign of things to come.. It's out of warranty, but it seems like southbend is good at accomodating.. I'm going to talk to them on Monday, and perhaps do a dual disc upgrade when I put the NV5600 in since I think I am getting pretty close to the 475 HP mark the clutch is rated at.
Title: Re: My life, My coding
Post by: hakcenter on May 14, 2016, 10:53:21 AM
I have the big single ceramic, and while it works, I absolutely hate it.
Title: Re: My life, My coding
Post by: Rx7man on May 15, 2016, 05:28:22 PM
What do you dislike about it? what kind of power is it rated for?  Is it just grabby?
Title: Re: My life, My coding
Post by: hakcenter on May 15, 2016, 07:52:48 PM
I'm pretty much forced to start in 1st cause it just bucks and bangs trying 2nd. Not made to slip, its on/off

I was going to do a g56 swap but the guy near me just stopped communicating with me so I gave up
Title: Re: My life, My coding
Post by: Rx7man on May 15, 2016, 08:03:27 PM
I heard if you get them good and hot a couple times they become a little nicer.. Buddy has a bronze LUK clutch and it's pretty grabby too.. I find the SB I have could be more grabby.. I did have it slip on me once when I was shifting under load
Title: Re: My life, My coding
Post by: Rx7man on May 17, 2016, 08:29:58 AM
Wow.. Really impressed with Southbend...
I'm getting a complete new clutch, not even paying shipping, and it's 4 years old.. Thumbs up to them!
Title: Re: My life, My coding
Post by: hakcenter on May 17, 2016, 10:27:18 AM
Ya everyone seems to have the ultra luck dealing with SB for whatever reason, but my emails get no response. Probably cause I'm filtered @hacker for a last name :(
Title: Re: My life, My coding
Post by: Rx7man on May 17, 2016, 08:56:39 PM
haha!  Closest name I've seen to yours is one of my friends, Hackerott
Title: Re: My life, My coding
Post by: Rx7man on June 21, 2016, 12:31:34 PM
Well, it's sounding like there's going to be a 1/8th mile drag race in town here in a month... I think I might go flog on my truck a little bit!.. I'm going to have to connect up the linelock electrics, toss a set of single tires on it, and make a 'staging' mode for the turbo.. Perhaps I'll slack off the star wheel too and borrow my buddy's bigger injectors and see what kind of time I can put down.... What do you guys think is possible?.. I'm only really familiar with 1/4 mile times, and I figure I should be able to do about a 15 second 1/4 mile...
Title: Re: My life, My coding
Post by: Rx7man on July 14, 2016, 01:01:39 AM
I think I may have found a way to operate solenoid at a reasonable PWM frequency.. I'm thinking about a minimum increment of 5ms...

I'll have a timer expire every 5ms and increment a counter from 1 to 100 in 5's, then when you want to pulse the valve, you just check to see if your desired PWM % is greater than the counter value.. Resolution isn't great, but it's sufficient to control most valves, especially if a feedback loop is incorporated.

I came up with the idea (I'm sure I could have googled the same one) when I wanted to blink indicator lights at different rates, I incremented a counter at 50ms from 0 to 7.. a slow, even blink is if it's greater than 3, a slow blink with a long "ON" time is if it's greater than 1.. a fast blink is if modulus 2 == 1.. you can do other combinations too with minimal overhead.  I just made a few global boolean values that store the status, and then use them wherever I need it.. so far so good :)
Title: Re: My life, My coding
Post by: Rx7man on July 14, 2016, 06:21:19 PM
Figured out how to use an interrupt to increment the counter, so it's steady.. I currently have it so it's got about a 2.5% resolution, which is good enough for controlling an AFC ;) 

Now I'm going to go to town and see what I can do for tuning the staging mode

Here's the interrrupt code.. Blinks LED13 according to Analog input 1

Code: [Select]
#include <TimerOne.h>
volatile int T1clicks;
int T1tickResolution = 40;

int LED = 13;

void setup() {
  // put your setup code here, to run once:
Timer1.initialize(2000);
Timer1.attachInterrupt(T1ISR);
pinMode(LED, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
SetPWM(LED, (analogRead(A1)/10));
}
void T1ISR(){
  T1clicks +=1;
  if (T1clicks > T1tickResolution){
    T1clicks = 0;
  }
}
  void SetPWM(int Pin, int Percent){
    digitalWrite(Pin, (float(T1clicks)/float(T1tickResolution) *100) < (Percent));
   
   
  }
Title: Re: My life, My coding
Post by: Rx7man on July 16, 2016, 10:09:19 PM
Advanced my timing today.. checked valve lash, was pretty loose, went to 8/16 on it (it was about 12/22 before)
Title: Re: My life, My coding
Post by: Rx7man on September 05, 2016, 01:30:59 AM
Been a while since I updated.. been too busy with kitchen renos to do a whole lot of tinkering, finished today (took 2 months)

I know I posted these in another thread, but I'll put them here.. Truck turned a lot of heads at the 1/8th mile drags, best time was 10.055@75mph
Knew I had no chance against this, but I did get him on the 60'
https://www.youtube.com/watch?v=YChXQXOBAEo

Poor old chevy gas job slept at the light and it only got worse from there
https://www.youtube.com/watch?v=gV2okbWAclU


Other than that, I blew the head gasket in my newer XR500, so it came apart.. total clusterfuck job of a rebuild done by the last shop, if they could screw it up they did... As if it wasn't bad enough they stripped the head bolts from the cylinder (the reason for the blown head gasket), they helicoiled them and DID IT AGAIN :banghead:  I took the cylinder from my old XR500, and it had water pitting in there, so wasn't that great, then I was told I could swap the sleeves.. Just heat them in the oven to 300F and they just fall off.. worked like a charm.
Of course I wanted better power, so I did a little head and valve work.. the old bike will never run again so I had lots of parts to play with.. decided I was going to see if I could grind the cam for better lift and duration... did a LOT of figuring to see how much I could increase the cam lift before the valves would bottom out and reground it.. added about 5* duration on either side of center for each lobe and .040" lift on the exhaust, .080" on the intake..  Next I'll see if I can lower the cylinder to increase the compression a little bit, will have to watch valve/piston clearances though... Anyhow, hopefully it gives it a little more oomph at the top end when I'm done, might sound a little raspy.
XR400 with the bad tranny is also going to be getting redone (blew 3rd gear 2 weeks after I bought it). as well as a set of rings in the XR100 farm bike, it just smokes sooo bad now.. bike is a total wreck but it gets me from point a to point b.

The truck.. well.. hopefully I can find a 3.55 rear end gear set and then I can do the 6 speed swap this fall and flog it on the dyno.. looking at a methanol kit from Devils Own.. will require about 20gph so I'm thinking of splitting it with a 5 and 15 GPH nozzle... Still haven't gotten around to backing my timing down.. runs well enough where it is and I'm lazy/busy.
On the arduino front, I'm looking at making a better, neater setup, got some 12pin aviation connectors which will connect to the box neatly, and on the inside I got a screw terminal board with a little prototyping space, on which I will have some 12V-5V step down IO's in both digital and analog flavors so I can read battery voltage, 3 axis accelerometer, compass and gyro, 8 channel Mosfet output which should be able to control the methanol solenoid and pump, interface for the R-Pi head unit, which will require 3.3-5V conversion unless I find a CAN bus controller for it (which I'd rather).

On the farm? well, haying is all done for the year, probably shipping calves out next Monday, they're eating me out of house and home.. The 4 replacement heifers I have look really good and behave correctly, hopefully they do well.. Here's one of them *really* enjoying a neck scratching
https://www.youtube.com/watch?v=PhnygvK46zA

That's all folks!

Title: Re: My life, My coding
Post by: Rx7man on September 24, 2016, 10:52:51 PM
Picked up another HE351ve with no actuator from a 2012 for $200.. figure if anything piles up in mine it would be handy to have a spare around, and if I really wanted to I could play with an air or oil actuator on it.. Meanwhile the guy I bought it from does a lot of work and has access to the Cummins tools, so I might bring my truck in to him and get him to set the actuator to "Learn" mode, but what he won't know is that the Arduino will log all his commands and the replies from the turbo so I can do it myself later *snicker*
Title: Re: My life, My coding
Post by: Rx7man on October 06, 2016, 09:49:23 AM
ONE MORE TIME.. working on a frontend for my version... I'm not going to get into the R-Pi just yet... building it in VB.net.. My laptop has an HDMI port which i can interface to the 7" touchscreen, so I'll start with that.. I'm really not having much luck fine tuning without a HUD that shows me exactly what's going on, and which compensators are active and a good readout of the stats... I'm trying to make it at least half pretty with changing colors depending on values... Yeah, I'm probably going to scrap it all again at some point.  Then I gotta figure out the serial interface again.. it's been a year since I looked at it.

Also, I'm getting a bunch more crap off ebay... going to get a couple more Arduinos.. 2 dues and 2 more Megas.. they're so darned cheap now.. I have a 9 axis accelerometer/gyro/compass, humidity/temp sensors, barometric pressure sensors, GPS, HC06 bluetooth, SD card readers, and real time clocks, and some 20x4 LCD displays. of course not just for this project!
Title: Re: My life, My coding
Post by: hakcenter on October 08, 2016, 03:23:19 PM
I would ditch that hc06 for an hc05, going to be happier with it, just fyi *wink*

You'll also need to do some garbage collecting on the serial interface, if you parse any information before bluetooth connection.. etc

ie: startup values and whatnot

The hc buffer is pretty large :D
Title: Re: My life, My coding
Post by: Rx7man on October 08, 2016, 04:25:05 PM
They're easy to swap out if needed.. I'm actually not really planning on using it with this project.. yet... and definitely not looking to program through it, but it would be handy for a serial monitor

Meanwhile I'm tearing my hair out with this Visual Studio debugger... I don't know if its some hidden setting or not, but it doesn't break on an error at the line that caused the error.. so it is 10x harder to figure out  what line is acting up.
Title: Re: My life, My coding
Post by: hakcenter on October 09, 2016, 04:48:51 PM
Not just for being able to program the uno, but the at mode, and all the crap surrounding the unit.. I've had nothing but problems working with it.

Dropped a hc05 and everything cleared up. YMMV
Title: Re: My life, My coding
Post by: Rx7man on October 09, 2016, 06:53:51 PM
I'll keep that in mind when I get to working on it.. I also have some other wireless uits.. NFC24W I think it is?  Look just like the HC05/6 modules. 
I did also find some HC07 ones.. don't know if they're the best of both?

Still fighting VS.net.. on a different problem this time... events aren't working right.. grrrrr...
Title: Re: My life, My coding
Post by: Rx7man on October 10, 2016, 12:46:54 PM
YESSSSS!!!
I finally won against all odds.. it's not particularly pretty, but it will do the job of displaying the data in an easy to read manner.. still have a few things I want to add, but the proof of concept works, and though of course it's a bit tedious to set up, it's not difficult.. and I think I managed to do it in a pretty object oriented fashion...

Each group of graphs has a configuration structure which contains the main title, color gradient, minimum and maximum values allowed, division increments, decimal digits to display, a value multiplier, Min/max peaks with falloff delay, rate, and color and width

Each graph in the group has the value to set, a tag to match to the serial input, name, and what I called a "zero point", which can determine at which point the bar is drawn from the top down

The labels for the values and titles also automatically rotate if the size is too narrow to display them horizontally.. Also, the titles and labels follow the color of the graph, which makes it easy to see at a glance  which ones are different


Unfortunately I'm going to have to redo this all for the R-pi, as well as add code to control the box.. but this is a good start, and I dont' think I'll have to scrap all of this and start right from scratch.. This is quality code I can dare reuse!


Title: Re: My life, My coding
Post by: Rx7man on October 21, 2016, 10:36:17 PM
Well, the 6 speed swap is nearly complete.. was quite a job.. Depending on the interest I'll be doing a writeup on Cumminsforum.. I did document it pretty well.. Lots of little things you don't foresee.. Things like tcase shifter mounts being tranny-mounted on the NV4500, but body mounted on the later ones.. So you get the body mount and then find that the rods are different lengths, and you get the right length rod.. you put it together and find you go through all the gears in about 1" of motion.. the transfer case actuator arm is about 3 times longer on the new trucks.. so you get that.. and then find that the eustacheon on the transfer case knob reads in reverse, so there must be some differences internally on the later tcases... And then there's the stuff you do foresee.. like tranny mount relocation, reverse switch wires not being long enough, etc... Looks like my reverse switch wire is going to be DARNED close to my downpipe.
Title: Re: My life, My coding
Post by: Rx7man on February 03, 2017, 10:39:04 PM
Alright, I got the 6 speed in, also put the 3.55 gears in and shortened the driveshaft by 1/2"... LOVE this setup, so much quieter cruising and i'm sure i'll get much improved highway mileage, and I can afford  to drop down a gear when loaded and pull the hills in direct drive since I can now do 75mph in 5th.

Changed out my fuel filter, I'll see if that fixes my low pressure problem and gives me some more top end power.

Also finally programming the LCD screen.. I don't know how well it'll perform, but it's worth a shot.. LCD's seem SLOOW to refresh, and anything over 2 updates a second is useless
Title: Re: My life, My coding
Post by: Rx7man on March 26, 2017, 04:45:29 PM
well, calving season is under way, 11 calves so far, doing pretty well.. 12 to go.

Love the truck with the new gearing, being able to go 75mph in direct gear and having another one to go sure helps on the passing lanes.
Currently waiting on a pile of CAN transceivers so I can kinda redesign everything, probably will be using a DUE for the brains because of the 32 bit capability, then having a couple Pro-minis on the CAN bus, one for the dash/display/manual inputs, one in the engine bay reading analog sensors close to the source, one may be dedicated to thermocouple duty... then MAYBE I'll still think about using the R-Pi and sniffing the CAN bus for all the information and displaying it.. might take a while yet.

I got an itch yesterday to fiddle with something new, so I had some Sparkfun TLC5940 boards and some RGB LED's.. the board is a 16 channel 12bit PWM module which is chainable.. I bought 50 RGB LED's, so I used 5 of them, and for my purposes I had to rather rewrite the library.. the TLC is a sequential unit, so every time you push a new value in, the previous values for any channel get moved to the next channel.. great for doing sequential stuff, not so great for RGB or setting individual LED's... a few hours and I made some pretty nifty blinkies.. damn those LED's are bright!.. One little issue I came up with was that the green channel is a little weak and it shows when mixing colors, so I still fiddled a little to get that part good by 'trimming' the more dominant colors.. Works pretty good and it's easy to use now... Lavalamp effects, police flasher, misc color displays, fading, chasing colors.. I couldn't think of anything else interesting to do, though if I was epileptic I definitely wouldn't have been able to do this!
Title: Re: My life, My coding
Post by: Rx7man on March 27, 2017, 01:54:06 PM
I also FINALLY got the LCD screen in.. no cover or anything on it, just kinda glued to the dash.. I'll take a little trip with it and see how it works.. I'm waiting on an LCD that has some buttons on it to see if I like that better.. also waiting on some rotary encoder buttons and an FTDI interface for the Pro Minis, in which case I'll have one of those on the dash controlling the LCD, dash inputs, and blinkylights.
Title: Re: My life, My coding
Post by: Rx7man on March 29, 2017, 10:36:21 AM
After a few tweaks the LCD is working alright.. had a couple glitches with stuff getting written on the wrong line, especially when a negative number came along and messed up my alignment.
Second problem is that the LCD update takes 72ms, which is freaking slow, so I had to update the turbo position once in the middle of it to prevent the turbo from timing out.. a bandaid fix.
I'm going to rework the library entirely so that I don't have to make Log10 calls to figure out how many digits to show, as well as only updating the LCD physically when it's all done, which should save MASSIVE amounts of time, and probably make it possible to update it more frequently too...
Title: Re: My life, My coding
Post by: Rx7man on March 29, 2017, 10:38:04 AM
Here's a picture of it
Title: Re: My life, My coding
Post by: hakcenter on March 29, 2017, 11:00:29 PM
You can check the common code under the logging output section to see how I handle digits, with string replacements, which saves a ton of computational time
Title: Re: My life, My coding
Post by: Rx7man on March 30, 2017, 12:20:23 AM
I think a lot of time is lost since it updates the LCD on every change.. cursor position change, etc.. each call takes quite a few cycles.. (probably at least 20 over i2c)
If I have a couple character arrays corresponding to each line, then set the cursor position once, and update the entire memory at once, even if my math, etc is unoptimized I should be better off.. Also, in my current code I set the position for each text tag seperately, I could already glob it all together and see how that changes the speed... I'll take a look at the common code if I get stuck :)
Title: Re: My life, My coding
Post by: hakcenter on March 30, 2017, 08:40:28 AM
Set a timer, refresh the entire string you send to the lcd on that, only do string replacements to update specific areas :) super fast
Title: Re: My life, My coding
Post by: Rx7man on March 30, 2017, 01:13:43 PM
that's kinda my idea.. refreshing individual parts of the screen is just way too slow.. it'll be a while until I get back to coding it.. got too much other stuff happening
Title: Re: My life, My coding
Post by: me78569 on March 31, 2017, 10:21:06 PM
I think I am only updating like 6 positions on my screen now.  I set titles in the setup section of the code. 

Been a very long time since I have looked but I do remember taking my screen update time from ~80 ms to 24ms after that update.
Title: Re: My life, My coding
Post by: Rx7man on March 31, 2017, 11:13:54 PM
I think I am only updating like 6 positions on my screen now.  I set titles in the setup section of the code. 

Been a very long time since I have looked but I do remember taking my screen update time from ~80 ms to 24ms after that update.
Is yours a 2 or 4 line screen?  I'm displaying 7 parameters right now..
I'm still waiting on my mini CAN controllers, I'm thinking I'm going to have the current Mega/Lilbb just do IO duty and transfer it over CAN, and perhaps use my DUE that ought to be here soon too do the processing... It may have some barebones backup code to keep you driving should CAN comms get lost (redundancy is good)
Title: Re: My life, My coding
Post by: me78569 on April 01, 2017, 07:29:11 AM
4 line updating turbo speed /100 boost drive and position in cm^2
Title: Re: My life, My coding
Post by: Rx7man on April 01, 2017, 09:56:17 AM
I've got MAP, EGP,  TPS, RPM, turbo speed, command position, actual position, temp..
I might at some point have a couple different display modes so I can view other things.. perhaps some switch positions.. When i get it hooked up, 4 channel pyro, perhaps vehicle speed..
Title: Re: My life, My coding
Post by: Rx7man on April 13, 2017, 07:07:33 PM
I found my big problem, I2C data rate was too slow, It didn't want to work at 1mhz, but at 800khz it works, and the update time went from 78ms to 22ms
Just add..
Code: [Select]
Wire.setClock(800000);
big improvement, highly recommended.
Title: Re: My life, My coding
Post by: Rx7man on April 13, 2017, 09:32:47 PM
Also, EVERYONE concerned with speed should be using Bill Perry's library.. MUCH MUCH faster than any other with some cool features, though it's a little confusing to get started with.. it autodetects a lot of things.

https://github.com/duinoWitchery/hd44780

So after setting the baud rate to 800khz, and using that library, it's now at a steady 13.12ms for a full refresh.. I can live with that...
Title: Re: My life, My coding
Post by: hakcenter on April 15, 2017, 07:42:32 AM
Interesting, why no 1meg ?
Title: Re: My life, My coding
Post by: Rx7man on April 15, 2017, 08:40:25 AM
Interesting, why no 1meg ?
wouldn't work at 1mhz.. 800K worked, 801 and higher didn't, so I guess it's staying there
Title: Re: My life, My coding
Post by: Rx7man on April 17, 2017, 11:42:24 AM
Now I'm working on accelerometer, compass, gyro, clock, and barometer.... trying to get all the libraries to play nice with each other and not have too much overlap between them
Title: Re: My life, My coding
Post by: bperrybap on April 26, 2017, 10:04:55 AM
Interesting, why no 1meg ?
wouldn't work at 1mhz.. 800K worked, 801 and higher didn't, so I guess it's staying there
Technically according to the datasheets I've seen, the part is only spec'd to run up to 100khz.
However they do seem to run much faster.
In order to run fast, the pullups will need to be quite strong and the wires will need to be kept fairly short. If attempting to run this fast you should make sure your pullups are fairly small but don't go below 1k. (1k is the lowest allowed by the i2c spec)
Also keep in mind that at high clock speeds like this since it is beyond the parts maximum ratings, it may be more subject to electrical noise especially in high noise environment such as a vehicle. And the issues you may run into will likely vary according to temperature.

I'd be curious if when you got the failures at 1meg if hd44780 was reporting an error on the API function or whether the system locked up.
I've experienced some issues where the system will lockup if a slave improperly handles the ending status right at the end of the i2c transfer. My conclusion was that this is a h/w issue in the AVR two wire implementation around multi-master suport. It appears that that it could be worked around in the Wire library. My concern would be that running at these high speeds that you might end up in the same situation if there were a signal glitch that occurred at just the right time.

--- bill
Title: Re: My life, My coding
Post by: Rx7man on May 01, 2017, 08:39:10 AM
Interesting, why no 1meg ?
wouldn't work at 1mhz.. 800K worked, 801 and higher didn't, so I guess it's staying there
Technically according to the datasheets I've seen, the part is only spec'd to run up to 100khz.
However they do seem to run much faster.
In order to run fast, the pullups will need to be quite strong and the wires will need to be kept fairly short. If attempting to run this fast you should make sure your pullups are fairly small but don't go below 1k. (1k is the lowest allowed by the i2c spec)
Also keep in mind that at high clock speeds like this since it is beyond the parts maximum ratings, it may be more subject to electrical noise especially in high noise environment such as a vehicle. And the issues you may run into will likely vary according to temperature.

I'd be curious if when you got the failures at 1meg if hd44780 was reporting an error on the API function or whether the system locked up.
I've experienced some issues where the system will lockup if a slave improperly handles the ending status right at the end of the i2c transfer. My conclusion was that this is a h/w issue in the AVR two wire implementation around multi-master suport. It appears that that it could be worked around in the Wire library. My concern would be that running at these high speeds that you might end up in the same situation if there were a signal glitch that occurred at just the right time.

--- bill
I"m running it at 400 now just to give me a bit of room, the better library helped a lot!  Most other devices seem happy around 400 as well and by the end of this I'm going to have a number of devices on I2C, though I think I will experiment with using a separate processor for interfacing a lot of these non critical sensors and transferring the data over CAN

Welcome to this little playground :)
Title: Re: My life, My coding
Post by: Rx7man on August 20, 2017, 04:52:17 AM
I suppose I should update this once again.. I'm working on a little fuel injection controller for farm engines that I'm trying to make as versatile as I can.. and ONE of the requirements I'm looking from it is the ability to control the H1000 pump, which I might be getting and installing on my truck... dang, 1100hp of fuel, 325bar injection pressure, better ramp rates, adjustable timing, and essentially no limit to RPM.. sounds like fun.

Anyhow, I gotta go bale hay.
Title: Re: My life, My coding
Post by: me78569 on August 21, 2017, 01:11:30 PM
I love the Idea of the h pump,  hard to find, but VERY cool. 

you could make a very nicely running engine with one of those bad boys.   What I have learned in the vp44 tuning world shows signicant improvement in MPG, smoke, and power without having to limit to a given speed rpm or power.
Title: Re: My life, My coding
Post by: Rx7man on August 21, 2017, 02:51:32 PM
If I manage to cough up the money for the pump and get it installed, I'll let you know how it goes!... takes a considerable amount of power to run them (battery and crank power).. 12A for the rack solenoid and 6A for the timing.
Currently working on the controller for the fellow who has the pumps, his is in a Ford where a lot of info is on the CAN bus (It has MAF, MAP, etc all on the CAN bus), so it'll be a simpler unit than one found on a standard application.. there will be some trickery to get it to all work together though.. I'll still have to interface to a 60-2 crank trigger and put a piezo sensor on the #1 injection line so I can get a feedback on actual timing position.. Rack position has a 0-5V feedback reference so that's easy.

The programming side of it is certainly going to be a learning curve for me.. and a bit of a steep one, though a lot of the stuff will be applicable to my next pet project of a small injection controller
Title: Re: My life, My coding
Post by: me78569 on August 22, 2017, 08:31:07 AM
Well if you need help with a starting point for where the vp44 trucks like to run I am more than willing to share what I know. 

Some of it will be apples to oranges, but it may help you some lol..... I've made a lot of mistakes... I mean I have learned lots.
Title: Re: My life, My coding
Post by: Rx7man on August 22, 2017, 10:35:43 AM
haha, yeah,.. I have as well.  The fellow who has it on his truck seems to have a pretty good idea of what he wants.. pin time it to 10* which will make for a very tame engine at low revs, and bring in some timing as revs come up.. This pump has a MUCH faster injection cycle than a P7100, so you don't need as much total timing.. With the much higher injection pressure you can use a smaller nozzle and get a cleaner burn as well
You on facebook?
Title: Re: My life, My coding
Post by: me78569 on August 22, 2017, 09:01:48 PM
Nope no Facebook here.

What's the rated pop pressure supposed to be?
Title: Re: My life, My coding
Post by: Rx7man on August 22, 2017, 10:23:19 PM
325 bar is what you can set them to.. so that's a considerable bump
Title: Re: My life, My coding
Post by: me78569 on August 23, 2017, 06:15:06 AM
I like that.  I am wanting to get a set at 340 bar for testing how well I can atomize while keeping it driveable
Title: Re: My life, My coding
Post by: Rx7man on August 23, 2017, 01:50:11 PM
What are the 24V injectors usually set at? I think 12V  P pump ones are usually around 285?
Title: Re: My life, My coding
Post by: me78569 on August 23, 2017, 04:00:14 PM
310 ish 
Title: Re: My life, My coding
Post by: Rx7man on August 23, 2017, 09:30:42 PM
hmm.. so the H pump on a 24V should work nicely
Title: Re: My life, My coding
Post by: Rx7man on September 18, 2017, 09:18:10 AM
Well, I went to the drag races yesterday again.. I beat my best from last year by 1/100th of a second, but MPH was a little slower.. 10.02 @ 72mph.. I attribute that to the extra shift I needed with the 6 speed..
I blew the 5th gear shift 3 times, that short throw shifter is sooo sensitive you just THINK of the gear you want to go to and you've gone too far.

Didn't get much for video, but here's the burnout competition.. I didn't get anything, but the tires were at the very end of their life anyhow, so might as well have some fun
https://youtu.be/flNE-KVfBPE

I told the pit guy to stop me if I was smoking the clutch.. I started in 3rd gear, and he say "you're good".. I killed it thinking it wasn't working.. so then I didn't want to restart another time since the tires had gotten sticky, so I just did it in 2nd.. tire speed was way down so took a while to smoke, but I had fun brapping the throttle, and the truck looked good doing it
Title: Re: My life, My coding
Post by: Rx7man on September 18, 2017, 09:22:30 AM
Oh, I also hadn't looked at my program in AGES.. I had some bugs to work out of it that I never got to fixing.. it's working better now, and my display will show what mode it's in.. brake mode, staging, burnout, etc

I'm still having a problem with what I assume is the I2C preventing interrupts from being caught and making my engine speed erratic.. have yet to figure that out..
Once I get my daughterboxes built I will just transfer everything over CAN and have faster processors which will make both the wiring and the coding simpler.. one box for display and manual inputs, one box for "thinking", and one or two in the engine bay that collect data and control outputs.
Title: Re: My life, My coding
Post by: hakcenter on September 19, 2017, 07:37:15 AM
Looked great dude. How are you catching engine speed ? You may want to disable the interrupt during the math section of using that variable.. that's all I did.
Title: Re: My life, My coding
Post by: Rx7man on September 19, 2017, 02:07:43 PM
The engine and turbine interrupt handlers are very short, just "count++;".. Then every so often I check for how many counts have elapsed, and only briefly disable them to copy to a temporary variable... I never noticed this when I had it displaying over serial, it started when I enabled the LCD
Title: Re: My life, My coding
Post by: Rx7man on September 27, 2017, 09:55:22 PM
I pulled the trigger!!
67mm turbine wheel and 67mm compressor are coming in... I look forward to lowering my drive pressures, I think that'll make a huge difference at the top end
Title: Re: My life, My coding
Post by: Rx7man on October 04, 2017, 11:02:32 AM
Well, on my drive to Kamloops (100 miles each way) yesterday with a load of calves, my #2 injector stuck on me.. I think it stuck open first, smoked like the truck was starting at -20, then it cleared up and ran well, then started acting up again and missing, but not so much smoke... cracked the injector lines, #2 was dead, pulled it and took it apart and the pintle was seized solid.. with a bit of fiddling I got it to come out, it was galled.. I had some steel wool with me and I cleaned it off good, put it back in, still misfired badly.. Limped home, will be swapping out to my old injectors (found out they're 4x013 155* VCO).

Considering how much the 4x013s compressed the spring when you took them apart, and how little the 5x012 did, I'm wondering if the spring isn't bad.. perhaps broken? I'll take it apart and inspect it.

They're out of warranty but the vendor will be looking at what they can do for me.. we'll see.

Oh, I also got the turbine housing machined out for the new turbine shaft.. compressor will be a bit more of a challenge.. waiting for the parts before I tackle that side of it.
Title: Re: My life, My coding
Post by: hakcenter on October 05, 2017, 09:59:40 PM
which shaft ? the 10 wheel from BAE ?
Title: Re: My life, My coding
Post by: Rx7man on October 05, 2017, 10:31:18 PM
Yes, 10 blade but from Turbolab of america
Title: Re: My life, My coding
Post by: hakcenter on October 06, 2017, 08:41:31 AM
67x76 blade ? Pretty sure you can't go any larger than 70mm on the outer because of the vanes

I'm pretty sure the BAE is a drop in,
   Turbine Wheel/Shaft for Holset HE341VE HE351VE 70.00mm Inducer 64.00mm Exducer 10 Blade High Performance by BAE-1
 (http://baeturbosystems.com/compressorwheelformitsubishitd04hl4350mminducer-5600mmexducer-1-1-3-1-2-4-1-2.aspx)
Title: Re: My life, My coding
Post by: Rx7man on October 06, 2017, 10:09:07 AM
It's a 67x72 I think.. yes, the unison ring gets in the way of bigger turbines.

I don't think the flow bottleneck in these turbos is around the unison ring though, I think it's in the exducer, so increasing that are from 60 to 67mm, with less blades impeding the flow is going to make a really big difference in drive pressures at the top end.. Yes, it might spool a little slower, but I don't think it's going to be terribly noticable... I think after about 50-60% open I won't need to open wide as fast since it flows better.

To start with I'm just going to install the hot side so I can do some comparisons, then install the compressor later.
Title: Re: My life, My coding
Post by: hakcenter on October 06, 2017, 11:39:55 AM
Is there even enough material left at the exducer @ 67mm ? Or are you just going to machine around the turbine and leave the exiting hole still @ 60mm ?
Title: Re: My life, My coding
Post by: Rx7man on October 06, 2017, 12:42:41 PM
Yep, there's enough room.. Just at the limit though
https://www.youtube.com/watch?v=h8weAXbZSKQ
Title: Re: My life, My coding
Post by: Rx7man on October 06, 2017, 10:16:01 PM
OK, I have the parts in my hand now... the compressor wheel is really nice, and a much tighter fit on the shaft than the stock cast wheels.. you have to press it on, or perhaps it would just slide on with some preheating.. anyhow, that's really nice.

Turbine wheel looks really nice as well, BUT, it doesn't have the cut in the shaft for the speed sensor... I put a small one in it with a diamond wheel, I don't think it'll throw the balance off, and being between the bearings it'll be more forgiving that at the end of a shaft anyhow.  All that remains is to install it all.  Injectors first though
Title: Re: My life, My coding
Post by: hakcenter on October 06, 2017, 11:12:18 PM
pix or it never happened
Title: Re: My life, My coding
Post by: Rx7man on October 07, 2017, 02:14:24 AM
It's already installed.. my phone doesn't take pictures worth showing, broke my good phone.. haven't installed the compressor yet though, I can do that super easily with the turbo installed though.. I'll probably take it for a rip tomorrow and see if I have to adjust the vane openings a little now..  The sensor is picking up the notch I put in the shaft, so that's good.

Also, put my old 4x013 injectors back in and my misfire went away thankfully! 

You know your truck rolls coal when you sweep the exhaust off the floor!  That stuck injector sure sooted things up!
Title: Re: My life, My coding
Post by: Rx7man on October 11, 2017, 02:36:57 PM
OK, I got everything put together.. here's my initial assessment..

It's hard for me to compare EGT's since my 5x012 injectors packed it in last week.. Took it for a quick drive though with my 4x013 injectors, might have to loosen the star wheel a little, has no fuel plate anyhow... it's dark so I can't see what the smoke is like.
It does spool a little slower but I haven't tuned the controller yet, it definitely flows a LOT more air on the hot side.. probably close to double! I do a lot of tooling around in 4th gear (NV5600) on the dirt roads, seems like 10psi boost at 1400 is no problem to get, 1800 I think I can get any amount I want.. 5th gear rolling into it at 2000 it lights the tires and hits 3K pretty damn fast..., EGT's were 1200F
Next Monday I'll have a couple ton behind me in the trailer and I can see how that does.

As for the sound, definitely a lot louder, but it's more of a whoosh than a whine, at least at the power levels I've been asking of it on the dirt.

It took HOURS of machining to do it, I had no specs or anything and a manual lathe, so it was a lot of small cuts and test fitting!
Here's a vid of machining the hot side
https://photos.app.goo.gl/neypofOvBuh3vPts1

Pics.. backside after machining, front side with new wheel, front side with old wheel, and the new wheel alone
new wheel is a 67x89x95
Title: Re: My life, My coding
Post by: Rx7man on October 11, 2017, 02:38:51 PM
If anyone is interested, I'd be able to do the hot sides quite easily.. I think a lot of gains can be had from that alone.. and I have cores to work with
Title: Re: My life, My coding
Post by: hakcenter on October 11, 2017, 04:57:59 PM
I would love to do my hot side, how much was the wheel from turbolab ?
Title: Re: My life, My coding
Post by: Rx7man on October 11, 2017, 07:00:42 PM
$150
He351ve 10 Blade Turbine Upgrade 67mm By 70mm  | eBay (http://www.ebay.com/itm/He351ve-10-Blade-Turbine-Upgrade-67mm-By-70mm/112041999175?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649)
Title: Re: My life, My coding
Post by: Rx7man on October 11, 2017, 07:02:21 PM
It should be noted that it doesn't come with the cut for the VR sensor.. I used a diamond bit in a dremel to put one in
Title: Re: My life, My coding
Post by: Rx7man on October 15, 2017, 09:50:26 AM
Here's a quick vid I made.. only coarsely tuned, doesn't complain at all about 40+ PSI though the boost gauge does!
https://www.youtube.com/watch?v=CH_pXsLA5aA
Title: Re: My life, My coding
Post by: Rx7man on October 22, 2017, 04:06:24 PM
Someone put bad ideas in my head... I'm thinking of a strange set of twins.. parallel hot sides and series cold sides using 2 HE351VE's... I think I should be able to make it work but it will take a lot of fiddling.  I need to find another actuator before I can even think about it though... Then modifying an exhaust manifold and doing downpipe work is going to be another adventure... At this point it's just a pipe dream
Title: Re: My life, My coding
Post by: hakcenter on October 22, 2017, 06:34:43 PM
My idea was just to make a V adapter. Cut the manifold flange off completely. Weld a an outlet sideways with your V cut. So one is up and one is down, angled at your leisure. Then it's as simple as routing a few oil lines, and complicated as a Y pipe to exhaust.
Title: Re: My life, My coding
Post by: Rx7man on October 22, 2017, 08:48:18 PM
Yeah, that's what I'm thinking as well.. since i have the 4th gen manifold I have on facing down, and I'd put one at a 45* upward, but perhaps moved forward a little bit.

What do you think of the idea of parallel hot sides and series cold sides?  Think it could work?
Title: Re: My life, My coding
Post by: Rx7man on October 28, 2017, 03:35:24 PM
Well, did a lot of work on my truck the last day..
Part 1: Hydroboost unit installed.. waay better brakes after I fixed a Homer moment of mine and put the PS pump relief valve O ring in the wrong groove, making it bypass at about 20 PSI.. that caused some cussin'!

Part 2: Upgraded my fuel system, 1/2" fuel lines all the way with a draw straw.. My fuel pressure issue was caused by excessive goop on the tank screens (it was disgusting).. but the upgrade is nice anyhow!  WAAY better power, even though I'm still on my 4x013 injectors.. When the 5x014's go in I'm sure it'll be sweet.

Part 3: New TPS sensor, old one was glitching all the time.. and a little bit of programming... Freerevving the truck I build 20PSI boost and it sounds just ANGRY when the turbo opens up.. I've also incorporated some anti-surge programming into it to hold the turbo open more during shifts and force it open when I'm approaching surge.
Title: Re: My life, My coding
Post by: me78569 on October 29, 2017, 09:47:44 AM
I need to adjust my anti bark function now that I have the 7x .012's as it is way easy to bark the turbo now lol
Title: Re: My life, My coding
Post by: Rx7man on October 29, 2017, 10:10:57 AM
I need to adjust my anti bark function now that I have the 7x .012's as it is way easy to bark the turbo now lol


7x12's seem to be nearly identical in cross-sectional area to my 5x14's  (1583 vs 1539 square thousandths of an inch, 4x13's I have in now are 1063)

I'm hoping to get the intercooler installed tonight, but might wait on it a little yet...
Title: Re: My life, My coding
Post by: Rx7man on October 29, 2017, 10:14:32 AM
What I did for anti-bark is have map of turbine speed vs minimum turbo area, I also have a little idiot light that lights when it's actively increasing turbo size.. Since I have a TPS on my truck, it also increases turbo size for a certain duration when you let off the throttle depending on how fast you let off.. seems effective so far.. I only have had one small bark on it and I haven't fine tuned it
Title: Re: My life, My coding
Post by: me78569 on October 29, 2017, 11:12:01 AM
I dont have barking if I let off at the top of the map, but I do have it if I let up in the 5-10 psi range with shaft speeds in the 70k rpm range.
Title: Re: My life, My coding
Post by: Rx7man on October 29, 2017, 10:46:33 PM
Spent the day cleaning up deprecated code and tidying things up a little.. and fixing some broken stuff, added some features, etc.
For some weird reason my LCD takes 45ms to update AGAIN.. I had it down to 19ms a while back and have no idea what happened.. I had to split the update into a few segments to make stuff run smoothly again.

I don't think a bit of surge at 70K is very damaging.. at 120K it has about 3.5x the energy

Another electrical gremlin I have is a sketchy RPM input.. it's picking up electrical interference so I'll have to look at all my wiring and maybe install some filters
Title: Re: My life, My coding
Post by: hakcenter on October 30, 2017, 07:56:18 PM
Okay can I have your old TPS pls
Title: Re: My life, My coding
Post by: Rx7man on October 31, 2017, 08:07:18 AM
you're aware it's FUBARED, right?
Title: Re: My life, My coding
Post by: hakcenter on October 31, 2017, 08:51:44 AM
I naid it
Title: Re: My life, My coding
Post by: Rx7man on October 31, 2017, 01:17:00 PM
If you need it to design a mount or actuator, I can give you good measurements, etc and it'll be cheaper than mailing it!
Doing it over again, or if this one dies too, I think I'd look adapting a much more common GM or Ford style to it that you can pick up easily and cheaply
Title: Re: My life, My coding
Post by: hakcenter on October 31, 2017, 10:09:01 PM
I forget you're in ohhhhhh Caaanaaadaaaa huh ? Can't you media mail it to me ? :(
Title: Re: My life, My coding
Post by: Rx7man on November 04, 2017, 01:27:21 PM
I totally brain farted about sending the TPS off last week, I was halfway into town when I remembered.


Meanwhile, I'm working on cleaning up some wiring by setting up an I/O box near the turbo, it'll have 2 thermocouple amps (Just the Max31855's this time), and will read EGP, MAP, and engine RPM.. don't think I'll do turbo RPM though on that one though since I'm doing on soldered breadboard and it just takes too many components.. I've discovered something meanwhile.. I HATE BREADBOARD!!!
All things considered it's turning out OK, I'm using a Arduino Pro Mini 5V/16mhz which has a small enough footprint, the enclosure is a waterproof   ~2.5"x3.5" unit which should do fine.. I'll put a power LED on it and perhaps a CAN transmit LED as well so I can troubleshoot it at a glance.. Most components will be removable on headers for easy replacement and screw terminal connecting.. I'll post pics when I'm a little further along.
Title: Re: My life, My coding
Post by: Rx7man on November 05, 2017, 07:22:59 AM
I got most of it done, doing some programming now and having issues with the thermocouple libraries giving me wonky numbers... It was a bit of an art form to get everything to fit into that box.. Still have to figure out how I'm going to run my analog signals into it and wire it.  I should have found a box 1 size bigger for this!.. Of course it wouldn't have been a problem if I used a printed board.

As far as programming goes, I'm going to try to keep everything in the daughter-boxes interrupt-only... If I can get a turbine speed input stuffed into the box I may put a "dumb" VGT position controller into it if it has seen that the turbo is about to timeout from not having received a command in some time just to keep it driveable if comms fail from one box to the other.  It's interesting to find other ways of doing things!
Title: Re: My life, My coding
Post by: Rx7man on November 05, 2017, 11:17:19 PM
I just put my 5x014 injector nozzles in.. Also cleaned out my fuel filter prescreen (Goopy), and deleted the heater.. Sure made the shop smoky in a hurry.. Hopefully I see another improvement in the fuel pressure.. look forward to the trip to town tomorrow.. perhaps I gain 50hp with this..
Title: Re: My life, My coding
Post by: Rx7man on November 13, 2017, 09:07:44 AM
I'm feeling lazy, but have to get to it soon.. have to replace E brake cables, with the cold wet weather they're freezing up on me...
Also ordered up some new headlights, hoping they'll be here today...

As for my plans on using the MAX31855 chips, a lot of the Ebay breakout boards are defective, with the GND and T+ terminals being shorted.. MAX31855's are also not 5V tolerant on the CS line, which makes them a pain.. I have gone blue in the face trying to get them to work and it just ain't happening.  Probably going to go back to the quad 31856 board I have.
Title: Re: My life, My coding
Post by: Rx7man on November 14, 2017, 10:43:15 AM
Well that pizzed me off.. it took Amazon 7 days to just ship my order!.. I should have it thursday or Friday (hell to pay if it isn't here friday)..
Here's the lights I'm getting  https://www.amazon.ca/gp/product/B01ATPDGS8/ref=ya_st_dp_summary?ie=UTF8&psc=1

Also found my AFC stop bolt was in fact limiting travel.. backed it off a bit and it seems to make a bit of difference... I'm getting closer to having the turbo well tuned, definitely need to get a 60PSI boost gauge because I'm wrapping the 35psi one right to the peg with ease.. so somewhere around 45-50 psi?  I think I might get the Hewitt Industries dual needle gauge so I can glance at EGP as well.. They also have some VR sensor pickups as well that might be handy.
Title: Re: My life, My coding
Post by: hakcenter on November 17, 2017, 09:20:34 AM
Mine hits 40-45 then settles around 35 at 125k. But drive pressures can be over 2:1 sometimes so you might want like a 100psi one :)

Also thanks, got your TPS, thanks :)
Title: Re: My life, My coding
Post by: Rx7man on November 18, 2017, 01:27:51 AM
I haven't paid super close attention to it, but drive pressures are much better with the new turbine.. the truck really moves now, I hit 100mph pretty easily passing people today.. Took my buddy for a ride, he loves it... t'was a long day, going to hit the sack.. good you got the TPS.
You MIGHT be able to bring it back to life if you get it hot for a while, It really bit the dust after I steam cleaned the engine. perhaps put it in the oven at 225* or so for a half hour would fix it?  might be worth a try.. what's to lose (A: the oven)
Title: Re: My life, My coding
Post by: Rx7man on December 17, 2017, 11:26:46 PM
fork me gently... Head gasket is taking a dump again, and I'm not sure if I have a broken ring or something.. seems to have a little more blowby and the power didn't seem as violent as it was.. then again I had a lot of weight on it too... I'll be taking a trip to town empty tomorrow and will see what it's like

Screw Cummins head gaskets though, this is the 2nd one in 40,000 miles and it's on a freshly decked block with a new head and ARP studs, there is NO reason it should have failed.  I don't think I'm getting compression into the coolant, but perhaps some into an oil passage?  It's leaking externally pretty good around #6 cylinder.. I've dummied it up to get by a while...  It's never gotten hot either.
Title: Re: My life, My coding
Post by: hakcenter on December 18, 2017, 10:31:15 PM
Well, my valve covers had oil inside the actual gasket. Like the part the valve cover sits in on. So if you don't have oil there I don't think you're loosing it into the oil just yet.
Title: Re: My life, My coding
Post by: Rx7man on December 19, 2017, 12:04:02 PM
I"ll only know when i take the head off.. I can then inspect the bore as well and see if there's any scoring... it is down on power, roads were wet last night and it should have lit the tires off in 5th gear, it was just barely doing it