What I Accomplished This Week
UART frame receiver. I wrote a C module to receive and parse Jeffrey’s UART packet format, including sync bytes, length, packet data, and CRC-16. I also tested it on my laptop without needing the Pico. The CRC values matched Jeffrey’s implementation: 0x29B1 for the standard test string and 0x369B for his test frame. All nine automated tests passed, covering garbage data before a frame, invalid lengths, back-to-back frames, minimum and maximum packet sizes, and a stress test with 1,000 frames. I also wrote send_frames.py to generate test data and simulate the Pico.
Firmware v3. I updated the tag firmware to read UART frames, discard invalid ones, and put valid packets into the periodic advertising data. The payload can carry up to 88 bytes, which is within the anchor’s 255-byte limit. The 160-microsecond CTE continues running while the tag sends the data. I also added two LEDs to help check the receiver’s status. After flashing the firmware, I sent 20 frames per second from my laptop. The first LED flashed continuously, while the second stayed off. When I introduced bad frames and random bytes, the second LED started flickering, confirming that the firmware was detecting bad frames.
Pin selection. While checking the board files, I noticed that my original pin choice was shared with the radio’s antenna switch and SPI. I changed it to the board’s built-in Arduino serial port on D0.
Firmware v3.1. I made the tag ID and advertising interval configurable through build settings. I also built the versions needed for next week’s tests, with intervals of 50, 30, and 25 ms. The serial log confirms that the test build uses tag ID 000000000002 and a 30 ms interval.
I also collected the test outputs, build logs, LED test video, serial log, and pin analysis, and updated the firmware notes. The build uses about 20% of flash and 15% of RAM.
I spent approximately 16 hours on the project this week.
Is My Progress on Schedule?
The firmware work and everything I could test independently are done. The IMU test and power measurements are also still pending because I don’t have access to an IMU board or a current meter yet.
Verification
The signal subsystem needs to meet several requirements from our design review. The average angle error should be no more than 2.45 degrees, with a standard deviation of no more than 0.8 degrees, to keep the lane position error below 1.07 m. The system should also receive packets reliably at distances up to 25 m in line of sight, keep packet loss below 5%, maintain end-to-end latency under 1 second, and allow the tag to run for at least 4 hours on a 150 mAh battery.
So far, I have completed several initial tests. For the anchor command link, I found that the anchor occasionally missed individual characters in incoming commands. In the first test, 11 out of 200 commands failed. After adding a 2 ms delay between characters, all 200 commands were received correctly. I still need to run a longer test with 1,000 commands to make sure this is consistent. I also tested the tag-to-anchor link. During the first live test, the anchor received about 92% of the tag’s transmissions, at a rate of roughly 18 packets per second. The reported angle also changed smoothly as I moved the tag. For the packet receiver, all nine automated tests using Jeffrey’s test frame passed. I also tested the firmware with 20 generated frames per second. When I introduced damaged frames, the receiver rejected them instead of forwarding them to the anchor.
The next step is to collect enough data to check the angle accuracy. I plan to test 28 fixed positions, covering angles from -60 to +60 degrees and distances of 5, 10, 15, and 25 m, with 500 samples at each position. I will measure the positions with a tape and compare the reported angles with the actual angles. For each position, I will calculate the mean error, standard deviation, maximum error, and percentage of samples within 2.45 degrees. I will also calculate the overall mean absolute error. Before collecting the data, I will calibrate out any fixed angle offset at 0 degrees. The target is a mean absolute error of no more than 2.45 degrees and a standard deviation of no more than 0.8 degrees. I will also convert the angle error into sideways position error using distance × tan(angle error) and check whether it stays below 1.07 m, which is half a lane width, including at 25 m.
For packet loss, I will use the packet counter to identify transmissions that never reach the anchor. I plan to test advertising intervals of 50, 30, and 25 ms, followed by 10-minute runs. The target is to keep packet loss below 5%. Since each packet is sent twice, the expected loss would be around 0.6% if the two transmission failures are independent. However, I still need to check whether packet losses actually occur independently rather than assuming that they do.
I also need to test the system at different distances, up to 25 m, and check how it performs near the pool with a moving tag and water splashing. I will record the reception rate, packet loss, and RSSI at each distance. For the enclosure test, I will compare the tag in three conditions: without a cover, inside a plastic bag, and taped to the forearm. The tests will be done at a fixed distance of 1 m. I will compare RSSI, the number of received events per second, and angle variation to see whether the enclosure or the position on the body affects performance. Both tests should meet the packet loss and angle accuracy requirements.
For latency, I plan to record the tag event and the corresponding dashboard update on video and repeat this for 20 events. I will measure the time between the two and report both the median and worst-case latency. The requirement is to stay below 1 second. For battery life, I will measure the tag’s average current consumption if I can borrow a current meter. If the meter is unavailable, I will use the datasheet values to make an estimate. The calculation will use 80% of the 150 mAh battery capacity as usable capacity, divided by the average current. The target is at least 4 hours of operation.
Finally, I will test multiple tags and check the anchor’s current limit of 25 tags. I will record whether the anchor can receive the angle data from each tag and how long it takes to switch between tags. The results will also help determine whether the tag-count requirement needs to be updated.
If any test does not meet its target, I will first try changes that are relatively easy to make. For example, I can reduce the advertising interval if packet loss is too high, adjust the anchor position or recalibrate if the angle error is too large, and make the enclosure thinner or change its position if it affects reception. I will record the number of samples and actual results for each test so that the conclusions are supported by the measurements.
Deliverables for Next Week
- Testing with Matthew: Verify that forwarded packets reach the anchor with a valid CRC, including both normal and stress tests. Run timing tests at 50, 30, and 25 ms, check the angle at 1 m, and test the enclosure.
- Testing with Jeffrey: Connect the Pico to the DK and verify the complete UART data path, with his Raspberry Pi reading the data from the anchor.
- Accuracy testing: Complete the first part of the test at 5 m and 10 m.