0

I'm a beginner, just so you know.

Okay, I've a Arduino IR Infrared sensor right next to me, some jumper cables and a Raspberry Pi.

My question is: Do i need an Arduino board to hook the sensor up to my RP or is that not necessary?

Also, is it alright to connect the output to a GPIO or can this potentionally damage the RP?

Thanks in advance

Quotenbanane
  • 111
  • 4
  • 2
    Impossible to say without more information. It depends on the sensor. Arduinos typically have 5V GPIO. The Pi has 3V3 GPIO. – joan Sep 22 '18 at 22:16
  • Ok, so the potentional threat to kill the RP is there? – Quotenbanane Sep 22 '18 at 22:18
  • If you feed less than 0V or more than 3V3 into a Pi GPIO you can kill the GPIO and the Pi. – joan Sep 22 '18 at 22:27
  • Well..... sucks – Quotenbanane Sep 22 '18 at 22:39
  • Do you have any good Arduino-board recommendations for me? I'd mainly use it for sensors and feed the data in a raspberry pi python program – Quotenbanane Sep 22 '18 at 22:40
  • Nobody has said you need an Arduino. I am trying to point out that it depends on the sensor. You need to specify the sensor model. – joan Sep 22 '18 at 22:42
  • I know Joan, but I've like a dozen sensors and some of them definitely will require a 5V-GPIO pin. That's why I was asking – Quotenbanane Sep 22 '18 at 22:48
  • I've bought the sensor [here](https://www.ebay.at/itm/3-x-IR-Infrarot-Hindernis-Erkennung-Abstandssensor-Sensor-Modul-Arduino-Raspb/252784174112?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649) but there are no specs and the model is in Chinese. It seems to be this one right [here] (http://qqtrading.com.my/ir-infrared-obstacle-detaction-sensor-module-fc-5) It says "working voltage 3-5V". Does that mean if i put it on 3.3V, it'll work with the GPIO? – Quotenbanane Sep 22 '18 at 22:51

2 Answers2

1

Most of the time, if you supply only 3.3 volt to Vcc, the maximum output will be 3.3 volts.

The FC-51 appears to have been used with Raspberry Pis before. This Python program at github.com appears to look for the FC-51 signal on pin 7 of the Raspberry Pi using the GPIO BOARD pin number method:

import RPi.GPIO as GPIO
import time

pin = 7

GPIO.setmode(GPIO.BOARD)

GPIO.setup(pin, GPIO.IN)

input = GPIO.input(pin)

while True:
    if (!GPIO.input(pin)):
        print("In Range")
time.sleep(1)
st2000
  • 386
  • 1
  • 6
0

General answer is yes, you can.
Be careful anyway. Three things to consider (with possible solutions).

  1. Voltage.
    Some Arduinos (Uno, Mega, Leonardo) have 5V operating voltage, other (Due, MKRZero) are 3V3. If your sensor is 3V3 powered and gives 3V3 signals level on the outputs, then you connect it directly to your Raspberry, make a script/C/assembly/python program and you good to go. If your sensor is 5V powered, using a voltage level converter is recommended.
  2. Current.
    Be careful what are you driving. When connecting low current LED (LED with resistor to limit LED current to say 3-5mA) to GPIO, then you can easily connect it to any of GPIO's. But if you want to drive relay or array of LEDs then you can kill the GPIO. To solve problem like this ("I want to drive LED strip!") a transistor/buffer/amplifier can be used. Look here to see how much current GPIO/3V3/5V line can provide.
  3. Examples
    In Arduino IDE you can easily find examples/libraries to work with most popular sensors. This may be hard to achieve with sensors connected to Raspberry. You can do autopsy on the Arduino's library and see the approach to given sensor and translate it to Raspberry c/python/assembly/any other script or program.

Good luck!

smajli
  • 213
  • 1
  • 2
  • 8