Hoping I can get some pointers from the more experienced members or admins. I have a 3Pi and have played with it a fair amount and am now working on my own line following variant but I think I am implementing my QTR-8RC sensors in an extremely inefficient way.
I have read and scoured the forums, resource documentation, internet and other links as much as possible but I still dont have the understanding I’d like. Please forgive my basic level of knowledge as I’m learning as I progress.
To obtain a sensor value I am using two I/O tied to one sensor. 1 I/O line is the high/low control needed to charge the cap and then it is dropped low at which point the 2nd connected I/O line is an input used for input capture to reference a millisecond timer on the falling edge and again on the rising edge and then taking the difference to calculate the duration.
When I studied the 3Pi simplified schematic I see each sensor is hooked up to only 1 I/O line. Is there a more efficient use of I/O to acquire the readings I need? How is it performed with the 3pi? Is it possible to use the same line to drive it high and then perform the input capture or other method of duration calculation?
Also I noticed the 3Pi schematic has the sensor lines connected to ADCx pinouts, so am I correct in assuming the 3Pi uses the analog sensors?
I don’t think your dual-I/O approach will work because as soon as you switch your output line from high to low you are draining the QTR-RC capacitor through the I/O line instead of the phototransistor. Essentially, your input line will just read the value of your output line. You talk about “studying the 3pi schematic” and it seems like you’re surprised that only one I/O line is used per sensor, but this is exactly how the product page instructs you on how to use the sensor (and this is exactly how the 3pi reads the sensors):
This information is also covered in the user’s guide. Have you read through this yet? Can you explain what specifically is confusing you?
I don’t know anything about your Rabbit BL4S210 board. Is it possible to configure a pin as a digital input or output on the fly?
The sensors on the 3pi are the digital versions (QTR-RCs) that are charged using pins PC0 - PC4 as driving-high digital outputs and read using these pins as digital inputs. These pins can also be configured as analog inputs, so they could be used with analog versions of the sensors as well.
Thanks for the prompt reply Ben, I have read the documentation and I think I misread some of the info on my board. I am still in the stages of I/O assignment and will begin writing my code this afternoon. I think with my new info I should be up and running. I’ll post my results when completed.
I realize I am probably one of very few who would use this particular board with these sensors. Just thought I’d update as maybe later on down the road some else may need this and stumble across it. It came to light that the downfall of this particular board was the sinking outputs (initially overlooked, hence why the digital sensor implementation was a bit of an uphill climb) with some expert help, a multiplexer configuration was designed to be used with the analog version of this particular sensor array. Still more to come, just thought I’d share.