fotoopa Posted February 25, 2023 Posted February 25, 2023 (edited) Bluetooth hub to hub speed test. The setup show 2 Lego RI 51515 hubs connected via bluetooth to transfer data. The setup uses the Maindstorms word blocks program to write both programs. I use a force sensor to forward a bluetooth command. Each time the push button level changes a 0 or 1 value is sent to the other hub. The picoscope is used to measure various signals from the sensors. This allows me to know exactly when a Bluetooth command will be sent. The RX hub uses a distance sensor whose 4 lights I turn on or off. To measure the signals, I cut the sensor cables and reconnected them via a connector PCB with measurement pins. The sensor signals are available on pins 5 and 6 of each port. These are ideal for real-time measurement. The Picoscope has 4 channels and has a large buffer memory. Thus, all data can be stored over several seconds. These are used for extensive analysis. Here you see both small programs, one for the RX side and one for the TX side. I would have liked to use the lego 3x3 led matrix along the TX side but Lego does not support this sensor in the Maindstorm program. Later I will be able to use it with the Pybricks Python software. With the led 3x3 matrix included, it becomes much easier to analyze scope signals. On ch-B you see the data from the force sensor. The first byte of the data is the CMD byte $D0 followed by 4 data bytes, then the checksum. The 3rd byte we see once 1 and then on the next string a 0. This is the point where the sensor will give a release action in the blocks program. The Bluetooth outout will change as a result. To this, the RX hub can respond by turning off the 4 LEDs on the distance sensor. You can see this LED value at ch-C in the data string. It is indicated on the drawing (4 bytes 00). We measure here a delay of 46.97 ms. By performing several measurements one after another, we see that this time can vary quite a bit. Sometimes this is around 25ms but it can also be above 100ms. Programming with Python is also not a solution because certain functions are not available with the Lego RI 515 software. If we use the new Spike 3.2.2 version, Python is not included, they might provide it in the near future, but after several months of waiting, our hopes are gone. With Lego's decision to no longer supply the RI 51515 kit it becomes completely hopeless. There is also no support for the technic hub version. You can only interchange between the RI hubs. Then let's see what we can do with Pybricks. Here you see both python programs, for the TX and RX sides. Since Pybricks supports many more hubs types, sensors and motors, I have now been able to add an led 3x3 matrix in the TX setup. The led 3x3 output allows additional measurement values to be added for the picoscope. This makes looking up the Bluetooth changes easier. These extra commands for the 3x3 LEDs do not directly affect the speed because the pressure sensor state will never change that fast. On the scope, that LED control is very clear. The light value of the distance sensor LEDs can also be set very precisely. I use a very low value of 5% here because the LED can be photographed better without overexposure. This value of 5 you see then also in the picoscope data value. You can use the same Python program both on the RI hub and on the Technic hub or even when combining both. I tested the 4 possibilities: RI - RI hub RI - Technic hub Technic hub - RI hub Technic hub - Technic hub. The results were really surprising. First, let's take the version Technic hub - Technic hub. This was not so good. The variation in delays are very large. Sometimes it is fast down to 15ms other times it can be very long to over 300ms. All tests were done with the program running in the hub and the online web version disabled. You can now also clearly see the LED 3x3 matrix data on ch-A of the picoscope and the 2 x consecutive output as a reference position where there is a change in the Bluetooth data. The next option was with an RI hub and a technic hub. The results were the same for: RI - Technic or Technic - RI Again the times could vary quite a bit but the max time was still quite low though, around the 65 ms while there were also very low times as low as 1 ms. Over several measurements the average value was around 30 ms. This is already a very good result. As soon as one of the hubs is an RI hub it becomes very reliable and the values are quite good. Now the RI-RI version: This combination works perfect. The max times are arround 6 ms, most of them just above the 2 ms, minimum 1 ms. The results are also very stable. You can see a total overview of a measurement above. Note: The Pybricks Python version is a test release. You must use these versions to program the hub. https://pybricks.com/projects/tutorials/wireless/hub-to-hub/broadcast/ fotoopa. Edited February 25, 2023 by fotoopa Type errors Quote
Jurss Posted February 26, 2023 Posted February 26, 2023 No use for me, but kudos for work done. For somebody definately will be usable. Quote
Repkovsky Posted February 27, 2023 Posted February 27, 2023 Great work! Could you summarize these results in some table? Quote
fotoopa Posted February 27, 2023 Author Posted February 27, 2023 Thanks @Jurss and @Repkovsky I just finished a demo setup. A total of 6 hubs have been used and each hub has a motor. The aim is to start all motors synchronously. There is an LED3x3 matrix on the transmitter and on the receivers a Color sensor and the Distance sensor. With these LEDs together you can see how quickly everything reacts. 4 Technic hub and 2 RI hub have been used. One of the RI hubs is the transmitter, all 5 other hubs are receivers and the commands are broadcast via Bluetooth from the TX (RI) hub. I'm going to make a video and it will be online soon. Frans. Quote
fotoopa Posted February 27, 2023 Author Posted February 27, 2023 (edited) Here is the setup with 6 lego hubs to test the Bluetooth broadcast speed. DSC08315update by Frans, on Flickr The video has been recorded but still needs editing. Frans. Edited February 27, 2023 by fotoopa Quote
fotoopa Posted March 1, 2023 Author Posted March 1, 2023 Lego hub to hub speed test with Pybricks beta software Boadcast. Here I made a short video to better see the results. The video show 6 hubs, 2x RI hub, 4x Technic hub. The master is the RI hub to broadcast a CMD to the 5 other Lego hubs. The LED 3x3 matrix is connected to the first TX RI hub, which lights up as soon as the command is passed on. Furthermore, 2 sensors with LEDs are connected, the distance sensor to an RI hub and the color sensor to a Technic hub. In most cases, the LEDs all go on and off at the same time. This means that there is only a very small time difference between the different LEDs. However, I have found another place where there is a clear difference. The video was recorded at 50 frames per second. Whenever there is a visible delay of an extra frame, this corresponds to a delay between 0 and 20 msec. For example, you sometimes see that the LEDs have not yet reached full brightness. This means that that frame was not exposed for the full 20 msec. To better visualize this sequence, I repeated the same frame 50x at that location. We now clearly see that the RI hub responds much faster than the Technic hub. I've rendered those special extended frames with a constant tone. hubtohub v6 by Frans, on Flickr I also made the test with the Technic hub as master but the results were not stable enough to use. It works best with the RI hub as master and even better with 2x RI hubs. I don't have any more RI hubs to expand the tests. The video is on my Flickr page. Frans. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.