Difference between revisions of "Projets:Perso:2011:Motorshield"

From Electrolab
Jump to: navigation, search
m
 
(31 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Project
 
|name= Motorshield
 
|author= Clément
 
|proposal_date= 25/03/2011
 
|abstract1=So there's this cool shield from Adafruit industries... but it handles such little currents !
 
|abstract2=And there's this chip, quite cool, which handles a bit more...
 
|abstract3=OpenHW is about commiting patches, right ? So here's mine !
 
|tags=PPC
 
|where=Anywhere
 
|for_who=Anyone using the motorshield and in need of a few more amps
 
|official_electrolab_project= not yet
 
|budget= 0 (perso)
 
|number_of_members= 1, on the shoulders of many others
 
|estimated_time= few nights of work for the first prototype
 
}}
 
 
 
= Introduction =
 
= Introduction =
Because this project is intended as a patch/commit for adafruit's motorshield, I've decided to shamelessly copy the organization of their webpage documenting their version ! Please check their own webpage for further info.
+
What should you do if you wanna plug motors to your Arduino ? There's [http://ladyada.net/make/mshield/index.html this cool Motorshield from Adafruit industries], but it handles such little currents ! Fortunately, there are other nice chips out there...
  
{pic 1: the beast in all its prototype beauty}
+
OpenHW is about commiting patches, right ? So here's mine !
 +
[[File:Motorshield-overview.jpg|400px|center|thumb]]
 +
<center>The current prototype.</center>
  
 +
== Latest news ==
 +
* This project has been put to good use for a student project, stay tuned for more information/pics !
 +
* Almost everything is ready to launch the first production batch. Pre-order will be opened soon.
 +
* This design serves as a reference for the ongoing tests on PCB fabrication. We're pretty close to being able to manufacture stuff like that in the lab :)
  
I have been using Arduino for quite some time, and also adafruit's motorshield, but I have to admit, it is a bit light on the "can handle amps" side of things. It is also a bit annoying to see all these thruhole components, because I'm quite sure people should live with their time. I have my share of arduino projects and boards (although way under what adafruit has done), and have already successfully tried to pilot tougher H bridges, my fav' being the Freescale MC33932.
+
== Design goals ==
So, here it is: a fully pin/function compatible motorshield, using two of these sweet chips and a bit more smd components to fit my taste, for you to enjoy the greatness of opensource hardware !
+
* The goal of this project is to '''replace the weak L293D''' of Adafruit's Motorshield with a stronger chip, a [http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MC33932&fsrch=1&sr=2|Freescale MC33932], which is a fully integrated dual H-bridge rated at 5.0A (vs 0.6A for the L293D).
 +
* One major constraint is to '''keep a full pin/function compatibility''', so that this shield can be a drop-in replacement for Adafruit's version.
 +
* I also chose to use mostly '''SMD components''', because I am fed up with all those thruhole resistors: people should live with their time, and in my opinion, those are a thing of the past.
  
* Similar in most regards to adafruit's own motorshield:
 
** 2 connections for 5V 'hobby' servos connected to the Arduino's high-resolution dedicated timer - no jitter!
 
** Up to 4 bi-directional DC motors with individual 8-bit speed selection (so, about 0.5% resolution)
 
** Up to 2 stepper motors (unipolar or bipolar) with single coil, double coil, interleaved or micro-stepping.
 
** Pull down resistors keep motors disabled during power-up
 
** Big terminal block connectors to easily hook up wires (10-22AWG) and power
 
** Arduino reset button brought up top
 
** 2-pin terminal block to connect external power, for seperate logic/motor supplies
 
** Tested compatible with Mega, Diecimila, & Duemilanove (not yet, but should behave exactly the same)
 
** Download the easy-to-use Arduino software libraries from adafruit and you're ready to go!
 
  
* '''except''':
+
Note that I decided to call this shield "the Arduino sHHHHield - an Arduino shield with four H bridges" and am proudly claiming full fame and credits and everything for such a lame name :-)
** 4 H-Bridges: MC33932 chipset provides 5A per bridge (at 6.5A overcurrent kicks in), RMS (eg: mean over time) value depends on how well you cool it. This chipset implements a thermal shutdown protection, status flag, current feedback, over-current protection, and can work between 8v and 28v. Anyway, as always, check the datasheet for more information on freescale website.
+
** Full kit available sometime. Contact me if you're interested in getting a prototype, or build your own damn one !
+
  
 +
== Features ==
 +
As intended, this shield is very similar to Adafruit's current version:
 +
* 2 connections for 5V 'hobby' servos - still the huge drawback of pumping on the 5v regulators, which means you cannot expect to use torque-full servos.
 +
* Up to 4 bi-directional DC motors with individual 8-bit speed selection (so, about 0.5% resolution)
 +
* Up to 2 stepper motors (unipolar or bipolar) with single coil, double coil, interleaved or micro-stepping.
 +
* Pull down resistors keep motors disabled during power-up
 +
* Big terminal block connectors to easily hook up wires (10-22AWG) for motor and power supply
 +
* Arduino reset button brought up top
 +
* 2-pin terminal block to connect external power, for seperate logic/motor supplies
 +
* Tested compatible with Duemilanove & UNO. Not tested on Mega yet, but should work as the original shield. Not tested for steppers yet neither (see below: there might be issues with the current prototype, but it'll be corrected on final version).
  
 +
There are some differences tho:
 +
* Max voltage is 28v for the H-bridge [1]
 +
* Mostly compatible with easy-to-use Arduino software libraries from Adafruit [2]
 +
* 4 H-Bridges: MC33932 chipset can provide 5.0A per bridge (at 6.5A overcurrent kicks in) [3]
 +
* Current feedback readable directly on four of the analog inputs of the Arduino [4]
 +
* Status flag for each chip on two other analog inputs [4]
  
= Make it! =
+
# As I've done the design rather in a hurry for another project in a 12v environment, condensators have been chosen for this value (actually, 16v max if I remember well). Mount other values and you'll be able to get closer to the MC33932 max voltage rating. Be reasonable: at full amps, it'll get you close to 500w, even with high efficiency it'll fry the chip - or at least get it in thermal protection very fast - without additional cooling.
Unfortunately for you, I am against thruhole components. Too boring to solder, too boring to build the printed circuit board yourself at home or at the local hackerspace, too boring to design.
+
# Most notably, the enable (and thus PWM and speed control) works the opposite way at the moment, that is setspeed(255) will get stop and setspeed(0) will get fullspeed. See sections below for details.
Fortunately enough, it is '''not''' that hard to solder smd components. You can use an oven (any oven may work, just forget about using it for any food related activity afterward). You can use any soldering iron, even for smaller packages. But you'll have to learn how to do it. Just STFW, or get in touch with your local hackerspace.
+
# This is  RMS (eg: mean over time). Actually depends on how well you cool it. This chipset implements a thermal shutdown protection and short circuit/over current protection. I've tested it for quite a quile at 2.5A per bridge "stock", eg without any additionnal heatsink, and it went hot but not too hot.
 +
# Check below for details on how to use this
  
= Use it! =
+
Yeah, I know, I hate those "see conditions below" things, but hey, this is only a prototype at the moment, so live with it :)
So, what can I do with this toy, may you ask ? There's no deep, thorough tutorial about this yet. Check what is done with the original adafruit version, and come back later to check what '''we''' are using this for - once I document all that ;)
+
  
{pic: robot handibot}
+
= Current version =
 +
Please note that this is an ongoing project: this page itself is a work in progress. Use at your own risk :)
  
{pic: robot trophées plasci + squeakbot}
+
Current prototype ''do work'', but a better version is expected sometime soon enough.
  
= Download =
+
You can also check past versions of this project:
Check adafruit version of the library required to use this shield. It works fine.
+
* nope, actually this one is the first :-)
Come back later for full eagle files of this design, I'm still working on it and way too ashamed to publish the current version... or contact me directly if you wanna check it.
+
 
 +
== Make it! ==
 +
Because there are quite a lot of pictures of the build, check the sub-page describing the [[Projets:Perso:2011:Motorshield:assembly|assembly process]].
 +
[[File:Motorshield-lab.jpg|400px|center|thumb]]
 +
<center>A nice SMD assembly station, isn't it ?</center>
 +
 
 +
The current board design wasn't really optimised for DIY processes:
 +
* 6 mil spacing (0.15mm), 12mil tracks: so to speak "class 5" (not sure this is an international thing ; the higher the class, the harder to manufacture. It is probably a french standard).
 +
* 0.3 mm vias
 +
These are Pcb Pool standard process parameters - board house I went with for the first prototypes.
 +
[[File:Motorshield_TOP.png|400px|center|thumb]]
 +
[[File:Motorshield_BOT.png|400px|center|thumb]]
 +
<center>Don't try this at home, kids !</center>
 +
 
 +
You can either:
 +
* go for a pro fab house
 +
* buy one of our prototypes
 +
* tweak the current design to adapt to your manufacturing abilities
 +
* come with us tweak the lab pcb fab equipment to achieve such results
 +
''Amusing fact: just for fun (at 3am we get sweet spots for stupid challenges ;), we tried to make the bottom layer with our not-yet-trimmed pcb-process at the lab, and it went out suprisingly well. It is highly probable that in a rather near future we will be able to actually manufacture such PCB directly at the lab (of course, without metal vias, soldermask and silkscreen: those are for quite later on ;)''
 +
 
 +
== Use it! ==
 +
There's no deep, thorough tutorial about this yet. Check what is done with the original adafruit version, and come back later to check what we are using this for - once I document the related projects ;)
 +
Spoiler alert: one of them is related to Physical Etoys/Squeakbot (STFW :)
 +
Hint: having 8 half bridge on a board means you could control, like, 8 lamps. Or whatever requires few amps.
 +
 
 +
More info on the [[Projets:Perso:2011:Motorshield:use|related sub-page]].
  
 
= Resources =
 
= Resources =
 +
== Download ==
 +
Check adafruit version of the library required to use this shield. It works okay. See previous section for limitations and some example code.
 +
 +
Come back later for full eagle files of this design, I'm still trying to figure out a way to upload any kind of file on this wiki !
 +
[[File:Motorshield_SCH.png|center|400px]]
 +
<center>I know, it sucks to have only a .png</center>
 +
 +
Contact me directly if the images on this page aren't enough for you. As soon as I figure a way to upload the Eagle design files on here, I will.
 +
 +
== Links ==
 
* http://www.adafruit.com/products/81
 
* http://www.adafruit.com/products/81
 
* http://www.ladyada.net/make/mshield/
 
* http://www.ladyada.net/make/mshield/
 
* http://shop.snootlab.com/powerduino/87-rotoshield.html
 
* http://shop.snootlab.com/powerduino/87-rotoshield.html
  
= Buy Kit =
+
== Buy Kit ==
This one you cannot buy yet. But check its smaller/older brother on adafruit, snootlab, ... or contact us/me if you '''really''' wanna buy some.
+
This is just a prototype at the moment. Check its smaller/older brother on adafruit, snootlab, or get in touch with contact@electrolab.fr if you ''really'' wanna buy one of the prototypes.
 
+
= Forums =
+
There's actually all the ressources associated with the original version of this shield. For anything regarding this particular version, you can contact me directly through the electrolab mailing list, or on IRC: clmnt/#electrolab on freenode networks.
+
 
+
  
= FAQ =
+
Please note that price would be significantly higher than that of the Motorshield, like 50€ or even more. That's because:
Please start with reading [http://www.ladyada.net/make/mshield/faq.html adafruit own FAQ], here are only additionnal answers specific to this version.
+
* that's what they cost me right now
 +
* the MC33932 is stronger but more expensive than L293D: even in a production run, costs would be higher
 +
* these are still prototypes, with tiny volume (eg: more expensive pcb and components, because volume is what drives prices down)
 +
* the prototype boards are assembled by hand. Even if I happily give some of my time to design stuff, assembling batches is boring and thus my time doing so isn't totally free (as in free beer. But you can offer me one :-).
  
== What additionnal features does this version have to offer ? ==
+
= More info =
* More amps !
+
Check all the ressources associated with the original version of this shield.
* Less thru-holes !
+
* a way to measure the current consumed on each of your motors
+
* a way to get a feedback on the chipset status
+
  
== Can I really use all bridges to full power ? ==
+
For anything regarding this particular version, you can contact me directly through the electrolab mailing list, or on IRC: clmnt/#electrolab on freenode networks.
No. It'll hurt the chips by overheating if you dont take care of that. But at least, it wont self destroy (or less often ;) if you short the outputs
+
  
== It makes annoying noises ==
+
You can check the [[Projets:Perso:2011:Motorshield:faq|Frequently Asked Questions]] sub page for more info & troubleshooting.
It is being pwmed at a rather low frequency. Change your setup in the lib. Live with it, because those chips cant handle a higher pwming frequency, or design a similar board with different, better chips :)
+
  
== Suggested motors ==
+
= TODOs =
we use bigger ones, like [http://www.conrad.fr/motoreducteurs_puissants_p_50802_51488_845284_486281_FAS that thing], but any DC motor of an appropriate size/spec should do the trick !
+
== Wishlist for next revisions ==
 +
* be sure the HW is 100% compatible. Today, it is not the case !
 +
** check signal names (eg motor x forward should behave as expected)
 +
** decide on high/low PWMing in HW (inverter, or other enable - even if not recomended by spec). Should be done somehow.
 +
* enhance features & slight rework
 +
** protect reverse polarity on power plug
 +
** do something about the poor servo power design (including move that 2pinheader that shorts on the USB connector... what a pitty !)
 +
** think about polyfuse on Vin jumper (protect arduino 5v reg)
 +
** change led resistor value (maybe 5k or even less)
 +
** bring available digital I/O to headers
 +
** bring led on D13 up ?
 +
** bring analog I/O to headers, in case some features are not wanted
 +
** add holes for heatsink mounting + make some space for it
 +
** design a better silkscreen (eg servo1 & servo1...)
 +
** SMD condo ?
 +
* manufacturing
 +
** add revision info sticker on pcb (datecode, SN)
 +
** make the pcb easier to manufacture (DIY friendly)
 +
** implement end of line testability in a more easy manner (eg testpoints)
 +
** check/think about a small volume production price
 +
* code & support:
 +
** release a proper lib/code examples for specific features
 +
** clean up related pages
 +
** add troubleshooting and examples robot
 +
** document testing
 +
* crazy features
 +
** check how hard it'd be to be able to chain two of such boards to drive 4 steppers (RAMPS style) : mostly connector issues to chain shift registers + SW to drive it, I suppose... even it'd be more clever to do an all in one platform directly.
 +
** experiment with paralleling outputs and max power
 +
** try to mess with a current-loop mode firmware
 +
** mega version (eg, with more features, like RAMPS, or full robotic platform ?)
 +
** your wildest dream here ! :)
  
== I wanna understand what's really going on inside/with this shield ==
+
== TODO for this page/project doc ==
Well... check with your local hackerspace, or come to visit us !
+
* <strike>Move those pics to a sub-page/download, or sort them.</strike>
 +
* <strike>Add a true overview pic with the board and adapted motors/loads.</strike>
 +
* <strike>Create assembly sub-page</strike>
 +
* <strike>Clean this page</strike>
 +
* <strike>Add history/release notes in an explicit way</strike>
 +
* translate either in french or english assembly page
 +
* clean "use it" page.
 +
* find a way to upload eagle files & source code --> See [http://www.mediawiki.org/wiki/Manual:FAQ#How_do_I_allow_uploading_of_additional_formats.3F LocalSettings.php]
 +
* find a way to display source code --> [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi SyntaxHighlight_GeSHi extension]
 +
* organize the beta testing phase + reports
 +
* prepare the RC1 rework phase

Latest revision as of 15:18, 18 May 2012

Introduction

What should you do if you wanna plug motors to your Arduino ? There's this cool Motorshield from Adafruit industries, but it handles such little currents ! Fortunately, there are other nice chips out there...

OpenHW is about commiting patches, right ? So here's mine !

Motorshield-overview.jpg
The current prototype.

Latest news

  • This project has been put to good use for a student project, stay tuned for more information/pics !
  • Almost everything is ready to launch the first production batch. Pre-order will be opened soon.
  • This design serves as a reference for the ongoing tests on PCB fabrication. We're pretty close to being able to manufacture stuff like that in the lab :)

Design goals

  • The goal of this project is to replace the weak L293D of Adafruit's Motorshield with a stronger chip, a MC33932, which is a fully integrated dual H-bridge rated at 5.0A (vs 0.6A for the L293D).
  • One major constraint is to keep a full pin/function compatibility, so that this shield can be a drop-in replacement for Adafruit's version.
  • I also chose to use mostly SMD components, because I am fed up with all those thruhole resistors: people should live with their time, and in my opinion, those are a thing of the past.


Note that I decided to call this shield "the Arduino sHHHHield - an Arduino shield with four H bridges" and am proudly claiming full fame and credits and everything for such a lame name :-)

Features

As intended, this shield is very similar to Adafruit's current version:

  • 2 connections for 5V 'hobby' servos - still the huge drawback of pumping on the 5v regulators, which means you cannot expect to use torque-full servos.
  • Up to 4 bi-directional DC motors with individual 8-bit speed selection (so, about 0.5% resolution)
  • Up to 2 stepper motors (unipolar or bipolar) with single coil, double coil, interleaved or micro-stepping.
  • Pull down resistors keep motors disabled during power-up
  • Big terminal block connectors to easily hook up wires (10-22AWG) for motor and power supply
  • Arduino reset button brought up top
  • 2-pin terminal block to connect external power, for seperate logic/motor supplies
  • Tested compatible with Duemilanove & UNO. Not tested on Mega yet, but should work as the original shield. Not tested for steppers yet neither (see below: there might be issues with the current prototype, but it'll be corrected on final version).

There are some differences tho:

  • Max voltage is 28v for the H-bridge [1]
  • Mostly compatible with easy-to-use Arduino software libraries from Adafruit [2]
  • 4 H-Bridges: MC33932 chipset can provide 5.0A per bridge (at 6.5A overcurrent kicks in) [3]
  • Current feedback readable directly on four of the analog inputs of the Arduino [4]
  • Status flag for each chip on two other analog inputs [4]
  1. As I've done the design rather in a hurry for another project in a 12v environment, condensators have been chosen for this value (actually, 16v max if I remember well). Mount other values and you'll be able to get closer to the MC33932 max voltage rating. Be reasonable: at full amps, it'll get you close to 500w, even with high efficiency it'll fry the chip - or at least get it in thermal protection very fast - without additional cooling.
  2. Most notably, the enable (and thus PWM and speed control) works the opposite way at the moment, that is setspeed(255) will get stop and setspeed(0) will get fullspeed. See sections below for details.
  3. This is RMS (eg: mean over time). Actually depends on how well you cool it. This chipset implements a thermal shutdown protection and short circuit/over current protection. I've tested it for quite a quile at 2.5A per bridge "stock", eg without any additionnal heatsink, and it went hot but not too hot.
  4. Check below for details on how to use this

Yeah, I know, I hate those "see conditions below" things, but hey, this is only a prototype at the moment, so live with it :)

Current version

Please note that this is an ongoing project: this page itself is a work in progress. Use at your own risk :)

Current prototype do work, but a better version is expected sometime soon enough.

You can also check past versions of this project:

  • nope, actually this one is the first :-)

Make it!

Because there are quite a lot of pictures of the build, check the sub-page describing the assembly process.

Motorshield-lab.jpg
A nice SMD assembly station, isn't it ?

The current board design wasn't really optimised for DIY processes:

  • 6 mil spacing (0.15mm), 12mil tracks: so to speak "class 5" (not sure this is an international thing ; the higher the class, the harder to manufacture. It is probably a french standard).
  • 0.3 mm vias

These are Pcb Pool standard process parameters - board house I went with for the first prototypes.

Motorshield TOP.png
Motorshield BOT.png
Don't try this at home, kids !

You can either:

  • go for a pro fab house
  • buy one of our prototypes
  • tweak the current design to adapt to your manufacturing abilities
  • come with us tweak the lab pcb fab equipment to achieve such results

Amusing fact: just for fun (at 3am we get sweet spots for stupid challenges ;), we tried to make the bottom layer with our not-yet-trimmed pcb-process at the lab, and it went out suprisingly well. It is highly probable that in a rather near future we will be able to actually manufacture such PCB directly at the lab (of course, without metal vias, soldermask and silkscreen: those are for quite later on ;)

Use it!

There's no deep, thorough tutorial about this yet. Check what is done with the original adafruit version, and come back later to check what we are using this for - once I document the related projects ;) Spoiler alert: one of them is related to Physical Etoys/Squeakbot (STFW :) Hint: having 8 half bridge on a board means you could control, like, 8 lamps. Or whatever requires few amps.

More info on the related sub-page.

Resources

Download

Check adafruit version of the library required to use this shield. It works okay. See previous section for limitations and some example code.

Come back later for full eagle files of this design, I'm still trying to figure out a way to upload any kind of file on this wiki !

Motorshield SCH.png
I know, it sucks to have only a .png

Contact me directly if the images on this page aren't enough for you. As soon as I figure a way to upload the Eagle design files on here, I will.

Links

Buy Kit

This is just a prototype at the moment. Check its smaller/older brother on adafruit, snootlab, or get in touch with contact@electrolab.fr if you really wanna buy one of the prototypes.

Please note that price would be significantly higher than that of the Motorshield, like 50€ or even more. That's because:

  • that's what they cost me right now
  • the MC33932 is stronger but more expensive than L293D: even in a production run, costs would be higher
  • these are still prototypes, with tiny volume (eg: more expensive pcb and components, because volume is what drives prices down)
  • the prototype boards are assembled by hand. Even if I happily give some of my time to design stuff, assembling batches is boring and thus my time doing so isn't totally free (as in free beer. But you can offer me one :-).

More info

Check all the ressources associated with the original version of this shield.

For anything regarding this particular version, you can contact me directly through the electrolab mailing list, or on IRC: clmnt/#electrolab on freenode networks.

You can check the Frequently Asked Questions sub page for more info & troubleshooting.

TODOs

Wishlist for next revisions

  • be sure the HW is 100% compatible. Today, it is not the case !
    • check signal names (eg motor x forward should behave as expected)
    • decide on high/low PWMing in HW (inverter, or other enable - even if not recomended by spec). Should be done somehow.
  • enhance features & slight rework
    • protect reverse polarity on power plug
    • do something about the poor servo power design (including move that 2pinheader that shorts on the USB connector... what a pitty !)
    • think about polyfuse on Vin jumper (protect arduino 5v reg)
    • change led resistor value (maybe 5k or even less)
    • bring available digital I/O to headers
    • bring led on D13 up ?
    • bring analog I/O to headers, in case some features are not wanted
    • add holes for heatsink mounting + make some space for it
    • design a better silkscreen (eg servo1 & servo1...)
    • SMD condo ?
  • manufacturing
    • add revision info sticker on pcb (datecode, SN)
    • make the pcb easier to manufacture (DIY friendly)
    • implement end of line testability in a more easy manner (eg testpoints)
    • check/think about a small volume production price
  • code & support:
    • release a proper lib/code examples for specific features
    • clean up related pages
    • add troubleshooting and examples robot
    • document testing
  • crazy features
    • check how hard it'd be to be able to chain two of such boards to drive 4 steppers (RAMPS style) : mostly connector issues to chain shift registers + SW to drive it, I suppose... even it'd be more clever to do an all in one platform directly.
    • experiment with paralleling outputs and max power
    • try to mess with a current-loop mode firmware
    • mega version (eg, with more features, like RAMPS, or full robotic platform ?)
    • your wildest dream here ! :)

TODO for this page/project doc

  • Move those pics to a sub-page/download, or sort them.
  • Add a true overview pic with the board and adapted motors/loads.
  • Create assembly sub-page
  • Clean this page
  • Add history/release notes in an explicit way
  • translate either in french or english assembly page
  • clean "use it" page.
  • find a way to upload eagle files & source code --> See LocalSettings.php
  • find a way to display source code --> SyntaxHighlight_GeSHi extension
  • organize the beta testing phase + reports
  • prepare the RC1 rework phase