Saturday, July 10, 2010

I need to put an addendum on that last post, with new stuff I've learned since then.

If you take a lead off the sensing/ground lead, and take it to an analog input pin, you'll get a voltage across the resistor if it's there. This can be used to provide feedback on how much power is being pulled by the motor, and PWM can be adjusted to provide constant current depending on the conditions.

Most people will be more worried about the speed of the motor however, which isn't consistently available through the current level. Current control can tell you if the motor is stalling, but generally if you have a reasonable method of measuring speed, you'll be able to tell the motor is stalling that way.

You don't need a resistor unless you're messing with the current sensing, but if you are, the wattage rating on the resistor needs to be selected properly(probably over a watt), and the resistance needs to be chosen to make sure the voltage being sent to your sensor pin doesn't fry it.

Friday, April 23, 2010

L298 current sensing

The L298 pulls the current from the source voltage(not to be confused with the logic voltage) supply, to the current sensing pins--NOT the main ground. The resistors that are recommended? The power to the motor/load is going through that resistor, as well as the load. If the resistor is too big, it blocks the power and the motor won't run until the voltage is high enough to overcome the resistor. I put the recommended 10 ohm resistor in, and it was keeping the motor from running. I didn't quite realize what was happening until I touched it and realized it was hot--Kirchoff's Law says that the resistor will have the same current as the motor--.6 amps in this case, which was also "letting the magic smoke" out of the resistor--9V * .6A = 5 watts, not 1/4. When I put a potentiometer on the circuit, I found that the motor would slow around 4-5 ohms, and stop at 5-6, well below the 10 ohms from before.

For future reference, unless you REALLY want to limit the current, just put the sensing contacts straight to ground. If you need the resistor for whatever reason, get a potentiometer(preferably one rated for the desired power), and adjust it to get the desired outcome. Check it with a multimeter, and you have the reistance you want. Also make sure that you have the power rating needed--most likely anything above 3-5 volts will draw more than the 1/4 watt most resistors people use for hobby electronics are rated for. Magic smoke is only fun if you're deliberately trying to get it, though resistor smoke is cheaper than L298 smoke, which I got when putting 9 instead of 5 volts on the logic supply.

Sunday, March 28, 2010

I got an L298 with the switches for my preliminary project. I got it working tonight. The L298 is a fairly powerful motor controller--with two 2 amp channels, most robots won't need more. The two channels can be paralelled for 4 amps, and the voltage can go up to 40 volts or so. I'm not sure l298s will work for the big tank, but for the drive on the 1/16 plastic model, it'll be fine.

http://www.pyroelectro.com/tutorials/l298_control/index.html
This is the best I found in a few minutes of google to find a tutorial. Keep in mind that the L298 comes in two versions right now--an older L298N, and a newer L298NH. On the data sheet for the N, it points out a need for filter diodes on the motor feeds. The NH has these built in. Thus it will be much simpler to wire. Keep in mind that larger motors than the 6V Erector set motor I used will probably need a heat sink on the motor driver to help keep it cool.

I got the driver from http://www.taydaelectronics.com one of many electronics outlets on the web. They had the microswitches I needed for a different project for much less than others, and since they wanted a $5 minimum order, I grabbed the L298 at the same time, knowing I'll need it for the tank eventually. Electronics are like everything else, you sometimes have to shop around. A big thing about Tayda though is that they're in Thailand. If you order something, keep an eye on the shipping options, the standard will take anywhere from one to three weeks to arrive. They also have higher prices on other components--the dozens of LEDs and resistors I needed for my other project were better gotten from Mouser Electronics.

Friday, February 26, 2010

Got it today


The Arduino came in today. Nice little thing, I set up a braedboard and some sticky stuff to hold it while I experiment. I got a few LED blinks, then it crapped out and it can't find COM3 anymore. Anyway, picture time.

The tabs on the side are those post-it adhesive strips. They have a velcro like stuff on them, so I can attach here, or attach elsewhere. Not sure if I'll keep it exactly like this, but it's a start.

Wednesday, February 24, 2010

Gooood Morning Internet!

First post on my new blog. I'll save linking to my personal one, I'd like to keep it disconnected.

Anyway, I'm a "sophomore" at the University of Wyoming, working towards a B.S. in computer engineering. I have three main goals:
Power armor.

Instinctive, highly integrated control systems, from Wii remotes to neural interfaces.

Robots.

This blog will mostly be focusing on the third, since it's the one that will be easiest to start and work on. I use the term "Bolo" in honor of Keith Laumer's sentient creations. It'll be a while before they get that big, but the idea is the same.

First is learning to do more sophisticated programs with the Arduino Mega as a basic platform--"hello world" and blinking a few LEDs is lame when you already have programming experience. The Arduino Mega will eventually talk to my Aspire One via Zigbee wireless protocols for access to more processing power and operator input. Eventually a single board computer of far greater power will be referring to an Ipod Touch or some such for ever more limited input.

The first vehicle will be a Heng Long M41 Bulldog that will be set up to run from the netbook via zigbee. Later, either something like a Chunwai model or more likely(much cheaper) a custom built chassis will be used with an internal computer.

I'll be linking to resources for learning how to work these, or posting my own articles so that the information is available in an easily readable format--half the time, the information is so convoluted that someone who barely has any technical knowledge(let alone planning on learning more jargon than "do-hicky") can't tell what's being said. Code will also be included, and also provides an example of how crazy it can get. Looking up a function, it can be hard to figure out just what you use it for. Take ToString in C++ for instance. While some resources showed that it could be used to case an int as a string, I encountered severe fail in doing it. Every other primitive can be recased as a string with this function, but not integers, apparently. sprintf is one function that can do it, but I shouldn't have to do #include extra stuff outside of string, right? I suppose later in comp sci I'll learn why there isn't such a simple way to do that particular conversion, but right now, logic still operates.

Anyway, since components aren't here yet, this post is done.