dukecarge

Forever aspiring Himbo

  • he/him

29 | he/him | medical embedded devices engineer | big brain on the clock, small brain off the clock | bi |Lei Zardo @ exodus (Caught up) | BR nos EUA


Discord
dukecarge

This is about the 4th or 5th time I've run into limitations with hobbyist grade code and libraries. And it's always the same small leap that causes my issues.

I work in medical devices and a lot of the time I need to mock up proof of concepts for data collection. You would think I would revel in the existence of easy-to-use hobby libraries that talk to my peripherals (arduino, CircuitPython, etc), but I don't.

I think that hobbyist libraries leave a lot to be desired for anyone that wants to reach above their level, and do a minor disservice to their users in not letting them understand it better or even give the option.

This is one of my rants, so expected if you would like to not pay attention.


I can give a few examples off the top of my head:

  1. Arduino Library timers are not as fast as they could be (2018 version at least). I had to purposefully look up my chipset's register addresses to bypass the Timer interface and set my own low-level isr timer to be able to read temperatures at 10ms intervals.

  2. Sparkfun and Adafruit's C++ implementations of reading LIS3DH accelerometers are inaccurate due to failing to bitshift a left-justified, 10-bit number.

  3. A lack of recontextualizing what programming a microcontroller entails produces a lot of barely functional code. The EEG library I rewrote from an Arduino user came with a comment that their micro was not "fast enough" to output data at 115200 baud, and it turns out it just needed a slight polling restructure. Had the user been better briefed on loop() and isr() they could have made that arduino rocket to 1Mbit if they wanted to.

  4. Libraries from hobbyist sources are often missing critical functionality such as setting interrupt conditions and instead just... Do the math and don't rely on the peripheral's features. No, you don't need to average to detect motion, literally just read your interrupt registers! They do that for you!

They're all simple enough to get started with, but the second you want something a little more performant, time critical or just to read one more byte, they tend to fall apart. My recommendation is usually take their code bones and flesh them out.


You must log in to comment.

in reply to @dukecarge's post: