I'm designing a PCB with XBee radio module and a bluetooth module (RFDuino SMD with XBee 2mW Radio). Since both of these modules are using 2.4GHz, are there any special consideration about how to place them on the PCB to minimize radio interference? Is it a good idea to place the XBee on top of the BLE module to save space?
Electronic – Two 2.4GHz radio modules (XBee+Bluetooth) on same PCB. How to minimize interference
antennabluetoothinterferencepcb-designradio
Related Solutions
As you probably know the BLE112 is a Bluetooth 4.0 single mode module, meaning it doesn't support/interoperate with Bluetooth devices older than version 4.0. The iPhone 4s and iPhone 5 are pretty much the most popular phones that have Bluetooth 4.0 support and provide APIs to use Bluetooth 4.0. Some android vendors have their own APIs such as Motrola for its Razr phone, but there is no Android API for Bluetooth 4.0. Currently any solution you make is not going to work with just any smartphone with Bluetooth.
Bluetooth 4.0 is also very different to older Bluetooths in the way it transmits and handles data. All data packets are only 20 bytes long. As you have read, at the heart of it is the slave device's (typically a sensor) GATT database which can be through of as a table with keys and values. Compared to the serial port profile (SPP) this is a very different way of thinking of data.
You can read and write the values (attributes) of the keys (attribute handles) locally (sensor / slave) or remotely (mobile phone). The idea with gatt is that instead of you writing your data like name,measurement,timestamp in one long data stream, you update the name attribute ("value"), measurement attribute and timestamp attribute in the sensor's local gatt. These changes then gets indicated to the mobile phone over the air. In short: Bluetooth 4.0 is not intended to be used for creating a data stream.
However, it is always possible to simulate or emulate streaming even when everything is packetized. Bluegiga provides a "Bluetooth Smart: Cable replacement application note" (registration required) which discusses exactly how to replace a UART cable with Bluetooth 4.0 and they give detailed explanations of how to accomplish that with the BLE112.
Update: Any device with Bluetooth and an Android version 4.3 or newer supports Bluetooth 4.0 natively. All the old vendor specific stacks have been deprecated in favor of the official support.
How flexible are you with your hardware options? As others have pointed out RSSI is terrible for positioning, you'll be lucky to get better than 5-10 m accuracy on an RSSI only system.
As pjc50 indicated there are a number of optical systems. If you want to stick with radio then there are some other options that I've seen used:
Time of flight, the same principal as GPS uses. Bluetooth and wifi are a bit useless for this but other radios like the DWM1000 module from decawave combined with a little bit of software can do it fairly accurately. That should get you down under the 1 m error assuming you have line of sight to the beacons. If you are carefully with the system design and do some averaging those parts can get you closer to 30 cm accuracy.
Map the room. RSSI has issues with other noise sources and internal reflections within the building. You cant do much about other noise since it changes all the time but reflections are fairly constant. If you can map out the signal strengths at every point in the test area then you can compare what you see to the map, a couple of small movements will often then allow you to get a fairly high likelihood of knowing your location. Still not hugely accurate but better than RSSI alone. Until someone moves any large metal objects at which point you're screwed.
Go low tech. Sound moves painfully slowly. Make each beacon a radio and ultrasound transmitter. Each beacon sends out simultaneous radio and ultrasound pulses, you measure the time difference between seeing the two and you have a very good idea of your range. It's short range and has a slow update rate due to the time it takes sound to get anywhere but allows you do use a time of flight system without having to try to make time measurements accurate to fractions of a nanosecond. Windspeed and temperature changes will impact the accuracy but indoors those are normally less of an issue.
900 MHz RFID. Those tags cost pennies and have a range of up to 20 m. If you put a unique ID into each tag and then place them in a grid on the ceiling then walking around with an RFID reader you can calculate your location be which tags you can see and their signal strengths. It is an RSSI based system so the accuracy isn't great but you normally have a direct path, the signals are too weak to bounce around much and it's in a quieter RF band so it's not terrible. You can get this sort of system down to about 1-2 m accuracy. But RFID tags are a lot cheaper than wi-fi base stations and don't require power.
After that you get into multi-sensor systems, often something similar to one of the above or an optical system combined with an IMU. The IMU gives good high resolution short term movement measurements but will drift over time, the radio or visual systems give lower accuracy but don't drift. If you combine the two you can in theory get very good results. However the implementation of that sort of system can get very complex.
Best Answer
I don't think it will be an optimum solution to place one module on top of the other. I'm not saying that it will not work because it probably will only with less reliable connection, lower datarate etc.
Bluetooth in particular has been designed to avoid interference (it changes channel 1600 times per second !).
In general it is always best to separate transceivers as much as you can for optimum performance. If you look at how antenna's on cellphones are placed inside the phone you should notice that they are usually separated as much as possible even for antennas that do not operate in the same frequency band.