I have bought some motion sensors (called NaPiOn) but need some help in choosing the correct components when designing an output circuit.
The sensor is the 5V digital-output version:
The manufacture have some examples on how to use the sensor. I'm just a little bit confused on how to calculate the correct resistance and how to determine which transistor to use (or which FET to use in example 2).
Look at the links for examples:
I'm also interested in using a optocoupler - Does anyone know if its okay just to have this directly on the sensor output? Or does this damage the sensor?
Hi, Zenty. These data sheets are a little obscure. I think the people who wrote them must have graduated from the Omron school of data sheet writing.
Nonetheless, they are decipherable. If you look on the page labelled 5 (second page of the .pdf), you'll see that the digital output can source up to 100uA. That's pretty weak, so it's recommended you use an NPN transistor and two resistors to create an open collector-type output. They leave the selection of the transistors and resistors up to you, of course, so you have to do a little work.
If the output can only source 100uA max, you have to size the resistor so that maximum will not be exceeded. Using Ohms Law,
(5V - 0.7V) / 100uA = 43K (use 47K as next standard value up)
Both resistors are typically the same value.
If you're going the transistor route, you should use a small signal NPN transistor with an acceptable current gain. Try the 2N3904. It has a typical current gain of 200. This will mean you can easily interface with a transistor load of 1mA. You shouldn't have a problem with getting a logic level out of a load of a couple of mA. You might want to use a 3.3K pullup resistor for interfacing with your logic. So, your entire digital interface might look like this (view in fixed font or M$ Notepad):
This circuit will give you guaranteed good logic levels for your interface. Of course, it inverts the logic output (If input = 0, output = 1).
The app note on p. 56 shows interfacing with an N-type logic level FET. It's easier, one less component, and you have the capability of driving much more current (you apply a logic level voltage at the gate, and your drain current is limited by package power dissipation and Rds(on). You do need the 100K pulldown resistor to prevent the output from floating into the linear region if the gate is open or the power supply for the logic gets turned off. You could do worse than choosing a 2N7000KL (Vishay) for an N-type logic level FET. It's a TO-92 package, and has an Rds(on) of 4 ohms max with a 4.5V supply. 1V to
2.5V switching level -- suitable for any type logic. You won't have any problem at all switching up to 100mA.
Now for the analog output. If you look closely at the block diagram in the data sheet, you can see the FET is internal to the sensor. You get an analog output that's capable of sourcing only (that's why the drew the FET), that can give you 0 to 2.5V at up to 50uA with a 5V supply. This output can be directly interfaced with a uC ADC input. If you want to do more, you may have to buffer and/or amplify the signal. If you need to buffer the output, using a single-supply op amp like the LM358 as a voltage follower would work well here.
This will get you good buffering from a couple of mV above GND all the way to 2.5V, and can source several mA without problem. But you didn't describe what you're doing with the signal, so you might want to post again with more info if this isn't right for you.
Now for the optocoupler part. Since the output of your sensor can only source 100uA, it's not suitable to drive an optocoupler (10 - 20mA through the optocoupler LED). The logic FET circuit can easily drive either an LED or an optocoupler LED, as shown in the diagram on p. 56.
I hope this has been of use. Try to remember that, in the real world, the manufacturers have tech reps, and their distributors also have application engineers, who are more than happy to help. Omron has always made up for their obscure data sheets by having a good support system. And once you've been around these obscure data sheets for a while and asked a few questions, it does get easier.