Reverse Engineering Hoverboard Motor Drive

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!

All his code for the project is on GitHub, for his 9-bit SoftwareSerial library and a motor control sketch.

If you want a real Back to the Future hoverboard then you may have to wait a while longer. We have featured a replica made as an unrideable floating artwork though, and a working board that is more of a personal hovercraft.

Continue reading “Reverse Engineering Hoverboard Motor Drive”

Adding Position Control To An Open Source Brushless Motor Driver

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.

Thanks [Dudelbert] for sending this one in.

Continue reading “Adding Position Control To An Open Source Brushless Motor Driver”

Simple Autonomy with an RC Boat

[Vlad] wrote in to tell us about his latest project—an RC boat that autonomously navigates between waypoints. Building an autonomous vehicle seems like a really complicated project, but [Vlad]’s build shows how you can make a simple waypoint-following vehicle without a background in autonomy and control systems. His design is inspired by the Scout autonomous vehicle that we’ve covered before.

[Vlad] started prototyping with an Arduino, a GPS module, and a digital compass. He wrote a quick sketch that uses the compass and GPS readings to control a servo that steers towards a waypoint. [Vlad] took his prototype outside and walked around to make sure that steering and navigation were working correctly before putting it in a boat. After a bit of tweaking, his controller steered correctly and advanced to the next waypoint after the GPS position was within 5 meters of its goal.

boatgifNext [Vlad] took to the water. His first attempt was a home-built airboat, which looked awesome but unfortunately didn’t work very well. Finally he ended up buying a $20 boat off of eBay and made a MOSFET-based motor controller to drive its dual thrusters. This design worked much better and after a bit of PID tuning, the boat was autonomously navigating between waypoints in the water. In the future [Vlad] plans to use the skills he learned on this project to make an autopilot for the 38-foot catamaran his dad is building (an awesome project by itself!). Watch the video after the break for more details and to see the boat in action.

Continue reading “Simple Autonomy with an RC Boat”

Hackaday Prize Entry: DC Motor Controller

There are a lot of cheap Chinese CNC machines out there with okay mechanics and terrible electronics. The bearings aren’t complete crap, but the spindle of these CNC machines is a standalone PWM controller with a pot to control the speed. This means you can’t control the spindle speed with LinuxCNC or Mach3.

For his Hackaday Prize entry, [SUF] is building a DC motor controller for a Chinese spindle motor that doesn’t use any kind of encoder. The first part of that project is fairly easy; [SUF] has already built a high current driver. The second bit is a little it harder – because these spindles don’t have an encoder, [SUF] will have to read voltage spikes on the motor poles, giving him the RPM of the spindle. From there, it’s a bit of PID code to get this spindle running at a desired RPM and connecting it to a CNC control box.

So far, [SUF] has a second version of his board waiting for assembly. In the first version of the board, the switching time for the MOSFET was a little slow, but that’s all corrected in the current revision. It’s a great project to extend the capability of these cheap CNC machines, and perfect project for the Hackaday Prize.

The 2015 Hackaday Prize is sponsored by:

BLDC Controller With The Teensy 3.1

[Will] is on the electric vehicle team at Duke, and this year they’re trying to finally beat a high school team. This year they’re going all out with a monocoque carbon fiber body, and since [Will] is on the electronics team, he’s trying his best by building a new brushless DC motor controller.

Last year, a rule change required the Duke team to build a custom controller, and this time around they’re refining their earlier controller by making it smaller and putting a more beginner-friendly microcontroller on board. Last years used an STM32, but this time around they’re using a Teensy 3.1. The driver itself is a TI DRV8301, a somewhat magical 3 phase 2A gate driver.

The most efficient strategy of driving a motor is to pulse the throttle a little bit and coast the rest of the time. It’s the strategy most of the other teams in the competition use, but this driver is over-engineered by a large margin. [Will] put up a video of the motor controller in action, you can check that out below.

Continue reading “BLDC Controller With The Teensy 3.1”

Brushless Motor Controller Shield for Arduino

Brushless motors are ubiquitous in RC applications and robotics, but are usually driven with low-cost motor controllers that have to be controlled with RC-style PWM signals and don’t allow for much customization. While there are a couple of open-source brushless drivers already available, [neuromancer2701] created his own brushless motor controller on an Arduino shield.

[neuromancer2701]’s shield is a sensorless design, which means it uses the back-EMF of the motor for feedback rather than hall effect sensors mounted on the motor. It may seem strange to leave those sensors unused but this allows for less expensive sensorless motors to work with the system. It also uses discrete FETs instead of integrated driver ICs, similar to other designs we have covered. Although he is still working on the back-EMF sensing in his firmware, the shield successfully drives a motor in open-loop mode.

The motor controller is commanded over the Arduino’s serial interface, and will support a serial interface to ROS (Robot Operating System) in the future. This shield could be a good alternative to hobby RC controllers for robots that need a customizable open-source motor controller. The PCB design and source code are available on GitHub.

Continue reading “Brushless Motor Controller Shield for Arduino”

Ride, Captain, Ride Aboard Your Arduino-Controlled Autopiloted Sailboat

[Jack], a mechanical engineer, loom builder, and avid sailor wanted an autopilot system for his 1983 Robert Perry Nordic 40 sailboat with more modern capabilities than the one it came with. He knew a PC-based solution would work, but it was a bit out of reach. Once his son showed him an Arduino, though, he was on his way. He sallied forth and built this Arduino-based autopilot system for his sloop, the Wile E. Coyote.

He’s using two Arduino Megas. One is solely for the GPS, and the other controls everything else. [Jack]’s autopilot has three modes. In the one he calls knob steering, a potentiometer drives the existing hydraulic pump, which he controls with a Polulu Qik serial DC motor controller. In compass steering mode, a Pololu IMU locks in the heading to steer (HTS).  GPS mode uses a predetermined waypoint, and sets the course to steer (CTS) to the same bearing as the waypoint.

[Jack]’s system also uses cross track error (XTE) correction to calculate a new HTS when necessary. He has fantastic documentation and several Fritzing and Arduino files available on Dropbox.

Autopilot sailboat rigs must be all the rage right now. We just saw a different one back in November.

Continue reading “Ride, Captain, Ride Aboard Your Arduino-Controlled Autopiloted Sailboat”