8M speed encoder

CWells

New Member
I building an encoder using a photocell and illumination LED with a black/white disk on one of the gears.
Has anyone here any similar experience? I'm concerned about data loss due to rctime lag. What is the maximum RPM I can expect to measure with an 8M?
 

manuka

Senior Member
Chris- (assuming you ARE the NZ Chris Wells)- you should have asked me when we met up last eve! LDRs are pretty sluggish of course,so by "photocell" are you meaning a photo transistor? I'd say a good 1000 rpm (say 20 per sec, each hence ~50 ms)would be possible with the latter. Stan
 

CWells

New Member
Actually, I'm the NH Chris Wells. :) Also actually, I was planning on using an LDR - I guess that's a no-no, eh? Which phototransistor would you recommend?

The project involved an 8M monitoring the pulses, calculating a speed, then sending that data serially. I thought the 8M would be perfect for this job, is there a more appropriate chip, not too difficult for a beginner to figure out?
 

premelec

Senior Member
Some LDRs are very fast but in general they aren't very fast... especially the ones that take little light to go to low R.... Interrupter assemblies incorporating phototransistor and LED are usually speedy...
 

moxhamj

New Member
I used a slotted photointerrupter - LDRs are much to slow. I also used a piece of aluminium as it blocks light better than paper or card (try shining a red led through card or even plastic). The phototransistor is set to give a positive pulse when the beam is blocked and the aluminium is narrow so it only blocks over 2 degrees of the 360 degree circle. Pulsin 3,0,w0 triggers on a negative edge so it starts after the strip goes through and measures till it comes back. Typical values for w0 are 20,000 for 300 rpm, and the value for w0 decreases as the rpm's go up so this will give accurate readings well over 50,000 rpms. Max w0 is 65,535 so this arrangement won't work below about 100rpms. At slow speeds <100 rpm a count loop and pause statements could be used. All this is running on an 08M and sending out data serially. Hope this helps.

Edited by - Dr_Acula on 27/07/2007 01:49:57
 

CWells

New Member
I'm using a black/white disc, not a slotted one. So far, I'm planning on replacing the photoresistor with a reverse-biased photodiode.
 

evanh

Senior Member
Have a read of <A href='http://www.rev-ed.co.uk/picaxe/forum/Topic.asp?topic_id=5410&amp;forum_id=28&amp;Topic_Title=Quadrature%2Bencoders&amp;forum_title=No+new+posts+please%21+20' Target=_Blank>External Web Link</a>
and <A href='http://www.rev-ed.co.uk/picaxe/forum/Topic.asp?topic_id=5969&amp;forum_id=29&amp;Topic_Title=ensuring%2Binputs%2Bare%2Btriggered%2Bto%2BHigh%2B%2526amp%253B%2BLo&amp;forum_title=No+new+posts+please%21+21' Target=_Blank>External Web Link</a>

 

hippy

Technical Support
Staff member
Dr_Acula : <i>Pulsin 3,0,w0 ... will give accurate readings well over 50,000 rpms. Max w0 is 65,535 so this arrangement won't work below about 100rpms. </i>

One trick for dealing with slower rpm would be to underclock the 08M while executing PULSIN. 1MHz should be good enough down to 25rpm and in terms of cycling that may be too little progress being made to be worth reporting. Auto-ranging could adjust the oscillator speed on the fly.

More slots to measure helps keep the data refresh rate high at low rpm. It doesn't matter which slot/block time is measured but errors in cutting accuracy would cause some variances in data. These can be averaged out in software, or may just 'disappear' in the maths.

For higher rpm, do the opposite; overclock the 08M to 8MHz and just one or less slots.

One quick and easy way to stop 'jitter' and rapid changing of rpm display etc, is to check if the rpm is rising or falling. If the next is in the same direction, update the display, if in the opposite, only update if the change is over a certain size or percentage of current reading. That's also good for taking noise out of READADC inputs.

Edited by - hippy on 27/07/2007 13:55:50
 

Michael 2727

Senior Member
If you have an old, dead PC Ball Mouse, they have 2 sets of IR Rx Tx LEDs/PhotoTransistors inside them which look at the optically encoded wheels.
<b>Free </b> if you have a spare mouse.

Remember to treat both devices as if they were LEDs e.g. limit the current to 20mA or less and you can't really go wrong, (5V).

 

CWells

New Member
Ok, bear with me, I'm new at this...

I now have a NTE3037 phototransistor. I'm going to cover it with a heatshrink tube, with the open end perhaps 2mm from the encoder wheel, which is a black &amp; white striped paper disk glued onto a gear. There is a green LED beside the phototransistor illuminating the disk.
I need to get a digital 1 or 0 when the wheel rotates. I don't care about direction right now, only speed. I understand I'll have to play around with resistor sizes to get the threshold right, but I'm unsure of the wiring, can someone provide a basic schematic?
 
Google on Wheel Encoder Schematic

Here is one... http://seekay.eidoloskop.com/Rugwarrior.html

Here is one...
http://www.schursastrophotography.com/roboimages/encdisksensor.jpg
 

ljg

New Member
the easiest encoder build I've found is to use a Hammamatsu 5586 or 5587 photoreflector-LED assembly
It just requires a couple LED's for the circuit for a Schmitt trigger sensor that can be used with an encoder disk printed off a PC printer.

The sensor alone can be purchased many places-- Here's one:
<A href='http://www.active-robots.com/products/sensors/sensors-hamamatsu.shtml' Target=_Blank>External Web Link</a>

It's not the only place. I just picked it because this site offers the sensor alone or a prebuilt assembly.

Look at the pictures- you'll see it's dead simple.
 

CWells

New Member
I've got it working - sort of. I need to either increase the light hitting the disk (the LED won't do it) or apply a bias voltage - I'm guessing. I'm currently not using the base terminal of the phototransistor - can I simply attach a bias resistor to it &amp; 5V? What value should I use?
 
Top