Hacker News new | ask | show | jobs
by rapjr9 888 days ago
Bluetooth is indeed very complex, the complete spec runs into thousands of pages. The Nordic SDK has more than 100,000 lines of code in it, and the proprietary stack (which they don't give you source code for) is probably another 100,000 lines of code. Nordic tries to get you to buy their software development services for Bluetooth, which may explain why their example code is not the greatest in my opinion (for example they provide an example of handling interrupts and an example of connecting to multiple devices, but no example of doing both at the same time and you can't just put the two examples together.) Nordic's SDK is a wrapper around the Bluetooth stack, so you not only have to understand Bluetooth itself, you have to learn Nordic's wrapper around it. They kept changing the stack and SDK and the chips themselves every few months (look at their part number histories) as well so any code you wrote went out of date quickly. There is speculation that large manufacturers love Bluetooth because it is a large barrier to entry for smaller companies, unlike say ANT+. I got ANT+ working on an embedded device in a month. I spent two years trying to get Bluetooth to work on the same device (admittedly in a more complicated configuration with multiple simultaneous channels) and I've spent a decade doing embedded programming with wireless radios. Most developers just use an example program with little modification, so they don't handle errors well or think about recovery from bad situations or do security/encryption. Human bodies block Bluetooth signals. I had a test device about 3 feet from a laptop where I was running long term tests of the radio, the data stopped every time I stood between the device and laptop. We were using Bluetooth based body worn sensors with a custom smartwatch so this was a problem for us, if someone put the smartwatch hand behind their back or under their arm all communication stopped. Put your phone in your back pocket and it will miss most packets from your smartwatch. This comes from using the 2.4GHz frequency, VHF radios are much more robust in getting around bodies and through obstacles. Bluetooth is just the wrong technology for many of the things it is used for, but it became ubiquitous in smartphones so now we're stuck with it.