1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Stepper motor control with PIC16F84A

Discussion in 'Microcontrollers' started by netbug, May 6, 2004.

  1. netbug

    netbug New Member

    Joined:
    May 6, 2004
    Messages:
    51
    Likes:
    0
    Location:
    Lisbon - Portugal
    The input voltage is 12V and I added the capacitors to 7805. Maybe I will use the 8 output ports to drive the motor (2 per wire) and put the resistors that Mike sugested.

    Pedro
     
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    I take it the capacitors are as close as possible to the 7805?, it is REALLY important, if the 7805 oscillates (which may occur only under certain conditions!) you will have loads of problems (including the 7805 getting much too hot).

    The resistor technique is standard practice, and I agree that they should be in the top end of the stepper, I've never heard of them being fitted in the emitters of the transistors?, but it will certainly reduce the performance of the circuit.

    If you do a google search for 'stepper motor tutorial' there are plenty of good sites out there, most of which explain why adding the resistors is a GOOD idea, increasing speed and power. As you already have a 12V supply, it seems the obvious thing to do, and you're massively reducing the load on the 7805 as well! - you could probably get away with a 78L05 in it's place?.
     
  3. motion

    motion New Member

    Joined:
    Jul 14, 2003
    Messages:
    560
    Likes:
    0
    Location:
    Quezon City.PH
    I agree with Nigel. Instead of adding 7805 in parallel, you should draw power directly from the 12V for the steppers, dropping the voltage down using resistors. You are, in effect, transferring the power dissipation from the 7805 voltage regulators to the resistors. Therefore, you should use high power rated resistors. In return, this improves the current rise and fall times in the coil windings and translates to a higher speed limit.

    A more advanced stepper driver uses PWM current control. Since this is a microcontroller forum, I'd like to mention that you can actually use a fast 20Mhz PIC16F873 PWM module to control the current in the windings getting feedback from the the current sensed in the resistors and converted to digital form by the ADC. Not only will the PIC generate the step sequences but also control the current at the same time.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. netbug

    netbug New Member

    Joined:
    May 6, 2004
    Messages:
    51
    Likes:
    0
    Location:
    Lisbon - Portugal

    Hi,

    I have now the correct data for the stepper. I am sorry but I wos wrong, the stepper has the following caracteristics: 12 V / 400 mA / 30 ohm / 1.8 deg and the reference is SST0017 from AstroSyn.

    So once the stepper should be powered with 12V, I think the 3.5 V are very few to the motor have some torque. I am really stupid !!! Anyway I have to deal with the overheating problem the way some people said here, drawing power before the 7805, and applying resistor between commom (white/black wires) and 12V.

    Do you think there is a need to connect the common leads to a voltage higher than 12 Volts ?


    Pedro
     
  6. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    No current limiting resistors needed if you are using 12V. And judging from the current requirement, two ULN2803 output pins driving one coil would be OK currentwise.

    However, a higher driving voltage, like 24V and together with 27 to 33ohms current limiting resistors would give better performance which you may or may not need. You have to consider the additional losts in the resistors too.

    Note that pin10 of ULN2803 should be connected to the coils common(i.e. after the current limiting resistor) instead of 24V.
     
  7. netbug

    netbug New Member

    Joined:
    May 6, 2004
    Messages:
    51
    Likes:
    0
    Location:
    Lisbon - Portugal
    Hi all,

    Thank you for your contribution to this project. It had stopped for a while, so I could finish my MsC :). Anyway I need some more help to end this project.

    At this moment I am using Eagle to do the PCB. I am getting some problems with autoroute, and the final work doesn't look good. So please try to help me with some issues:

    - When using top and bottom layers, how to connect the holes in both layers (because I always have to solder the same pin on both layers)?
    - How it is possible to draw power in one layer, and signal in another ?
    - Is there anyone that can take a look to my final job and do comments about it ?

    Best regards,

    Pedro
     
  8. janethnx

    janethnx New Member

    Joined:
    Aug 27, 2008
    Messages:
    52
    Likes:
    0
    delay program

    -Have you any idea on how to program a five minute delay in pIC16F84A?

     
  9. netbug

    netbug New Member

    Joined:
    May 6, 2004
    Messages:
    51
    Likes:
    0
    Location:
    Lisbon - Portugal
    Hi,

    First of all which language are you going to use ? If you are planning to use ou already using assembly, please take a look at Nigel's webpage.

    http://www.winpicprog.co.uk/pic_tutorial.htm

    Relative to the 5 second delay, would do a function (using interrupts, for eg.) that would cause a well known delay , for example a 1sec. delay, and then I would call that function 5 times. This would give you roughly 5sec. delay. This is not very accurate, but is fairly simple to implement.

    Anyway nowadays I am not using PIC16F84A anymore, you should consider buying other microcontrollers that are more powerful and cheapper than that one (eg. 16F628). Please, just take a look at the Microchip website.

    Best regards,

    Pedro Cardoso
     
  10. janethnx

    janethnx New Member

    Joined:
    Aug 27, 2008
    Messages:
    52
    Likes:
    0
    PIC16F84A 5 minutes delay program

    -I am to use only PIC16F84A in doing this project. My project include doing a delay for five minutes in assembly language. I am also using a motor but its not a stepper one. Its a motor coming from a washing machine, an ac one... I couldn't thinkmof anything to do with this motor so I end up thinking of using delay as to conserve energy..and that is for five minutes which is short enough for defense of the project purposes. By the way my project is a grain dryer.
    -I did try to use many call delays but I end up having no enough space to support the delays..

    -Thanks.







     
  11. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,331
    Likes:
    653
    Location:
    Derbyshire, UK
    You need to employ a slight bit of programming technique - you don't use an endless run of delays, you use one delay and call it multiple times in a loop.

    You might check my tutorials, many of which use this technique, and a basic delay generated by the PICList delay code generator.
     
  12. janethnx

    janethnx New Member

    Joined:
    Aug 27, 2008
    Messages:
    52
    Likes:
    0
    number of delays

    -there are a lot of technique to solve a problem.. Some say that the time delay could be achieve by calling delays several times.. there is also this technique which the codes could be generated the calculator-the one you've mentioned.

    -Someone has given me the delay code through the piclist, the problem is I don't understand the way it is done.. There is this talk about CYCLES. To obtain five minutes delay time, how many cycles do I need?

    -Why is it that even though the codes are running when I load it and put in a circuit it will only light the LED until there is a supply? Was our circuit wrong?

    ---thanks.

     
  13. janethnx

    janethnx New Member

    Joined:
    Aug 27, 2008
    Messages:
    52
    Likes:
    0
    how long the motor works

    -Have you achieve the the running time to display how long your motor is operating?

    -I have also this similar problem,, could you help me?


     

Share This Page