Current. Too little of it, and you can’t get where you’re going, too much and your hardware’s on fire. In many projects, it’s desirable to know just how much current is being drawn, and even more desirable to limit it to avoid catastrophic destruction. The humble current shunt is an excellent way to do just that.
To understand current, it’s important to understand Ohm’s Law, which defines the relationship between current, voltage, and resistance. If we know two out of the three, we can calculate the unknown. This is the underlying principle behind the current shunt. A current flows through a resistor, and the voltage drop across the resistor is measured. If the resistance also is known, the current can be calculated with the equation I=V/R.
This simple fact can be used to great effect. As an example, consider a microcontroller used to control a DC motor with a transistor controlled by a PWM output. A known resistance is placed inline with the motor and, the voltage drop across it measured with the onboard analog-to-digital converter. With a few lines of code, it’s simple for the microcontroller to calculate the current flowing to the motor. Armed with this knowledge, code can be crafted to limit the motor current draw for such purposes as avoiding overheating the motor, or to protect the drive transistors from failure.
In fact, such strategies can be used in a wide variety of applications. In microcontroller projects you can measure as many currents as you have spare ADC channels and time. Whether you’re driving high power LEDs or trying to build protection into a power supply, current shunts are key to doing this.
The hack begins as [Jerry] decides to gut a Maytag MAH7500 Neptune front loader. Many projects exist that borrow the motor but rely on a seperately sourced variable frequency drive, so the goal was to see if the machine’s original controller was usable. The machine was first troubleshooted using a factory service mode, which spins the drum at a set speed if everything is working correctly.
From there, it was a relatively simple job to source the machine schematics to identify the pinouts of the various connectors. After some experimentation with a scope and a function generator, [Jerry] was able to get the motor spinning with the original controller doing the hard work.
It’s a simple hack, and one that relies on the availability of documentation to get the job done, but it’s a great inspiration for anyone else looking to drive similar motors in their own projects. The benefit is that by using the original motor controller, you can be confident that it’s properly rated for the motor on hand.
Perhaps instead of an induction motor, you’d rather drive a high powered brushless DC motor? This project can help.
For anyone with interest in electric vehicles, especially drives and control systems for EV’s, the Endless-Sphere forum is the place to frequent. It’s full of some amazing projects covering electric skateboards to cars and everything in between. [Marcos Chaparro] recently posted details of his controller project — the VESC-controller, an open source controller capable of driving motors up to 200 hp.
[Marcos]’s controller is a fork of the VESC by [Benjamin Vedder] who has an almost cult following among the forum for “creating something that all DIY electric skateboard builders have been longing for, an open source, highly programmable, high voltage, reliable speed controller to use in DIY eboard projects”. We’ve covered several VESC projects here at Hackaday.
While [Vedder]’s controller is aimed at low power applications such as skate board motors, [Marcos]’s version amps it up several notches. It uses 600 V 600 A IGBT modules and 460 A current sensors capable of powering BLDC motors up to 150 kW. Since the control logic is seperated from the gate drivers and IGBT’s, it’s possible to adapt it for high power applications. All design files are available on the Github repository. The feature list of this amazing build is so long, it’s best to head over to the forum to check out the nitty-gritty details. And [Marcos] is already thinking about removing all the analog sensing in favour of using voltage and current sensors with digital outputs for the next revision. He reckons using a FPGA plus flash memory can replace a big chunk of the analog parts from the bill of materials. This would eliminate tolerance, drift and noise issues associated with the analog parts.
[Marcos] is also working on refining a reference design for a power interface board that includes gate drivers, power mosfets, DC link and differential voltage/current sensing. Design files for this interface board are available from his GitHub repo too. According to [Marcos], with better sensors and a beefier power stage, the same control board should work for motors in excess of 500 hp. Check out the video after the break showing the VESC-controller being put through its paces for an initial trial.
As soon as he spied the Jolly Wrencher on my shirt, [Jerry Wasinger] beckoned me toward his booth at Kansas City Maker Faire. Honestly, though, I was already drawn in. [Jerry] had set up some interactive displays that demonstrate the virtues of his Pi-Plates—Raspberry Pi expansion boards that follow the HAT spec and are compatible with all flavors of Pi without following the HAT spec. Why not? Because it doesn’t allow for stacking the boards.
[Jerry] has developed three types of Pi-Plates to date. There’s a relay controller with seven slots, a data acquisition and controller combo board, and a motor controller that can handle two steppers or up to four DC motors. The main image shows the data acquisition board controlling a fan and some lights while it gathers distance sensor data and takes the temperature of the Faire.
The best part about these boards is that you can stack them and use up to eight of any one type. For the motor controller, that’s 16 steppers or 32 DC motors. But wait, there’s more: you can still stack up to eight each of the other two kinds of boards and put them in any order you want. That means you could run all those motors and simultaneously control several voltages or gather a lot of data points with a single Pi.
The Pi-Plates are available from [Jerry]’s site, both singly and in kits that include an acrylic base plate, a proto plate, and all the hardware and standoffs needed to stack everything together.
Daughter boards for microcontroller systems, whether they are shields, hats, feathers, capes, or whatever, are a convenient way to add sensors and controllers. Well, most of the time they are until challenges arise trying to stack multiple boards. Then you find the board you want to be mid-stack doesn’t have stackable headers, the top LCD board blocks the RF from a lower board, and extra headers are needed to provide clearance for the cabling to the servos, motors, and inputs. Then you find some boards try to use the pins for different purposes. Software gets into the act when support libraries want to use the same timer or other resources for different purposes. It can become a mess.
The alternative is to unstack the stack and use external boards. I took this approach in 2013 for a robotics competition. The computer on the robots was an ITX system which precluded using daughter boards, and USB ports were my interface of choice. I used a servo controller and two motor controllers from Pololu. They are still available and I’m using them on a rebuild, this time using the Raspberry Pi as the brain. USB isn’t the only option, though. A quick search found boards at Adafruit, Robotshop, and Sparkfun that use I2C.
The must-have toy of the moment last winter was the “Hoverboard”. We all probably secretly wished them to be the boards from the Back to the Future series of films made real, but the more achievable reality is a self-balancing scooter somewhat akin to a miniature Segway. It seemed every child wanted one, schools banned them, and there was a media frenzy over some of the cheaper models that lacked protection circuitry for their li-ion batteries and thus had a tendency for self-incineration.
[Drew Dibble] is interested in the Power Racing Series (PRS), in which toy electric cars are souped up for competition. Casting around for a source of cheap and relatively powerful motors he lit upon the self-balancing scooters, and waited on Craigslist for the inevitable cast-offs. His resulting purchase had two 350W brushless hub motors and all the associated circuit boards for motor control, gyroscope, and oddly a Bluetooth speaker. The motor control board received an unknown two-wire digital feed from the scooter’s control board, so he set to work investigating its protocol. His write-up of how he did it is an interesting primer in logic line detective work.
Hooking up his logic analyzer he was quickly able to rule out the possibility of the control signal being PWM because all signals followed the same timing. Both lines had data so he was able to rule out I2C, for in that case one line would carry a clock. He was therefore left with a serial line, and taking the 38 microsecond timing interval, he was able to calculate that it had a rather unusual bitrate of 26315 BPS. Each packet had a multiple of 9 bits so he either had 9-bit or 8-bit with parity, and trying all possible parity schemes resulted in parity errors. Therefore the boards used a highly unusual 9-bit non-standard bitrate serial port. Some experimentation led him to an Arduino library, and he was able to get some movement from his motors. Some clever timing detective work later and he could make them move at will, success!
Brushless motors are everywhere now. From RC planes to CNC machines, if you need a lot of power to spin something really fast, you’re probably going to use a brushless motor. A brushless motor requires a motor controller, and for most of us, this means cheap Electronic Speed Controllers (ESC) from a warehouse in China. [Ben] had a better idea: build his own ESC. He’s been working on this project for a while, and he’s polishing the design to implement a very cool feature – position control.
We’ve seen [Ben]’s work on his custom, homebrew ESC before. It is, by any measure, a work of art. It’s capable of driving brushless and brushed motors with a powerful STM32F4 microcontroller running ChibiOS that’s able to communicate with other microcontrollers through I2C, UART, and CAN bus. If you want to build anything with a motor – from a CNC machine to an RC helicopter to an electric long board – this is the motor controller for you.
[Ben]’s latest update considers position encoders. Knowing how fast a motor is turning is very important to knowing how fast a wheel is turning, how much torque the motor is generating, and an awesome step in building the finest motor controller ever made.
Like the last update, [Ben] demonstrates the great control program written for this ESC. This GUI programs the microcontroller on the controller, with protection from high and low voltages and currents, high RPMs, duty cycle changes, and support for regenerative braking.