Shop OBEX P1 Docs P2 Docs Learn Events
laser TTL — Parallax Forums

laser TTL

marcmcphersonmarcmcpherson Posts: 2
edited 2014-08-05 19:18 in Learn with BlocklyProp
my new laser Module has TTL input that needs a square wave with a frequency from 0 to 20000 hertz. Can this be done using freq out at the servo pins and if the answer is yes what would the freq out parameters be 0 to ? for the 20000 hertz.

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-06-20 02:16
    A link to the laser you're using would be helpful. It's generally a good idea to include a link to whatever hardware you have a question about.

    Are you using a Basic Stamp?
    my new laser Module has TTL input that needs a square wave with a frequency from 0 to 20000 hertz.

    I'm pretty sure the above just means the fastest you should turn it off and on is 20,000 times a second. You should be able to just set the pin high or low to turn the laser on or off. You don't have to keep sending it pulses.

    Does this TTL line power the laser? If so, it might not be safe to power the laser from an I/O pin. Depending one how much current the laser uses, you might need to use a transistor or relay to turn the laser on and off.
  • marcmcphersonmarcmcpherson Posts: 2
    edited 2014-06-20 12:01
    thanks for your reply. I am using a Basic Stamp 2. Unlike a LED that you can turn on and leave on with no harm to the Led, a laser will quickly destroy itself in 2 minutes if left on. The idea behind using a TTL line is to trigger the laser off and on fast enough to give the laser a 50% duty cycle. The laser is powered by a separate power source and the TTL line will be powered by the Stamp 2 PWM pins using the freq out command. The TTL line is operated by a square wave pulse train with a frequency between 0 and 20000 Hertz. I need to convert 10000 hertz (50% duty cycle) to microseconds for the freq out pulse on the basic stamp.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-06-20 13:00
    The Basic Stamp has pretty limited PWM abilities. I'm also pretty sure the Stamp won't let you "set and forget" a PWM or frequency setting. The program will be blocked while these commands are executed.

    The Stamp's PWM doesn't behave as one would initially suspect. The PWM is very high (I don't recall how high) and one has pretty limited options on what one can do with it. I'm not sure, but I think there was also something kind of strange about the way freq out command worked. Hopefully someone more knowledgeable about the Stamp will add detail.

    My guess is the Stamp isn't going to be very useful in sending a constant pulse train to the laser. You might need to add some sort of 555 circuit. I'm just spouting stuff I've read here on the forum. I don't have much experience with this sort of stuff with the Stamp.

    Do you have any experience with other microcontrollers? I think just about any other microcontroller would be able to send a constant pulse train to the laser.

    I'm a Propeller fan myself but I've recently started using some of the many inexpensive mini Arduino clones from ebay. These mini Arduino boards make useful slave processors to other microcontrollers.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2014-07-15 20:21
    FREQOUT is for "sine-waves", in conjunction with the filter ckt. shown in PBASIC Help.

    How about 500 Hz, 50%?
    (You can do that with HIGH/LOW and PAUSE in a LOOP)
  • Bruce SmithBruce Smith Posts: 5
    edited 2014-07-21 05:58
    I guess the below article will be a lot of help

    http://www.pololu.com/blog/17/servo-control-interface-in-detail
  • ercoerco Posts: 20,256
    edited 2014-08-05 19:18
    Bruce: That's a great servo tutorial, worthy of its own post instead of being buried here. I'm bookmarking it. Thanks for posting.
Sign In or Register to comment.