Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Another Counting question

  1. #1
    Junior Member
    Join Date
    May 2019
    Posts
    10

    Another Counting question

    Hi All

    I'm trying to build a counter which counts pulses from a energy meter, I would like to count as fast as possible.
    I have tried a 3.5 and 3.6 found not much difference between the two. I have looked at the example video that Paul did, but the
    difference being I'm trying to use an Optocoupler (6N139)

    I have tried using both counting interupt's and the Freqcount.h library and haven't had much success in getting it to go really fast.

    Just throwing it out there if anyone has done anything similar using an opto

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,073
    How fast is "really fast"?

    More than ~100 kHz is tough even with the best optocouplers.

  3. #3
    Junior Member
    Join Date
    May 2019
    Posts
    10
    5MHz+ I was thinking that was the bottleneck. I need them because if I have three teensy connected VIA serial sharing a common supply they effect each other if they aren't isolated.
    So i put an Opto on the pulse circuit.

    Maybe i should try and put opto's on the serial circuit instead come to think of it.

  4. #4
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    24,073
    5 MHz is much faster than you'll get a 6N139 to work. It's nowhere near that fast. You might get 1/10 of that speed, if you drive the LED at 12 mA and you use a 270 ohm pullup resistor on the output. But if you use a lower LED current or weaker pullup resistor, you can expect *much* slower speed.

  5. #5
    Junior Member
    Join Date
    May 2019
    Posts
    10
    I think i will try to find a way of leaving out the opto's and solving the interference issue between multiple teensys

Posting Permissions

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