Закрыть ... [X]

As usual, I expected easy – but got anything but.

For my Big Project, I needed an photointerrupter – what they are is a small device that shines a light from one side to the other, where there’s a detector.

The idea is that if anything breaks that light beam, you take note of it, and use the information as you wish. For example, if you put a disk on a motor shaft with a small hole cut in it, the beam will be broken except for that one spot – so count the ‘breaks’, and you get an RPM for the motor.

rpi574 opto isolator

The catch however was getting it to work. The one I bought at eBay was a simple 4-pin variety, called the RPI-574. One side was an infrared led, and the other was a phototransistor (although with only two pins I think it should be called a photodiode). When the LED was on, the phototransistor would conduct; when it was off (or something blocked the light falling on the transistor) it wouldn’t conduct.

With that part ready, my first goal was to scour the Internet for examples of these types of projects. My idea was to design it first, get it working, and THEN import to the Arduino. To make a long evening short, I couldn’t get a single example I found to work right, even to do something simple like light up an LED.

So I gave up and attacked it another way. Looking at the specifications for the device, the diode side was easy. I saw a reference to using a 150 ohm resistor, so I used an available one (180ohm) and connected it to power. I then checked the current through it – the specs said the maximum for it was 50mA, and I read 20mA, so I figured I was OK.

In reality, I should have started with 5v and worked backwards; realizing that R = V / I, I could have said R = 5v / 0.05A, or 100ohm. Anything over that would keep my current under 50mA, no matter what the resistance of the diode might be.

In any case, I had proof the diode was working, so now on to the photo-transistor. My next step was to connect power to it, and then connect the other lead to a resistor (again, 100ohm) and to ground:

At this point, I hooked in my multimeter, and checked the current. Then, I put a piece of paper into the photointerrupter to cut the beam, and watched as the milliamps went to zero. I had a working detector!

Pages: 1 2

. Bookmark the .




ШОКИРУЮЩИЕ НОВОСТИ