0
\$\begingroup\$

I have BASYS3 board which outputs 3.3 V, however my sensor (pir sensor) works with 5v. I also have a 5v supplier but I'm not sure how to connect these 3. I don't want to damage my BASYS3 as well so I'm reluctant to try anything. How can I connect these 3 on my breadboard? Thanks.

Edit: This is what I'd like to do basically: enter image description here

But the sensor does not work with Basys3's 3.3v output. Normally it does not work when I try to connect vcc and ground pins to the 5v power supply and the output pin to the fpga.

datasheet for my power supply: https://pdf.direnc.net/upload/3-3v-5v-breadboard-guc-karti-datasheet.pdf

datasheet for pir sensor: https://www.mpja.com/download/31227sc.pdf

datasheet for basys3 fpga board: https://reference.digilentinc.com/_media/basys3:basys3_rm.pdf

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Show what you'd like to connect pictorially and link to the device data sheets. \$\endgroup\$
    – Andy aka
    Sep 5 '20 at 10:48
  • \$\begingroup\$ @Andyaka i edited the post \$\endgroup\$ Sep 5 '20 at 11:13
1
\$\begingroup\$

From what I see in the datasheet of your PIR, it requires 5V (4.5 to 20) as power supply, but its logic output is 3.3V, which seems the same level of your BASYS board.

So, definately you can safely connect them provided the following:

  1. Connect all the GNDs of every device together. As mentioned in another answer, two devices can communicate only when sharing a common reference.

  2. Find a +5V somewhere to give power to your PIR. If the BASYS board has a power output of +5V, you can use that and you are done.

  3. If your BASYS device does not have a +5V output, then you need another power supply. In this case, even 12V would do (the PIR accepts from 4.5 to 20 volt). The power supply has a GND pin and a +V pin. Again, connect the GND pin to the two GND pins of the two other devices. The +V pin goes in the only place it can go: the +PowerIN of the pir.

ANOTHER THING: when using logic (digital) levels, you can always put resistors in between. For example, you have to connect an output to an input? Well, connect them via a 1k resistor, it will work the same but it will not fry your devices in case of errors. Resistor values range normally from 100 ohm to even 10k, depending on the application, internal resistance (or impedence) of input and output, but 1k should always work. If it does not work, at least you does no damage.

FORGOT to say: probably a 3.3V output drives correctly a 5V input anyway - it is the contrary that can be problematic (but in this last case a resistor can do, even if it is not the most beautiful solution).

\$\endgroup\$
1
  • \$\begingroup\$ thank you very much! you saved my day :) can't thank you enough for this well detailed answer. \$\endgroup\$ Sep 6 '20 at 11:21
1
\$\begingroup\$

Normally it does not work when I try to connect vcc and ground pins to the 5v power supply and the output pin to the fpga.

It probably needs the same GND.

\$\endgroup\$
1
\$\begingroup\$

Here is the TL'DR

  1. Use a single 5V external power supply for simplicity and ditch the USB, power the FIR and the FPGA off that, problem solved.

  2. Alternatively a more hackish single-supply solution is to power your FIR off the middle pin of JP6 and power both the FIR and FPGA from USB power.

  3. The most complex solution is do what your currently doing but bridge the ground on the FPGA with the ground on the power supply, then use the power supply to power the FIR and connect the logic pin as normal.

  4. No matter which of the top three solutions you decide on there is no need for you to add any logic level conversion between the FIR and the FPGA, the voltage level is already appropriate.

Your setup where you power the PIR off of 5V and use the output as a digital logic to the FPGA board is, in theory, the correct approach. The PIR's output logic level is 3.3V so this works just fine, since this hasnt worked for you there are a few possibilities to consider.

First off your FPGA board doesn't really provide a regulated 5V voltage source, which means you will need to use the one your supplied if you want a nice clean output. That is the best way to go. However what I would do to make this as minimalistic as possible is to use the power supply you have linked in 5V mode to power your FPGA board directly rather than powering it off USB or a different external power supply. To do this you would connect the power supply to JP6 and you would configure JP2 to EXT. This will ensure the ground connection provided by your FPGA board is connected to the ground from the power supply. At that point you can hook up the PIR to the ground from any point you want and the +Vcc to your power supplies output. This eliminates the need for two seperate power supplies. The other option which is a little hacky but should work well enough is you could power the FPGA from a USB power supply (which tend to be relatively clean) and then tap into that to power your FIR by wiring the +Vcc to the middle connector of JP6 on the FPGA board. This would eliminate the need for the external power board.

The reason your own setup didnt work is, I suspect, because you wired the FIR's power directly to the power supply you lited, but then powered the FPGA from a different power supply. This results in what we call a floating ground where the ground potential of your FIR and the ground potential of your FPGA could be significantly different and cause things to break. If for some reason you wanted to use two seperate power supplies rather than the simplified single power supply I suggested you can still do that, but in that case you would need to have a wire physically connected the ground on the FPGA board to the ground on your secondary power supply.

Keep in mind because of the way you wired your board already there is a possibility you fried something, so if the above doesnt work you should consider the fact that one of the components may not need to be replace.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.