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

Pic Based Servo Controller and Free Control Software!

Discussion in 'Robotics & Mechatronics' started by hvlabsdotcom, Oct 7, 2008.

  1. Telemachus

    Telemachus New Member

    Joined:
    Dec 15, 2009
    Messages:
    24
    Likes:
    0
    You have 3 and 7 switched. Pin 3 on the D-sub9 port goes to pin 8 on the max232, and pin 7 goes to 13.

    If needed, print this out and highlight where the different traces go.

    http://www.hvlabs.com/Images/serialservo.jpg
     
  2. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Thanks thats the way I had it initially. It's still not working. Is there anyway I can test to see what's going on?

    I have a logic pulser - Are there any inputs on the PIC that I can pulse to get an output?
     
    Last edited: Apr 26, 2010
  3. Telemachus

    Telemachus New Member

    Joined:
    Dec 15, 2009
    Messages:
    24
    Likes:
    0
    I have some pic code that will move a servo if you want to test that part. That at least will help you determine if the PIC is programming correctly, and the servos are getting power. Are you able to take the pic out to reprogram it? Also, make sure your power supply is at least 2 amps and about 9 volts or more.

    Was the circuit working on the breadboard?
     
  4. dave

    Dave New Member

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


     
  5. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK

    Hi and thank you. The code would be very useful. Its a 16f628A. I can sort out the necessary includes etc if you have written it for anyting else. I never built the SCC on bread board I went straigh to PCB. I used the LM1084 version of the board. I also put header pins in place of the D-Type. I drill everything through veroboard to ensure correct pin alignment but of course you cant do a d-type like that. That's why i was convinced it was something to do with the RS232 comms. Anyway the pic code would be a start to fault finding. Removing the PIC is no problem and I use the velleman programmer.

    Many thanks.

    Paul.
     
    Last edited: Apr 26, 2010
  6. Telemachus

    Telemachus New Member

    Joined:
    Dec 15, 2009
    Messages:
    24
    Likes:
    0
    This is a link to code from another project I did recently with the 16f628a. This runs a single servo off of pin 10, which will be servo 5 position on Olly's board.

    It is meant to decode an RC signal and move the servo accordingly. Without an RC signal, it will do nothing more than center the servo when powered up, but at least you will know that the power and servo control are working.

    DIY project: Navlights Landing Gear 1.0-- Landing/Navigation Lights & servo retracts - RC Groups
     
    Last edited: Apr 26, 2010
  7. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Thanks. That seemed to work ok. - I just don't know what the problem is. Im sure it must be something to do with comms. Im going to check the PCB today and make sure everything is ok.

    Thanks for your help so far.
     
  8. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Well I can find nothing wrong at all. I have no idea what's causing this. Would anyone like to take a look at the board if I mailed it to them?
     
  9. Telemachus

    Telemachus New Member

    Joined:
    Dec 15, 2009
    Messages:
    24
    Likes:
    0
    post it here and I will try to help. It is hard to troubleshoot a board over the net. If the power to the servos and pic is working, and you have tested all of your leads with a multi-meter, and are sure that the max232 is connected correctly to the PIC, then my guess is you need to look at your connector to the computer. Make sure you are reading the pins correctly, and haven't reversed it. Do you have any other serial devices that you can try on that port?
     
  10. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    I have managed to get in touch with Oliver and he's hopefully going to show me where i've gone wrong. I hope its nothing too stupid. In the meantime i have setup a blog here.

    Insectabot's Blog | An amateur robotics blog

    I hope its ok to put links here.

    Regards - Paul
     
  11. Telemachus

    Telemachus New Member

    Joined:
    Dec 15, 2009
    Messages:
    24
    Likes:
    0
    I assume you changed the RS232 connections from the ones you posted here?

    DSCF1372 | Insectabot's Blog

    If not, that is the problem. It is reversed.
     
  12. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Hi. The pic doesn't show it very well but thats just two rows of pcb headers on the board. I didn't have a pcb mount connector so I just used header pins. The pins are traced and just wired to the correct pins on the max232 (I Think).
     
  13. Telemachus

    Telemachus New Member

    Joined:
    Dec 15, 2009
    Messages:
    24
    Likes:
    0
    I just don't see how you could salvage that one. You don't even have traces drawn to some of the required elements, but I guess you worked around it somehow.

    If I were you, I would re-etch the board with the version that I posted. I have made 4 off of it, and I know it works. It also isolates the power to the Pic from the Servos, which is ideal to prevent brownouts.

    http://www.electro-tech-online.com/attachments/sscboard600dpiupdated-jpg.37487/
     
  14. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    Yes I think i'll make another attempt at it this week with your updated pcb layout. Out of interest what tracks are missing?
     
  15. Telemachus

    Telemachus New Member

    Joined:
    Dec 15, 2009
    Messages:
    24
    Likes:
    0
    Two of them don't have any copper around them at all. Did you end up soldering a wire directly to the chip?

    Can you post a pic of your completed board, top and bottom?

    Also, I would buy a few PCB mount D-sub 9 pin connector. Digikey has them cheap.
     
  16. Wing

    Wing New Member

    Joined:
    Jun 4, 2010
    Messages:
    2
    Likes:
    0
    Ssc

    Help!
    I had run the SSC several times but it show few problems:
    -The servo only move within number 0 - 128 (in ssc)(more than 128 will be appear error: the servo twitch and move violently to one side)
    -the servo only move 1 side (in my case left, how to get it to right? it should be 90 degree to left and 90 to right?)
    (Is that SSC only support up to 90 travel degree?)

    Any idea why this happen?
     
  17. SwingeyP

    SwingeyP Member

    Joined:
    Apr 26, 2010
    Messages:
    292
    Likes:
    2
    Location:
    Birmingham UK
    I finally got my SCC up and running with help from Olly. I too noticed that the SCC didn't allow full travel of the servo but as this was an exercise in servo control for me I decided to build my own board with just a pic and a few servo contectors on it. I use the board I built as a servo controller for my robot project. Olly's board acted as a great training aid for me in understanding pulses to the servo which is exactly what I needed it for. Sorry I can't help further with your problem but you can try emailing olly direct at HVLABS.
     
    • Like Like x 1
  18. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    I think the standard servo range is 90 degrees, that's 45 to the left and 45 to the right of center, most servos will actually give a larger range than this but it's it's highly dependent on the exact servo. I don't know how your software works but it looks like you have your offset set up incorrectly. The value 0 should correspond to a pulse width output of 1ms and 255 should correspond to 2ms pulse width output. It sounds like yours is setup at 1.5 at 0 (which makes it not able to move in the one direction) and once the pulse gets too much past 2ms in width the servo starts glitching, so basically you're sending it an out of bounds pulse width. 127 should be center
     
    Last edited: Jun 12, 2010
    • Like Like x 1
  19. Wing

    Wing New Member

    Joined:
    Jun 4, 2010
    Messages:
    2
    Likes:
    0
    Serial Servo Controller

    Sceadwian, i think what u said maybe closest to my problem so i will try to change the offset value but i donno how....

    Below is the ASM files i'm using and refered to, can you check the content and suggest me how to solve the error? i'm confused with the pwm signal calculation and the offset value setting. (anyone who know ASM please help...!)

    P.S.
    Right now my servo turn 45 degree to left(not center) at sync byte decimal 128, and turn to complete left at sync byte decimal 0. My servo will not move to center or right even at sync byte higher than 128(my servo can travel at 180 degree, 90 to left and 90 to right).

    So i have some possible solution in mind :
    1. Change the rotation resolution of my servo, maybe 180degree/128steps (since now i can only use sync byte between 0-128, not sure what happen to 128 above)
    2. Change the offset value so i can put my center point at 64 sync byte, thus 0-64=left, 64-128=right, but i have to set 64 sync byte at my center...

    anyone know how to check PWM signal using multimeter? i'm not sure if my pic generate correct PWM signal...
     

    Attached Files:

  20. Sceadwian

    Sceadwian Banned

    Joined:
    Oct 27, 2006
    Messages:
    14,047
    Likes:
    141
    Location:
    Rochester, US
    Nope, I'm afraid I can't check your code, I don't program PICs.
    Based on my experience programming AVR's though there's no reason you should settle for 128 steps, you should be able to get a minimum of 256 for the full servo range if not more easily. Instead of posting the ASM as a link try including it in code tags so that other users can view the code without having to download the file.
    To use code tags you type the word code inside square brackets, past your text and then type the word /code inside square brackets, it's kind of like HTML markup. You have to use the code tags when posting something like that as the regular forum text doesn't preserve white spaces (tabs) and won't process any other possible markup references.
     
  21. juliodsj

    juliodsj New Member

    Joined:
    Oct 19, 2010
    Messages:
    3
    Likes:
    0
    Help

    SwingeyP,I wonder how did you do to solve your problem because I am
    with the same problem. thanks
     

Share This Page