Last week, we thoroughly tested the MPU9250 that Alexis lent us. At first glance, it looked a lot more promising than the TLV493D-A1B6 MS2GO () we tried before : the range is way better ! Unfortunately, magnetic detection is more complicated than we first thought and it looks like it’s not going to cut it.
You can take a look at this post to remind you of the detection scheme we had in mind.
Essentially, the idea is to use electromagnet in every Phyllo that can be turned on and off, so as to detect the Phyllos one after another, and use Wifi or Bluetooth to coordinate. Every Phyllo would have a magnetometer that it would use to detect the electromagnets.
Now, let’s cut into the heart of the matter :
The most important thing to keep in mind is that the magnetometer is a sensor that can detect the strength and direction of a magnetic field in one point in space (the location of the magnetometer).
Therefore, to have any hope of detecting the position precisely, we will have to place the magnets so that the magnetic field they generate is contained in the horizontal plane. Indeed, if the magnetic field is vertical,the resulting field at the location O of the magnetometer will be the same regardless of the position of the Phyllo on a circle centered in O.
Our first idea was to put both the magnetometer and the electromagnet in the fixed part of the Phyllos (as opposed to the rotating part). But that means that, from the point of view of the magnetometer O, the field generated by another Phyllo depends not only on its position relative to the magnetometer, but also on the orientation of its own fixed base (which would depend on how it was placed by the user).
One possibility to work around this problem was to place several electromagnets per Phyllo, and to only turn on the one that was most aligned with the Earth’s magnetic field (which the magnetometer is able to detect). That way, all the fields generated by surrounding Phyllos would be in the same direction, and the angle and strength of it at the location of the magnetometer could be used to deduce each position. But we rejected this method because we’d need too many magnets to have a precise detection.
Another possibility would have been to put a rotating magnet on the Phyllo and only turn it on when it was aligned with the earth’s magnetic field. But this idea was also rejected for problems of overly restrictive timing due to the rapid rotation of the Phyllo.
On top of that we’re not sure we’d be able to detect Earth’s magnetic field properly anyway with the magnetic interference from all the motors around.
Our most promising idea was to put the magnets on the rotating part of the Phyllos and to observe the evolution of the strength of the generated field as the magnet rotates. The field is strongest when magnet is pointed towards the magnetometer, which means the Phyllo we’re trying to detect is on the axis of the generated magnetic field. Note that the field is strongest twice per rotation : when the North point towards the magnetometer, and then when the South points towards it. So that means we can infer nothing from the direction of the field, only from the orientation of the axis of the field. But that still leaves two diametrically opposed directions and therefore two very different but equally possible positions :
To address this, we could place the rotating magnet not in the center of the Phyllo but closer to the outside, so that the magnet doesn’t turn on itself but around the center of the Phyllo, and points towards the outside. That way we break the symmetry of the previous situation : the field detected by the magnetometer at point O is strongest once per rotation when the magnet is closest to the magnetometer. If we make sure beforehand to always point the same pole of the magnets (for instance, the South) towards the outside, we can now also use the direction of the field on top of its orientation to distinguish between the two previously indistinguishable possibilities.
But the magnetic field measurements that we obtain (with a magnet and a fixed magnetometer) are not stable and precise enough to allow us to differentiate the strengths of the field when we move the magnet by 10cm (approximately half of a Phyllo ) while pointing towards magnetometer. That would mean we aren’t capable of picking up the moment when the field is strongest.
In addition, we have not done any tests with as much magnetic noise as there will be due to the Phyllo’s motors. And we have not yet received the motors, we have not done any tests with magnets rotating at 30 RPS. The magnetometer can be fast (up to 1MHz in SPI), and the sensor even faster (up to 20MHz if we read it directly), but even if that turned out to be fast enough to precisely detect the variations of field strength all along one rotation, it’s only one issue out of many.
This is why we are going back to our original idea based on IR.
Previous mentions of our ideas for IR detection can be found in this post.
The main idea we’re currently entertaining is to use a rotating receptor to detect IR signals emitted from Phyllos all around, and to modulate this signal in order to :
- encode the identifier of the emitting Phyllos
- recognize and discard non-Phyllo IR sources
First, we need to assign a unique identifier to each Phyllo and make sure that each Phyllo knows who the other active Phyllos are.
One possibility would be to use UDP broadcast in WiFi: The scenario would then be as follows:
- Each Phyllo broadcast an “I am alive” signal at regular intervals with its IP.
- The other Phyllos enter their IP in their running Phyllos table.
- After a while (let’s say a minute), if one Phyllo has not heard the broadcast of another, it will remove it from its active Phyllos table.
The identifiers could be dynamically assigned on the spot, or be attributed at the time of conception, like a serial number.
In a previous post, we mentioned that IR reflections could be a serious issue
Thanks to Alexis, we eventually realized that this issue with reflections was not nearly as deal-breaking as we first thought : by using weak transmitters, we should manage to only produce reflections weak enough to pass undetected and to detect only the nearest Phyllos.
So we dusted off our previous idea of using several fixed transmitters covering 360 ° and a rotating receiver which allows us to detect the direction of a neighboring Phyllo.
Furthermore, instead of taking turns at transmitting the identifier of a Phyllo in Wifi while it is on, we plan to encode the identifier of the Phyllo by modulating the IR it emits, which will also allow us to detect them all simultaneously and will cut back on the time spent synchronizing over Wifi.
As soon as possible, tests will be done to adjust this method and the required components. We will keep you informed ! 🙂