Ride On Vehicle Variable Speed Controllers
Variable Speed Controllers tested and designed
This article is going to provide my personal experience with off the shelf variable speed controllers and explain why I decided a new design was warranted.
What is a Variable Speed Controller?
Most ride on toys use a plunger switch connected to the foot pedal that switches the battery voltage ON and OFF when pressed, this provides 100% of the power as soon as the pedal is pressed and 0% power when removed. With a variable speed controller, the percent of power provided to the motors is mapped to the throttle position, if the throttle is at 50%, the power output to the motors is 50%.
How is this accomplished?
Using MOSFETs (Electrical switches with no moving parts) the output to the motors can be switched very fast and precisely, the image below shows a PWM signal with a 20% duty cycle (ON for 20% of the time) sent to a motor.
20% Duty Cycle Motor Output
Off the Shelf Speed Controllers
I have tried two of the most common options before realizing something a little more customized for the application was necessary. Both of these options do work and they worked just fine, however, they lack the ability to electrically change from Forward to Reverse and they are limited in customizing how the power is applied.
Common Variable Speed Controllers
My son did use the Soft Start / Soft Stop Variable speed controller on the left for months with no issue and it did work well. This was used at 12V with Traxxas 21T 550 motors. With only my son in the car it ran fine but once you added a passenger is seemed to struggle and limit the current. Eventually the connectors on the gear shifter melted to the point I had to cut them off which led me down the path of searching for an alternate solution for switching direction.
The second attempt was to use some 800W 24V speed controllers (Right side of the image above) and have the gear selector control relays to select the direction, this did work, these had better power output but required a lot of relays and took a while to wire. Also, standard automotive relays (Shown below) are rated for 30A on the contacts, I needed about double the current still, a set of relays per motor would have worked fine though. My kids have an entire fleet of power wheels and I thought I could make a better solution still using an H-Bridge.
30A Automotive Relay and Housing
What is an H-Bridge?
An H-Bridge is an electronic circuit that allows a motor to run in both forward and reverse directions by controlling the polarity of the voltage applied to the motor. It is named for its configuration, which resembles the letter "H" when the circuit is diagrammed.
The H-Bridge circuit consists of four electronic switches (typically MOSFETs or transistors) arranged in an "H" shape:
The motor is connected across the horizontal bar of the "H."
The switches on the left and right sides control the flow of current through the motor.
By selectively opening and closing these switches, the circuit controls the direction of current flow, which determines the rotation direction of the motor.
Modes of Operation
There are four modes of operation an H-Bridge can be in:
Forward Rotation:
One pair of diagonal switches (e.g., top-left and bottom-right) is closed, allowing current to flow in one direction through the motor.
Reverse Rotation:
The opposite pair of diagonal switches (e.g., top-right and bottom-left) is closed, reversing the current flow and motor direction.
Coast:
All switches are open, stopping the current flow to the motor. (Note that when using MOSFETs, there is a body diode that does allow current to flow in the reverse direction, this allows the motors to charge the batteries and can build up very high voltages if there isn’t a circuit to discharge excess voltage, DRV230BD will clamp to 45V when turned off and spinning the motors)
Brake:
The bottom switches are closed shorting the motors but disconnecting power.
Four operating modes of an H-Bridge (Follow the red line for the current path)
Building a Speed Controller for my Kids Ride On Cars
First Custom Speed Controller
I searched the internet for an off the shelf H-Bridge that I could control with a Micro Controller (I chose the ESP32 because that is what I had), I found these older IBT-2 dual half H-Bridges (Makes a full H-Bridge when you combine two half’s) with heatsinks mounted to them for a couple dollars each (Setup shown in the image below). They had impressive but un-believable specs so I de-rated them by 50% and gave it a try at 24V running 775 Traxxas motors. They lasted a couple hours before failing, I burned up three H-Bridges before I went back to 12V where this was a solid reliable design. I found it to be reliable at 12V running Traxxas 775 motors and Traxxas 21T 550 motors, I had this setup in three different cars with no failures at 12V. However, my kids wanted more speed. These H-Bridges did not last longer than a few minutes at 18V with Traxxas 21T 550 motors, 12V was the limit.
IBT-2 H-Bridges with custom software
First Custom Designed installed in Barbie Dream Camper (Nice wiring, I know)
Custom PCB Version 1 (DRV230BD V1)
If I was going to design a custom PCB (Printed Circuit Board) to install in my kids car, I wanted to add as many features as practical. I started with the list of required functions the board needed to have:
12V accessory output to maintain original vehicle functionality (Lights and sounds) independent of input voltage
Support up to 40V (two drill batteries in series) for future proofing
Handle more current than anyone could reasonably put through it (Tested up to 45A per channel with thermal imaging)
Wire directly into a stock vehicle using the existing foot pedal and motor wiring
Accept an input for both throttle and brake pedals
With this list of minimal requirements I designed the board shown below and waited a couple weeks for it to arrive from my supplier.
First board installed in Barbie Dream Camper
Testing Version 1’s current capability (Sustaining 30A at 40V input on one channel) I only had one load bank at the time.
The first iteration was a success, but had some minor flaws, first being the size and the second being the lack of output current measurements, so I revisited the requirement list and added these:
Current sensing for both output channels (Version 1 couldn’t read the current and the limit was fixed with components on the board)
Low Voltage detection
Reduce the size as much as practical
Conformal Coat to protect the PCB from humidity and debris
Mocked up additional functionality to support Version 2 design
Custom PCB Version 2
Version 2 of the PCB worked well; however, it was not perfect. The size was reduced and did fit better in all the vehicles my kids have and the new functionality worked, however, I had two errors in the PCB that needed minor drilling and jumper wires to correct. There was a via that was shorted to Battery COM, luckily it was on the bottom side and easy to drill out without damaging anything else. I still cannot understand how the layout tool missed a shorted net, I understand how I missed it, just not the tool…
The missing trace was due to me not reviewing the schematic well enough, there was a missing COM connection to the Analog to Digital Converter (ADC) used for measuring input voltage and output current. The COM trace crossed over Battery COM in the schematic but didn’t have a node on it.
DRV230BD Version 2 (Jumper for missing trace by the microcontroller)
Version 2 Custom Circuit Board installed in Bravo Grave Digger
Custom PCB Version 3
Version 3 arrived and it was brought to my attention that the Peanut Workshop logo was misspelled on the PCB (Peanut Workhop)… It was between version 2 and version 3 that my kids wanted Peanut to be in the name, so with some help from AI, Peanut Workshop was born.
Other than the typo, I thought version 3 of the board was perfect, all functions were working acceptably well, however, the kids didn’t want to drive their Grave Digger back to the garage so I pushed it back with no battery in it and the 12V DC converter failed. Upon further investigation I found that the motors were generating too high of a voltage and there wasn’t anything other than the 12V converter to discharge it. This meant a Version 4 was required to prevent the 12V DC converter from getting damaged when pushing the car without a battery. I did update the software to apply brakes once it turns on, this discharges the built-up voltage but applies brakes when pushing the car. However, if you are not using my software or there isn’t a microcontroller installed, it will destroy the 12V converter rendering the board useless.
Version 3 Mounted in mockup enclosure (Yes, I cut the enclosure with a jigsaw, it looks like I did it with my teeth though…)
Custom PCB Version 4 (DRV230BD V4)
To prevent damage to the 12VDC converter, a protection diode was placed between the VIN+ power and the new to this version VIN+ and ON terminal block locations. This prevents reverse current from the motors from going through the logic circuit (the diode) and now you can use a jumper wire and switch to enable / disable power to the logic circuit.
Version 4 also isolated the VIN+ power to the gate drivers driving the MOSFETs, this turned out to be a bad idea because it caused the gate driver to have higher voltage under load from the capacitance in the logic circuit, this turns OFF the MOSFETs as soon as the motors attempt to drive. This issue was identified after testing at my desk was completed, all functions with motors (at my desk with no load) as well as the 1000W load banks were tested flawlessly, I thought this was it, until I installed it in the Grave Digger, the most power-hungry unit of them all… It could not spin the motors up unless I bypassed the protection diode with a jumper.
DRV230BD V4
Custom PCB Version 5 (DRV230BD V5)
Version 5 had to be the final version, I moved the VIN+ supply back to the motor input and left all of the other logic circuits protected with a diode, and… it did not turn ON…
After 4 weeks of waiting for the hardware to arrive, the unit would not power on at all, the change was so minor there was no way I could have messed up the PCB layout, and I was right, I didn’t mess it up, I messed up the circuit. I stayed up late reviewing every detail of the design and I could not figure it out, I thought I had a bad batch of 12V converters so I replaced a converter with a known to be good board, still nothing. I gave up and went to bed, but I had to get up early before work to figure it out. I started scrubbing every datasheet for every part used, and I found it, there was a missing capacitor in the design from the beginning to stabilize the 12V supply input. It happened to work because of the capacitance used for the gate driver that was no isolated from the 12VDC converter.
I tacked a 1uF capacitor to the 12VDC converter and it worked, again! The 12VDC converter was stable, it operated up to 4A no problem, then stopped… I had tested a few units up to the rated 4A and only had issues around 6A, that was too risky.
A new test for Version 5 was to use a push button to enable brakes, kind of like a trans brake in a drag car, thought it would be a neat feature, well, that also didn’t work, the variable pedal worked fine, so I reviewed my schematic again and found I forgot pull down resistors on the Throttle and Brake inputs, so the filtering capacitor would charge up and never discharge, not too big of an issue for the brake, but huge issue for the throttle. If the throttle wire was pulled out the throttle would slowly decay to 0% over about 10 seconds, that wasn’t safe so it had to be fixed as well.
DRV230BD V5
Custom PCB Version 6 (DRV230BD V6)
Version 6 now has two major upgrades pull down resistors to discharge the filtering capacitors on the active high I/O (The built-in pull-down resistors on the ESP32 did not help the issue by the way.) and a ~4A resettable fuse on the 12V output, at room temperature you can output 3A all day, around 4 amps it will start to limit the current and turn off within a few seconds. This was tested with various loads down to 1 ohm load (12A) and it protected the DC/DC converter nicely, no failures were experienced.
The added recommended capacitance from the 12V converter datasheet also kept the converter very stable at low and high current draws.
Version 6 finally passed all tests both on the bench and in cars with 775 Motors and 550 motors. As of writing this article, version 6 has driven many hours by my kids with no reported complaints.
DRV230BD V6
Software Development
The software started off very basic with simply providing Forward and Reverse functionality that mapped the output power to the position of the throttle pedal, all other parameters were hard coded with no configurability. Since I had a couple weeks to wait for my first version of hardware, I could experiment with adding features, so I created a Wireless Access point. Note that I am an electrical engineer that designs physical boards, not software or web pages so I knew this was going to be a challenge.
Wireless Access Point
Since the speed controller is based on an ESP32 microcontroller development board with a built in Wi-Fi antenna, I wanted to include an easy way to customize as many parameters as possible through the use of an access point. An access point is a local Wi-Fi network just between the connecting device and the speed controller, no router is necessary so the speed controller can be connected to easily anywhere with any device with Wi-Fi and a web browser.
The first version had simple sliders to limit the speed, Ramp Up Throttle and Ramp Down Throttle, those were the most critical features all of the off the shelf controller lacked. I wanted to protect stock gear boxes and be able to add speed.
As the first HTML I had ever written, I was proud of it, but it was basic and needed to look a little more modern.
I started with the default IP and some basic checkered flag images. I thought green for a green flag was appropriate as well.
As the versions progressed, I changed the IP to a more memorable 4.3.2.1 and updated the color profile to a more appealing gradient blue.
One of the last changes was removing the checkered flags and inserting the Peanut Workshop logo.
With this version, the user can control just about any parameter of the H-Bridges (both simultaneously, you will need to write your own code to control the motors individually, hardware does support it)
The amount of information and variables that could be adjusted grew so additional pages were necessary to keep it somewhat organized.
Calibration for pedals has been added along with better control of enabling and disabling the throttle and brake functions.
Diagnostics, the most useful of the pages, this can save a lot of time when diagnosing failures in the car.
From this page you can see if you are receiving a throttle input, a direction isn’t working, the motors are being current limited.
A crude current detecting circuit has been added to the board as well, this has been tuned as well as practical so you can observe how much power those little under 400W motors are absorbing.