Go to Post I'm here to unintentionally offer insightful quotes. - Jeff Waegelin [more]
Home
Go Back   Chief Delphi > Technical > Electrical
CD-Events   CD-Media   CD-Spy   FRC-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-26-2012, 08:02 PM
SeanPerez SeanPerez is offline
Registered User
FRC #2625 (Arc Reactor)
Team Role: Driver
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Mississauga
Posts: 45
SeanPerez is an unknown quantity at this point
Wiring a Photoresister to an arduino interupt

how would i wire a photoresistor to an arduino interupt so i can use it as a simple encoder to get my rpm. is there a better way to measure rpm? im measuring the rpm of a shaft thats larger then the encoder can handle. also it will spin in the range of 750 - 1500 rpm maybe a little faster.
  #2   Spotlight this post!  
Unread 04-28-2012, 12:25 PM
dtengineering's Avatar
dtengineering dtengineering is offline
Teaching Teachers to Teach Tech
AKA: Jason Brett
FRC #1346 ("Trobotics" competed 2004-2010)
Team Role: Teacher
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Vancouver, BC
Posts: 1,657
dtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond repute
Re: Wiring a Photoresister to an arduino interupt

I tend to prefer photodiodes or phototransistors for high speed work. A photo transistor works very much like a standard transistor, but with the incoming light acting as the base of the transistor. This allows for a much more significant voltage swing, making the sensor easier to read. You can actually find some nicely matched IR LED/Phototransistor pairs that might work well for your application at your favorite local electronics shop. (I'd recommend Lee's Electronics, were you in Vancouver... but that's a bit of a trip.)

Anyway, what you do is you basically make a voltage divider circuit. You hook the sensor (be it photoresistor, phototransistor, mechanical switch, what have you...) in series with a resistor. Usually a fairly high value resistor... 5 to 50kohms... will do nicely. If you are using a photoresistor you will have to match the value of the resistor to be roughly the same value as the photoresistor so that the junction between the two of them alternates between "something above 2.5v" and "something below 2.5v". (Assuming your chip is working at 5v, that is.) Again, phototransistors make getting this voltage swing much easier and much more reliable than photoresistors and I highly recommend you consider a phototransistor emitter/detector pair for your encoder.

In any case, hook it up like this...

+5v----resistor------sensor-----ground

You put your microcontroller pin to the junction between the resistor and the sensor. In this case, when light hits the sensor and it conducts, the junction between the resistor and sensor will fall to a lower voltage. When light no longer hits the sensor then the sensor will not conduct as much and the voltage will rise.

Whether or not this will read too quickly depends on how many pulses per revolution you have on your encoder. If you just have one pulse per revolution then you've only got 25 revolutions per second to deal with... if you've got 100 pulses per revolution (like, say, the VEX encoders do) then you've got 0.0004 seconds between each pulse. This is still quite "doable" for an arduino, but will start to become a hassle if you add multiple encoders and other time-sensitive sensors to your system.

Good luck... have fun, and did my subtle hint that you should try a phototransistor come through?

Jason
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 01:17 PM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi