Mutliple SPI Devices to POST MySQL data from RFID using ENC28J60

Long time lurker, first time poster.

I come here seeking advice after a very long journey with many dead ends. I have extensively googled and searched this forum for answers, but it is difficult to find direct solutions given the scope of my project.

Here is what I have, and what I am trying to accomplish: I have an Arduino Uno, an RFID/NFC shield from, an ENC28J60 Ethernet module, and an MP3 shield with SD card storage also from Separately, I can get all of my devices working with the Uno. When I try to put 2 or more together I run into hardware and software roadblocks.

This is what I am trying to do:

  • Establish a Device ID for the arduino (if I can get this working there will be several arduinos)
  • Wait for and then Read RFID Tags
  • authenticate Tag & play audio file: if RFID Tag ID = some value then Trigger audio to play else do nothing
  • Update MySQL table with: RFID Tag ID,Arduino's Device ID, and date/time stamp

I am attempting to have data passed from the arduino to a LAMP server using PHP and HTTP POST (or should I be using GET?).

My main difficulties are dealing with the multiple SPI devices and limited pins, (which has led me to try out a WTV-020-SD-mini that can be run independently of the arduino), and combining sketches effectively to carry out all the functions of this project. I am also having software issues with the Ethercard library for the ENC28J60 module. I am able to get DHCP IP and gateway, but I have not been able to successfully build and send a POST (or GET) to the MySQL server.

My goal with this post is to seek advice from the community to determine if what I am trying to do is feasible with a single Arduino Uno, or if I am approaching this project the wrong way. Would moving to a bigger platform like a MEGA with additional pins be the simple solution to my hardware issues? SPI can support multiple devices, but I am finding that hardware mods like cutting traces and remapping pins is necessary... Is there a better way? Also, is it feasible to combine the RFID, MP3, and Ethercard sketches to achieve the goals above?

Thank you in advance for your time

[u]Reference research:[/u]

RFID/NFC Shield with pn532(SPI) (works great, can read, write, etc)

Ethercard ENC28J60 (SPI) (have to use IDE 1.0 to compile)(works, get dhcp)


2 options, one is a shield with sd card using SPI, the other is a standalone audio player with sdcard:

-WTV020-SD-mini (I have 16 pin, can be autonomous, but play trigger is achieved by pulling a pin low)

control with arduino- sample project

play audio without arduino- sample project

-MP3 Shield (SPI)

MySQL with arduino,-POST-to-PHP-to-MySQL.html

Old forum post for MySQL GET using ENC28J60 (cannot locate any "my_datafill_cb" or find where/how to build the request in that example)

I hesitate to be the first to respond, because I'm a newbie too. However I have just built a system that is similar in essence but much less ambitious (RFID event triggers external device and also records event to SD card; no ethernet stage).

The one aspect on which I can offer a suggestion is: write the Arduino ID tag into your code, and simply change that ID value each time you write the code to a new Arduino. I added further identifiers in a config file on the SD card, because ultimately my data are combined into one database, and I need to identify the site where the Arduino was operating, and the person operating it. The config file is easily edited, even in the field. The program reads it and adds the identifiers to every line of data.

Aren't you going to need a clock if you want to record a date/time stamp? That's more connections, either I2C or SPI.

Thanks for the reply. I thought about the issue of needing a RTC module for each arduino setup; however, since I am sending the data to a MySQL database hosted on an actual server I will use the TIMESTAMP function (as offered here: to add a timestamp with the server time the entry was made. This is sufficient for my needs.

Getting multiple shields to work together is often a challenge. In this case it seems that you have already discovered that yours won't co-exist happily. It's probably going to be easier to get this working with the ethernet shield and then more standalone devices that you can talk to over serial. Might be possible with an UNO if you use software serial, but a Mega with its four hardware serial ports would make life easier.

Interesting suggestion, I had not considered using multiple serial interfaces. That is definitely a viable option. I guess I was enticed by posts such as this: ...but it appears the implementation is much more complicated once you dig into the details.

OK, it has been a while since I posted this, but I still have yet to receive a reply that attemps to help me tackle this coding and SPI/I2C bus problem. I have now resorted to using an arduino and a 2nd ATMEGA328PU chip on a custom PCB (with minimal standalone configuration). I run the Ethernet module and NFC shield using the arduino UNO, and the MP3 shield from the standalone ATMEGA328PU. The hardware works, especially when the sketches run their individual tasks, but combining the sketches has not proven fruitful. here again is my goal:

  1. user swipes NFC tag to reader shield on arduino.
  2. UID of tag logged and submitted via http to offsite mysql server via ethernet module.
  3. Swipe of NFC tag simultaneously triggers MP3 module via digitalWrite/digitalRead pins on respective NFC and MP3 arduino/ATMEGA hardware.

I know there is a simple solution in here somewhere, but my "arduino sketch coding prowess" is lacking :blush:....I again reach out to the community for suggestions. Thanks in advance


Hi, I happened to be checking my site stats ( and saw a reference from your post. Did you ever get the POST or GET method working to insert data in your MYSQL database?