Shopping Cart

Posts

Running multiple slave devices on Arduino SPI bus – hardware modifications.

WiFi and NFC shield stack

WiFi and NFC shield stack

Add-on boards AKA “shields” greatly expand the capabilities of standard Arduino platform. Typically, a shield adds a specific peripheral interface; if you need several peripherals you may need to use several shields. The biggest problem in this approach is shield compatibility. Shield developers don’t care much about interoperability and sometimes making several shields work together is difficult. In the previous article on the topic I described a project where USB Host and WiFi shields were made to share the same SPI bus. I have been recently tasked with similar project which required rather heavy hardware modifications. This article shows the necessary steps to build a system consisting of Arduino board, official WiFi Shield and Seeedstudio NFC Shield.

Here is the hardware configuration. Both shields come with stackable headers so they can be plugged into each other. Both shields use ICSP for SPI but connectors are non-stackable so at least one of the shields must have its ICSP connector replaced with the stackable variant ( I sell them). Also, both shields use pin 10 for CS so this pin needs to be re-assigned on one of the shields.

NFC shield has offset female connectors therefore if another shield is placed on top of it ICSP connector won’t mate. It means that stackable ICSP connector shall be placed on WiFi shield. At the same time, since NFC Shield does have a second row of contacts re-assigning pin 10 on this board is easy.

Before we start cutting traces and desoldering connectors, let’s establish a baseline or “a known good state”. I simply grabbed an example from NFC shield library distro called readMifareMemory, compiled, loaded and ran it. I was able to read the card and now I know that my NFC shield is functional.

One other note – both shields are assembled using lead-free solder which has higher melting point. Don’t forget to set the temperature of your soldering iron accordingly – between 700F and 750F.

Pin 10 removed

Pin 10 removed

Pin 10 re-assigned

Pin 10 re-assigned

Cutting a CS trace on NFC shield is not convenient – the trace is thin and has ground plane close to it. Instead of cutting it, I simply removed the pin 10 from the header to break the connection between this pin and Arduino. Next two pictures show the mod. First, remove the pin by heating it up with a soldering iron from the top and pulling it down with a small pliers. Heat up the pin until it starts moving then pull quickly (but gently). When the pin is removed solder a jumper between pins 9 and 10 on the NFC shield.

Now it’s time to test the mod. In the sketch, find a line near the beginning which looks like this one :

#define PN532_CS 10

and change ’10′ to ’9′. Then compile the sketch, upload and run. The sketch should function just like before the mod using just modified CS at pin 9.

The next step is to modify the WiFi shield. What we need to do is replace the standard 2×3 ICSP connector with one which have long pins facing up to mate with the shield placed on top of it (see previous article on the topic for pictures). The modification must be done very carefully – a damaged PCB often means the whole board is ruined. The following procedure typically works well:

  1. It is much easier to desolder pins one by one. On the left picture below the black case is pulled off the connector exposing the pins. This can be achieved by carefully prying the case out working from the sides of the connector between case and a spacer underneath it with a pair of small screwdrivers.
  2. When this is done, the shield can be turned upside down and pins pulled one by one using the technique used earlier when removing pin 10 on the NFC Shield. One of the pins is soldered to the ground plane and it needs more time to heat up – be prepared for it and don’t start pulling out the pin before it’s loose.
  3. The picture below on the right shows the empty place on the board with excessive solder cleaned from holes with a toothpick. It also shows the connector I just removed and put back together – perfectly usable.
  4. The stackable 2×3 connector can now be placed. Before doing this it is a good idea to assemble the stack and see if anything else needs to be added. My copy of WiFi Shield has extra long pins so I needed to add a spacer between 2×3 connector and the board – see the title picture. Put it on 2×3 connector pins, insert the connector and solder it on paying extra attention to the ground pin, as ususal.
2x3 connector removal

2x3 connector removal

2x3 cleanup

2x3 cleanup

The last step before using the setup is to run checks once again. The stack can be plugged into Arduino which at this time should still contain NFC sketch. Running this sketch once again would ensure that the NFC shield can communicate via the new connector. After this is done, WiFi shield can be checked as well using any of the sample sketches from the WiFi library.

This finishes the hardware modifications. Now it’s time to write the code which uses both devices to check compatibility between libraries. If anything interesting comes up, I’ll write about it.

Oleg.

No related posts.

6 comments to Running multiple slave devices on Arduino SPI bus – hardware modifications.

  • Fredrick

    Hi,
    I am using a usb hot shield v1.0 and an SD Card v1.0 for my project but the SD Card shield does not initialize when connected to the usb shield.how can you assist me on to solve this problem asap.?

  • Fredrick

    usb shield v1.0 hardware configuration is different from v2.0 as illustrated above

  • Fredrick

    I changed the CS pin,10,of the usb host to 8 as explained above,without any hardware modifiaction and the usb_desc example of the host shield did not work.when i left it at 10 as it was,it worked.my pickle here is how do get modify the hardware of this shield coz its different from v2.0 whose modification seems easy and elaborate.kindly assist.

    • Of course it won’t work. If you change the pin in the code you need to change it on the board as well. On rev1 SS pin has a jumper, you need to open it and run a wire from the level converter side to pin 8.

Leave a Reply

  

  

  



You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">