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

  • 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
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)
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!

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.