Gameduino 2, NFC and relay!

Hi all

Im currently using a Arduino Uno on my master project and I got some little problem.

I use the Adafruit PN532 RFID/NFC Breakout and Shield to manage access to the project.

Everything work find but when the system is waiting for a MiFare Classic Cards, my digital pin (set as a output) is activated. This is a problem because it active the relay that control a xray machine.

How can I be sure that a digital output is always low unless I request with digitalWrite(xray, LOW); ?

This is the code of the nfc that active the digital pin. xray pin is digital pin 3.

nfc.begin();
nfc.SAMconfig();
uint8_t success;
uint8_t uid[] = { 0, 0, 0, 0, 0, 0, 0 };
uint8_t uidLength;
unit32_t cardidentifer = 0;

success = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A, uid, &uidLenght);

Thanks you :slight_smile:

This is the code of the nfc that active the digital pin. xray pin is digital pin 3.

No, it isn't.

What you mean no?

Can you be more clear please.

You relpy is pretty useless.

My digital pin is always low but when nfc.begin happen the digital pin go high?

What you mean no?

Can you be more clear please.

Clearer than what? You said that that code activates a digital pin. It does not. The digitalWrite() function does.

Ok

I tought people where nice here.

Im telling you that when nfc.begin() happen, digital pin 3 get high.

Im wondering why? Do I need to use another digital pin ?

Is there something in Adafruit.NFCShield_I2C.h that make that ?

Anyone else that could help me more than nope is welcome. :slight_smile:

Im telling you that when nfc.begin() happen, digital pin 3 get high.

You need to post a link to the device you are using. It may be using pin3, in which case, you can't.

Suppoce to use only digital pin 2 and the I2C (Analog 4 and 5)

I did put some delay and serial print between each line of code and when nfc.begin() happen, digital pin 3 get high.

On your linked page, there is a link, "Breakout board wiring". It says:

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!

As a shield, they imply that only pins, A4 and A5 are used, but I'd take that with a grain of salt (or two).

Look like pin3 is use by the nfc even if they said no. :sleeping:

I changed the pin of the relay to 7 and everything work.