Auto-Throttle

Project Description:

Objective: Control and rev a throttle using the computer.

Final Solution: We dismantled the throttle pedal, replacing the spring pedal mechanism with a servo motor. We then programmed an Arduino which would control the servo motor and control the throttle pedal. We then connected the Arduino to a computer via USB. As for the UI (User Interface), we decided to utilize the Arduino IDE, and the PyFirmata Library in Python in accordance with Flask in order to create a web application similar to a command line interface which would allow the user to control the throttle pedal.

Project Timeline:

October 28th, 2024
(Introduction to Project Requirements)

4 brilliant students from the Grade 11 Computer Engineering Class were enlightned by the project requirements from Mr. Andrade. The students were to control the throttle using the computer. The students were also suggested to use the OBD2 Diagnostic Reader, which gave direct control to the ECU.

Following Two Weeks:
(November 11, 2024)

The following two weeks were spent in the car mulling over the logistics and practicals of the operation including evaluating the vehicle of the project; a "Brilliant Silver" 2009 Nissan Sentra with more than 120,000 Kilometers on the odometer, and a dead battery.

Following Two Weeks:
(November 25, 2024)

These two weeks were spent researching and trying to work through the OBD2 Port by trying to find software that will allow us to send information in addition to receive information, which we were able to derive using "Car Scanner ELM OBD2". We also experimented using other software but did not prove fruitful. We tested "EcuFlash", "MaxxECU MTune", and "ScanXL".

Following Three Weeks:
(December 15, 2024)

We realized that the OBD2 Scanner was a lost cause and that we would come back to it if we have time left over. Instead, we decided to disconnect the throttle and found out how it sent a signal to the ECU. We found a 6 pin pigtail connector that was responsible so we tried to send a signal using a multimeter at first, to no avail however. We then decided to call Nissan dealerships as well as OEM dealers around the area, (after colluding with around 15 different dealers) unfortunately due to the the pin being proprietary to Nissan, they were unable to help us, however we were able to get useful feedback on how they would tackle this.

Last Two Weeks:
(January 15, 2024)

After the Winter Break, we felt a fresh new wave of motivation alongside the appall of not finishing the project yet which was given months ago, leaving us only a couple weeks before the end of the semester and course. After recollecting our thoughts over the break, and concluding our research, we arrived at the predicament that the pigtail and trying to send a signal through it was a lost cause. We then decided to approach it through a rather simplified method where we bought a spare throttle pedal, and attached a servo motor to it, in coordination with an Arduino.

Final Details:

Reaching the final stretch of the project, when we attached a gear to the motor aimed to a gear attached to the throttle pedal, the gear was rendered static due to a lack of torque from the motor. In order to bypass this problem, we decided to use mechanical advantage to our advantage where we attached a small gear for the motor in conjunction with a larger gear for the pedal which gave us the necessary torque. The last step was to develop the software to control the Arduino. We created a Python Flask Webapp which utilized PyFormata in order to control the throttle via a command line-type interface. The entire codebase for this project can be found below.

Project Codebase (GitHub):

Firmata Library: https://github.com/firmata/arduino#firmata-client-libraries

Arduino Connection Setup Code (Firmata) Arduino C++: https://github.com/firmata/arduino/blob/main/examples/StandardFirmata/StandardFirmata.ino

Constant Motor Oscillation Code: https://github.com/SarveshwarSenthilKumar/Auto-Throttle-Backend-Codebase/blob/main/oscillatingMotor.ino

Constant Motor Oscillation Code (Python): https://github.com/SarveshwarSenthilKumar/Auto-Throttle-Backend-Codebase/blob/main/alwaysSpin.py

Manual Motor Adjustment Code (Python): https://github.com/SarveshwarSenthilKumar/Auto-Throttle-Backend-Codebase/blob/main/motor.py

Auto-Throttle Control Webapp Front-End (HTML & CSS): https://github.com/SarveshwarSenthilKumar/Auto-Throttle-Backend-Codebase/tree/main/templates

Auto-Throttle Control Webapp Back-End (Flask-Python): https://github.com/SarveshwarSenthilKumar/Auto-Throttle-Backend-Codebase/blob/main/app.py

Auto-Throttle Webapp Commands:

rev x
This command revs the car for x seconds, replace x with the number of seconds of full throttle. Example: "rev 2" revs the car at full throttle for 2 seconds.

sleep x
This command stops the program momentarily for x seconds, replace x with the number of seconds of rest. Example: "sleep 1" stops the program and rests for 1 second.

angletest x-y
This command allows the user to rev to a certain angle x, replace x with the angle you wish to test, for y seconds, replace y with the number of seconds of throttle at x position. Example: "angletest 60-2" revs the car, by spinning the gear to 60 degrees and keeps it there for 2 seconds.

reset x
In extraordinary cases, this command allows the user to reset the position back to 0 and sleeps for x seconds, replace x with the number of seconds of rest. Example: "reset 2" resets the throttle back to 0 degrees and sleeps for 2 seconds.

Additional Information:

1 / 9
Schematic of Accelerator Pedal Position Sensor
2 / 9
Wiring Diagram from Throttle to ECU (Alldata)
3 / 9
Electronic Throttle Control Diagram
4 / 9
5 / 9
Arduino
6 / 9
Fuse Box Diagram (We replaced a blown fuse)
7 / 9
Car Scanner ELM OBD2 Throttle Position Readings
8 / 9
Car Details
9 / 9
Original Pedal Housing

Finished Showcase:

1 / 10
Auto-Throttle vs Regular Throttle
2 / 10
Close Up Image of Auto-Throttle
3 / 10
4 / 10
5 / 10
6 / 10
7 / 10
Untampered Engine Compartment (Jump-started Battery)
8 / 10
Auto-Throttle on Car
9 / 10
image-2025-01-19-132440202
Auto-Throttle Webapp UI
10 / 10
Team Picture (Sarveshwar as Driver, Marcus as Passenger, Bao Khanh as Right Rear Passenger, Sudeys as Left Rear Passenger)

Enroll in Computer Engineering!