# Help with circuit design

• posted

Hi!

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?

Zenty

• posted

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):

| VCC | + | | | .-. | 3.3K| | | | | | '-' | | Output to CMOS Logic/ | o------->

| | Microcontroller | ___ |/ | o-|___|-o-|2N3904 | 47K | |>

| .-. | | 47K| | | | | | === | '-' GND | | | === | GND | (created by AACircuit v1.28.6 beta 04/19/05

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.

| | VCC | + | A_in |\\| | o--o------|+\\ Aout | | | >----o---o------>

| 100K.-. .--|-/ | | | | | | |/| | .-. | | | | === | | |10K | '-' | GND | | | | | '----------' '-' | === | | GND === | GND | (created by AACircuit v1.28.6 beta 04/19/05