Hi,
I'm currently trying to make a program to run a 6.0 ford powerstroke turbo on my truck. the turbo requires a pwm signal to run it if anyone could help that would be much appreciated. I've been messing with tinkercad trying to make a basic idea of how it will work an example of what i would need to do is a 0-5v input to a 5-0v output so as my input voltage goes up my output voltage goes down. the turbo vanes being vgt are closed at 5v for example and open at 0v. ive tried to use a pot and led as my test on tinker cad but cant get it to be like i said, any help would be nice thank you.
You'd need to verify the frequency the VGT actuator requires. I want to say it's in the 25-40Hz range. This can be easily accomplished by using one of the hardware timers in the AVR (assuming an Uno or Mega etc)
The harder thing is to know what DC (duty cycle) to command. In the OE application, it's probable the DC is determined using a bunch of parameters including manifold pressure, coolant and intake air temperature, engine RPM, commanded throttle percent (i.e. fuel control), transmission gear, vehicle speed etc.
Are you saying you just want to turn a potentiometer and have a 40Hz duty cycle adjust and it just stays at that setting with no regard to all the other engine operating parameters?
What Arduino are you planning to use?
Do you have access to an oscilloscope? This would be best.
As it is a pwm-signal such a $10 24 MHz 8 channel logic analyser would do too
Just a randomly choosen shop
https://www.ebay.com/itm/261831462069
choose a shop you trust
You should determine the frequency and the range of the duty-cycle.
Can you provide a datasheet of the 0 to 5V "delivering" circuit and the datasheet of the VGT (short for variable geometry turbocharger).
Is the 0 to 5V pwm-signal comming from the motor-control-unit? I have zero experience with customising turbo-chargers. I'm pretty sure that there is a online-scene for your kind of truck with a user-forum for things like that. Did you ask there if somebody has experience with this?
best regards Stefan
void setup() {}
void loop()
{
analogWrite(3, 255 - analogRead(A0) / 4);
}
Analog Read returns a value from 0 to 1023 as the voltage on the pin goes from 0 to 5V (assuming a 5V Arduino). Divide by 4 to get a value from 0 to 255. Subtract from 255 to get a value from 255 to 0. Apply that to a PWM output pin.
I was using a pot as a test on tinkercad but my end result is going to be a backpressure sensor as an input to the computer and the output will be the vgt actuator, and I wanna be able to tune when it come on and when not but to me it’s complicated. I would also wanna run a switch to open and close the vanes but when the switch is off it goes off the program to automatically do it I’m new to all this so I appreciate the help. I’m sorry if I’m not clear
Is this something I can test on tinkercad? Just as a test?
I don't see why not.
Okay Would I pretty much set it up like the example you gave? I’ll give it try later today and let you know if I have any questions
You can also give this a try (see Wokwi simulator as well...)
The gist of this is to provide a 40Hz PWM with upper and lower limits. The backpressure sensor (pin A0) is read every 10mS and filtered before being mapped to a PWM value to drive pin 9.
The built-in LED illuminates if the BP sensor input voltage suggests a short to 5V or GND (similar to how a car ECU determines certain types of sensor failures.)
/*
* Sketch: sketch_feb28a
* Target: Uno
*/
//VGT duty cycle constants
const uint32_t k_Minimum_VGT_DC = 2500u; //5% minimum drive duty
const uint32_t k_Maximum_VGT_DC = 47500u; //95% maximum drive duty
const uint32_t k_BPFault_VGT_DC = 25000u; //duty driven if BP sensor shows error
//backpressure sensor constants
const uint32_t k_BPSensorReadInterval = 10000ul; //BP sensor read interval (uS)
const float k_BP_FiltCoefficient = 0.27; //backpressure filter constant (smaller == slower response)
const float k_fMinBP = 0.25; //minimum BP sensor voltage
const uint32_t k_Min_BP_ADC = 51; //0.25V min from BP sensor (else consider shorted to GND)
const float k_fMaxBP = 4.75; //maximum BP sensor voltage
const uint32_t k_Max_BP_ADC = 972; //4.75V max from BP sensor (else consider shorted to 5V rail)
//pins
const uint8_t pinVGT = 9; //VGT PWM output
const uint8_t pinBackPress = A0; //backpressure sensor input
const uint8_t pinLimit = LED_BUILTIN;
uint16_t
tmrCompareVal,
adcBackPress;
uint32_t
tNow,
tBP;
float
fBPVolts,
fAvgBP;
void setup()
{
//set up the pins
digitalWrite( pinVGT, LOW );
pinMode( pinVGT, OUTPUT );
pinMode( pinBackPress, INPUT );
pinMode( pinLimit, OUTPUT );
//WGM14
// - ICR1 = TOP
// - /8 prescaler (2MHz tick rate)
// - clear OC1A on match, set on bottom
TCCR1A = _BV(COM1A1) | _BV(WGM11);
TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS11);
ICR1 = 49999; //gives 40Hz
OCR1A = k_Minimum_VGT_DC; //start off at minimum duty cycle
tBP = 0ul;
adcBackPress = analogRead( pinBackPress );
fAvgBP = ((float)adcBackPress * 5.0) / 1024.0;
}//setup
void loop()
{
tNow = micros();
if( (tNow - tBP) >= k_BPSensorReadInterval )
{
//update the BP sensor every k_BPSensorReadInterval microseconds
tBP = tNow;
//read the sensor
adcBackPress = analogRead( pinBackPress );
//convert to volts
fBPVolts = (((float)adcBackPress * 5.0) / 1024.0);
//filter it
fAvgBP = fAvgBP + ((fBPVolts - fAvgBP) * k_BP_FiltCoefficient);
//constrain it
if( fAvgBP > k_fMaxBP )
{
fAvgBP = k_fMaxBP;
digitalWrite( pinLimit, HIGH );
}
else if( fAvgBP < k_fMinBP )
{
fAvgBP = k_fMinBP;
digitalWrite( pinLimit, HIGH );
}
else
digitalWrite( pinLimit, LOW );
//convert back to counts
adcBackPress = (uint16_t)((fAvgBP / 5.0) * 1024.0);
//map it to the DC output
tmrCompareVal = map( adcBackPress, k_Min_BP_ADC, k_Max_BP_ADC, k_Maximum_VGT_DC, k_Minimum_VGT_DC );
//and set new DC
OCR1A = tmrCompareVal;
}//if
}//loop
thank you for the help i copied and pasted what you provided into tinkercad and it seems the led is getting to much amperage on there, so it doesnt seem to completely work on there but i looked at it on the website you provided as well and it works which i appreciate. how much amperage can the my actual Arduino take? cause i heard somewhere its only 20 or so. another one of my questions is it is possible to add a switch to command the vanes all the way closed or all the way open cause in the end id like an exhaust brake feature as well.
thank you for the help
Wokwi allows you to dispense with resistors for simulation. I've never used Tinkercad; try adding a 1K resistor in series with it.
A pin on the Arduino might sink 20mA (milliamps.) To drive the VGT vanes you're going to need an amplifier/driver between the Arduino pin and the VGT.
Yes, you can add whatever features you want, such as a bypass switch or whatever.
I'd start simple though. Make sure you can control the VGT vanes before thinking of adding all sorts of other stuff.
I tried to add a 1k resistor with no luck, ill look into the amplifier like you said and see what I can find, I appreciate the help and yeah that's prolly what ill do is just make sure everything goes ok then go from there I'm still waiting on parts to try it with my Arduino anyway. if anything happens ill make sure to post it here. is there a way to use a multimeter on that site so i can see what the voltages are at?
elegant
what happens is the led flashes on tinkercad but amp warning goes away whem you add 1k resistor
Did you try clicking the link to the WokWi simulator?
Yeah I went on there and looked at it on there and it works on there just weird it doesn’t on tinkercad is all. I’ll prolly get the stuff together and try it with the led and pot in the next couple days
You seem to have only a very basic knowledge about electronics. Well there are two ways to learn it:
a cheap one and an expensive one
The expensive one is: jzst wire it together and give it a try
With knowing too less you will damage your arduino multiple times.
The cheap way is:
asking a lot in the arduino-Forum.
There is a general electronics subforum for questions about what the name says:
general electronics.
You can post simple questions like how less milliamperes can an Arduino-IO-Pin deliver? here in the programming questions subforum. More special questions in the electronics-forum with a link to this thread.
You should provide a datasheet of your VGT voltage, current-consumption of the VGT are very important data to decide which "amplifier" to use to drive the VGT
best regards Stefan
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.