![]() | |
| Home Page | Mark Forums Read | Today's Posts | My Replies | Classifieds | Reviews | Photo Gallery | Web Links | Share Files | Advertise With Us | Ad List |
| |||||||
| PIC Programing / Design Discuss programing of PIC chips here and design of electronics using PIC chips. |
![]() |
| | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
| ||||
| ||||
As if I don’t have enough things to think about, I just can’t get my mind off of playing with a PIC controller. I have been tinkering around in my head with this design for a little while now and would like to throw it out there. I chose a PIC 16F684 as it costs only $1.39, has PWM and has a built-in 8Mhz oscillator. I set it up so that I could build it as either a cheap unipolar or by adding high side drivers and FETs, it could drive a bipolar. The costs come out quite reasonable, see attached bill of materials from Mouser. Of course connectors, passives, PCB, etc always add up. Quick circuit description: The PIC gets STEP and DIR inputs and looks up values to place in the PWM. The PWM will be running just outside the audible range at about 25khz. It has two outputs that are the complement of each other. The PWM is just a variable duty cycle oscillator, so it can for example direct 70% to one winding and 30% to the other in order to get micro stepping. It also has four other outputs to enable the FETs for switching directions. The sense resistor is fed to a comparator to monitor current limit. When the current is too high, the comparator will drive its output low clearing the ‘165 shift regs. These will clock out 0’s disabling the FETs as long as the comparator is low. When the current subsides, the shift regs will take another 8 clocks to shift in the HI on the SDI pin and turn on the FETS. The clock output from the PIC is 2Mhz, so this will take about 4 usec. For unipolar, do not install the high side drivers or FETs, and connect the center tap to VMOT. For bipolar, install everything and connect the motor across pins 1 and 4. I realize that I need to work on stepping down VMOT more before it hits the regulators, more bypass, EMF diodes, and a few other things. Is it worth pursuing? Suggestions? Steve |
|
#3
| ||||
| ||||
| Progress? Hmmm. Lots of hours spent. I have learned a lot. I’m still trying to do a cheap upgradeable design. Progress is just so slow, so many things to worry about. I did my first (and second and third) toner transfer PCB today. I took Phil’s advice and ended up using a glossy advertisement from a mattress store as the print medium. It worked so much better than the other papers I was trying. The ad had color pictures all over it, but that made no matter. It was nice and thin, so the removal was much easier also. I changed the design from post #1. It seems to me that stepper controllers have 5 parts: the Logic (processor), the Current sense/monitor, the Chopper, the Drivers, and the FETs. I moved all of the current and chopper out of the processor and into hardware (just like the original PIC design). After a lot of thinking about it, it just seemed more predictable (and I was not too impressed with the comparators and resistor ladder in the PIC). Simple IC’s are extremely cheap, so the cost comes out as a wash. Problem is that the chip count went up, so it is fairly packed on a one sided board that is etched at home. To packed for me, over 250 holes and 45 jumpers. But this bipolar design from Mouser is still under $15 with pretty good quality 60 volt / 20 amp FETs and $2 in sense resistors. I came up with a 4 bit resistor network D2A that lets me have 51 different voltage levels for the steps in a sine wave. By pulling up combinations of resistors, and pulling down others, and letting others float. I attached a spread sheet of my playing around with this. It was kind of fun. It also has what a hex value waveform and a ten step waveform look like for comparison. I have to come up with a better way to route or shrink this thing, or just give up. Would like some critisism. Steve Edit: Just a note: I only see this as a 3 or 4 amp, and about a 45 volt controller. I am not trying to enter into the high drive stuff. Last edited by spalm; 06-10-2006 at 10:56 PM. Reason: High current disclamer |
|
#4
| ||||
| ||||
| I think you are going to have trouble with the reliablility of your bridges.
__________________ Phil, Still too many interests, too many projects, and not enough time!!!!!!!! Vist my websites - http://pminmo.com & http://millpcbs.com |
|
#6
| ||||
| ||||
| Shoot through, low side gate drive, among others
__________________ Phil, Still too many interests, too many projects, and not enough time!!!!!!!! Vist my websites - http://pminmo.com & http://millpcbs.com |
|
#7
| ||||
| ||||
| OK, please help me understand this. Is driving a bipolar bridge really that much more of a problem than driving a unipolar stepper. It seems to me like they are very close; same current, same voltage. I thought the hard part was getting the high side drivers to work correctly. The plus side is 30% more torque. I am driving the low side with low power CMOS, like a lot of other designs do. They all seem to work OK. I also kicked up the voltage on this part to help discharge the gate capacitance a bit quicker. I just added the eight diodes to help absorb the back EMF. The FETs do have these built in, but for a dollar more, better safe than sorry. A large number of low cost controllers have also left off these diodes and they seem to weather the storm. I have separate control lines to drive each side of the bridge. This allows me to turn off everything when a change of direction occurs and let the back EMF be absorbed before energizing the other side. Thanks for your help, Steve |
|
#8
| ||||
| ||||
| yes and no, The problem, is everybody thinks MOSFETs are a simple device present a gate voltage, and they turn on. Each MOSFET has characteristics, where simple cmos will drive one logic level mosfet, it won't necessarily drive the next PN MOSFET. Gate capacitance and charge and switching speeds all come into play. Where H bridges seperate in drive complexity doesn't end at how to drive the high side. You HAVE to make sure you don't have both and HI and LOW side FET on the same side of the bridge on at the same time. And you have to be sure that is true for the whole tolerance range of the P/N of the selected devices.
__________________ Phil, Still too many interests, too many projects, and not enough time!!!!!!!! Vist my websites - http://pminmo.com & http://millpcbs.com |
|
#9
| |||
| |||
| Steve, You might want to use a couple of half bridge drivers that are made for bipolar drives. The charge pumps keep from having shoot through problems with the naked fets. A couple per motor coil that is.
__________________ Steve DO SOMETHING, EVEN IF IT'S WRONG! |
|
#10
| ||||
| ||||
| Steve, I agree. Seems to me that the IR2104 drivers would work for this small of a current load and they are $2.40 from Arrow and they include shoot through protection. I was going to give up on this little experiment, but judging by the PMs I have received; I plan to keep plunking along. I have two separate designs now: a unipolar and a bipolar. I talked myself out of a D/A converter and went with PWM. Actually it needs two separate PWM modules and there are only a few PICs with two. They are pretty much pin compatible so I am trying to accommodate a few choices. The PIC16F873 seems a fair choice, but it is $4.25 at Mouser. I also ordered some brand new PIC18F24J10 from Microchip Direct for $2 each (shipping was obnoxious as they had to come from Singapore, but they say the parts will be available soon for distributor purchase) but they are a 3.3volt device so extra regulation and level shifting needs to happen. The open collector TTL inverters do the level shifting when using CMOS parts (the IR2104 is already 3.3v compatible). Actually the charge pumps are there for the purpose of being able to drive the high side gate of an N-channel FET all the way to the top rail (or beyond). There is extra logic and a time delay inside the driver to control shoot through. I will try to get some boards built to try it out. Any thoughts or comments are more than welcome. Steve |
| Sponsored Links |
|
#11
| |||
| |||
| Shows how little I know about real world circuit design. Just associated the charge pumps with the shoot through protection. Had thought before that delays might work. Can't see why 2104's couldn't work, they work for gecko's.;-) Some of the big dogs here say you should use real driver chips instead of home brew and I'm sure that's true. My concern is providing idiot protection on the output. It costs extra on the geckos. Don't have a clue what's involved. This is one of the reasons I'm gonna try the lmd18245's for my first baby step. I think I have some samples coming. I wish I had access to the dac output because I want to add lead compensation to take care of mid-band resonance. I can always make my own 3-bit dac with an opamp. How are you going to use 2 designs, unipolar and bipolar? Are the step sequences the same?
__________________ Steve DO SOMETHING, EVEN IF IT'S WRONG! |
|
#12
| ||||
| ||||
| Well, I decided to make a flexible prototype PCB (4”x5”) that I will condense once I have tried some stuff because I just couldn’t make up my mind on what I was trying to design here – cheap or robust. I have it set up so I can do unipolar and bipolar type testing. I added AND gates and control outputs that will allow different styles (with some chip replacing and pin lifting). Four different styles of drive are possible for each type. All will use PWM for the microstepping and simple current chopping. Style 1: Run both coils with simple sinusoidal currents from 0 to max. Style 2: Run one coil with simple sinusoidal current and the other coil always turned on (sometimes called Hi-Torque). Style 3: Run both coils as you would a servo or DC motor. That is, each coil always gets max current that is oscillating back and forth to get the sum to be a sinusoidal result. (Does this make sense to anyone else?). Style 4: Use style 3 but keep one coil always turned on. (I am rooting for style 3 bipolar). I’ve received all the parts and sent out for PCBs to be made as I just can not find time to make them myself. I got a new stepper motor rated at 4.6 Amps for current testing, and it has 8 wires to test all the different modes (plus serial and parallel bipolar). I am starting with a 5volt PIC16F737, but have options to go to the 3.3volt PIC18F45J10 when I get more confident. I am using the free MPLAB toolkit from Microchip and writing in assembly. I plan to have on-board programming for the chip and I have most of the programmer written in Visual C, so I don’t have to buy a programmer thingy. I am including my schematic and silk, top, and bottom of the PCB. Now to find some more free time, Steve |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
| |