Counting IR sensor receiving pulses with Pulse Count Module

Hi, need help.

I am trying to count pulses from IR sensor using pulse module, but have no idea how. Which pins to use and how.

More advanced folks need advise.

Thanks

Are you thinking of decoding the IR sensor output?

The pulse module is not ideal for this as it does not give you any timing between pulses. It simply counts them.

You would be better off connecting to a GPIO pin that has interrupt capability and then you can use a timer to count the pulses and then work out the code received.

Look in the codeshare area for some sample code to do decoding.

I actually need to count them, it’s from my son project looking for solution not including too much coding, of course I could use GPIO.

But he needs to measure distance his robot moved, trying to calculate number of spins wheel did

Ah ok. It’s the IR output from a wheel encoder.

In that case you would connect to the A input if you only have 1 sensor.

If you are not sure about how to wire this, post some details of the robots sensor and we will be glad to help.

I have those one’s http://www.ebay.com/itm/5mm-LED-infrared-emitter-and-IR-receiver-diode-940nm-20pairs-40pcs-/390700376228?_trksid=p2054897.l4276

OK. So you’re going to need a circuit to use these. Do you currently have anything?

You’ll need a resistor on the emitter. As you are short range, this will be fine and not need for the normal transistor driver to get range.

As for the receiver, you’ll need a little more work with a transistor and resistors etc. I don’t have anything handy but you should be able to locate something on Google.

Shout if you get stuck.

I found this schematics http://mosaic.cnfolio.com/uploads/B202Coursework2012DesignReport3/groupproject.png

Should I example of Pin 11 connect to A to count?

Thanks a lot

That should work. You might need to adjust some resistor values but those would be a good start.

Pin 11 goes to A.

Thanks

2 more extra questions

  1. what’s signal voltage should be on A to count the pulse
  2. what’s the width of the signal precondition?

According to the datasheet the input is active HIGH.

There is no reference to 5V tolerance in the device datasheet and the GHI webpage has this as being empty. The device can be 5V or 3V3 powered and in the GHI design, it 3V3.

I would suggest you wire the 5V in the circuit you posted to 3.3V instead and then you are safe in knowing the input will not go above this.

Thanks,

Didn’t work for me yet, looking for solution myself if not will ask for help again :smiley:

Yes need schema with transistor, it gives me just different on ~.2 v, need to play with key