Using pull up resistor

Hi, I have a beam sensor and I am trying to find a way to convert the output voltage of this beam sensor to around 4volts(plus or minus half a volt).
When I power this beam sensor, I used 12vdc power supply.
I measured how much voltage is comming out from the beam sensor by measuring it with a multimeter.
The multimeter shows 75.6mV when the beam is not interrupted.
When the beam is interrupted, the multimeter shows 0.816v.
I assume if use 24vdc power supply, the voltage comming from the beam sensor would be the twice this current reading. But, it is not enough.
I need 4 volts from this beam sensor when the beam is interrupted.

I came to know that using a pull up resistor(10k or less) will do the job but I wasn't sure of how to connect it to the beam sensor.
Could you take a look at this drawing and tell me whether it is ok?
Imgur

Also, since arduino already has internal pull up resistors on each digital, analog pins, I think using them would be better rather than using external pull up resistors.
In this case, how can I connect the beam sensor to arduino to convert the output voltage of the beam sensor to around 4volts?

The specification of the beam sensor is as below.

  • Type : NPN
  • Detection type : Direct reflection type
  • Connection type : Code withrawal type
  • Detection distance(max) : 500mm
  • Operating voltage : 12~24VDC +or- 10% Ripple P-P below 10%
  • Current consumption : Below 35mA
  • Iluminance : Under sun light(10,000Lx),
    Under illuminate light(3,000Lx)
  • Max inflow current : 100mA
  • Residual voltage : Below 1.0V(at 100mA inflow current)
    Below 0.4(at 16mA inflow current)
  • Response time : below 1ms
  • Moderation resistance : Above 20Mohm(DC500V mega)
    *Three wires connection : blue(signal), brown(+), black(-)

Could you take a look at this drawing and tell me whether it is ok?

No you have the pull up to 12V. This will mean you put 12V on the input of your arduino and fry it.

Connect the pull up from the signal to +5V. You could use the internal ones but they are a bit high (about 30 - 40K)

I need 4 volts from this beam sensor when the beam is interrupted.

Why? put it into the analogue input and just set a threshold in the software.

Hi mingki, I thought you said you could adjust the output voltage with a control on the detector. If that's the case and you can wind it up to at least 3 volts but less than 5 volts (4 volts is a safe target) then you can read the value using digitalRead instead of analogRead.

The advantages of digital read:

  • you can use any Arduino pin, not just the analog ones.
  • Its faster
  • Its more logical to use digitalRead because you are treating signal as a digital value (its either on or off)

But if its difficult to get a four volt output suitable for digitalRead then its not a problem to keep using analog

Hi, Grumpy_Mike.
Then, in case I use external pull up resistor for this application, I should connec it like this?
Imgur
Is this ok?

Why?  put it into the analogue input and just set a threshold in the software.

OK, I will try that.

Oh.. Hi, mem

I thought you said you could adjust the output voltage with a control on the detector

oh.. i must have mis informed you. What I mean was I could reverse the values from beam sensor reading by adjusting a controlling some kind of lever in the beam sensor. It was like a normal open and normal close of a switch thing I think.
So, when we did the test, i coul reverse the readings from small values(when there is no interruption) to large values(when there is interruption) and vise versa.

The advantages of digital read:

  • you can use any Arduino pin, not just the analog ones.
  • Its faster
  • Its more logical to use digitalRead because you are treating signal as a digital value (its either on or off)

oh.. now I understand.

Yes that the way to use a pull up for an arduino.

Thank you.
I have a voltage regulator(MC7805) right now.
I also want to try to test using a voltage regulator and a resistor to get 4v from the beam sensor.
Please take a look at this drawing.
Imgur
So, i use the 12v to convert it to 5v and then i limit the current to get the 4v in the end.
Is this OK?

the center pin of the 7805 must be connected to ground.

That should work. But it may also be more trouble than its worth because the analogRead works.

But if you are having fun and its easy for you to try then go ahead. :wink:

Thanks a lot. I will do that.
I want to have experience how it works.

I thought pull up resistor is another type of resistor. ;D
I just realized that I could use normal 10k ohm resistor for this application.
So, I used 10k ohm resistor I have and I made up a circuit like this.
http://www.flickr.com/photos/34955071@N02/3982384746/sizes/o/
I measured the output from the MC7805 and the multimeter shows exactly 5v. But, the meter measured 75.6mV when beam is not interrupted and measured 0.816v when the beam is interrupted which is the same as before. I probed the red circle area when I measure the voltage.
Could you advise me which part should be corrected in the circuit?

Please somebody help~!

Mingki, the photo has been deleted. If the beam works using analog without the pull-up then don't worry about using digatalRead.

Hi, I am sorry for the picture.
Here is the link.
Imgur
Yes, I've been testing it and the beam sensor works ok on analog pin.
I did more test with a sketch I modified last night. I pasted it in the old etherpad.
But, when I continuously interrupt the beam at the same pot value, the LED on that pin sometimes doesn't flash although the serial monitor shows the enter and the exit status of the cup.
This also happens even when I interrupt the beam at random pot value.
So I was thinking maybe it is something to do using analog pin although the output from the beam sensor is digital.

A datasheet of the beam sensor would help - the voltage levels you mentioned are a bit suspicious for me (75mV and 860 mV).
If the sensor is properly connected, a solution could be an analog comparator like LM393 (with compare threshold set to about 400 mV).

Mingki, if you are getting the correct enter and exit messages then the problem is not with the beam. It may be easier to see what is happening if you can connect up the remote display using the Processing sketch.

Pepe34, there was a link to the datasheet posted in another thread, unfortunately is in Korean but there is a circuit diagram : http://www.santec.co.kr/pro_09_03c.htm

I finally found the data sheet of that beam sensor.
Imgur
Imgur
Imgur
Imgur

Ok, thanks to datasheet from All sizes | 1 | Flickr - Photo Sharing! it is clear now, what to do :
Please check (without Arduino) if the sensor works :

  1. Power it from 12V
  2. Connect 4k7 resistor (example only, should work with different values too) between output and +12V (replace "load" on schematic with resistor).
  3. There should be +12V and about +0.3V when a beam is closed / opened. If not, the sensor's output is damaged as a result of previous experiments.

If the sensor works :

  1. Power it from +12V
  2. Connect 4k7 resistor between output and +5V on Arduino
  3. Connect output to Arduino digital pin.

Careful - Do not connect the detector output to arduino when the resistor is wired to +12v, that is only for testing with your multimeter!

Thank you.
ok, I will test it, and I won't connect the detector output to arduino when the resistor is connected to +12v.

  1. Connect 4k7 resistor

4K7 resistor means, 4K ohm resistor + 7ohm resistor?