Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
12 years ago

de2 board expansion header

hi, i want to connect my ultrasonic sensor to de2 board and the sensor operating voltage is between 2.5 to 5.5V. Can i just connect the sensor using de2 board expansion header to power the sensor and also read the output from the sensor?. It is because i learnt that the expansion header pin has an output of 3.3v. is there any example of vhdl code to assign the GPIO pin?

thanks,

regards,

faizul

8 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You can definitely use the 3.3V pin to supply the sensor, provided the sensor current absorption doesn't exceed the maximum value the DE2 3.3V voltage regulator can source.

    Regarding the use of GPIOs to interface the sensor output, depends on the type of signal it has.

    If the sensor output is an analog signal the answer is no: fpga work with digital signals, so you need and ADC to convert the analog value.

    Instead, if the sensor has a serial interface, like spi or i2c, you probalby can directly connect to any GPIO.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Cyclone-II on DE2 is set to support 3.3V I/O, since VCCIO on this board is set to 3.3V.

    If your device operates on 2.5 to 5.5V, then 3.3V is certainly in that range.

    To be sure you need to find this information in your sensor datasheet:

    1) what voltage level your sensor provides for logic '1'? I assume '0' is close enough to 0V.

    2) what is the threshold voltage on data going to the sensor? I.e. when it switches from sensing logical '0' to logical '1'

    Speaking on setting I/O standard per pin - you do not use VHDL (or Verilog) to assign pin settings with Altera, you use .qsf file for that, which can be modified via Quartus -> Assignments -> Pin Planner dialog window.

    V.L.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    PWM is a digital signal, then you can use it; PW voltage levels are compatible if you supply the sensor with 3.3V.

    Then you only need to connect PW to any spare GPIO. In Quartus project you must implement something like a counter which derives the PW pulse length in order to calculate the sensor distance information.

    With this sensor, you could also directly read the measured distance through TX signal, if you implement a serial receiver.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Looks like you need an RS232 UART, you might want a 5 byte hardware fifo.

    I'd do an experiment to verify the polarity of the RS232 signal. The official levels are (IIRC) +15v for a logic 0 and -15v for a logic one, since RS232 line drivers are historically inverting the TTL level outputs might be inverted - although the data sheet doesn't say that.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    Looks like you need an RS232 UART, you might want a 5 byte hardware fifo.

    I'd do an experiment to verify the polarity of the RS232 signal. The official levels are (IIRC) +15v for a logic 0 and -15v for a logic one, since RS232 line drivers are historically inverting the TTL level outputs might be inverted - although the data sheet doesn't say that.

    --- Quote End ---

    Please note that the sensor datasheet states that the serial protocol is like RS232, but voltage levels are actually 0 to Vcc.

    Then with Vcc=3.3V you can directly connect to fpga I/Os
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Interesting device, thanks for the reference. If you power it with 3.3V you can directly connect it to DE2, as Cris72 stated correctly.

    But for stronger ultrasound beam/distance it needs to be powered with 5V. I think you can still connect it directly to DE2 with 5V power to the device, since 3.5V output from DE2 would be enough to switch input to '1', and DE2 has diodes and current limiting resistor on header I/O in order to be able to receive +5V. You may also use level shifting buffer, to convert +5V signal to +3.3V on signals going from sensor to DE2, but this is not mandatory.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    so i will just try to connect directly to de2 board then, thank you so much, i'm really appreciate your helps