I want to have a light seeking robot use
phototransistors in a voltage dividing circuit and
use the comparators on the 16f628 take the brightest
of the two, but i don't want to constantly adjust a
potentiometer for all the varying light levels. I
once saw a project that did just that but didn't show
any code for it. could anyone help me with this?
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/
Alexander Luis Perez wrote:
> I want to have a light seeking robot use
> phototransistors in a voltage dividing circuit and
> use the comparators on the 16f628 take the brightest
> of the two, but i don't want to constantly adjust a
> potentiometer for all the varying light levels. I
> once saw a project that did just that but didn't show
> any code for it. could anyone help me with this?
I just did some tinkering with the comparator module. ;-) Tell me more
about how you've designed your control system so far. I'm curious about
your use of the potentiometer. Tell me more about what you already have
designed, and how it's connected together.
michael brown
"In the land of the blind, he who has one eye is king"
I don't know if this will apply to your setup or plan, but I did a motion
detector once that used two photo diodes connected to adc. The software
would discount any light changes that occurred simultaneously. Thus, a
changing light level was never a problem. The detector software only looked
for changes that did not occur simutaneously.
At 03:59 PM 3/1/03 -0800, Alexander Luis Perez wrote:
>I want to have a light seeking robot use phototransistors in a voltage
>dividing circuit and
>use the comparators on the 16f628 take the brightest of the two, but i
>don't want to constantly adjust a potentiometer for all the varying light
>levels. I once saw a project that did just that but didn't show any code
>for it. could anyone help me with this?
Use the comparitor in the '628. Here is one method: connect one side of
both photo sensors to +5V. The other side of each sensor goes to pins RA1
& RA2. Also connected to pins RA1 & RA2 are pull-down resistors - you will
need to experiment to find the best value but start with 10K. Set CMCON to
b'00000101'.
To find the best value of resistor for the pull-downs, use a meter between
one of the sensors inputs (RA1 or RA2) and GND. Pick the resistor so that
in the brightest light you expect to encounter, the voltage is no greater
than about 3.5V. Now see what the voltage is in the lowest light level you
expect to encounter - it should be greater than about 0.2V.
Depending upon what sensors you are using, the resistor could be as high as
1M or 2M or as low as 1K or 2K. You just have to experiment. Use that
value for both resistors.
Now just look at CMCON bit 7. As one sensor becomes brighter than the
other and vice versa, the state of that bit will change.
Celebrating 19 years of Engineering Innovation (1984 - 2003)
.-. .-. .-. .-. .-. .-. .-. .-. .-. .-
`-' `-' `-' `-' `-' `-' `-' `-' `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.
I don't have thie actual light seeking module yet made, but I was basing my worry on what happens with many light seeking BEAM robots and comparator-only based robots.
>Date: Sat, 1 Mar 2003 18:20:39 -0800
>Reply-To: pic microcontroller discussion list <EraseMEPICLISTspam_OUTTakeThisOuTMITVMA.MIT.EDU>
>From: John Pearson <xerospam_OUTCMC.NET>
>Subject: Re: [PIC]:calibrating light sensors with the 16f628 in c2c
>To: @spam@PICLISTKILLspamMITVMA.MIT.EDU
>
>I don't know if this will apply to your setup or plan, but I did a motion
>detector once that used two photo diodes connected to adc. The software
>would discount any light changes that occurred simultaneously. Thus, a
>changing light level was never a problem. The detector software only looked
>for changes that did not occur simutaneously.
>
>John
>{Original Message removed}