Saturday, July 22, 2017

Hoverboard Robot Arm Part 1: The Class Project

I decided to build a robot arm for my 6.115 final project, which, in retrospect was a bad idea.  The project is open ended, but requires you to use an Intel 8051 and a Cypress PSoC microcontroller.  The 8051 is from the 1980's and is useless, and the PSoC is only there because Cypress gave MIT a ton of money.  The PSoC is honestly a very bad microcontroller - it's neither high performance nor cheap, but it's still way better than the 8051.  It's unique feature is that there's some sort of vaguely FPGA-like thing that allows certain pins to be remapped.  As a result it does many things, but nothing well.  It is very slow at floating point math.  The analog inputs are slow.  It can literally do half the PWM and encoder decoding of the similarly priced ST micro.  It has no hardware serial support.   Cypress donated development kits, so the class uses PSoC microcontrollers as the example of modern microcontrollers.

At least in my opinion, most project-based classes involve projects that are on the boring side, and are technically not that interesting.  6.115 is the exact opposite - the final projects are supposed to be very ambitious.  My original final project proposal included the following

  1. Designing a 3-phase inverter capable of running at 400V, 20A with low side current sensing
  2. Laying out a PCB for the motor controller
  3. Populating/debugging the PCB
  4. Implementing field oriented motor control for torque control of a brushless motor
  5. Designing a discrete-time current controller
  6. Characterizing a motor from an electric hoverboard
  7. Designing a full state feedback controller for robot arm endpoint position control
  8. Implementing code to compute the robot arm's Jacobian to have force control of the robot arm
  9. Designing and fabricating an extremely low inertia, direct drive robot arm
  10. Simulating the robot arm force/torque control in MATLAB
  11. Writing a motor simulator to test the field oriented control logic
  12. Coming up with a robust communication protocol for the motor controller to talk to the 8051
  13. Hooking the 8051 to the timer chip, the serial chip (to talk to the motor controller), two ADC's (for controlling the robot arm), a keypad encoder (for changing settings), and one of those Hitachi displays (for showing position error)
which pretty much hit everything covered in the class (motors, current control, first order circuits, feedback control, switching regulators, feedback control of switching regulators, stepper motors, digital signal processing, digital filters, and characterizing systems).  The suggestion was to add code that takes in a JPEG, vectorizes it, then draws the image.  On an Intel 8051.  


This project was submitted as a "safe" robot arm with "small" electric motors, driven by "little 3 phase inverter ICs" powered from a "low-power" bench supply. There's a huge number of safety requirements for the project, which is pretty reasonable given some of the proposed ideas. The "safe" and "small" motors are around 1.5 kW motors from an electric hoverboard, the "little" IC is actually a 75A, 600V IGBT in a package that can dissipate 225W, and the "low-power bench supply" is, well, actually a completely reasonable 3A, 15V bench supply that we're required to use.

We were taught in class that using words like "low-power" or "large" were relative and meaningless in engineering, so I didn't feel too bad about submitting the robot arm.  For the project checkoff, I ran the arm with a power supply limited to ~5 watts, and had somebody inspect the arm to make there wasn't a hidden boost converter with dangerously high voltage, so it wasn't like there was actual danger.

Building the Arm

Bayley recently bought 15 hoverboards from a man in New York, and gave me a few motors to use for this project.  I started by removing the tire from the motors and disassembling.

There's a lot of motor inside!  Unfortunately, I couldn't come up with a clever way to hide an encoder on the inside of the motor, so I bored a hole in the casing to give me access to the fixed shaft from the front of the motor.  There aren't very many circular features on this motor, so finding the center is challenging.  I ended up putting it in a four-jaw chuck on the lathe, but was only able to get within .001" because nothing on this thing is actually round.  

During the next week, I made all the brackets and clamps.  Some were made on the MITERS CNC
and other were made on the Haas VF-2 next door

The last three parts were done on all manual equipment because the CNC's were in use

After a week of machining, I had bunch of shiny aluminum parts

Next,  I found some thin wall tube laying around MITERS and assembled the two arms


Electronics

The controller for this arm is overkill.  The IGBT module (FNA27560) is good for 50A, 400V continuous with good heatsinking, so it's more of an electric vehicle controller than a robotics controller.  I created a schematic inspired by the reference design for the IGBT module and added a microcontroller and differential serial.  There are no power supplies on the board.  I'm not sure if this was a good decision or not, but I planned to put the 5V, 3.3V, 15V supplies on a separate board that connected to both boards.  Unfortunately, I wasn't allowed to use the ST microcontroller for the class project as the class was bought out by Cypress and forbids knowledge of other companies has received generous donations of money and parts from Cypress.  Instead I was forced to decided to take advantage of the Cypress Programmable System on a Chip 5LP microcontroller development platform, and created a controller that was in every way worse than the ST based controller was easy to implement with the Cypress "PSoC Creator" software (a 3GB IDE that vaguely resembles Office 2003).   

The board I drew up was a little bit scary - there's not much ground plane and the micro is directly under the IGBT. The reference design seemed incredibly conservative and only put components on the top layer, so I moved things around a bit to get a tighter layout.  
"Small" Power ICs

Around 6 days after placing the order to 3-PCB, the boards arrived.  I somehow screwed up the gerber file generation so I missed mounting holes, heatsink holes, and my text.  Populating the board was uneventful.  I screwed up and bought a through hole diode instead of the correct surface mount one (not sure how I screwed up that bad) and the holes for the large IGBT module pins were slightly too small, requiring the pins to be filed down.  

Fiddling with PSOC Creator to give me the center-aligned PWM with deadtime took an hour or so, which isn't too bad.  I ended up with my board in a state where the clock is set "too fast" for reliable programming, so it fails to erase flash one in four times, causing the whole PSOC Creator program to throw endless memory out of bounds errors until you restart it.   It's not a well written application.

The trick to aligning the PWMs is to set the counter reset on a control register.  When  toggling the control register, all three counters zero at exactly the same time, aligning the PWMs. 

Once I had control of the inverter with the PSOC, I fed open loop sinusoidal phase voltages into the motor:

Next, I got the DAC working.  The PSOC has no easy to use print statements for debugging (piece of junk), so the DAC is the main debugging output.  If I add debugging serial, I need to provide my own USB to serial adapter, and I use a ton of CPU power to implement the software serial, which prevented the FOC loop from running fast enough.  Once I configured the quadrature encoder "block", I wrote a little automatic calibration routine.    The motor spins open loop until it hits an index pulse.  To figure out the electrical offset, it raises one phase high and leaves the other two low, causing the motor to lock at the d axis.  From here, the microcontroller calculates the electrical offset and applies q axis volts, causing the motor to speed up.  Here's a video (don't forget your safety tupperware when doing class projects):


I wrote some other stuff with some nice pictures, but google blogger is terrible and messed up the formatting, so I got frustrated and copied everything into a video.  Watch as I slowly lose interest in the project and things get crappier and crappier.  The robot arm gets clamped to an old cart and the electronics get really bad.




In the end, after failing at least 3 different safety inspections, I finally added  a bunch of clamps and polycard shields, hid it in the corner of the lab underneath unused benches, and passed the final safety inspection the day before checkoff.  I demoed it slowly moving in a circle to a TA for 3 seconds and got full points for my project demo.

In the future, I do not plan to come back to this project.




24 comments:

  1. I'm interested in the encoder vs hall sensor vs zero crossing tradeoff for speed sensing. I'm looking at making a reaction wheel inverted pendulum, and most designs use an encoder for accurate speed measurement. I was hoping to do away with the encoder for space reasons, and it occurred to me that if you have a custom BLDC controller, using sensorless control, it must know how fast the motor is moving anyway from the zero crossing, making the encoder redundant. But you seem to have gone the other way, if I read that right, and are using the encoder to determine position for commutation. Is that a constraint of the PSOC, or would you do it the same way with an STM32?

    ReplyDelete
    Replies
    1. (I suppose for your application, you need the encoder anyway, since the arm cares about position, whereas I only care about velocity, so since you're reading the encoder you might as well make it do double duty)

      Delete
    2. I used the encoder for both velocity and position (used for commutation) and didn't use sensorless FOC. I have looked into interpolating hall sensors for position and velocity estimation, but I found that the performance wasn't very good for very accurate low speed operation.

      Making a reaction wheel pendulum work smoothly will probably be much harder without an encoder. It'll probably get much better if you use a model of your system and a Kalman filter to estimate velocity.

      These magnetic encoders are super small and reasonably priced:
      https://www.digikey.com/product-detail/en/ams/AS5050A-QF_EK_AB/AS5050A-DK-AB-ND/4764624

      Delete
    3. Thanks! That looks like a good candidate to squeeze into the pendulum, I'll give it a shot.

      Delete
  2. Cool stuff, and a very methodical approach!

    Congrats!

    Do you have a picture of the encoder mounted on the BLDC hub motor? I have seen the hole made with the lath, but not the end result.

    Thanks!

    ReplyDelete
  3. I've seen the video in which the encoder appears.

    Good luck, Jared!

    ReplyDelete


  4. Hi Josh, Great you are thrilled with the 357. I've got one myself because like 10 decades. I like it as well, not modded as yours however.
    At this time it does not function, it chokes if warm. Brought into some neigbour of mine and he will get a deeper look at it.
    It feels like a few have had difficulty using the automatic decompression valve, so does yours have this?
    Enjoy an excellent day! Chainsaw Sharpeners Best way to sharpen a chainsaw

    ReplyDelete
  5. it was a wonderful chance to visit this kind of site and I am happy to know. thank you so much for giving us a chance to have this opportunity.. ride-one-wheel-electric-scooter

    ReplyDelete
  6. Most of us commit a great deal of time frame looking released most of these options along with producing jacksonville divorce attorney these folks for individuals just like you, genuine, hard-working people who are sick and tired of working independantly unwell without previously appearing qualified to obtain forward. All of us wish to assist most people obtain additional. Consequently work with all of us in addition to we will retain everyone apprised involving fantastic strategies for making money on-line. Become one of the primary to educate yourself concerning the very best prospects for making massive funds. We live content with talk about by using other folks who sadly are keen to learn, nevertheless , you, in conversation with have the information when you are not within the variety. Sheri

    ReplyDelete
  7. Architects are presently planning the skateboards of the Future and are thinking here alongside the Online Think Tank. One intriguing situation for these planners right now is should these skateboards-hoverboards have wheels by any means.Best off road hoverboards

    ReplyDelete
  8. There couple of interesting points at some point here but I don’t determine if every one of them center to heart. There exists some validity but I will take hold opinion until I consider it further. Good post , thanks and then we want more! Added onto FeedBurner in addition Michail

    ReplyDelete
  9. Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks Best Off-Road Hoverboards

    ReplyDelete
  10. First appearing on our screens in the 1980s, the hoverboard has been the dream of kids everywhere. It's magical ability to seamlessly take you from one place to another, completely unhindered by the surface over which you travel.it-directory.ie

    ReplyDelete
  11. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! https://longboardbrand.com

    ReplyDelete
  12. There are many electric moped scooter on the market today. I hope you will find the best electric moped that suits you or you can buy it as a gift for your relatives, friends. Which thebest electric moped scooter is a very interesting game for adults and children.

    ReplyDelete
  13. Once you want to buy an electric scooter, it is very simple. Just need you access to EverythingElectric. You can find everything that runs on electricity on EverythingElectric.net.

    ReplyDelete
  14. Nice Blog, Try the best Mutual fund Companies in Delhi for the best Mutual Fund Advisors and Investment Schemes.
    Mutual Fund Agent

    ReplyDelete
  15. Awesome blog, Get the best Vinyl Signage Printing, Commercial Vehicle Wrap and Fleet Painting Services by Kalakutir Pvt Ltd in Delhi, India.
    Fleet Painting

    ReplyDelete
  16. Pleasantly surprised to see this meshwork of amazing words.
    https://www.hoverboards.fun/

    ReplyDelete
  17. Thanks for an interesting blog. What else may I get that sort of info written in such a perfect approach? I have an undertaking that I am just now operating on, and I have been on the lookout for such info about
    hoverboard for kids

    ReplyDelete
  18. I’m not that much of a online reader to be honest but your sites really nice, keep it up! I'll go ahead and bookmark your site to come back later on. Cheers iso certification in saudi arabia

    ReplyDelete
  19. Your blog is great. Thank you very much for this blog owner for sharing information about hoverboard robot arm. If you can share more about electric scooters for adults, this is great. I hope your blog page will grow. Thanks again to the blog owner.

    ReplyDelete
  20. Thanks to this blog owner for sharing this great article about the Hoverboard Robot Arm project. I think you shared about this valuable information that will help many people. Many people have preferred to buy these products to improve their mobility. If everyone needs to learn about hoverboard, then everyone can visit https://howmuchdohoverboardcost.com.

    ReplyDelete
  21. Thank you for sharing with us such a great blog. I would like to share my experience with you as well.
    I'm an author on the travel blog and I travel around the world a lot
    airlines phone number
    airlines official site
    airlines toll free number
    airlines toll free number

    ReplyDelete