PBP projects for R/C models


Closed Thread
Results 1 to 40 of 772

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Smile It Did It!

    This video is the same as the previous except it has an additional segment. The car goes down the hall, turns around and comes all the way back to me!!

    http://video.yahoo.com/watch/7169550/18673820

    Ioannis, I agree a potentiometer driven by a servo controlling direct current into the wheel motor would give the PIC smooth speed control.
    For this home project with only my personal resources that is a complication I hope to avoid.

    I would like some help directing me to a way to make interrupt driven PWM pulses delivered 50 times per second. My impression is with PBP GOSUB does not include arguments. This is very restricting. Am I correct?

    Ken

  2. #2
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default Should I go to PICkit 3

    I saw an article in SERVO which speaks about the VEX robotics computer package. The PIC is a 18F8520. My impression of the Microchip PICkit3 is that it is very close - it has a 18F8722 and a 18F87J11. The cost of a complete PICkit3 is only $164.00. Would using this tool make my project easier? more robust? more powerful? more flexible?

    Ken

  3. #3
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    More code space is about all that you will get from those chip, might be some things that the 887 does not have but probably nothing to help you.

    If you want to try one of those chips, check to see if the PicKit2 and PBP supports them, get on and put is on a solderless breadboard.

    Save yourself $160.00
    Dave
    Always wear safety glasses while programming.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    I may have not unerstood what exactly is your problem. Please can you repeat for me?

    Ioannis

  5. #5
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Smile How about a line follower?

    Been thinking that a good middle school STEM hook would be simple racing on an oval indoor (gymnasium basketball court) track delineated by large cardboard boxes (big enough to be detected by the SRF05 sonar proximity detectors) on the inside. I imagine a ten lap race. For six laps the kids control the cars with their radio transmitters. For four laps the cars are autonomous.

    I think I can design a PBP template that would make coding the PIC reasonably simple. The template would contain the code state machine. The students' job would be to choose the steering/wheels commands associated with each state.

    I have a question for you all.

    If I were to add a black tape line around the track, what electronic gimmick might I put on an RC car to make it into a line follower? Is there a commercially available light source and photo cell combo similar to the pre-canned SRF05 sonar device?

    Ken

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default

    The IR combo device is the least that I would be worry about.

    Check the videos on YouTube and you will realize why I still insist on PID control.

    Especially important on a line follower car! From the videos you will see that most ofthe cars are getting out of the path because they get very nervous. Or you have to make it really slow.

    Ioannis

  7. #7
    Join Date
    Nov 2009
    Location
    Fitchburg, Mass
    Posts
    483


    Did you find this post helpful? Yes | No

    Default ioannis is correct...

    I too have noticed the "nervousness" of my car and other line following devices. I made a line follower out of LEGOrobotics last summer. It too was too nervous to make fast progress.

    For my project to progress from its present state I need to:

    1. Get my hands on an appropriate RC vehicle. The "stadium truck" style has been suggested. It has two wheel drive, excellent miniature steering and suspension, and a broad flat frame structure to which it would be easy to attach my PIC and things. Thing is they are expensive. If I get a "ready to run" it's about $200. It will have a two channel RC. I need three channels - anther $100 or so.

    2. Corral the help of some friends with access to the correct facilities to help me design and build a robust kit that can be attached to most any RC 1/10 scale vehicle.

    3. Prototype a "simple" state machine structure for my PBP code. Non-computer nurd middle schoolers will throw up their hands in dismay if they had to code PBP from scratch for this 'race'. I have neither the resources nor the contacts to create a LOGO or ROBOlab like language.

    4. ioannis suggests potentiometer based motor control to calm down the bot's oscillations. My inclination is to try to get my HPWM signal down to the RC spec of fifty pulses per second. With my present code one gradation plus or minus on my PWM pulse width is the difference between stopped and going pretty fast. I saw this plan (below) for Interrupt driven PWM, but I have not yet studied it.

    -------------here's what I found------------


    1) Decide on the resolution (the number of steps between off and 100% on. Go with 16. That's plenty.

    2) Decide on a PWM frequency. Go with 30Hz. It sounds odd, but the reason becomes apparent next.

    3) Set a 1:8 prescaler on an 8-bit timer.

    4) Create a label "Count" and set it to the resolution (16).

    5) Create a label "Demand"

    6) In the interrupt service routine for the timer interrupt:

    6.1) Decrement Count

    6.2) When Count becomes zero, set it back to the resolution value again (16).

    6.3) If Demand > Count, set the PWM output bit. Otherwise, clear it.

    There you have a single PWM output. Put a value from 0 to 16 into "Demand" and the PWM output will perform accordingly. If you want two outputs, you create two Demands and perform two comparisons. (You only need one Count.)

    What happens is that (assuming a 4MHz clock), this will interrupt every 256*8=2048us. Each time, the counter decrements by one. This happens 16 times meaning that each of your unique mark to space ratios is 2048us apart and that your PWM time is 2048 * 16 = 32768us, or 30.51Hz.

    If your demanded PWM value is less that the PWM counter, then your PWM should be marking, otherwise, you should be spacing.

    Of course 30Hz might be a bit lumpy. Swap your 4MHz crystal for a 20MHz one and suddenly you're at 150Hz. Irritatingly audiable. Your options are to reduce your resolution (half the resolution = double the frequency) or reduce your total pulse time (half the pulse time = double the frequency).

    The disadvantage of reducing the resolution is obvious. The disadvantage or reducing the pulse time is that it leaves you fewer free processor cycles for your "main" program. In the example above, your interrupt is only called every 2048 cycles. Assuming it costs 200 cycles (that's generous) to process the interrupt, that leaves your main program 1948 cycles between interrupts.

    You could come down to a 2:1 prescaler with a PWM resolution of 8 and a clock of 20MHz. that gives you a PWM frequency of 20/4/(2*256*8)*1000000 = 1.22kHz. BUT there are only 512 operations between interrupts then and 200(ish) of hem are taken up servicing the interrupt itself.

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. PBP Extensions, What are they?
    By PJALM in forum PBP Extensions
    Replies: 9
    Last Post: - 28th September 2021, 11:26
  3. Compiler differences between PBP 2.33 & 2.46
    By nikopolis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2006, 19:01
  4. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th December 2005, 23:30
  5. Making PBP code more modular
    By forgie in forum General
    Replies: 30
    Last Post: - 25th October 2005, 16:24

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts