Friday, January 18, 2013

Heat Sinks

In the last post, I briefly mentioned that I planned on adding a 'heat sink' to my motor driver board in order to prevent it from over heating.  In this post I will cover why a heat sink is often needed and what it does.

Definition 
A heat sink (a.k.a heat exchanger) is a part which transfers heat into the surroundings (air in most cases).  It is typically an additional metal part, usually Aluminum but can be any highly conductive material, which is adhered to the thing that is getting hot.  Additional explanation... Wikipedia definition.
The heat (or 'thermal') energy is exchanged (or 'transferred') in to the air through a mode called convection (mostly).  There are also two other modes which do contribute to some transfer, but tend to be relatively small.  They are known as conduction and radiation.

  • Convection is the thermal energy transfer through fluids, like air (Link)
    • If you hold your hand above to something hot, you can feel the heat mostly because of convection
  • Conduction is the thermal energy transfer through a material, like metal (Link)
    • If you touch something hot, energy is transferred into your hand by conduction
  • Radiation is basically waves of thermal energy (e.i. infrared light) which are emitted by the thing that is hot (Link)
    • If you hold your hand next to something hot, you can feel the heat mostly because of radiation.
    • The earth is warmed by radiation from the sun.  In order for radiation to be of concern, the difference in temperature between the two objects (like the sun and earth) must be very large.


Overview of a Heat Sink


So, when do you need a heat sink?  
Well, that is not always an obvious question... it depends what you are doing, what you are doing it with, and where you are doing it.

What you are doing?
Are you driving a 0.5 Amp (at stall) motor with a 10 Amp motor driver?  Then no.
Are you driving a 6.0 Amp (at stall) motor with a 2.4 Amp motor driver (like me)? Then yes!
Are you driving a 6.0 Amp (at stall) motor with a 6.0 Amp motor driver?  Then probably...

What are you doing it with?
When using a motor driver, pull up the specification sheet and determine the maximum constant operating temperature.  In my case, I am using the L293D chip (Link to data sheet) which has an operating temperature from 0C to 70C.  If you have an IR thermometer, measure the temperature during heavy use.

Where are you doing it?
If you had a motor driver chip on a RC helicopter which is exposed to the wind created by the blades (that is key), you may not need a heat sink.  In this case, the wind causes forced convection into the air. Forced convection allows more thermal energy to be transferred into the air.  That is why you will often find a heat sink with a fan strapped to the top (like the CPU on the motherboard of your computer).

In general, if it gets hot to the touch during operation, I would recommend adding a heat sink.  If it is added correctly, you will only help prolong the life of the chip.

Finding a heat sink
You will typically find a heat sink in your local electronics shop or maybe even a hardware store.  If not, try pulling apart old electronics like computers or an Xbox.  After my Xbox showed me its red 'ring of death', I took the liberty of ripping it apart to salvage anything.  There were two of the coolest (ha) heat exchanges inside.

In most cases, finding a heat sink with fins is preferable.  Some of the really cheap versions are simply a bent piece of sheet metal... essentially creating two fins.  The key to an effective heat sink is surface area.  The more surface area your heat sink has, the better it will transfer the heat to the surroundings.
The image below shows a 'good' heat sink.  However, I am somewhat bias to the cool look of these.  An inexpensive bent sheet metal heat sink may be acceptable in some applications.

Heat Sink with Fins
In order to attach it to the chip, you should find yourself some thermally conductive grease or epoxy (a.k.a heat sink compound).  Simply using common household glue or bolting the heat sink to the chip is not sufficient (The generic glue could create a thermal barrier, having low conductivity, and restrict the flow of energy.  The same is true with an air gap between the chip and heat sink).  Conductive grease or epoxy usually has a high content of conductive particles, like silver, to help the heat transfer through it.  Apply a thin layer to the chip (avoiding bubbles).  The thinner the gap the better (unless you have bubbles). (Search Google for heat sink compound for more info).

Hope that helps.

Balancing Bot Arduino Shield Stack


I am slowly working toward the balancing robot Arduino shield stack.  So far, I have tested the XBee shield by sending information from the Arduino to the XBee and to my computer across the room.  As you can see from the below images, I have soldered my SparkFun 2 axis gyro and 3 axis accelerometer (Link) to my ProtoShield and mounted that to the XBee Shield which is mounted on the Arduino UNO.  The addition of the gyro/accelerometer was simple since no other shield I plan on using utilizes the analog pins (in order to use a stack of shields successfully, two shields can not use the same analog or digital pin... logic power is fine).


Gyro on ProtoShield

Wireless Gyro Stack
Next, I plan on adding the motor shield, which I purchased through the MakerShed (Link), to complete my balancing bot stack.  I have tested this shield and it should work for what I need it to do.  The shield is capable of driving 4 bi-directional motors... however, since my robot has 2 'large' motors (6A stall) (Link), I plan on doing some 'hacking' to allow it to drive 2 motors with all of the 8 outputs (essentially spreading the power around so I don't overheat the chips).  I will also add an Aluminum heat sink, which may be custom made unless I can find my way over to my local electronics store.  If heat sinks are new to you, I will do some explaining in the next post (in a nutshell, they help pull the heat out of the thing it is connected to,  a motor driver chip in this case, and spread it over a larger area).

Balancing Bot Arduino Stack

Friday, January 11, 2013

My First Arduino

After months of doing next to nothing with my electronics, I have finally jumped back into it.  This time I have come back with an Arduino!

I started playing with micro controllers while in college... about 8 years ago... really, 8years ago... I'm getting old.

My first micro controller was a Basic Atom Pro which used a C compiler which cost around $100 if you wanted to get into longer code (50+ lines if memory serves me correctly).

I quickly ran into issues and ended up switching to standard PIC chips (by Microchip) after a coworker, an electrical engineer, gave me a bunch of his old books and programmer.  Since then, and up to now, PIC is all I have used.

Since I began hearing about Arduino a few years ago, I considered giving it a shot... however, up until someone got me a UNO this Christmas, I had never used one.

After installing the software and about 10 minutes of playing... I regretted not switching sooner!  The majority of my time spent on the PIC was figuring out how to set the bits correctly to get something to work.  With the Arduino, although that stuff is still needed, it is all behind the scenes.. and I am glad to see it go.

I have purchased a number of shields and plan on hooking up my balancing bot (or so I hope it will balance).  I will probably update the Sumo Bot also with an Arduino...

Stay tuned...

Arduino UNO, XBee, Proto and Motor Shields

How to Set-Up a Pair XBees

There are plenty of examples on how to set-up a pair of XBees on the web, but since I had some trouble, I thought I would share my resources for the next person who tries.

I bought my XBees (Link) and XBee Explorer USB (Link) from Sparkfun

First, check out this you tube video I found on YouTube.


Here are rough steps
  1. Connect one XBee using a XBee Explorer USB, or equivalent
  2. Find the correct COM port and test the connection (set the Baud rate to 9600)
  3. Move over to the Modem Configuration tab.
  4. Click read to pull the info from the modem
  5. Change the Modem model to XB2-B
  6. Change the function set to ZIGBEE ROUTER/END DEVICE AT (for XBee 1) or ZIGBEE COORDINATOR AT (for XBee 2)
  7. Change the PAN ID to 3FFF (Can be any value within the given range as long as both XBees are set to the same one)
  8. Make note of the Serial Number High and Serial Number Low
  9. Press Write to program your XBee
  10. Perform steps 1 through 8 for the second XBee (XBee 2)
  11. This time, prior to pressing Write, input the first XBee's High and Low Serial Number in the Second XBee's Destination Address hight and low
  12. Ensure the Baud rate is set to 9600 and press Write
  13. Finally, reconnect the first XBee and input the second XBee's High and Low Serial Number in the Destination Address hight and low
  14. Press Write... DONE!

Although I thought I was following his tutorial step by step, I overlooked the fact that the modem type I was selecting was different than his.  In the video, the modem type was "XB24-B" but mine was selected as "XB24-BZ".  I don't know the difference, or why one was working and the other was not, but I don't care.  For my purposes, all I wanted was to send serial data back and forth.

Here are the screen shots for each XBee
Coordinator XBee Settings
Router/End Device XBee Settings

Using some serial source, you can now send data from one XBee to the other.

If you have "Bricked" your XBee, which means interrupted it during a firmware upload, use these steps to get you back up and running (I had to use them)

1. Take the module out of the interface board.
2. Connect the interface board to the computer.
3. Open X-CTU make sure Baud Rate is set to 9600
4. Go to "Modem Configuration"
5. Put a check in the "Always update firmware" box
6. Select proper modem from drop down menu,
7. Select proper function set and firmware version
from drop down menus.
8. Click on the "Write" button. After a few seconds of
trying to read the modem, you will get an Info box
that says Action Needed. At this point, CAREFULLY
insert the module into the interface board.
9. You may get the info box again a short while after,
just use the reset button on the interface board.


This is where I found these instructions (Link). 

Good Luck!

Sunday, May 6, 2012

Sumo Bot Fully Assembled (with issues)

After a lot of frustrating hours, I have my first Sumo Bot somewhat up and running... unfortunately, he is currently running in circles  I have not found my error yet, but I must have an short somewhere....

Here is the functionality which I do have. (The following four digits control the drive direction, for example, to drive forward, the command is 1010.  To 'turn on a dime' the command is 1001 for counter clockwise or 0110 for the clockwise direction.)
1000 = Right side drives forward (which is what should happen)
0100 = Nothing happens, but both pins on the right side are high (should drive right side in reverse)
0010 = Both sides drive forward (should only drive left side forward)
0001 = Both sides drive in reverse (should only drive left side in reverse)

Although he isn't working, he sure looks pretty.

Completed Sumo Bot Isometric View

Side View

Front View

Saturday, May 5, 2012

Updates


Its been a little while since my last post. Let's go over what I've been doing

The Sumo Bot (Name TBD)
I have slowly been populating the PCB and testing everything as I go along. I have had a series of issues which have been simple mistakes but time consuming to realize.

First, I was having issues with the driver chip not pulling down the low side of the H-bridge, even when I was telling it too. That was easily corrected when I realized the current sense pin MUST be connected to ground.  I am planning to hook the current sense to an ADC pin, but I was holding off just in case the driver sent a lot of current through that pin into the PIC.  So far, I have not let any of that magic smoke out... yet.

Next, the edge sensors were not changing voltage when the line was supposed to be sensed. That again was easily fixed when I realized that the program I was using had the pins set as outputs.
"Why does that matter?" You ask...
Well, when the PIC pin is set as an output (rather than input) there are pull down resistors (resistors which are connected to ground) that are enabled.  These resistors ensure the pin in not 'floating' (when you change states on to off, the pin remains high).  In my case, when I powered the board, they were pulling the output side of the IR sensor down, such that it appeared nothing was happening when the input changed.  I realized that while falling asleep one night.

Here is what the sumo bot is looking like these days.

Current Status of Sumo Bot

Learning C# (C Sharp)
One of my more favorite bloggers is Shane Colton (scolton.blogspot.com).  In general, he does a lot of seemingly advanced things with motor drivers, quad-copters, and robots in general.  He also does a lot of data logging and plotting with a program he created in Visual Basic (or so I have gathered).  I am hoping I can do the same with C# (pronounced C Sharp).  Through the robot club I am part of, a member has given me the code to log incoming serial data... now I am attempting to use the "Chart" tool to also plot the incoming data.  Once I have something worthy of posting... I will include the downloadable program.  The below image is the current layout.

C# Form Layout

Bench-Top Milling Machine

I realized the other day that I have not shared my new bench-top milling machine from MicroMart.  It is the "MicroLux High Precision Heavy Duty R8 Miniature Milling Machine", pictured below

MicroLux High Precision Heavy Duty R8 Miniature Milling Machine
Since December, when my wife surprised me with it, I have only used it a handful of times, but so far, I am impressed.  After adjusting the ways so they are a little tighter than the factory setting, I am happy with the results.  It's definitely no Bridgeport... but I'll be able to make all the same parts... only taking off less material with each pass.

That's actually a point I would like talk more about.  Typically, internet reviews of smaller metal working tools (e.g. mill and lathe) complain about how 'bad' they are when compared with full sized machines.  To those reviewers I say, Blah!  The main difference between a big machine and the bench-tops is the amount of material you can take off with each pass.  Larger machines are very stiff and can handle removing a lot of material while leaving a nice surface finish.  Small machines are significantly less stiff and require less material removal to get the same surface finish.  In reality, a hobbyist, like me, can do everything with a small machine that someone with a large machine could do (in general)... but only slower.  I'm not making parts to earn money, I don't need to make parts quickly.

But I digress....