Shop OBEX P1 Docs P2 Docs Learn Events
Newbie needs help.... — Parallax Forums

Newbie needs help....

BennettMANBennettMAN Posts: 2
edited 2009-11-11 13:10 in General Discussion
Hello all,

First time here, and already need help! Lol... I purchased a BS2 kit from radio shack, and have been successful at learning the basics in the book. ie, led's, photoresistors, servo's etc, and have even made a few simple programs such as a solar tracker, etc.

A recent project in the garage has me wanting to make a program in BS2 for a optical tachometer, using an LED and photoresistor, and reading it in rpm's. I can get to the point of reading light levels, but I can't figure out how to translate a change in levels to serve as a pulse, and then count the pulses, multiply that by 60, etc, to get rpm's.

My ultimate goal is to get a tach working fairly accurately(10-25rpm's tolerance) for my flywheel(will rotate between 200-5000rpm's). Then I would like to be able to use the data from the tach to control the motor itself via a solid state relay controlled by say, pin 5 high etc. Ie: if the tach reads <500 rpm's, then turn on the motor, if tach reads >550, turn off the motor.

Sort of sounds like a tach-based/optical-driven pwm. Lol.....

I think i can figure out the motor control based on tach rpm, but I can't seem to figure out how to set a led and photoresistor as a tach.

Any help would be greatly appreciated!

Comments

  • James LongJames Long Posts: 1,181
    edited 2009-11-11 07:44
    (no name supplied),

    I shouldn't be too hard. I would think just using the pulsin command would do. This does depend on how sensitive the photoresistor is. If reading a prop on a RC engine, the prop is moving pretty fast, and it could be hard to read.

    I think that should get you started.

    Just remember, the pulsin command requires a pretty fast rpm to not time out.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer
    Lil Brother SMT Assembly Services

    Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!
  • BennettMANBennettMAN Posts: 2
    edited 2009-11-11 07:58
    James- thanks for the input.

    I'm not using a rc motor actually... I'm using a 24v dc motor, to turn a flywheel(about 8" dia). I need to tach the flywheel. I would use a magnet and hall effect, but I have magnets around the outside of the flywheel itself, so that won't work.

    I know this is cheating, but could you show a example of what that code might look like? I'm just not sure how to set up PULSIN with differences in light levels. Ie: suppose static light level (rotor with reflective strip not turning) is 500. (begin rotation) If light level drops to, say, < 250, that equals a pulse.

    How do I use pulsin to read that as a pulse, and then in turn read it as a series of pulses that I can then read as rpms? I guess my confusion is I though pulsin wouldn't work with this, since technically there's going to be light "constantly" on the photoresistor? Also, would pulsin work with pulses in the range I'm trying for(200rpms-5000rpms)?

    Thanks again!
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-11-11 13:10
    Clue: COUNT (not PULSIN)

    Post Edit -- rpms could be derived from the beam's duty (time on or off), too, but it seems easiest to COUNT.

    Post Edited (PJ Allen) : 11/11/2009 1:37:40 PM GMT
Sign In or Register to comment.