Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Robot sensor question

Status
Not open for further replies.

richardv2

New Member
I want to signal condition a phototransistor line sensor output to a digital input.

Although I am using the PIC16F8680 chip, the answer should be valid for most PIC chips. If not, please let me know.

I have designed, built and tested a bank of 8 IR Transmitter/ Phototransistor pairs.
They all return 1.2 to 4.2 volts at 3/8ths inch depending on a light or dark surface below the sensors.

I ultimately want an 8-bit digital pattern where the sensors might react like this when travelling over a black line.

00011000
00001000
00001100
00000100
meaning the robot is drifting off center.

Seems like I have several options:
Lets say I use Port B as an input port.

1. If I just run the sensor inputs to the port, it would seem that I would get what I want; zeros or ones.

2. Could I send the 1.2-4.2 volt signal through some kind of chip like an inverter to "clean up" the signal and only produce 0 or 1? I know an opamp could do this, but that seems like overkill.

3. How about an LED/resistor voltage divider to drop the 1.2 down to 0.7 to make sure I get a zero into the chip at low voltage??

4. I could use ADC, but it seems inefficient to convert the voltage into an 8 bit number just to turn it back into a one or zero.

So what would you do???
 
You could use a pair of quad comparators. OR you could use the PICs built in comparators and a 4 to 1 mux chip like the CD4052 or one comparator an 8 to 1 like the CD4053. There's a built in DAC you could use too to set the threshold.
 
I'm not familiar with that PIC chip. IMO I like the 16F88 chip. If this is a line follower, you will need to adjust the threshold levels to determine if the robot is on the line and not on the line under varying light conditions and surface conditions. I would bring the voltage into the A/D converter on the PIC, if your PIC has this capability. Covert it to a 8 bit (0-255) number and set/adjust thresholds in the programming. You could output the light level to LCD.
 
ADC may seem inefficient, but if you aren't using them for anything else, it's really quite reasonable. You can take ADC readings and use the average to compensate for almost any light conditions. The sensors probably won't be identical. You can compensate for this by adding or subtracting a value from the sensors that are different. (or use the readings to help match sensors).

It's not any less efficient than posting identical messages on 4 different forums around the world, and 2 different topics here.
 
mneary said:
It's not any less efficient than posting identical messages on 4 different forums around the world, and 2 different topics here.

As a newbie to PIC chips, my plan was to post on as many forums as possible. Then gauge by the quantity/quality of the responses, which forums are best for what I'm doing/asking.

I see you disaprove. Are you saying I should avoid all forums in the world but one? How would you go about getting as many different responses as you can to a specific question???
 
How would you go about getting as many different responses as you can to a specific question???
I agree it's difficult to find the 'best' place to post a question. But from the responder's viewpoint, it means I don't know if you've already received a reply. Composing a helpful reply sometimes requires a lot of effort. If the question has already been answered elsewhere with the same thing that I'm writing, I feel that I've wasted my time.

Maybe if you waited a couple of hours, and mention the other places it's already posted.......
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top