Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help with an arduino project

  1. Jan 4, 2017 #1
    Hello, I am doing an arduino project and I need a bit of help with a code. What I am doing is I am setting an Infrared led to pulsate at different frequencies and I use IR phototransistor to capture that light. Then the phototransistor sends the data back to the arduino and here I need to add some code to read the frequency and depending on it to set different pins HIGH. Any suggestions? I am using the arduino language by the way.
  2. jcsd
  3. Jan 4, 2017 #2


    Staff: Mentor

    Last edited: Jan 4, 2017
  4. Jan 5, 2017 #3
  5. Jan 12, 2017 #4
    You can simply count the frequency. For that, you must get a square wave signal from the transistor (either by an amplifier or comparator). Then you can count the pulse length of a single square pulse or count the number of pulses in a some time frame by using interrupts and timers, much like a frequency counter.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted