I bought "RFID RC522" & "GY-NEO6MV2", and I need a useful guide for both of them in order to use them with Raspberry Pi 3 Model B.

I also want to know if there is a guide or a course for using Arduino devices with Raspberry Pi.


1 Answer 1


"Arduino devices" are really just general purpose devices that operate on 5V logic and can be connected to a bus style supported on an Arduino, such as UART, SPI, or I2C, none of which originated with or are unique to it.

This means you can use such devices with anything supporting the communication (busing) methodology and a compatible, 5V logic level.1 "Logic level" refers to the voltage used across the bus, which is independent of the bus style. Note this is distinct from supply voltage, which for many devices is also 5V but may be more. If the device is reasonably low amperage (< 1000 mA) and uses both a 5V supply and 5V logic, you can run it completely from a pi as described below. If it requires a higher supply voltage or more amps then you must provide that separately.

While the Raspberry Pi has a few pins connected to its 5V system and so can power such devices, the logic level used by the GPIO pins (some of which can be used to drive all the buses just mentioned), is 3.3V.

This means the signal voltage across the bus must be converted from one to the other. The most commonplace way to do that is probably a logic level shifter such as the one shown below.

enter image description here

This is on a small breadboard with a set of channels on two sides which the shifter spans. There is nothing connected on the other side (which there needs to be in order for the shifter to serve any purpose).

Shifters usually seem to support a small range of TTL voltages, of which 3.3 and 5 are very common. You attach a supply voltage corresponding to the logic level of the pi on one side and one of the device on the other. In the picture, this is the grey wire, which is on pin #1 (physical numbering -- there is no GPIO 1), supplying power from the 3.3V rail. If I were using a 5 V device which I was also powering with the pi, I would connect one of the 5V rail pins to the channel across from this on the shifter (or, if the device had a Vout, perhaps use that, or, if the whole thing is on a breadboard, use one channel connecting the shifter, the device, and the 5V supply pin).

The purple wire is ground and also requires a connection on the other side (unless there is already a common ground -- but some shifters may require a connection on both sides anyway). Beware that while the shifter may support a range of voltages, it is probably made such that the higher voltage is always on one particular side (in this picture the pi connection is on the lower voltage side; if you look closely/zoom in you'll notice an "L" and "H" on the shifter at one end on opposite sides). It is very important that this common ground be in place. The version on the other side must come from the device, or a ground rail which is common to the device (which may be from the pi, if you are powering it that way).

The blue and green wires are data lines on the UART TX and RX respectively (aka. GPIOs 14 and 15, which are physically the eighth and tenth pin depending on how you want to "count physically").2 This setup could be used to communicate directly with an Arduino, which is one alternative for controlling 5V devices indirectly. In that case, the 5V and ground on the opposite side must come from the Arduino.

Note that some logic level shifters use bi-directional channels and others do not; some may have a combination (a couple of bi-directional and a couple of uni-directional). "Bi-directional" means the signal may be flowing either way. For UART, this is unnecessary since serial buses use two channels to support duplex communication; one goes one way and one goes the other.

However, for I2C devices, you must have a shifter with a bi-directional channel, because the data line for I2C alternates between sending and receiving, i.e., a signal will be travelling in different directions across the bus at different times.

The shifter above has four bi-directional channels. There are various such devices around and they should be very inexpensive (I believe I got five of these for < $20). The two things to make sure of are:

  • The shifter supports 3.3 to 5V conversion (almost all of them will).

  • The shifter has at least one bi-directional channel, in case you need one at some point.

That answers how to connect Arduino devices in general for use with any model of Raspberry Pi.

I bought "RFID RC522" & "GY-NEO6MV2", and I need a useful guide for both of them in order to use them with Raspberry Pi 3 Model B.

You may or may not be able to find such a thing. You will have to understand how to code to do this; the languages most commonly used for such on the pi are C/C++ and python, but you could use anything given the right skill set. Remember, this is not plug n' play. You may have to write the code from scratch following specifications on the device's datasheet, first doing a bit of research about how the bus style works. If there is an existing Arduino library, this may be useful to you as a reference and snippets of it (presuming the legal context allows for such) may come in handy, but Arduino's peculiar brand of C++ is not completely portable.

Datasheets may be intimidating at first for someone with a pure software background as they usually do not refer to code but to some kind of communication scheme/protocol, and may include many low level electrical and timing details you do not need to know or worry about since the datasheet is probably actually for a chip which is mounted on/in the device you bought; those details were used by the people who put the device together. What is important to you is the protocol used with the bus. If you have done networking programming, this is essentially the same "language agnostic" idea.

1. Some devices are not restricted to one one logic level; although it should be the same on all communication pins, it may be, e.g., from 3-5 V. This may be related to the supply voltage (i.e., it has to be the same), or (I think more commonly) it may be independent of it, and the supply voltage may have an acceptable range also. If you can power a device with 5V but use 3.3V logic, do so (although the 3.3V rail on the pi is better regulated and provides a more stable voltage than the 5V, this is probably not a hugely significant issue unless you are drawing a lot of mA). Just be absolutely positive that's the case first, because if the logic level is tied to the supply voltage, you will permanently damage the pi making this mistake.

Looking at this, the device sold as the "RFID RFC522 for Arduino" appears to use 5V logic but requires 3.3V supply. The logic may or may not be restricted to 5V; at a glance the board appears to have a level shifter built into it so its logic pins can connected directly to the Arduino. You will have to dig around a little further; this may mean you do have to use another shifter of your own with the pi, or it may be okay connected directly. My guess is it is harmless to try but that is a more specific question you may want to ask at our larger sibling site, Electrical Engineering ("Can I use 3.3V logic with this device?").

2. On the pi breakout this is usually starting on the left side at the corner end, zigzagging across and down. You will find many diagrams online corresponding these physical numbers to the GPIO numbering scheme, which has to do with how they are connected to the SoC.

  • There are a few devices that work both in 5V and 3.3V. Commented Jun 14, 2016 at 9:38
  • 1
    @RuiFRibeiro True. I've added a footnote about that point. In fact, the RFID RFC522 seems to require a 3.3V supply but can be connected directly to the 5V logic pins of the Arduino. I am not sure if this means it has a range usable with the logic or whether (it kind of looks like it) because it has a shifter built in to make it easier to use with the Arduino (most models of which have a 3.3V supply, but are still just 5V logic). That might mean you ironically need another shifter -- or not...
    – goldilocks
    Commented Jun 14, 2016 at 11:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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