int potpin = A0; int tps = A1; int val1; int val2; int val3; int led = 13; void setup() { TCCR2B = TCCR2B & 0b11111000 | 0x01; //sets PWM to 32 KHz digitalWrite(led, HIGH); //turns LED in front panel on, letting you know the Arduino is running } void loop() { val1 = analogRead(potpin); //reads POT position val2 = analogRead(tps); //reads TPS position val1 = map(val1, 1023, 0, 0, 1023); //sets POT Value between 0 and 1023, actually reverses the pot val2 = map(val2, 862, 59, 0, 1023); //sets TPS Value between 0 and 1023 while(val2 < val1) { //routine if POT is ahead of TPS if (val2 < 340) { analogWrite(3, 60); //writes a PWM signal of 60 to pin 3 for first 3rd of throttle opening to smooth out low throttle settings } if (val2 > 339 && val2 < 680) { analogWrite(3, 90); //write a PWM signal of 90 to pin 3 for middle 3rd of throttle positioning, this speeds up throttle response } if (val2 > 679) { analogWrite(3, 120); //write a PWM signal of 120 to pin 3 for remainer of throttle positioning, this speeds up throttle response even faster } //by limiting the PWM to an out put of 120, it regulates the output voltage to a maximum of 5 volts from the TIP120 attached val1 = analogRead(potpin); //reads inputs for comparison in while loop val2 = analogRead(tps); val1 = map(val1, 1023, 0, 0, 1023); val2 = map(val2, 862, 59, 0, 1023); } while(val2 > val1) { //routine if TPS is ahead of POT analogWrite(3, 0); //sends a 0 to Pin 3 to turn off motor val1 = analogRead(potpin); //reads inputs for comparison in while loop val2 = analogRead(tps); val1 = map(val1, 1023, 0, 0, 1023); val2 = map(val2, 862, 59, 0, 1023); } }
Hello, Awesome job :o I see your topic on forum.arduino.cc and I search to implement that on my car what version of arduino you use please, can I use an arduino nano ? Thanks in advance :) Have a good day
So many people playing with ECU stuff... One day we will all join and make a great project :)
Do you have a wire diagram and code ?
What is the frequency of pwm
I want to play with it, is possible to hava Arduino project?
Hello, where I can buy this equipment
CAN YOU PLS UPLOAD THE DETAILS
Do you have the code available for this?
int potpin = A0;
int tps = A1;
int val1;
int val2;
int val3;
int led = 13;
void setup() {
TCCR2B = TCCR2B & 0b11111000 | 0x01; //sets PWM to 32 KHz
digitalWrite(led, HIGH); //turns LED in front panel on, letting you know the Arduino is running
}
void loop() {
val1 = analogRead(potpin); //reads POT position
val2 = analogRead(tps); //reads TPS position
val1 = map(val1, 1023, 0, 0, 1023); //sets POT Value between 0 and 1023, actually reverses the pot
val2 = map(val2, 862, 59, 0, 1023); //sets TPS Value between 0 and 1023
while(val2 < val1) { //routine if POT is ahead of TPS
if (val2 < 340) {
analogWrite(3, 60); //writes a PWM signal of 60 to pin 3 for first 3rd of throttle opening to smooth out low throttle settings
}
if (val2 > 339 && val2 < 680) {
analogWrite(3, 90); //write a PWM signal of 90 to pin 3 for middle 3rd of throttle positioning, this speeds up throttle response
}
if (val2 > 679) {
analogWrite(3, 120); //write a PWM signal of 120 to pin 3 for remainer of throttle positioning, this speeds up throttle response even faster
} //by limiting the PWM to an out put of 120, it regulates the output voltage to a maximum of 5 volts from the TIP120 attached
val1 = analogRead(potpin); //reads inputs for comparison in while loop
val2 = analogRead(tps);
val1 = map(val1, 1023, 0, 0, 1023);
val2 = map(val2, 862, 59, 0, 1023);
}
while(val2 > val1) { //routine if TPS is ahead of POT
analogWrite(3, 0); //sends a 0 to Pin 3 to turn off motor
val1 = analogRead(potpin); //reads inputs for comparison in while loop
val2 = analogRead(tps);
val1 = map(val1, 1023, 0, 0, 1023);
val2 = map(val2, 862, 59, 0, 1023);
}
}
Hello,
Awesome job :o
I see your topic on forum.arduino.cc and I search to implement that on my car
what version of arduino you use please, can I use an arduino nano ?
Thanks in advance :)
Have a good day