PIC help please

Discussion in 'Programmer's Corner' started by McCool89, Feb 28, 2011.

  1. McCool89

    Thread Starter New Member

    Oct 25, 2010
    8
    0
    Hi guys,

    im currently working on my final year thesis and was wondering if anyone could help with the programming of a simple PIC it would be great.

    i am working on a solar tracker that uses a zero carbon way of turning the system, i.e. Weights connected to a bicycle chain and sprocket connected to a turntable which is mounted on a Lazy Susan bearing.....pretty cool but simple idea?! the turntable will therefore be under constant rotating pressure

    i have a small servo motor, with a rotating arm on the end of it, it has a swing of about 270 degrees. Placed on the end of the rotating arm will be a small steel vertical bar. the vertical bar will move up and down and between screws each 14mm apart that are placed on the circumference of the rotating table, the vertical bar will effectivley hold the system in place.

    now on to the question....

    i need help with a program, that will move the servo's arm from a preset position to another preset position, now the arm needs to be in the upper position for about 11.5 minutes, at each intervil the arm will drop down and up again quickly, thus letting the rotating table move 4 degrees every time.


    any help would be really appreicated and thank you in advance guys.

    conal mcool

    <SNIP>
     
    Last edited by a moderator: Mar 1, 2011
  2. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Please draw a diagram.
     
  3. McCool89

    Thread Starter New Member

    Oct 25, 2010
    8
    0
    ok trying to upload now, just a rough design.
     
  4. McCool89

    Thread Starter New Member

    Oct 25, 2010
    8
    0
    hopefull the image is up?
     
  5. PRS

    Well-Known Member

    Aug 24, 2008
    989
    35
    I see no force causing the table to rotate, only an up and down arm motion. A better way, I think, is to use a stepper motor to rotate the table.
     
  6. McCool89

    Thread Starter New Member

    Oct 25, 2010
    8
    0
    in the picture i havnt shown the driving force.

    that part works fine, using two sprockets and a bicyle chain, with a weight hanging of the top sprocket cause the table to rotate.

    the PIC and servo motor are there to control when the table can move, ie every 11.5 mins.

    in the picture i have shown the side of the rotating table with screws placed in the side, 95 in total, the steel bar conneccted to the servo will move up and down between these screws.

    i hope this explains it a bit better, i think i mite be able to post a real picture of it

    thanks for your help

    conal
     
  7. McCool89

    Thread Starter New Member

    Oct 25, 2010
    8
    0
    hopefully these are uploaded
     
    • 006.jpg
      006.jpg
      File size:
      292.8 KB
      Views:
      28
    • 008.jpg
      008.jpg
      File size:
      297.2 KB
      Views:
      28
    • 009.jpg
      009.jpg
      File size:
      294.2 KB
      Views:
      24
  8. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Wow, some mechanism. Does that right-angle drive really work?

    But I wonder if you actually need the weight-driven system. Couldn't you make the servo drive the turntable, by means of an arm pushing forward against a diagonally-oriented surface, then pulling back against another such surface?

    Anyway, what you're really asking is impossible. "Please show me, on this discussion board, how to program a PIC processor." The only answer is "Go out and learn to program a PIC processor." Try a Google search. There are lots of people using these chips and writing about it.
     
  9. McCool89

    Thread Starter New Member

    Oct 25, 2010
    8
    0
    yeah the driving sprocket and chain work really well, i have rubber balls under the rotating table to slow the rotation of the table down, so the servo has enough time to move down and back up again between the screws.

    but on a different note

    i have been doing some research on the internet and i think a complete 360 degree rotating servo with 6 arms 60 degrees apart will work better.

    any ideas on how to write a PIC program for a rotating servo anyone?

    thanks for all your ideas so far guys

    Conal
     
  10. someonesdad

    Senior Member

    Jul 7, 2009
    1,585
    141
    Here's how to learn enough PIC stuff to be dangerous: buy the PICkit 2 Starter Kit for around $50. It comes with a small PC board with a PIC 16F690 processor; there are also 4 LEDs, a pot, and a switch on the board plus a small amount of prototyping space. The PICkit 2 is a PIC programmer that connects to the board and to your PC with a USB cable. Then go through the 12 lessons that come with it. You'll then know enough PIC assembly language to start doing some programming. You won't be an expert, of course, but you'll be confident enough to really start teaching yourself. This is, in my opinion, the fastest and cheapest way to start using PIC microcontrollers. The PICkit 2 is an excellent design and comes with some quite useful software tools, such as a 3 bit logic analyzer, port toggler and reader, and a serial terminal. I also have a PICkit 3, but I've experienced problems with it and for now am relying on the PICkit 2 (see the EEVblog rant about the PICkit 3).

    If you can cough up $125, I think a better tool is the PICDEM Lab. Besides a PICkit 2, this includes 6 different PIC processors, a prototyping board, an adjustable on-board power supply that runs from a wall wart or 9 V battery (neither included) using an LM317, sockets and headers for easy connection, and a selection of parts, including a 5 V motor. You can go through the included lessons and learn about lighting LEDs, delays, timing, interrupts, etc. The nice thing is that the PC board and prototyping area will be useful for future projects. It's about all you need to explore the low and mid-range PIC processors (you'll have to buy extra hardware if you want to do some in-circuit debugging of some of these low end chips though).
     
  11. McCool89

    Thread Starter New Member

    Oct 25, 2010
    8
    0
    just a quick update guys,

    i have now bought a new servo which will rotate through 360 degrees, it has 6 legs on it so they are 60 degrees apart, it was by luck that they will fit directly between the screws, this will give me an easier PIC program no?!

    any help on this guys would be great

    thanks so far for your help.

    many thanks in advance

    conal
     
Loading...