help with sensors

Discussion in 'The Projects Forum' started by s3b4k, Oct 4, 2011.

  1. s3b4k

    Thread Starter Member

    Feb 15, 2010
    the question is attached and my circuit is attached. my teacher made some comments about things being wrong like the sensor and the led brightness. My questions are the sensor I am using has a digital output, should i use an analogue output to work with the questions specifications?, and will i need an rc circuit for the led brightness variation? and can you comment what else i should do to my circuit.
    edit i am using GP2D15 should i use the GP2D12?
    Last edited: Oct 5, 2011
  2. SgtWookie


    Jul 17, 2007
    What software did you use to draw the circuit? Eagle?

    You did not document what kind of LED you are using. You should specify the part number, or at least the color.

    LEDs can have different Vf's at their rated current, but nowadays it's typical for red, yellow and green super-bright LEDs to have a Vf of around 2v-2.2v @20mA; blue and white LEDs range from ~3v to ~3.8v @20mA; IR LEDs are usually somewhere around 1.2v-1.4v @20mA.

    I don't know what your I/O pins are rated for current-wise, but it would be good to keep it 20mA or less. I suggest using a transistor for an LED driver, limit the maximum LED current using a resistor, and vary the brightness using PWM. Your transistor will need 1/10 of the desired maximum collector current flowing through it's base. If your LED current will be 20mA tops, then use (5v-0.7v)/(20mA/10) = 4.3/2mA = 2150 Ohms for the base resistor; 2.1k or 2.2k would be fine.
    Calculate your LED current as: (Vcc-Vf_LED) / Desired_Current, and use that result or the next larger standard value of resistance.

    If your sensors' output is digital, you should be communicating with it digitally.

    RS-232 is a legacy communication protocol. I don't know of any current PC's that include it. You should consider using USB communication if your uC supports it. Otherwise, you'll likely either need to use an RS-232 to USB adapter, or install an I/O card that has an RS-232 port on it.