Control of Electronic Throttle Body with Arduino

Hi!

I am trying to control the valve position of an Electronic Throttle Body (BOSCH: 0 280 750 156, 68 mm dia.) with Arduino UNO R3 and BTS 7960 (H-Bridge).

The datasheet of the valve says:

Supply Voltage: 6 to 16 V,
Supply Voltage Sensor: 5 V,
Output signal I: 0 to 5 V for 0 to 90°,
Output signal II: 5 to 0 V for 0 to 90°,
Max. allowed generator current: 10 A

Initially, I tried it with a Step Motor Driver only to realize that it sends pulses and not continuous voltage supply. The valve was switching ON and OFF very rapidly due to the pulses.

With the H-bridge driver (BTS 7960), I am unable to make the valve move at all. But I can read the position of the valve as a feedback properly (verified by physically moving the valve position and checking the feedback value of the position in serial monitor). I am putting my code below for reference:

#include <PID_v1_bc.h>

// Pin definitions
const int pwmPin = 3;       // PWM output to BTS7960
const int enablePin = 4;    // Enable pin for BTS7960
const int feedbackPin = A2; // Analog input from throttle body sensor

// PID control parameters
double setpoint = 100;        // Desired sensor position (0 to 100%)
double feedback = 45;        // Feedback from sensor (0 to 100%)
double output = 0;          // PWM output (0 to 255)

// PID tuning parameters
double kp = 2.0;            // Proportional gain
double ki = 0.5;            // Integral gain
double kd = 0.1;            // Derivative gain

PID pidController(&feedback, &output, &setpoint, kp, ki, kd, DIRECT);

void setup() {
    // Set pin modes
    pinMode(pwmPin, OUTPUT);
    pinMode(enablePin, OUTPUT);
    pinMode(feedbackPin, INPUT);

    // Initialize the BTS7960
    digitalWrite(enablePin, HIGH); // Enable motor driver

    // Start PID controller
    pidController.SetMode(AUTOMATIC);
    pidController.SetOutputLimits(0, 255); // Limit output to PWM range

    Serial.begin(9600); // Start serial communication for debugging
}

void loop() {
    // Read feedback from the throttle body sensor (0 to 100%)
    int sensorValue = analogRead(feedbackPin);
    feedback = map(sensorValue, 0, 1023, 0, 100);

    // Setpoint can be dynamically updated here based on user input
    // For example, setpoint = 50; would set it to 50% throttle position

    // Compute PID output
    pidController.Compute();

    // Write the output as PWM
    analogWrite(pwmPin, (int)output);

    // Debugging info
    Serial.print("Setpoint: ");
    Serial.print(setpoint);
    Serial.print(" Feedback: ");
    Serial.print(feedback);
    Serial.print(" PWM Output: ");
    Serial.println(output);

    delay(50); // Small delay to stabilize readings
}

Kindly help me out to set and hold the valve position at a desired angle.

here’s the data / links the OP forgot to include…
Sales page

Datasheet

Scribd datasheet pdf

Thanks @lastchancename

Is it possible to explain the application that you are using this for?

What resistance do you read between the motor+ and motor- connections?

I want to use it to control the amount of compressed air that passes through the valve. I am using it as a flow control valve.

So does the BTS7960 when using analogWrite(). Have you confirmed that the valve will work with a PWM signal

Not sure that it will work well for compressed air. Usually the compressor is after the air flow meter. If you look at pedal connection to Air Flow valve is uses resistance to provide proper voltage to unit. I would try a variable power supply 0 to 5v and see how the motion works.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.