Since Friday, Xavier and I have worked on the placement and routing of the main rotating PCB. We have a lot of constraints to place the components of this PCB, notably for the IR which is used for the detection of other Phyllos and the reception of the common time reference, and the IrDA, used to communicate between the fixed and mobile parts.
The IrDA would be used to send speed commands from the rotating part to the fixed PCB below, which controls the motor. This fixed PCB will handle the feedback control of the motor, so we really only need to send it a target speed with the IRdA. As such, even very slow communications would suffice, as we won’t need to change the speed very often.
As Xavier explained in his post, with the Dshot protocol, the speed information is encoded in the first 11 bits of a Dshot frame. Even if we only managed to transmit one bit per rotation, this would allow a speed update roughly every second, depending on the rotation speed (this is not to be confused with the feedback control rate of the fixed PCB, which will closely monitor the motor speed and if necessary apply corrections much more frequently.
IrDA transceivers guarantee reliable transmission in a 30° cone. In order to maximize our possible transmission time, we had placed the IrDA as close as possible to the center of the Phyllo (that is, as close as possible to the center on the main PCB and as close as possible to the motor on the fixed PCB). But Friday, we had news of the school mechanic: to fix the axis to the PVC plate which will support the main PCB, he wants to use a circular metal piece with a 5cm diameter. This would mean that no component can protrude inside a 5cm diameter disc in the center of the main PCB. We therefore had to shift the IrDA transceiver farther to the edge of the main PCB, thus reducing our possibilities of transmission – however, as mentioned above, even very slow communications could suffice.
But when we then talked to Alexis Friday, he ended up telling us to completely remove the IrDA transceiver and to rely only on the ESP32s to communicate between the fixed part and the rotating part. The thing is, there’s another potential problem with IRdA : as we’re also using IR for other purposes there could be problematic interferences.
Now that we’ve had to get rid of IrDA, we’re still using IR for two different tasks: detecting other phyllos and receiving the common time reference.
As explained in this post, the plan to use one IR receiver to detect the direction of neighbouring Phyllos and two powerful IR emitters inside the hull of the phyllos to emit IR through the hull in all directions. We’re more and more convinced that this through-the-hull omnidirectional emision will not work quite as well as hoped for, so we’ve added 8 side-looking LEDs protruding in all directions from under the main PCB. On top of that, there are 4 additional IR receivers, also pointing in all directions, to detect the common time reference (as explained in this post).
Here is how we place the 4 IR receivers for the common time reference to cover 360°. That way, there aren’t any blind spot, so we don’t lose time while receiving this time reference.
Then, I have added the directive receiver for Phyllos detection and side-looking IR LEDs, trying minimize the reduction of the field of vision.
In that same discussion with Alexis last Friday, we evoked the possibility that after all the common time reference could maybe be sent purely via WiFi. This would remove the need for the 4 additional receivers, and simplify the sharing of the common time reference. You can read more about this possibility and the test we plan to make in this post.
We have a hard time figuring how to choose our IR receiver.
To detect the direction of a neighboring Phyllo, the idea is to use the receiver to detect two angles: when the other Phyllo’s emitter first enter the receiver’s field of vision, and when it exits. In this scenario, the emitter is merely continuously emitting. We can then compute the direction as the middle angle between these two angles. We also previously figured that a more directive receiver could only improve the accuracy of the result.
But as it turns out, things are slightly more complicated than that and we have to take the receiver’s quirks into consideration.
A lot of different receivers
IR communication is actually really simple : the emitter is a simple IR diode sending a modulated signal, with a carrier frequency (from 30kHz to 56kHz, depending on the receiver). The receiver is composed of an amplifier and a limiter (for noise reduction and gain control), then a pass-band filter centered on the carrier frequency, and finally a demodulateur, an integrator and a comparator. The output is 1 if the receiver receives nothing (it’s a gap), and 0 when the receiver receives a carrier at its frequency for enough time (it’s a burst).
Each receiver has a determined frequency, a minimal burst length and a minimal gap length.
In addition, receivers have different types of gain control (AGCx), and AGCx impose maximum burst times, which are given in this document. We have to take those parameters into account to choose our IR receiver.
The maximum and minimum burst length of the receivers complicate the situation. Of the emitters stays in the receivers field of vision for a shorter time than the duration of the minimum burst length, the receiver might not detect anything at all. On the other hand, if it stays longer than the maximum burst duration, the Automatic Gain Control of the receiver might become temporarily overwhelmed and fail to immediately notice when the emitter exits the field of vision. In that case, the second angle would be off due to the delay, and therefore the computed direction as well. We’re not actually sure what exactly would actually happen or what delay this could result in, as the receivers datasheet says little on the subject.
The amount of time an emitter stays in the field of view of the receiver depends on the rotation speed and the angle of the field of view. As our speed will vary between roughly 10 RPS and 30 RPS, we would need a field of view wide enough to see an emitter for longer than the minimum burst duration when going at the highest speed, and narrow enough to see it for less than the maximum burst duration when going at the lowest speed. This doesn’t leave us much of a margin.
During our IR tests, with a heat-shrink tube attached to the receiver, we had a viewing angle of about 20 °. So the emitter is in the field of view of the receiver for between 1.8ms (at 30RPS) to 5.5ms (at 10RPS). If we want the AGC to be working, we cannot send a continuous IR stream (maximum burst length of 1.8ms for AGC2). To be able to use a continuous IR stream, we could reduce the receiver viewing angle to 6.4° (so that the emitter stays in the field of view of the receiver less than 1.8ms at 10RPS. But if we do that, when the Phyllo rotates at its maximum speed (30 RPS), the emitter stays in the field of view of the receiver almost less than the minimum burst length.
On top of that, so far we’ve approximated the IR emitter to a single point, but in reality we’ll use several emitters, which means the IR source will have a width which we must take into account.
We will run some more tests today to determine how the AGC reacts to different burst lengths and to measure the viewing angle of the receiver with more accuracy.
If it turns out that continuous IR is not practical, we can send non-continuous IR frames and set the on and off times in software.
In that case, reducing the field of view carries a risk: that the receiver only sees the emitter when it is off (during a gap). We have to choose the receiver field of view wide enough to be able to receive more than the minimal burst length before the emitter exits the field of view of the receiver, even if the emitter has just started a gap before entering the field of view.
In a nutshell, we have to choose on and off times such as :
With that method, the receiver will detect several rising and falling edges while the emitter is in its field of view, as the emitter will not be emitting continuously. We would then use a timeout to infer the first rising edge and the last falling edge and use those to determine the two angles we need. The (slight) downside of this method is that the gaps in the emission mean these angles could be a bit off. To limit this we would take gap times as short as possible. On top of that, we can repeat this whole procedure for several rotations to average out the inaccuracies.
During our tests, we will also try to send a signal with those characteristics and see if we haven’t any trouble receiving it correctly. We will keep you posted !