Hi guys, i've just read this article from SoR http://www.societyofrobots.com/schematics_photoresistor.shtml
i was wondering if this could also be done with a picaxe. the article talks about measuring "the voltage drop across the resistor with the analog port of your microcontroller". Do you know if/how i can do that? And also, can i really make it a sensor? (attach it to an input port and receive values from it).
Because if i can do this, i'll rather not buy this one https://www.robotshop.com/letsmakerobots/node/871 which i guess is more expensive and less DIY (if you have seen my robot you probably now i like extreme-DIY stuff :) )
DO IT!
A bad start:
First off, I query the Society of Robots statement: "Photoresistors (also often called phototransistors [yadda yadda yadda…]"
Photoresistors are NEVER called phototransistors, because photoresistors and phototransistors are two totally different devices, which behave in two totally different ways.
What they are talking about is photoresistors and it will work for you. The only thing to bear in mind is that where the QRB1134 has an IR source, your photoresistor (also sometimes called a Light Dependant Resistor or LDR) does not. If you want to use it to make a line tracker, you’ll have to calibrate it for the ambient light conditions.
Good theory:
There’s absolutely no reason why not to hook one of these up to your analog input in the manner described. NB I have not read about his controller board, so I can’t comment on the wiring of the molex, but I’ve used LDRs for line tracking in the following way.
The BoA method:
My suggestion is that you use two LDRs on two analog inputs. Place them side-by-side. If there’s a substantial difference, then you know one of them is seeing black and the other is seeing white. It means you don’t have to worry about shadows or calibration.
The Untested BoA method:
I think that you could probably use two LDRs in series across your battery and tap the centre point off into a single LDR. That way the voltage swiing at the ADC would tell you the difference in brightness between the two sensors. This approach would only need one ADC and wouldn’t need calibration. I’ve not tried it but I’d say it’s worth a go.
When you get it working, don’t forget to make a walkthrough.
i was thinking about the
i was thinking about the 2-LDR theory too. my only issue was whether they were “hookable” or not but if you say they are i trust you (of course! how can’t i trust BoA the builder aka BoA Constructor). tomorrow i’m gonna study the manuals to find out what code i have to use to retrieve informations from it.
Thanks for the feedback!
PIC Hatchet
I dunno nuthin’ about PICAXE. I presume you’re an axe man? For example, my setup used battery voltage as the reference for the ADC and I put no additional components on teh input. For all I know, PICAXE boards might already have a fixed Vref or they might have some sort of input interface.
a Two Fer!
That’s a pretty cool idea, running 2 CdS cells with a center tap to an ADC. Will have to try that sometime.
ok i got it! i’m slowly
ok i got it! i’m slowly understanding how PICs work. tomorrow i’m gonna make a walkthorugh if i have some free time…
ps: maybe not, i wanna try the boa method first!
You can use 2 LDR’s to
You can use 2 LDR’s to create a voltage divider and use a comparator.
if i well understood, you
if i well understood, you suggest making a resistive divider that involves 2 LDRs.
using this formula: Vout= (R2/(R1+R2))Vin where R2 is the one closer to the V0.
so if R2 is really high and R1 is low then i’m gonna have something that gets close to 1 or so. if R2 is low and R1 is high then i’m gonna get a really small number. this way i can understand which one is the darker/brighter!
the middle would be R1=R2 and that makes it : Vout=(1/2)*Vin
so i first calculate the “middle” value, if i get a higher number, well that means R2 resistance is higher, if i get a lower number that would mean R1 is higher.
I have to admit these calculations were made really quickly because of the excitement, so i’m gonna give them another look tomorrow to see if they work well, cause now is 22.42 and i feel tired
need some rest
edit: of course i’m also gonna add a 10k
know what? the boa untested
know what? the untested boa method just got tested! gonna make a walkthrough as soon as i can.