This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
tutorials:products:rfidnfc:wiring.html [2012/04/18 20:00] ladyada |
tutorials:products:rfidnfc:wiring.html [2016/01/28 18:05] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Using the Adafruit NFC Shield with I2C ===== | + | ====== Moved! ====== |
- | + | ||
- | The Adafruit NFC shield is designed to be used using the I2C by default. I2C only uses two pins (Analog 4 and 5 which are fixed in hardware and cannot be changed) to communicate and one pin as an 'interrupt' pin (Digital 2 - can be changed however). What is nice about I2C is that it is a 'shared' bus - unlike SPI and TTL serial - so you can put as many sensors as you'd like all on the same two pins, as long as their addresses don't collide/conflict. The Interrupt pin is handy because instead of constantly asking the NFC shield "is there a card in view yet? what about now?" constantly, the chip will alert us when a NFC target comes into the antenna range. | + | |
- | + | ||
- | The shield is drop-in ompatible with any Classic Arduino (UNO, Duemilanove, Diecimilla, etc using the ATmega168 or '328) as well as any Mega R3 or later. Mega R2 Arduinos work as well but you need to solder a wire from the **SDA** and **SCL** pin holes ( | + | |
- | + | ||
- | ===== Using the Adafruit NFC Shield with SPI ===== | + | |
- | + | ||
- | ==== Wiring the Breakout for SPI ==== | + | |
- | + | ||
- | + | ||
- | The PN532 chip and breakout is designed to be used by 3.3V systems. To use it with a 5V system such as an Arduino, a level shifter is required to convert the high voltages into 3.3V. If you have a 3.3V embedded system you won't have to use the shifter of course! | + | |
- | + | ||
- | + | ||
- | + | ||
- | To begin, we'll solder in the header to the breakout board. You'll need two small 3-pin pieces of header and one 8-pin piece. You can break these off of a large piece | + | |
- | + | ||
- | [[http://www.ladyada.net/images/pshield/breakplier.jpg|{{ http://www.ladyada.net/images/pshield/breakplier_t.jpg?nolink&500x375 |}}]] \\ [[http://www.ladyada.net/images/pshield/breakclip.jpg|{{ http://www.ladyada.net/images/pshield/breakclip_t.jpg?nolink&500x375 |}}]] \\ {{ http://www.ladyada.net/images/boarduino/jumperheader.jpg?nolink&444x326 |}} | + | |
- | + | ||
- | Solder the two small pieces to the **SEL0** and **SEL1** pads. These are interface selectors for the chip. Depending on how the jumpers are inserted the chip will talk in TTL serial, i2c or SPI//. //Also solder a strip to the end so you can plug it into a breadboard | + | |
- | + | ||
- | [[http://www.ladyada.net/images/rfidnfc/header.jpg|{{ http://www.ladyada.net/images/rfidnfc/header_t.jpg?nolink&500x342 |}}]] | + | |
- | + | ||
- | + | ||
- | + | ||
- | Wire up the 4050 level shifter chip to the Arduino as shown. The notch in the 4050 is at the 'top' in this image. | + | |
- | + | ||
- | + | ||
- | *Arduino digital pin **2** is connected to 4050 pin **9** (orange wire) | + | |
- | *Arduino digital pin **3** is connected to 4050 pin **11** (yellow wire) | + | |
- | *Arduino digital pin **4** is connected to 4050 pin **14** (green wire) | + | |
- | + | ||
- | On the breakout board | + | |
- | + | ||
- | + | ||
- | ***3.3Vin** is connected to the Arduino **3.3V** pn | + | |
- | ***SCK** is connected to 4050 pin **10** (orange wire) | + | |
- | ***MISO** is connected to Arduino pin **5** (blue wire) | + | |
- | ***MOSI** is connected to 4050 pin** 12** (yellow wire) | + | |
- | ***SSEL** is connected to 4050 pin **15 **(green wire) | + | |
- | ***GND** connects to Arduino** ground** (black wire) | + | |
- | + | ||
- | Also connect 4050 pin #1 to **3.3V** and pin #8 to **ground**. | + | |
- | + | ||
- | + | ||
- | + | ||
- | Click to see a larger image. The red power wire should be connected to the **3.3v **pin on the Arduino! | + | |
- | + | ||
- | [[http://www.ladyada.net/images/rfidnfc/pn532wiring.jpg|{{ http://www.ladyada.net/images/rfidnfc/pn532wiring_t.jpg?nolink&500x333 |}}]] | + | |
- | + | ||
- | Also, we need to select SPI as the interface so on **SEL1** place the jumper in the **ON** position. for **SEL0** place the jumper in the **OFF** position | + | |
- | + | ||
- | That's it! Later on you can change what Arduino pins you are using but for the beginning test we suggest matching our wiring. | + | |
+ | This tutorial has moved to [[http://learn.adafruit.com/adafruit-pn532-rfid-nfc|http://learn.adafruit.com/adafruit-pn532-rfid-nfc]] |