|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
|
TOP SECRET
Motor Control Lately Ive been a lot of talk and no app (happens to the best engineers when they go PHM1). So, I thought I should get back to my engineering roots a little. I recently discovered a need for a precise motor control, one that could set a specific level as well as modulate the output. I thought, hey, this would make a great little project. Something fun that would stretch my design muscles. Before I go further, I must let you know that this device is TOP SECRET. I cannot reveal its purpose. You may guess all you want, but dont ask me to tell you 'cause I wont. If you wonder why I cant tell you, remember a little hype never hurt anyone. The device I have in mind sounded like a great application of the Atmel Tiny15, a really neat little chip with a lot of bang for your buck. I figured some of you out there might have your own secret use for it. You can get the tiny programmer, the STK100, at Digikey if they have any in. Last I checked, there were 0 in stock. The programmer is cheap enough for a poor man like me to own. I guess youll have to ask your local rep, or try going to Atmel for a sample. I got some from Thorsen Rocky Mountain in SLC. The Skinny on The Tiny First of all, it has an internal oscillator, no need to find room for, or deal with, a crystal. It maximizes the output pins toonice when all you have are 8 pins. It also has a PWM output, perfect for DC brush motor control. And lest you think it a wimp, the PWM supports up to 150-Khz PWM frequency, not bad for an internal oscillator! Now top it off with not one or two, but FOUR, ADC inputs including a differential input to the ADC. If that isnt enough, you can have a comparator too, if you care for one when you already have a 10-bit ADC. Oh, by the way, did I tell you that any of the inputs could be basic I/O too? Talk about your multiple configurations! And yet one more thing, the program memory is flash, so your prototype involves just one chip till you're done. Gone are the days of, "Oops, I shouldnt have burned that code!" When you start hooking up bigger motors you also discover that it is nice not risking your computer by hooking your emulator up to a motor. Its even in-circuit programmable. To sum it up, Id say its kinda like an op-amp with some brains. Maybe its the "Bob Pease" in me, but youll realize how great a compliment that is if you read some of my op-amp articles. I tell you, the specs on this chip rock! The first time I saw it, I thought this would be perfect for a motor control. Its only detriment is that it has 6 pins of I/O, but thats the hazards of such a small package. Besides, you can configure the various pins depending on the function you require. How many times have you had a control project where you thought, If I had just a tiny (no pun intended2) little micro here, it could handle all this work for me without going to the trouble of a bunch of circuit design or redesign?" Back to the Project As I said, I wanted a digital motor control that I could increment in small discrete steps, and would output the desired voltage and even add a little modulation. The output was easy. I tied a transistor to the PWM output. Now I could handle the motor I wanted to turn. The inputs took a little more thought though. Here is the heart of the control. First I thought I might take advantage of the differential ADC inputs to monitor the voltage across the motor. On a DC brush motor, controlling the voltage is important, as the speed is directly proportional to the voltage applied3. As the motor is loaded, the voltage across the motor will change (depending on the output impedance of your device); however, in this case the load does not vary much. So I figured I could save the pins and use them for something else. I wanted to do a couple of modulation schemes on the output of my tiny little control, including steady state, sine wave, pulse, saw tooth, and a few other treats. But one thing they all have in common is a need to vary the output voltage as well, at a given modulation frequency. So I figure I'll need at least two controls and a mode button. "Hey" I thought, "here is a perfect chance to use those ADC inputs." Ill just hook up a pot for each control. But I rejected that option. I could do the whole project with some op-amp and a bunch of resistors if that were the case. And I did this project to understand the Tiny 15, so I ought to use its capabilities a little better. Besides, I wanted precise digital control, and you get that with buttons. I/O Mapping I started by mapping some of the desired traits of my design; it should be battery powered. (Needs a sleep mode so I dont have to remember to turn it off.) I should have a user interface that is easy and intuitive without need for a complex display. So I settle on one LED output, to indicate operating mode (everyone is doing a 1 LED display these days!) 1 switch to change mode, 2 switches to change base voltage up or down, and 2 switches to change modulation frequency up or down. Let see... 1 PWM output, plus 1 led, plus 5 switches, that equals 7 I/O!? I dont know about you, but I see a problem. There must be a better way. So why not use an analog input to get digital signals. In fact, a lot of portable CD players do just that. (Besides, it gives me a reason to use the ADC.) So I put all the switches on one line like this. Theoretically you could get over 500 different switches with the 10-bit ADC that this little guy has, but you really ought to put some space between the voltage levels, or the bad guy "tolerance" might show up and cause headaches. Thats OK, I set 8 levels and only use 5 for now. Always be prepared for more I say. If you like this type of interface, fellow EE Expert Robert Ashby (yes, we are related) goes into more detail in his article "Doubling Up on Inputs." He even wrote a program to help you figure out if you have overlap problems. Whew, all that brainwork frees up 3 lines. So Ill hook the differential inputs back up just for kicks. (Who knows? maybe Ill want try a little feedback.) Now toss in an extra LED for diagnostics and what ever else strikes my fancy. Id show you a final schematic, but I cant reveal everything. Dont forget that this is a TOP SECRET project. A wise man said, "The things that come to those who wait may be the things left by those who got there first." I want to be there first! Photo Opportunity Here is a picture of the TSMC in its prototype stage. It definitely is tiny, could you imagine the size if Id used surface mount parts? Well, hardware is done, and the game is afoot. Tune in next time. Well talk software. Notes
|
|||||||||||||||||||||||||||||||||
|
Copyright © 2003 ChipCenter-QuestLink About ChipCenter-Questlink |
||||||||||||||||||||||||||||||||||