2017年11月27日星期一

6-DOF Stewart Platform



It's time for me to document my Stewart Platforms. It's a cool little project that will make you interested in robotics. Actually I modified this project to be my Robotics course's project, and it turns out pretty good. Here is the presentation video, check it out!
[Robotics Project Vlog] Presentation Video

It started out as a personal project, with no particular reason -- I simply want to build something cool, and a Stewart Platform is something cool.

First let's talk about theories, basically the way this thing moves itself. The motion model of Stewart System is based on a concept
called inverse kinematics. The basic idea is that in order to achieve a particular pose, the actuators in the motion link need to be in a desired position. This is different from forward kinematics, which uses the position of actuators in the motion link to derive the pose.

As you can see, in case of Stewart Platform, what we want is to have the upper platform in a desired pose; to get that pose, we use inverse kinematics to calculate what the servo angles should be. This is a natural way of thinking. If we use forward kinematics, the problem will be rediculously hard: there are 6 two-joint-legs that forms 40+ equations for final pose and there are multiple solutions, from which we have to pick one. It's just too hard for somthing like an Arduino to do.

Now we can break the problem into two subproblems: 1. representing the pose of the platform in a way that computer can understand. 2. Calculate lengths of all six legs (and then servo angles) to reach that desired pose.

The first subproblem is relatively simple, it's just a 3D rotation matrix plus a translation vector. The 3D rotation matrix gives you the desired roll-pitch-yaw of the platform, and the translation vector tells you the relative position between the center of the base and the center of the upper moving platform.
Once the pose is fully repersented in matrix form, the next step is to calculate desired leg lengths and servo angle of the actuators (servos). Here I have to mention that this document from U3A Wokingham Math group:
Math of Stewart Platform V5
This document explains the angle calculation step by step, it's clear and straightforward. Be prepare to refresh your trignometry knowledge while reading this document.

Theory part over, let's talk about design. The design has two iterations, and the first one is actually hand drawn and hand made. Thanks to my woodworking skill that the final result is pretty neat.

Here are some pictures of manufacturing:
 ball joints

 rod assembly

assembly 1

assembly 2

assembly done

ball on plate

The first generation turned out to be a success -- it is able to perform 6-DOF (6 degress of freedom) motion as desired. Now the concept has been proved, it's time to do another iteration. 

The next generation has the same design concept, but the manufacture was brought to another level: fully designed in CAD with laser cutting technique for fabrication.  

Doing the CAD model for this thing really refreshed my skill in UGNX, especially the assembly part. 
you really have to build that universal joint and assemble them

full assembly

The assembly is verified in CAD; it looked better than I thought. The next step is to bring this thing to the cutting machine and make a real one. 


laser cut parts

not bad, huh?
Here is this thing doing some motion:

In order to get this thing to do some interesting stuff, I put a resistive touch pad on the top so that it can detect small objects placed on it.

The first idea that came to my mind is doing a PID control to keep a ball on plate. Since the resistive touchpad can detect the position of the ball, it wouldn't be hard to use the two rotation degrees of the system to keep it on the plate.
Here is the video:
[Robotics Project Vlog] PID test

After the PID, I see that there are a lot interesting stuff that I can do with this system, such as a gravity simulator, a flight system simulator, or a course equipment to teach students inverse kinematics. For now I haven't done any of them due time constraint, but I will definitely explore more about what I can do with this thing, and for sure I will build more interesting stuff. Stay tuned!

Here are a few links about similar stuff:
http://fullmotiondynamics.com/
Circular-Base-Stewart-Platform



BLDC Motor Control Road Map

The goal of this blog is to provide a basic roadmap for those who want to learn about BLDC/PMSM motor control theory. The readers are assumed to have basic knowledge about electronics.

The materials mentioned here are arranged from basics to advanced techniques. After finishing the material the reader should have a solid understanding of motor control theory such as commutation algorithm, PWM technique, PID controller, sensorless technique, field oriented control and flux observer.


I don't own any of these material, what I do here is to arrange the stuff in a progressive order so that you can learn smoothly.


For all the materials a rough study plan will be given according to author's learning experience.


Let's get started.


Sensored Commutation:

Brushless DC Motors & Control - How it Works (Part 1 of 2)
Brushless DC Motors & Control - How it Works (Part 2 of 2)
Suggested Learning time: 30 min
The "hello world" of motor control is Hall-sensor based 6 step commutation, and these two videos gives you a taste of how it works.


Sensorless Commutation:

Introduction to InstaSPIN™-BLDC Motor Control Solution
Suggested Learning time: 45 min
If you want to get rid of those sensors and build a more robust system, this video shows you exactly that; it's time to see how sensorless system play a role in motor control applications. 


Motor Control Tips & Guidelines:
The Ten Commandments of Digital Control (part 1)
The Ten Commandments of Digital Control (part 2)
The Ten Commandments of Digital Control (part 3)
The Ten Commandments of Digital Control (part 4)
The Ten Commandments of Digital Control (part 5)
Suggestd Learning time: 2 hrs
These blogs give you a guideline about digital control designs. Before moving to advanced techniques, it's important to refresh the building blocks.


PWM & H-bridge Basics:
So, Which PWM Technique is Best? (Part 1)
So, Which PWM Technique is Best? (Part 2)
So, Which PWM Technique is Best? (Part 3)
So, Which PWM Technique is Best? (Part 4)
So, Which PWM Technique is Best? (Part 5)
So, Which PWM Technique is Best? (Part 6)
So, Which PWM Technique is Best? (Part 7)
Suggested Learning time: 4 hrs
These blogs discussed in detail about PWM techniques for motor control application. PWM and ADC (Analog to Digital Converter) are two essenstial components for motor control, so it's important do know about them before moving to advanced techniques.


FOC (Field Oriented Control) Basics:
Field Oriented Control of Permanent Magnet Motors
Suggested Learning time: 2 hrs
FOC is a widely used motor control technique in industry. This video is a clear and straightforward explanation of field oriented control technique. Do your homework and fully understand this video; then you are in a good position to start learning FOC.


James Mevey's Master Thesis (The big paper for motor control):
SENSORLESS FIELD ORIENTED CONTROL OF BRUSHLESS PERMANENT MAGNET SYNCHRONOUS MOTORS 
Suggested Learning time: 100 hrs
Suggested Learning plan: Read this paper in parallel with motor control side projects or other materials.
This is a comprehensive discussion of FOC motor control technique from start to end. It is not easy to read, and I haven't finished it yet. From what I see, this paper connects all the dots in PMSM/BLDC motor control techniques in a very thoughful manner. If you want to fully understand motor control from the fundamental concepts such as law of physics, read this paper.


Sensorless FOC (Shane Colton's Paper):
Flux Observer-Based Sensorless Field-Oriented Control ofSurface Permanent Magnet Synchronous Motors (Gen. 1)
Suggested Learning time: unknown
First of all, here is Shane Colton's website:
http://scolton.blogspot.com/p/motor-controllers.html
This guy is good at making motor controllers, and by good I really mean GOOD. Check his website for MORE interesting stuff.
This paper discusses flux observer for sensorless FOC control; it's an advanced topic that I haven't done reading yet. What I can say is that the real challenge of FOC technique is its sensorless position estimation, not the FOC itself. If you want to make your theory level match the industry level, the sensorless technique is what you cannot avoid.



Besides the motor control roadmap, I want to mention some other sites that can help you understand or gain interest in motor control:
Teaching Your PI Controller To Behave
TI Motor Blog
VESC - Open Source ESC
ESC32 | AutoQuad
BLHeli32

Other resource links: (will be updated):
http://ww1.microchip.com/downloads/en/AppNotes/01078B.pdf

Have fun with motor controllers!  : )



2017年11月22日星期三

CNC Plotter -- Part 1

It has been a long time since I want to build my own CNC machine. I love to make things, and so I like making things that make things. School's laser cutter is a beefy workhouse, but I can only access it three days a week at specified hours, and that's definitely not enough. I want my own machine.

So here is the plan: build a small-scale 2D CNC routing system, with a third control channel that can do different jobs (laser, pen, spindle...).

After some search, here is one that caught my eye:
PCB Plotter

PCB plotting is a function that I really want to have on my system. Recently I have started doing PCB designs, and it would be nice to have a 30min-turnaround home made PCB prototyping platform.

The the capability of homemade CNC, especially with budget under $500, cannot compete with real commercial CNC machines. What I expect out of my machine is that it can draw lines and shapes on a paper/PCB bare board, can drill holes with acceptable accuracy and precision, and can do some light carving jobs.

Unlike the PCB Plotter shown above, I'm going to use a single-rigid body design for my machine, so that the stiffness is good enough to ensure fine line drawing. The chassis will be made out of 0.5 inch acrylic sheet, since that's the strongest material that I can cut shapes out of.

NEMA17 stepper motors will be used, and the transmission will be timing belt. The lead screw system is too slow for me and the extra force is just beyond the scope of this system.

The software used for this system will be GRBL; this is a nice open source CNC drive software that are perfect for homemade CNC and 3D printers.

This blog is mainly the general discussion of the system. Next part will be the dicussion of CAD design and assembly of this thing. The design is already done. For your curiosity, here is what it looks like in CAD:
model assembly




2017年11月21日星期二

REV BLDC MC V1.0 part 3

The boards comes in, let's check it out.
top

bottom

The board came out nice and clean. The manufacture did a good job on both PCB fab and assembly. Now it's time to take it to the shop for a spin since the software is already done (will be discussed in another blog). 

test day

Safety measure first : ). After that plywood shield is our prototype car for last year : ). And the order from left to right pretty much tells the degree of involvement when building this controller : ). 

The test went out great, actually it's too great. We got this thing spinned up within 20 minutes. Notice this is the first prototype of a PCB with 300+ pins and 100+ parts, with mixed signals, power stages, and communication stuff. It worked nearly right out of the box!!!

first spin up


 
throttle range test

It's been 9 months since our first idea of using DRV8301, and I'd say that the time and effort put into this controller is really what help our team grows.
This is the first time ever that our team designed our own brushless DC motor controller; actually it is the first motor controller that we built and WORKED.

More tests for this board will be performed, such as stress test and spinning different motors. The software will be fine tuned for the best performance. I'm very happy that this thing finally worked. One successful design opens up the door of a thousand more designs, and I'm on my way to get them captured in my work!





REV BLDC MC V1.0 part 2

It has been awhile since my last blog, and I decided to finish this series by the break. So let's do it.

In this blog I will discuss the PCB design of the controller, from schmatic to layout.

The primary component of this motor controller is a DRV8301 MOSFET gate driver. This chip is the connection between logic signal to power stage; what it does is that it takes in the control signal to the microcontroller (3.3/5v logic), and amplify this signal to drive the mosfets. The reason such a driver is required is because power mosfets has gate capacitance which can sink quite a bit of current for some time, plus it is usually 12v; a microcontroller cannot provide such signal power, especially at high frequency.

Besides the gate driving function, DRV8301 also include hardware/software support such as voltage/current protection, current shunt amplifier, mosfet hand shake,SPI communication, overtemperature protection. It also includes a 1.5A buch converter which can be used to power the MCU. (1.5A on such a small chip is quite beefy)

Here is the schematic and design:
Main Driver Circuit

Mosfet Bridge Circuit

The schematic is quite simple; TI (Texas Instruments) has planty of reference designs for this chip and its cousins. Here is a good example

Another source of support that must be mentioned is Duke Electric Vehicle. It is with their inspiration that we decided to use DRV8301 instead of other controllers, and it turns out that this choice is good for long term development.

 The second part, the tricker one, is the layout. 

top side

bottom side

The software used is Diptrace, which gave me a really smooth exprience while doing this design. DRV8301 is specified as a bridge between MCU and MOSFET bridges, so it also has a user friendly pinout: logic input pins on left side, power control pins on the other. As you can see from the top side layout, the traces are kept relatively clustered around IC; there are no long traces that cut across the ground fill. DRV8301 is on the top left corner, and it nicely spreads its traces from right to the power stage and its left pins going down to the MCU (from via throgh the bottom traces). 

On the power stage, it's the copper pours that does all the work. Copper pours are thick and large so that can handle large currents and more heat. Bulk capacitors are kept near the power inputs so the decoupling will be quick and effective. 

Here is a 3D view of the design:
3D model

Some of the components are not shown because the components don't have 3D model; however, this model gives a good idea about how it will look like. 

Part 3 coming soon for those of you who wants to see this thing in real. : )