Hi, I’m Albert

This is where I post about projects and leanings from the past and present in the hope that someone else (my future self included) will find them useful. You can contact me on social media, or email at “mail” on this domain.

  • Find the type of a variable in Rust

    I was trying to make an abstraction in Rust and found myself navigating a lot of code to determine the type of pwm below so I could put it in a struct: A quicker way to find it is to add an empty type, : () and check the compilation error: I’m using Visual Studio Code with the Rust Analyzer plugin and there I immediately get the error and can copy the type by hovering on the line: So there you have it, the type was as simple as this – no wonder I gave up on trying to find…

    Read more

  • How to close an unresponsive SSH session

    If you work on embedded Linux systems, those Docker container thingies, play around with Raspberry Pi or anything in between, you may occasionally find yourself on your main computer connected to the target via SSH when it suddenly hangs or gets rebooted, rendering your SSH session unresponsive. Sometimes when this happens, the SSH session gets disconnected automatically and you can start a new one. In other cases, the terminal with SSH open freezes and your usual hotkeys like ctrl + D do nothing. This is because ctrl + D key presses are usually transferred to the target and the disconnecting…

    Read more

  • Strict Aliasing – yet another way for C-code to blow up

    Recently, I got to learn about Strict Aliasing in C. It is yet another thing that can cause your C code work perfectly fine today and then blow up because of Undefined Behavior down the line. One example of what not to do is casting an array of uint8_t (like a payload from a communications protocol) into a struct (like the message you are receiving): A better way is to use memcpy: One reason this kind or “reinterpret cast” is not allowed is that you can’t be sure that accessing a field within the struct after typecasting will be a…

    Read more

  • Embedded Rust Toolchains

    I recently started learning Embedded Rust. As I mentioned at the top of the last post, there are a couple of toolchain options: OpenOCD + GDB probe-rs + cargo-embed Turns out there is also a third one that I just discovered: probe-rs + probe-run This was a little confusing at first, I was unsure what was the better option and how these projects all connect to each other. Embedded Rust seems to be moving fast, so this might get outdated but here is a basic summary if you are just getting into Embedded Rust as well. The Embedded Rust way…

    Read more

  • Embedded Rust: Timer Timeout Problem

    TL;DR: When doing timing critical stuff, use the –release flag to get a faster binary!For example: cargo embed –release. I’m learning Embedded Rust on a STM32 Bluepill board (with a STM32F103 microcontroller). At the time of writing there seems to be two toolchain options: The “official” Embedded Rust way, using OpenOCD and ARM-compatible GDB. Up-and-coming probe-rs that is working on having everything in Rust and installable via cargo. Their tool cargo-embed basically replaces OpenOCD and GDB. OpenOCD + GDB is true and tested, but a lot more work to set up. Probe-rs is litteraly just cargo install cargo-embed, but it…

    Read more

  • NB-IoT and LTE-M Covarage Maps

    Here are some links to coverage maps for NB-IoT and LTE-M in Scandinavia. The GSMA also has a global deployment map here:https://www.gsma.com/iot/deployment-map/ Denmark Telia – https://www.telia.dk/privat/hjalp/dakning-og-drift/iot-dakningskort/ Finland Telia – https://www.telia.fi/asiakastuki/verkko/verkko/verkkokartta Norway Telia – https://telia.no/dekningskart Telenor – https://www.telenor.no/bedrift/iot/dekning/#map Sweden Telia – https://www.telia.se/privat/support/tackningskartor

    Read more

  • Talk: Cellular Connectivity for IoT

    In 2018, I had the great honor to speak at the NDC conference in Oslo.  At the time, I was working with cellular connectivity for IoT at nordic mobile operator Telia, and I titled the talk accordingly. NDC is mainly a developer conference, so the talk was intended as an introduction to cellular IoT for the “Rasppberry Pi and Arduino crowd” that I anticipated would show up. I went into the difference between NB-IoT and LTE-M as well as between chips, modules and boards. Probably the best part however, if I may say so myself, was the last one, where…

    Read more

  • LED bed light

    I have been working on my own custom wakeup-light on and off for several years (part 1, part 2, part 3). After getting Philips Hue lights, however, I have not gotten around to setting it up in my new apartment. So recently, when the need came along, I figured the quarter round rod I used for that project might also make a pretty nice looking bed light. Version 1 I cut one of the old rods to length and taped it to the headboard to see how it would look: This could work! I borrowed the old driver board from…

    Read more

  • Kodama Trinus 3D-printer upgrades

    At work, we recently got the Kodama Trinus combined 3D-printer and laser engraver. I’m pretty happy with the overall quality of the printer so far, but for our use I immediately identified some areas of improvement: No power switch – the only way to turn the printer off is by unplugging the cord. No lights inside the enclosure – we got the additional enclosure, but it came without any lights inside. No network interface – you have to connect to the printer via USB directly or go get the SD-card. Also no way to control or monitor it remotely. So…

    Read more

  • Alarm Clock v0.1.0

    We wanted to try banning phones from the bedroom (you should try, I recommend it!). Clearly, a suitable hardware replacing the alarm clock app was needed. Having thought about building my own alarm clock for a while, I quickly determined it was not a viable option to just go buy one – there simply did not exist a model with all the features I had thought of and now needed to have, like for example: Weekly schedule (no alarm on weekends) Smarter snooze (configurable and longer) Integrated with wakeup-lights and the rest of the appartment Configurable from other devices Programmable/extendable…

    Read more