What 8 pin pic do I use for this?

Discussion in 'General Electronics Chat' started by stanman11, Sep 13, 2011.

  1. stanman11

    Thread Starter Member

    Nov 23, 2010
    230
    4
    Im trying to come up with a design to run a servo with an 8 pin pic microchip
    nothing over $4
    how it will work is I press a button and it moves the servo one way then when i release the button the servo returns
    press it again the servo spins the opposite way. release and it returns

    Press:spin left
    Release center
    Press: spin right
    Release center.

    But I dont know which chip to use.
    FLash chip?
    find one off ebay for me please?
     
  2. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    Basically any 6 pin or 8 bit PIC will do what you wanted, but you must have the hardware programmer setup to program it. Suitable chips like 12F629, 12F675, 12F683....

    The actual requirement is in the software inside the PIC, which you have to come up with yourself.

    Basic hobby servo requires a continuous pulse signal every 20ms to work, even when it is in the neutral position. For the servo to stay in the neutral position, the pulse width is 1.5ms. If the pulse width is shorter, the servo moves to the left, and if longer than 1.5ms, it moves to the right. The normal pulse width range is 1ms~2ms, corresponding to the extreme of travel in either direction, with 1.5ms being the "center" or "neutral" position.

    Therefore your PIC must provide this continuous pulse signal without interruption every 20ms, in addition to sensing the user key input and acts accordingly.

    The easiest way to provide the pulse signal is to use PWM, whether 8-bit PWM or higher would depends on your requirement. Some PICs do have PWM inbuilt to their timers, so it is easy to setup. Then the main program loop will be checking the key input and adjusting the PWM parameters.

    Or, the PIC can generate the required servo pulse via an infinite loop without even using timers or PWM. The sensing of the user key press can then be done in between the 1.5ms servo pulse and there is plenty of time (18ms) to check user key input and acts accordingly.

    Takes your pick with PIC that fits.
     
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,606
    I've used a PIC12F615 or PIC12HV615 in several projects now. 8 pins, PWM, A2D, other goodies for about a buck single quantities.

    I keep using it as the HV type features an internal current shunt regulator that can save a part or two in very tiny applications (which as my specialty).
     
  4. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    The PIC10F200 can do it easily enough and it's one of the easiest PICs to learn to program.
    You get 4 on this auction, but 1 is about half the price on ebay.
    From an electronics supplier they would be about 50 cents each.
    If you wanted to add extra functionality later then I agree that the PIC12F615 or 12F675 would be a better choice.
    http://www.ebay.com/itm/4x-Microchi...328?pt=LH_DefaultDomain_2&hash=item336679dc18
     
  5. stanman11

    Thread Starter Member

    Nov 23, 2010
    230
    4
    I placed the programmer on orderlast night same time as i posted this question.
    its just a cheapo with usb for 17 bucks but I really only need to have it for the project and maybe some future projects.

    The link the last answer gave me to ebay seems like it will work and is a damn good price. I dont know how you found them pecause i entered 8pin pic in to the search and only got a few shopping from lowest price first.
    I'm going to place those on order here in about 15 minutes unless some one has another say in the matter.

    I have to finish this before holloween so i hope i can. I might need some of you guys's help.

    I set up a pulse switch with a 555 timer. If I use an up down counter switch with the timer ic, would it be possable to acheive the fuctions that I need or would i need to go in to extensive programming?
     
  6. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Have you got a link to the programmer you bought?
    Some of them don't program the whole range of PICs.
    Hopefully you didn't get this one because it doesn't program any PICs:
    <ed>I should add that if you got this one all is not lost, because it programs some ATMEL microcontrollers which will do the same job </ed>
    http://www.ebay.com/itm/USB-PIC-Programmer-ATMEL-MICROCHIP-SST-SCM-SP200S-/370529600222?_trksid=p4340.m1374&_trkparms=algo%3DPI.WATCH%26its%3DC%252BS%26itu%3DUCC%26otn%3D15%26ps%3D63%26clkid%3D2779943901988251688

    It might be possible to do what you want with a 555 chip and a few other components, we have some 555 experts on here.
     
    Last edited: Sep 14, 2011
  7. stanman11

    Thread Starter Member

    Nov 23, 2010
    230
    4
  8. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    That looks like it should do the job.
    You can download MPLAB from the Microchip site and start seeing how it works. I'd recommend MPLAB 8.something because MPLAB X isn't finished yet.
    Here's a link to something similar with source code.
    http://www.ndholmes.com/pmwiki.php/Electronics/ServoMotor
     
  9. stanman11

    Thread Starter Member

    Nov 23, 2010
    230
    4
    ok, thnks mark
     
  10. stanman11

    Thread Starter Member

    Nov 23, 2010
    230
    4
    I wish thie stuff would get here sooner. Taskes 2-4 weeks.last time i ordered from china it took 22 days which would leave me about 10 days to finish setting up te mechanicle fuetures and programming the servo.
     
  11. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    MPLAB has a pretty good simulator built in, so it should be possible to write the program now and be fairly confident that it will work on a real chip.
    Is it for a halloween project?
     
  12. stanman11

    Thread Starter Member

    Nov 23, 2010
    230
    4
    got the chips in today and the programmer i got last week.
    the chips are the size of an adult flee. tiny chips.
    I've never worked with something this small

    I think this project is a fail though. My 3 cylinder piston isnt working properly
    might have to scrap it
     
  13. stanman11

    Thread Starter Member

    Nov 23, 2010
    230
    4
    this chips can be used on my programmer but how the hell do i put these things on there?
    there so tiny they dont fit on the DIN
     
  14. stanman11

    Thread Starter Member

    Nov 23, 2010
    230
    4
    I'm guessing here but.
    Run wires from the Din to a bread board to the correct corrisponding pins on the chip?
     
  15. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,606
    Yeah, that should work, except I can't tell what chip or what programmer you have.

    Not that *I* have ever ordered the wrong parts. Twice. In lots of 50 each time.

    Not me. Nope.
     
  16. nigelwright7557

    Senior Member

    May 10, 2008
    487
    71
    I would opt for a microchip programmer, if they cant get it right then no one can !
    I use a second hand picstart and it has been trouble free. You can alos update the firmware in it as new pics come out.
     
  17. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Surface mount parts normally end in /IOT, through hole parts end in /IP or /EP
    If you ordered the surface mount version instead of the through hole version it should be possible to solder wires to the pins if you have a steady hand. The normal way is to make a board like this:
    [​IMG]
     
Loading...