ciesie.com https://ciesie.com/ Recent content on ciesie.com Hugo -- gohugo.io en[email protected] (Michał Ciesielski)[email protected] (Michał Ciesielski) Parsing JSON-RPC in C https://ciesie.com/post/json_rpc_blows/ Sat, 31 Jan 2026[email protected] (Michał Ciesielski) https://ciesie.com/post/json_rpc_blows/ <h1 id="yeah-youre-not-convincing-me-that-json-rpc-is-a-real-protocol">Yeah you&rsquo;re not convincing me that JSON-RPC is a real protocol<a href="#yeah-youre-not-convincing-me-that-json-rpc-is-a-real-protocol"> &lt;</a> </h1> <p>Let&rsquo;s deal with JSON-RPC in C! Something I don&rsquo;t ever want to hear when sipping an iced coffee, during a sunny, June afternoon. Fortunately, it&rsquo;s January and I haven&rsquo;t seen the sun in a while! This article is sponsored by my lack of vitamin D!</p> <p>I have been building my own <a href="https://moonraker.readthedocs.io/en/latest/">Moonraker</a> GUI client. Inspired by <a href="https://docs.mainsail.xyz/">Mainsail</a> and <a href="https://docs.fluidd.xyz/">Fluidd</a> but not a web application. I want to get more experience in immediate GUI paradigm and memory management through different types of allocators. I&rsquo;ll write about that project soon, but today I&rsquo;ll be focusing on a small part of it. That part is &ldquo;parsing JSON-RPC messages using C, but honestly not fully even, just a part of them&rdquo;.</p> Things I'm looking forward to in 2026 https://ciesie.com/post/looking_forward_2026/ Mon, 19 Jan 2026[email protected] (Michał Ciesielski) https://ciesie.com/post/looking_forward_2026/ <h2 id="ai-wheels-coming-off">AI wheels coming off<a href="#ai-wheels-coming-off"> &lt;</a> </h2> <p>Do you remember <a href="https://www.theguardian.com/technology/2022/jun/12/google-engineer-ai-bot-sentient-blake-lemoine">people loudly proclaiming we’ve built a sentient intelligence</a>?</p> <p>Because you should. Those people should be remembered as the first line of “intellectuals” that has fallen to the onslaught of AI propaganda. AI is a marketing term and in the last few years it has become a test, just like NFTs, testing your resilience to corporate propaganda.</p> <div style="width: auto; height: auto; margin-left: auto; margin-right: auto;"> <figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"> <a href="https://ciesie.com/imgs/91baf3_ilyaBarelyConscious.jpg"> <img itemprop="thumbnail" src="https://ciesie.com/imgs/91baf3_ilyaBarelyConscious.jpg" alt="&#39;Slightly&#39; is doing a lot of heavy lifting here..." style="max-width: 100%; height: auto; object-fit: scale-down;"> </a> <figcaption> &#39;Slightly&#39; is doing a lot of heavy lifting here... </figcaption> </figure> </div> <p>Many have fallen, many are still in the trenches, slowly falling for the trick that are LLMs. I do recognize I might need to employ more empathy here. Seems AI <a href="https://en.wikipedia.org/wiki/Chatbot_psychosis">triggers literal psychosis</a> in some people.</p> Ender 3 and the power of 3D printing community https://ciesie.com/post/3dcommunity_is_literally_jesus/ Wed, 16 Jul 2025[email protected] (Michał Ciesielski) https://ciesie.com/post/3dcommunity_is_literally_jesus/ <p>I really like my Ender 3. After several necessary upgrades, I think I&rsquo;ve reached a place where it&rsquo;s dependable and I know it well enough to fix most of the issues. Moving apartments forced me to pull it apart. That became a perfect opportunity to build it back up into something better.</p> <p>I&rsquo;ve always had an issue with leveling the bed - me, and everyone else who bought this printer. For a short period I have managed with a glue stick. It was time to look into bed probes. At this point there are some very precise solutions, like the <a href="https://cartographer3d.com/">Cartographer 3D</a>, but that felt like too much complexity and too much fidelity for such an unsophisticated printer.</p> Well, it seems you just don't like programming https://ciesie.com/post/coding_with_ai/ Mon, 03 Feb 2025[email protected] (Michał Ciesielski) https://ciesie.com/post/coding_with_ai/ <p>I already tried to write a blog post about AI. An article, discussing AI generated art, still festers in my drafts folder. As someone who enjoys 3D modelling, drawing, animating, someone who believes in art lifting our spirits, I find it pointless and distasteful. Not much to discuss.</p> <p>Here are some loose thoughts about AI, mostly from software development perspective, but not unique to it.</p> <p>I see coding as both a skill, which enables me to build things I want to build, and an intellectual exercise. Like any other discipline, it doesn&rsquo;t have sharp borders. If you&rsquo;re receptive, if you pay attention, you&rsquo;ll learn things that apply outside of computer science. Underlying principles behind coding tell a bigger story, about systems, math, logic, or effective communication of ideas. Diving deeper into these ideas can become a source of great, personal satisfaction.</p> Update for December, 'here we go again' 2024 https://ciesie.com/post/update_01122024/ Sun, 01 Dec 2024[email protected] (Michał Ciesielski) https://ciesie.com/post/update_01122024/ <p>It&rsquo;s been a while since I have written one of these. There&rsquo;s definitely a cadence to these. That cadence would be something between once and thrice a year. 2024 will have to make with just one.</p> <p>I have spent a bit of time understanding the <a href="https://github.com/ggerganov/ggwave">ggwave</a> project, which allows for sending data over sound. It&rsquo;s not an extremely complicated protocol. I think the most difficult part to understand is the Reed-Solomon error correction, which is still something I have not delved deep into. I have first started by understanding Fourier Transform well. This started with a Jupyter notebook, but I have quickly moved to using <a href="https://github.com/marimo-team/marimo">Marimo</a>. You can find <a href="https://github.com/MrOneTwo/jupyter_experiments">my repo here</a>, but don&rsquo;t expect it to be polished and guests friendly.</p> Tagged Unions - bag them and tag them https://ciesie.com/post/tagged_unions/ Tue, 25 Jun 2024[email protected] (Michał Ciesielski) https://ciesie.com/post/tagged_unions/ <p>I have recently tried to update my Zig project from 0.11.0 version of Zig, to 0.12.0. Zig compiler brings in its own build system. Since Zig is still under development, that API changes. The 0.12.0 changes forced me to dive a bit deeper into Zig&rsquo;s source code. I went through <a href="https://ziglang.org/documentation/master/std/#src/std/Build.zig">Build.zig</a> and <a href="https://ziglang.org/documentation/master/std/#src/std/Step.zig">Step.zig</a>. What caught my attention was the usage of <a href="https://ziglang.org/documentation/master/#Tagged-union">Tagged Unions</a>.</p> <p>Tagged unions aren&rsquo;t nothing new. C has them&hellip; kind of. In C, the tagged unions are more of a design pattern than a language feature.</p> Custom Linux build for Raspberry PI with Buildroot https://ciesie.com/post/buildroot_nnn/ Wed, 20 Mar 2024[email protected] (Michał Ciesielski) https://ciesie.com/post/buildroot_nnn/ <p>It seems working in embedded means you&rsquo;ll, sooner or later, use a Raspberry PI. At my current work place we use Raspberry PIs, connected to the hardware we&rsquo;re developing for, as Github CI runners. Anytime we want to add a new runner we need to flash an SD card and manually install all the dependencies and tools.</p> <p>What I&rsquo;m looking for is an ability to generate Raspberry PI images, pre-installed with all the necessary (+ some of my favourite) tools. That can be achieved thanks to projects like Yocto or Buildroot. This post relates to the latter, which is considered to be simpler and easier to get started with.</p> Emotional value of the bytes you don't own https://ciesie.com/post/bytes_you_dont_own/ Tue, 08 Mar 2022[email protected] (Michał Ciesielski) https://ciesie.com/post/bytes_you_dont_own/ <p>For a long while now I&rsquo;ve been using <em>Google Photos</em> service to store my photos. Few years ago I&rsquo;ve switched to using <em>iOS</em> devices and <em>Apple</em>&rsquo;s ecosystem. That made me start using <em>Apple Cloud</em> service. I guess my life would be simple if not for the fact that these two places don&rsquo;t store my entire photos collection. Some photos and videos are stored on my local drive, backed up on yet another cloud service.</p> Alternative social media and federation https://ciesie.com/post/alt_social_media/ Sun, 30 Jan 2022[email protected] (Michał Ciesielski) https://ciesie.com/post/alt_social_media/ <p>At this point most people are pretty cynical about social media. The worst offender in that space is <em>Facebook</em>, recently rebranded into <em>Meta</em>. In a world constantly incentivized by profit it&rsquo;s difficult to imagine <em>Meta</em> optimizing for anything else. The striking part was always how cunning and ruthless they are in pursuing profit. Nevertheless, despite many controversies around privacy, usage of personal data and <em>Meta</em>&rsquo;s political involvement <a href="https://www.statista.com/statistics/264810/number-of-monthly-active-facebook-users-worldwide/">services like Facebook grow year after year</a>.</p> Update for September, year of the new hope 2021 https://ciesie.com/post/update_22092021/ Wed, 22 Sep 2021[email protected] (Michał Ciesielski) https://ciesie.com/post/update_22092021/ <p>I&rsquo;ve not written one of those at all this year. Not surprisingly, the most productive year for this website was 2020&hellip; thanks global pandemic&hellip;?</p> <p>I&rsquo;ve posted the <a href="https://ciesie.com/post/rfid_explained/">RFID Explained</a> blog post. I&rsquo;m trying to gather everything I&rsquo;ve learned, while working on my RFID project, in one place. This is an assumption but in the maker&rsquo;s space a lot of technologies are just an Arduino libraries. What I mean by that is that very few people actually learn how a specific technology works. They build a device using Arduino, using the most popular library. I don&rsquo;t think there is anything wrong with that. It was probably one of the goals of the Arduino creator: remove the technical obstacles to make technology more approachable for people without deep technical knowledge. What if you want to learn more? You need to read, often times badly written, documentation spread over multiple websites and documents. Sometimes, if you really want to understand something, you should read the documentation of the standard, which is a document you have to pay for&hellip; My RFID blog post is supposed to be a quickstart for those that want to understand the common RFID solutions.</p> [STM32] - part 4 - CPU goes brrrrr https://ciesie.com/post/stm32_part4/ Sat, 24 Jul 2021[email protected] (Michał Ciesielski) https://ciesie.com/post/stm32_part4/ <p>This is the final part of a series of articles. I&rsquo;d suggest going through <a href="https://ciesie.com/post/stm32_part1/">part 1</a>, <a href="https://ciesie.com/post/stm32_part2/">part 2</a> and <a href="https://ciesie.com/post/stm32_part3/">part 3</a> first.</p> <p>I&rsquo;ve been working on a project (which you can find <a href="https://gitlab.com/MrOneTwo/paw-usb">here</a>), using <a href="https://stm32-base.org/boards/STM32F103C8T6-Blue-Pill.html">Bluepill</a> board with a <em>STM32F103C8T6</em> microcontroller. It&rsquo;s a USB keyboard project. It uses the <em>libopencm3</em> project and I&rsquo;d consider this a pretty minimalistic, baremetal project. It&rsquo;s great for analyzing what happens when a <em>ARM Cortex-M</em> processor boots.</p> <p>Let&rsquo;s analyze the linker script and the final binary of that project to understand more about the boot up of a <em>STM32</em>.</p> You can’t create in a bad environment https://ciesie.com/post/environments/ Thu, 10 Jun 2021[email protected] (Michał Ciesielski) https://ciesie.com/post/environments/ <p>Recently I haven’t been as productive as I’d like. Sure, the pandemic took its toll. The summer is coming and if there is a time to consume what life has to offer, instead of producing what you have to offer, this is it. Productivity should never be the goal in itself.</p> <p>Nevertheless, I could be better at focusing on what’s important. Significant amount of time gets wasted. It’s rarely caused by an unexpected, huge time sinks. It’s usually small things - one YouTube video here, one Twitter doom scrolling there. It’s not about replacing all those moments with work. Your time isn’t something you have to trade for money or self improvement, but it is something you should trade for positive/beneficial things. Before you buy something, you usually ask yourself “is this worth my money?”. The more important question is “is this worth my time?”.</p> [WIP] RFID Explained https://ciesie.com/post/rfid_explained/ Sat, 08 May 2021[email protected] (Michał Ciesielski) https://ciesie.com/post/rfid_explained/ <p>RFID is complex but It&rsquo;s also fun. Personally I find this technology to be a bit underutilized. I&rsquo;d like to explain it in a simple way so you don&rsquo;t have to do the &ldquo;wait, what?&rdquo; through the many, many documentation PDFs. I hope to give you some confidence and maybe inspire you to do something fun with RFID.</p> <p>My experience is that you either grab the cheapest, most popular <strong>MFRC522</strong> based RFID reader and hook it up to Arduino or you go deep down the rabbit hole. I&rsquo;d like to bridge that gap. Enough knowledge that you know where to look for the answers and if you put in a bit of work you&rsquo;ll hopefully be able to write your own driver for a RFID reader. I won&rsquo;t tell you how to design your own PCB with a custom antenna, which, I agree, is a bummer.</p> Perks and difficulties of tech blogging https://ciesie.com/post/technical_blog/ Mon, 01 Feb 2021[email protected] (Michał Ciesielski) https://ciesie.com/post/technical_blog/ <p>Having your own blog is a very interesting experiment. Like any other project it will teach you something. Your writing skills will improve (that&rsquo;s an assumption but it&rsquo;s difficult not to improve if you do it regularly). If you&rsquo;re not writing in your native language, you&rsquo;ll improve in the language you do write in. You&rsquo;ll notice holes in your understanding of the subject you&rsquo;re describing. You&rsquo;ll draw attention of others to your work and, hopefully, you&rsquo;ll help others. There is certainly more, good reasons to have a blog.</p> C as a scripting language thanks to TinyCC https://ciesie.com/post/tinycc_dynamic_compilation/ Thu, 21 Jan 2021[email protected] (Michał Ciesielski) https://ciesie.com/post/tinycc_dynamic_compilation/ <p>This year I&rsquo;d like to play around with music. Mostly live looping. Live looping is a pretty specific way of making music. It&rsquo;s about recording short, simple music clips and overlaying those to create more complex and interesting music.</p> <p>A recent googling session took me to <a href="http://openavproductions.com/">OpenAV</a>&rsquo;s website. It&rsquo;s Harry Van Haaren&rsquo;s initiative. He&rsquo;s focusing on making open source application&rsquo;s for live music performances. You can find the apps&rsquo; code on <a href="https://github.com/openAVproductions/openAV-Ctlra">his Github page</a>. I really recommend checking it out.</p> Update for December, year of total chaos 2020 https://ciesie.com/post/update_06122020/ Sun, 06 Dec 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/update_06122020/ <p>This will be the last update for 2020. We&rsquo;re almost on the other side! We shouldn&rsquo;t expect much out of 2021, since the time doesn&rsquo;t care about our labels. Still, there is a feeling of hope that we&rsquo;ll be able to, slowly, transition to post pandemic world. How will that world look like? Time will tell.</p> <p>Last few months have been very productive for me. For better or worse. It&rsquo;s nice to create and have a lot of fun ideas but&hellip; there is only so much time in a day. Self isolation, working from home, etc. help save time but that means I&rsquo;m working way more than before pandemic. I&rsquo;ll certainly need some quality vacation soon.</p> My terminal, coding workflow - i3, Kakoune, nnn https://ciesie.com/post/i3_kakoune_nnn/ Tue, 17 Nov 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/i3_kakoune_nnn/ <p>If I&rsquo;m working on code or tech related tasks, I&rsquo;m doing it on <em>Linux</em>. That&rsquo;s because I enjoy spending my time in terminal. I like playing around with new command line tools and fitting them into my workflow. Improving my process is important so I often try to update parts of my setup. The goal is to reduce the friction between my intention and execution.</p> <p><em>Linux</em> environment is full of various tools and utilities. I&rsquo;ve always been a fan of <em>Vim</em> but quickly found <em>NeoVim</em>, which is an attempt to modernize <em>Vim</em>&rsquo;s codebase. <em>Vim</em> itself is never enough so I&rsquo;ve started integrating plugins, which in turn introduced me to a lot of smaller tools that further improved my process. Some of those tools have been substituted by a faster and more robust alternative (usually written in <em>Rust</em>).</p> Communication with Blender via Python RPC https://ciesie.com/post/blender_python_rpc/ Sun, 25 Oct 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/blender_python_rpc/ <p>My current 3D graphics setup revolves around <em>Blender</em>, <em>ZBrush</em> and, less often, <em>Marmoset Toolbag 3</em>. Transferring the meshes between <em>ZBrush</em> and <em>Blender</em> is the constant dance of exporting and importing (yes, I know about <em>GoB</em> but it&rsquo;s not good enough for me). I strongly dislike this back and forth. I feel it adds a lot of friction, throws me off and wastes a lot of time. That makes me experiment with inter process communication. This is one of those experiments.</p> Flexbile Python use in Blender https://ciesie.com/post/blender_flexible_python/ Fri, 16 Oct 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/blender_flexible_python/ <p>This post is about using Python in <em>Blender</em>. It&rsquo;s not a tutorial. It&rsquo;s more of an inspiration to learn and experiment with Python.</p> <p>Imagine you work on a piece. The first stage is very experimental. You look for what works and what doesn&rsquo;t. At some point the piece and the process take shape. Some things become repetitive. It&rsquo;s very useful to notice those patterns early and optimize them.</p> <p>Lets say I&rsquo;m working in <em>ZBrush</em> and I want to render in <em>Blender</em>. The geometry moves between those two pretty often. Exporting and importing takes quite a few clicks. All that clicking adds up and nibbles at my, that day&rsquo;s, energy.</p> (Basic) Thoughts on Nim https://ciesie.com/post/thoughts_on_nim_01/ Mon, 31 Aug 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/thoughts_on_nim_01/ <p><strong>Warning</strong>: this is a very opinionated post. I&rsquo;m not claiming I&rsquo;m right. I&rsquo;m describing my observations.</p> <p>This is a great time when it comes to new, fun programming languages. Languages like <em>Rust</em>, <em>Zig</em>, <em>Odin</em>, <em>Nim</em>, <em>Jai</em> bring something new to the table. Those are only the languages I&rsquo;m keeping tabs on. There is way more projects worth following.</p> <p>This post is about <em>Nim</em>. I use a lot of <em>Python</em> and I enjoy it less and less everyday. It&rsquo;s a good language with a great standard library. The community is thriving with great projects. <em>Python2</em> has been put in the freezer which means that soon there will only be one, proper <em>Python</em> version. There is a lot of fundamental things about <em>Python</em> that just don&rsquo;t overlap with my opinions.</p> Update for August, year of total chaos 2020 https://ciesie.com/post/update_18082020/ Tue, 18 Aug 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/update_18082020/ <p>Close to month and a half has passed since the last update. So many things have happened during that time. I&rsquo;ll only write about tech related topics. It&rsquo;s not a hard constraint but it&rsquo;s also not a personal blog about my life.</p> <p>The project that takes most of my free time is the custom controller for CG artists. Unfortunately the <em>BLE</em> version is on hold. I have not been able to fix <em>Windows</em> pairing problems. I have bought <a href="https://www.adafruit.com/product/2267">The Bluefruit LE Friend</a> and uploaded the sniffer firmware. That helps me to fix the advertising packets. I was inspired by the <em>Logitech</em> mouse&rsquo;s sniffed, advertising packets.</p> Song practice app concept https://ciesie.com/post/song_practice_app/ Tue, 07 Jul 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/song_practice_app/ <p>If you&rsquo;ve ever tried to get better at playing a particular song you want to learn, you might want to first learn it in chunks. After you feel good with those chunks you start putting it all together. Then you realize, you still suck at some of those chunks, so you practice them.</p> <p>It would be nice to have a tool that works well for that process. I didn&rsquo;t feel like coding today but I needed to export this idea out of my mind so here is a quick concept I&rsquo;ve put together.</p> Update for July, year of total chaos 2020 https://ciesie.com/post/update_06072020/ Mon, 06 Jul 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/update_06072020/ <p>I&rsquo;m trying something new. I&rsquo;d like to regularly write some sort of an update which explains what I&rsquo;m working on. Since this website doesn&rsquo;t generate any meaningful traffic, I&rsquo;m doing this for myself. I&rsquo;m not imposing any strict time frame on this. I don&rsquo;t want to do this too often, since I don&rsquo;t want my blog to be full of posts like this one. I want the blog section to be useful for weary travellers who look for answers, in this world full of questions! Anyway, lets get to it.</p> Adding comments system to this website https://ciesie.com/post/comments_isso/ Fri, 12 Jun 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/comments_isso/ <p>I&rsquo;ve started this website with the <em>Beautiful Hugo</em> theme. At that point in time I was learning how <em>Hugo</em> works. I knew I wanted to design my own theme, only because I like customizing and designing. The theme I&rsquo;m currently using was designed and written by me. I&rsquo;m not a web developer so it&rsquo;s not professional quality. It&rsquo;s made by me - that&rsquo;s what matters. I&rsquo;ve never implemented a comments system in my own theme. That has recently changed! This website doesn&rsquo;t generate, what people in this lovely place called &ldquo;internet&rdquo; call, traffic. This doesn&rsquo;t change a thing though. The goal was always to share what I&rsquo;ve learned. Some problems don&rsquo;t deserve to be solved twice. If I&rsquo;ve struggled with something silly, you shouldn&rsquo;t. What if you struggle with something I didn&rsquo;t consider to be problematic? Then you should be able to easily ask me about it. That&rsquo;s the reason why introducing comment system seemed to be worth my time.</p> Connecting Ender3 to WiFi with ESP32 https://ciesie.com/post/ender_esp/ Fri, 15 May 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/ender_esp/ <p>If you dabble in 3D printing, you&rsquo;ve probably stumbled upon the <a href="https://octoprint.org/">OctoPrint project</a>. It&rsquo;s a web interface for your printer. It&rsquo;s a very cool project with lots of features. The typical use case is to host <em>OctoPrint</em> on a <em>Raspberry PI</em>. That requires a bit of fiddling around if you want to power it from the printer&rsquo;s power supply. It&rsquo;s a very popular project so finding instructions on how to do it isn&rsquo;t difficult.</p> Microphone stand for Novox NC-1 microphone https://ciesie.com/post/mic_stand_01/ Sat, 02 May 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/mic_stand_01/ <p>I like the idea of small, weekend projects. Something small you can make in a weekend. I&rsquo;ve used the last two days to play around with an idea for a microphone stand. That&rsquo;s because the microphone stand I&rsquo;ve got when buying the microphone is really, really bad. It&rsquo;s unstable and can barely hold the weight of the microphone, which in my case is the <em>Novox NC-1</em> microphone. It&rsquo;s a good entry level microphone, which I&rsquo;ve used to record most of my YouTube videos.</p> Learning Zig - first hour... https://ciesie.com/post/zig_learning_01/ Tue, 31 Mar 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/zig_learning_01/ <p>Today I&rsquo;ve played around with <em>Zig</em>, the new, hip (is it hip?) programming language. I find it pretty neat. I&rsquo;m going to walk you (and myself) through my first, very short, piece of code.</p> <p>Below you can see the entirety of it. It basically allocates a 2MB buffer and reads a file into it&hellip; Yep, not particularly impressive, but this is a judgment free, learning zone, ok?!</p> <div class="highlight"><div class="chroma"> <table class="lntable"><tr><td class="lntd"> <pre tabindex="0" class="chroma"><code><span class="lnt"> 1 </span><span class="lnt"> 2 </span><span class="lnt"> 3 </span><span class="lnt"> 4 </span><span class="lnt"> 5 </span><span class="lnt"> 6 </span><span class="lnt"> 7 </span><span class="lnt"> 8 </span><span class="lnt"> 9 </span><span class="lnt">10 </span><span class="lnt">11 </span><span class="lnt">12 </span><span class="lnt">13 </span><span class="lnt">14 </span><span class="lnt">15 </span><span class="lnt">16 </span><span class="lnt">17 </span><span class="lnt">18 </span><span class="lnt">19 </span><span class="lnt">20 </span><span class="lnt">21 </span><span class="lnt">22 </span><span class="lnt">23 </span><span class="lnt">24 </span><span class="lnt">25 </span><span class="lnt">26 </span><span class="lnt">27 </span><span class="lnt">28 </span><span class="lnt">29 </span><span class="lnt">30 </span></code></pre></td> <td class="lntd"> <pre tabindex="0" class="chroma"><code class="language-zig" data-lang="zig"><span class="line"><span class="cl"><span class="kr">const</span><span class="w"> </span><span class="n">std</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">@import</span><span class="p">(</span><span class="s">&#34;std&#34;</span><span class="p">);</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="kr">const</span><span class="w"> </span><span class="n">warn</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">@import</span><span class="p">(</span><span class="s">&#34;std&#34;</span><span class="p">).</span><span class="n">debug</span><span class="p">.</span><span class="n">warn</span><span class="p">;</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="kr">const</span><span class="w"> </span><span class="n">Allocator</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">std</span><span class="p">.</span><span class="n">mem</span><span class="p">.</span><span class="n">Allocator</span><span class="p">;</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="k">fn</span><span class="w"> </span><span class="nf">readFile</span><span class="p">(</span><span class="n">allocator</span><span class="o">:</span><span class="w"> </span><span class="o">*</span><span class="n">Allocator</span><span class="p">,</span><span class="w"> </span><span class="n">filename</span><span class="o">:</span><span class="w"> </span><span class="p">[]</span><span class="kr">const</span><span class="w"> </span><span class="p">[]</span><span class="kr">const</span><span class="w"> </span><span class="kt">u8</span><span class="p">)</span><span class="w"> </span><span class="o">!</span><span class="p">[]</span><span class="kt">u8</span><span class="w"> </span><span class="p">{</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c1">// Get the full path to the file. </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="w"> </span><span class="kr">const</span><span class="w"> </span><span class="n">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">try</span><span class="w"> </span><span class="n">std</span><span class="p">.</span><span class="n">fs</span><span class="p">.</span><span class="n">path</span><span class="p">.</span><span class="nf">resolve</span><span class="p">(</span><span class="n">allocator</span><span class="p">,</span><span class="w"> </span><span class="n">filename</span><span class="p">);</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="k">defer</span><span class="w"> </span><span class="n">allocator</span><span class="p">.</span><span class="nf">free</span><span class="p">(</span><span class="n">path</span><span class="p">);</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="c1">// Open file, allocate memory of the same size as the file, read file contents into that memory. </span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="w"> </span><span class="kr">const</span><span class="w"> </span><span class="n">f</span><span class="o">:</span><span class="w"> </span><span class="n">std</span><span class="p">.</span><span class="n">fs</span><span class="p">.</span><span class="n">File</span><span class="w"> </span><span class="o">=</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="k">try</span><span class="w"> </span><span class="n">std</span><span class="p">.</span><span class="n">fs</span><span class="p">.</span><span class="nf">openFileAbsolute</span><span class="p">(</span><span class="n">path</span><span class="p">,</span><span class="w"> </span><span class="p">.{</span><span class="w"> </span><span class="p">.</span><span class="n">read</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">true</span><span class="w"> </span><span class="p">});</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="kr">const</span><span class="w"> </span><span class="n">f_stat</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">try</span><span class="w"> </span><span class="n">f</span><span class="p">.</span><span class="nf">stat</span><span class="p">();</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="kr">const</span><span class="w"> </span><span class="n">result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">try</span><span class="w"> </span><span class="n">allocator</span><span class="p">.</span><span class="nf">alloc</span><span class="p">(</span><span class="kt">u8</span><span class="p">,</span><span class="w"> </span><span class="n">f_stat</span><span class="p">.</span><span class="n">size</span><span class="p">);</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="k">errdefer</span><span class="w"> </span><span class="n">allocator</span><span class="p">.</span><span class="nf">free</span><span class="p">(</span><span class="n">result</span><span class="p">);</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="kr">const</span><span class="w"> </span><span class="n">read_result</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">try</span><span class="w"> </span><span class="n">f</span><span class="p">.</span><span class="nf">read</span><span class="p">(</span><span class="n">result</span><span class="p">);</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="n">result</span><span class="p">;</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="p">}</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="kr">pub</span><span class="w"> </span><span class="k">fn</span><span class="w"> </span><span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="o">!</span><span class="kt">void</span><span class="w"> </span><span class="p">{</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="kr">var</span><span class="w"> </span><span class="n">memory</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="mi">2</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1024</span><span class="w"> </span><span class="o">*</span><span class="w"> </span><span class="mi">1024</span><span class="p">]</span><span class="kt">u8</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">undefined</span><span class="p">;</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="kr">const</span><span class="w"> </span><span class="n">allocator</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">std</span><span class="p">.</span><span class="n">heap</span><span class="p">.</span><span class="n">FixedBufferAllocator</span><span class="p">.</span><span class="nf">init</span><span class="p">(</span><span class="o">&amp;</span><span class="n">memory</span><span class="p">).</span><span class="n">allocator</span><span class="p">;</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nf">warn</span><span class="p">(</span><span class="s">&#34;Lets open a file...</span><span class="se">\n</span><span class="s">&#34;</span><span class="p">,</span><span class="w"> </span><span class="p">.{});</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="kr">const</span><span class="w"> </span><span class="n">file_contents</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">try</span><span class="w"> </span><span class="nf">readFile</span><span class="p">(</span><span class="n">allocator</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="p">[</span><span class="n">_</span><span class="p">][]</span><span class="kr">const</span><span class="w"> </span><span class="kt">u8</span><span class="p">{</span><span class="s">&#34;.&#34;</span><span class="p">,</span><span class="w"> </span><span class="s">&#34;Box.gltf&#34;</span><span class="p">});</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nf">warn</span><span class="p">(</span><span class="s">&#34;{x}</span><span class="se">\n</span><span class="s">&#34;</span><span class="p">,</span><span class="w"> </span><span class="p">.{</span><span class="n">file_contents</span><span class="p">});</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="p">}</span></span></span></code></pre></td></tr></table> </div> </div> <p>It starts with adding files to the build process with <code>@import</code> built-in function. What&rsquo;s interesting is that source files are implicitly structs. That&rsquo;s why a typical syntax for declaring variables applies. In <em>Zig</em> you can define methods inside a structure definition. That basically puts the function in a namespace with the name of that struct. So if <code>std</code> is a struct, the methods accessed via <code>std</code> are just functions in that structure namespace.</p> Cool, new language for 2020 https://ciesie.com/post/new_language_2020/ Sat, 28 Mar 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/new_language_2020/ <p>A lot of new programming languages pop up here and there. It&rsquo;s a very interesting moment to pick a new one up. The ones I&rsquo;m interested in are <em>Rust</em>, <em>Nim</em> and <em>Zig</em>.</p> <p><em>Rust</em>? Might be a good choice but it&rsquo;s intimidating. I&rsquo;m not convinced yet that what it brings to the table justifies its difficulty&hellip; <em>Nim</em> is pretty cool. Don&rsquo;t have that much experience writing <em>Nim</em> though. It has a garbage collector, which you can turn off and use your own memory management system. I&rsquo;m not a fan of garbage collection. <em>Zig</em>? C without its problems. At least that&rsquo;s how it markets itself. I&rsquo;m intrigued. There is actually a lot of interesting things <em>Zig</em> does. I&rsquo;d like to mention some of those here and explain we <em>Zig</em> is my pick for <em>what to learn 2020 edition</em>.</p> Derotating image with EXIF orientation https://ciesie.com/post/fspy_exif_orientation/ Sat, 21 Mar 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/fspy_exif_orientation/ <p>If you want to overlay a rendered graphics on top of an image or a static video in Blender you should use the <a href="https://fspy.io">fSpy</a> tool. It matches the camera to specified frame of reference. Unfortunately it doesn&rsquo;t support <em>EXIF</em> meta information. That means that it sometimes fails to properly orient an image.</p> <p>When it comes to an image orientation there are two factors: how image is encoded and the <em>EXIF</em> orientation value. A great explanation can be found <a href="https://www.impulseadventure.com/photo/exif-orientation.html">here</a>.</p> Pointers to pointers in C https://ciesie.com/post/pointers_c/ Sat, 21 Mar 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/pointers_c/ <p>Pointers seem to be the most confusing part about C. It takes a while to fully understand them. As soon as you start feeling what they are about you stumble on a pointer to a pointer. Technically not that much changes but, again, it takes a while to create a solid understanding of what&rsquo;s going on. As they say: you don&rsquo;t understand something if you can&rsquo;t explain it in a simple way.</p> Communication with Blender via sockets https://ciesie.com/post/blender_sockets/ Sat, 15 Feb 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/blender_sockets/ <p>I&rsquo;m always curious about expanding functionality and improving workflow by connecting devices to software that I already enjoy using. I love using <em>Blender</em> and making custom controllers for creating computer graphics is something very interesting to me.</p> <p>As long as a program has a scripting environment or a plugin support, you can usually connect anything you like to it. In one of my previous experiments I&rsquo;ve added a serial communication between <em>Blender</em> and a custom device. It was a bit clunky, obviously. Serial communication isn&rsquo;t something you want to be run as a <em>Blender</em>&rsquo;s subprocess.</p> What problem does it solve? https://ciesie.com/post/solving_which_problem/ Sat, 08 Feb 2020[email protected] (Michał Ciesielski) https://ciesie.com/post/solving_which_problem/ <p>My experience in tech industry isn&rsquo;t that big. It would be something around 5 years working as a coder. This industry moves fast, things change, new technologies emerge on daily basis. In order to do my job well I have to constantly learn something new. I enjoy that a lot. Learning is great. It allows you to look at the world differently than you did before.</p> <p>Sometimes it&rsquo;s exhausting and frustrating. It&rsquo;s easy to be negative towards a new framework, programming language or a build system, when it&rsquo;s new and alien to you. In this industry you should be sceptical. We are already drowning in a sea of a complexity, and when we can barely keep our heads above the water we tend to save ourselves by adding another layer of abstraction.</p> SparkFun Thing Plus - Ambiq Apollo3 - part 1 https://ciesie.com/post/sparkfun_thing_plus_part1/ Fri, 29 Nov 2019[email protected] (Michał Ciesielski) https://ciesie.com/post/sparkfun_thing_plus_part1/ <p>Driven by the idea of building a <em>Bluetooth</em> keyboard like device, I&rsquo;ve bought the <em>SparkFun Artemis Thing Plus</em> board. It&rsquo;s a board designed for small, power efficient devices with <em>Bluetooth</em> capability.</p> <div id="__3d_scene" style="margin: auto; width: 100%;"> </div> <script type="module"> import * as THREE from 'https://cdn.skypack.dev/[email protected]/build/three.module.js'; import { GLTFLoader } from 'https://cdn.skypack.dev/[email protected]/examples/jsm/loaders/GLTFLoader.js'; var insertPoint = document.getElementById("__3d_scene"); var loader = new GLTFLoader(); var scene = new THREE.Scene(); var gltfScene = null; const FOV = 25; const gltfSceneFilePath = "https://ciesie.com/models/artemis_sparkfun.glb"; loader.load(gltfSceneFilePath, function ( gltf ) { gltfScene = gltf.scene; scene.add( gltfScene ); }, undefined, function ( error ) { gltfScene = null; console.error( error ); } ); const W = 640; const H = 640 * 0.75; var camera = new THREE.PerspectiveCamera(FOV, W/H, 0.1, 1000 ); var light = new THREE.DirectionalLight( 0xffffff, 2.2 ); light.position.set( 0, 10, 0 ); scene.add( light ); var lightAmbient = new THREE.AmbientLight(0xffffff, 1.2); scene.add( lightAmbient ); var renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true }); renderer.setSize(W, H); insertPoint.appendChild(renderer.domElement); camera.position.z = 10; camera.position.y = 13; camera.lookAt(0, 0, 0); function resizeCanvasToDisplaySize() { const canvas = renderer.domElement; const widthTarget = insertPoint.getBoundingClientRect().width; const heightTarget = 0.75 * widthTarget; if (canvas.width !== widthTarget || canvas.height !== heightTarget) { renderer.setSize(widthTarget, heightTarget, true); camera.aspect = widthTarget/heightTarget; camera.updateProjectionMatrix(); } } var animate = function () { resizeCanvasToDisplaySize(); requestAnimationFrame( animate ); if ( gltfScene !== null ) { gltfScene.rotation.y += 0.01; } renderer.render( scene, camera ); }; animate(); </script> <p>The board carries an <em>Ambiq Apollo3</em> processor. It&rsquo;s an <em>ARM Cortex-M4F</em> chip. Runs at 48MHz but can, for a brief amount of time, go up to 96MHz. <a href="https://www.ambiqmicro.com/mcu/">Here</a> you can read more about the whole <em>Apollo</em> line-up.</p> Blender - text with scanlines https://ciesie.com/post/blender_text_scanlines/ Fri, 20 Sep 2019[email protected] (Michał Ciesielski) https://ciesie.com/post/blender_text_scanlines/ <p>With the release of <strong>Blender 2.8</strong> I went back to messing around with graphics. I would like to be able to replicate some of the, already existing, effects. Nothing fancy. Nothing new. At the same time looking&hellip; good! I also would like to explain the process to learn and improve.</p> <p>Lets look at a text with some scanlines.</p> <div style="width: auto; height: auto; margin-left: auto; margin-right: auto;"> <figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"> <a href="https://ciesie.com/imgs/4905f8_final.png"> <img itemprop="thumbnail" src="https://ciesie.com/imgs/4905f8_final.png" alt="..." style="max-width: 100%; height: auto; object-fit: scale-down;"> </a> </figure> </div> <p>The scene is pretty basic, text object and a scaled cube with an array modifier. Both objects have their own <em>Collection</em>. Each of them are also living in their own <em>View Layers</em>. That allows for separate rendering of the objects and easier composition.</p> Debugging image resources https://ciesie.com/post/gdb_images/ Thu, 27 Jun 2019[email protected] (Michał Ciesielski) https://ciesie.com/post/gdb_images/ <p>I work a lot with image processing. There is a lot of transformations and sub images extraction. Often, it would be great to actually see those images when debugging. Quick Google search pointed me to the <code>dump</code> command present in <code>gdb</code>.</p> <p>In short, to get the memory dump, you would do something like this:</p> <div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">set</span> <span class="nv">$source</span><span class="o">=</span>pointer_to_the_memory </span></span><span class="line"><span class="cl"><span class="nb">set</span> <span class="nv">$size_of_the_dump</span><span class="o">=</span><span class="m">4096</span> </span></span><span class="line"><span class="cl">dump memory filename.bin <span class="nv">$source</span> <span class="nv">$source</span>+size_of_the_dump</span></span></code></pre></div> <p>You have to know the size of your data. For an image it means: width, height, color depth.</p> Node based GUI app https://ciesie.com/post/node_based_gui/ Sun, 16 Jun 2019[email protected] (Michał Ciesielski) https://ciesie.com/post/node_based_gui/ <p>Inspired by a horrible Jenkins CI workflow I thought about a GUI app that could help compose and request/monitor CI jobs. Node based GUI seemed like an interesting option for that. I&rsquo;ve tested several technological stack to develop something like that and here are my observations.</p> <div style="width: auto; height: auto; margin-left: auto; margin-right: auto;"> <figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"> <a href="https://ciesie.com/imgs/929caa_concept.jpg"> <img itemprop="thumbnail" src="https://ciesie.com/imgs/929caa_concept.jpg" alt="..." style="max-width: 100%; height: auto; object-fit: scale-down;"> </a> </figure> </div> <h2 id="nodes-in-haxeheaps">Nodes in Haxe/Heaps<a href="#nodes-in-haxeheaps"> &lt;</a> </h2> <p>I&rsquo;ve started with testing <strong>Haxe</strong> + <strong>Heaps</strong>. I like the flexibility <strong>Haxe</strong> gives. Outputting a web app based on <em>JavaScript</em> is pretty easy. Unfortunately <strong>Heaps</strong> engine can&rsquo;t be easily outputted as a <em>C++</em> target.</p> Black magic probe out of cheap STLink programmers https://ciesie.com/post/black_magic_probe_stlink/ Thu, 03 Jan 2019[email protected] (Michał Ciesielski) https://ciesie.com/post/black_magic_probe_stlink/ <p>If you have ever worked with <strong>ARM Cortex M</strong> processors you&rsquo;ve probably used <strong>GDB</strong> + <strong>OpenOCD</strong> combo for debugging. If you didn&rsquo;t: <strong>OpenOCD</strong> connects to the processor via a <strong>STLink</strong> programmer and opens a socket to which <strong>GDB</strong> can connect. It will push data necessary for debugging (and understandable for <strong>GDB</strong>) through this socket. That means that if you connect <strong>GDB</strong> to this socket (so called remote debugging) you can debug processor&rsquo;s software like any other application on your PC.</p> Using txti.es + Python as a data dashboard https://ciesie.com/post/txti_python/ Sun, 30 Dec 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/txti_python/ <p>Have you ever heard about <a href="http://txti.es">txti.es</a>? It&rsquo;s a basic web page creator. You can basically create a very simple website by typing content into a form. I thought it might be used as a very simple frontend.</p> <p>I always dabbled with automation. An example would be a scraping script that gets the job postings from a specific website or one that checks when the bus I take every morning leaves and sends this information by e-mail.</p> Creators responsibility https://ciesie.com/post/creators_responsibility/ Tue, 04 Dec 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/creators_responsibility/ <p>Recently I&rsquo;ve enjoyed reading blog posts by <a href="https://twitter.com/nikitonsky">Nikita</a>. You can find the blog <a href="tonksy.me">here</a>. One blog post I see quoted often is <a href="tonsky.me/blog/disenchantment">this</a> one (you can read it in 6 languages - that says something). It&rsquo;s about the disastrous state of current software development.</p> <p>The author brings a lot of good points. The message is that no one puts effort into making software performant. We solve problems by adding complexity, never actually solving the root cause. This comes at a cost. It&rsquo;s all a slow, bloated and complicated mess. Hard to disagree.</p> Setting up a PiHole https://ciesie.com/post/setting_pihole/ Sat, 17 Nov 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/setting_pihole/ <h2 id="whats-a-pihole">What&rsquo;s a <strong>PiHole</strong>?<a href="#whats-a-pihole"> &lt;</a> </h2> <p>It&rsquo;s basically a DNS sinkhole. DNS servers resolve domain names into IPs. DNS sinkholes are basically faulty DNS servers. For example when you go to a website your web browser will also download ads. In order to get them it has to resolve the domain name of the ads provider into an IP. That&rsquo;s what DNS server does. <strong>PiHole</strong> is just a local DNS server which say &rsquo;nah&rsquo; when you ask it to serve a content from a blacklisted provider. You can add domains to the blacklist banning their content but you can also whitelist those you want to support.</p> Setting your pc for remote access https://ciesie.com/post/pc_remote_access/ Sat, 13 Oct 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/pc_remote_access/ <p>I&rsquo;m not sure I need it. Maybe you will. It is an exercise in excess. I rarely need something from my home PC because nowadays it&rsquo;s so easy to store things in the <em>magical cloud</em>. Still, it&rsquo;s a nice exercise.</p> <p>I have set up remote access on <em>Void Linux</em> and I will describe the process of doing so for that OS. You might encounter some problems if you are using <em>Windows</em>&hellip; but if you do you have bigger things to worry about (writing this around the time <em>M$</em> update for <em>Windows</em> bricked some users&rsquo; computers.</p> [STM32] - part 3 - Start your engine! https://ciesie.com/post/stm32_part3/ Tue, 19 Jun 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/stm32_part3/ <p>I think it&rsquo;s time to go through what happens when you power on the <strong>STM32 Cortex-M</strong> microcontroller. There is a lot of resources on this topic (if you are reading this one&hellip; thank you!). I will explain this process in my own words.</p> <p>You have powered on your microcontroller. Less than a second has passed and it is already munching through data, sending and receiving messages, controlling motors and blinking leds. In less than a second (waaaay less) the micro sets everything up for it, to do everything you programmed it to do. So what&rsquo;s the process?</p> Shortcomings of todays human-computer interaction https://ciesie.com/post/shortcomings_of_human_computer_interaction/ Mon, 11 Jun 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/shortcomings_of_human_computer_interaction/ <p>I have spent a lot of time in front of a computer. That&rsquo;s because you can do a lot of amazing stuff with it. I don&rsquo;t think I enjoy the process that much though. Sometimes there is so much clicking and pointing to do simple stuff. I don&rsquo;t think I would code without using <em>VIM</em> or at least adding <em>VIM</em> bindings to the text editor I&rsquo;m using. I just can&rsquo;t use mouse when I code. Coding is discrete. Smallest unit of code is a letter. If you use the mouse to move the cursor in your text editor you actually move over space that doesn&rsquo;t interest you, like letters themselves. What you are actually after are the spaces between letters. Using only keyboard puts you in this discrete space you are after - with keyboard you can move exactly one letter at a time by adding, removing or moving over a letter. <em>VIM</em> bindings expand this by giving you motions, simplest being moving over words. When you code, your tool is the keyboard. We all know how keyboard looks and what should it do&hellip; do we?</p> [Knowledge snippet] - STM32 bootloader https://ciesie.com/post/stm32_bootloader/ Sat, 09 Jun 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/stm32_bootloader/ <p>You programmed STM32 microcontroller using Nucleo or Discovery boards. That means you used <em>Serial Wire Debug</em> (<em>SWD</em>) for programming/debugging. Now, you are designing a PCB with a STM32 microcontroller on it, which means you have to be able to program it. One solution is uploading the code through a <em>bootloader</em> - a small piece of software, made by <em>ST</em> that has been saved in the protected (read-only) memory of the microcontroller. It&rsquo;s a simple program which reads data, sent from the host (PC) using a specific protocol, and saves it into <em>FLASH</em> memory.</p> [STM32] - part 2 - Lets look inside! https://ciesie.com/post/stm32_part2/ Fri, 27 Apr 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/stm32_part2/ <p>Still wondering why it all works? Why this black square does things? Lets go deeper.</p> <p>Previously I explained a bit about processor architecture. It&rsquo;s the basis of the chip. It&rsquo;s a fundament. You won&rsquo;t find anything about an UART in a <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0439b/ch01s05s01.html">Technical Reference Manual of <em>Cortex-M4</em></a>. It&rsquo;s just not a part of this fundament.</p> <p>When you get an <em>STM32</em> microcontroller based on the <em>Cortex-M4</em> architecture you just get microcontroller made by <em>ST</em> which uses this specific architecture. What stops them to add to it? Nothing. That&rsquo;s why you can find so many different models of families and models of processors. Just look at <em>ST&rsquo;s F</em> and <em>ST&rsquo;s L</em> series. They are both <em>ARM Cortex-M</em> but they do differ in many ways.</p> [STM32] - part 1 - Cortex what...? https://ciesie.com/post/stm32_part1/ Tue, 10 Apr 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/stm32_part1/ <p>Recently I wrote a short article about setting up an environment for programming <em>STM32</em> microcontrollers with the <em>libopencm3</em> library. You can read it <a href="https://ciesie.com/post/libopencm3_part1/">here</a>.</p> <p>I wanted to write the second part as soon as possible but I found out that even though I could, I didn&rsquo;t understand everything well enough. I just didn&rsquo;t feel comfortable with the subject. That&rsquo;s why I started this series. I want to explore what actually happens when you program a <em>STM32</em> microcontroller.</p> Adventures in libopencm3 - part 1 https://ciesie.com/post/libopencm3_part1/ Sat, 31 Mar 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/libopencm3_part1/ <p>Recently, I&rsquo;ve started working on a new project. It will take some time before the goal of the project is even worth mentioning. The important part is that it is an electronics/hardware project and it needs an energy efficient computing unit.</p> <p>For early development I chose an <strong>ARM Cortex M3 STM32F3</strong> microcontroller. More precisely <strong>STM32F303K8T6</strong>, mostly because I have a <strong>Nucleo</strong> board, with this chip, laying around. It&rsquo;s also a good time to try a new framework. Choices worth considering:</p> Compiling Raylib programs with SCons https://ciesie.com/post/building_raylib_with_scons/ Sun, 18 Mar 2018[email protected] (Michał Ciesielski) https://ciesie.com/post/building_raylib_with_scons/ <p>If you like writing programs in C, are interested in game development and don&rsquo;t enjoy all those complicated and ancient build systems I think I&rsquo;ve got something of interest to you. I belive there is something enjoyable in the simple setup I&rsquo;m describing below. Hope you will enjoy as well.</p> <h2 id="raylib">Raylib<a href="#raylib"> &lt;</a> </h2> <p><a href="https://www.raylib.com/">Raylib</a> is a C library made by <a href="https://twitter.com/raysan5">@Ray San</a>. On the Raylib&rsquo;s website it says &lsquo;<em>raylib is a simple and easy-to-use library to learn video games programming</em>&rsquo;. Whole API can be browsed <a href="https://www.raylib.com/cheatsheet/cheatsheet.html">here</a>. It does abstract a lot of things important for game developement. It&rsquo;s important to note because if you chose to write something in C, performance is something you might care about. High level abstraction usually takes a toll on performance. In this case mostly because you are not tuning small parts of your code to suit your needs. Raylib wants to abstract those parts to make the learning easier. In the end you have the power of C (which basically allows you to write <em>performant</em> code) and high level abstraction Raylib library provides you. That&rsquo;s a good starting point to write cool software, enjoyable for the end user.</p> Naive comments system https://ciesie.com/project/naive_comments/ Thu, 15 Jan 2026 11:05:25 +0100 Sat, 02 Dec 2023[email protected] (Michał Ciesielski) https://ciesie.com/project/naive_comments/ <p>This website used <a href="https://cactus.chat/">Cactus</a> comments system, which leverages Matrix protocol. It was a nice little experiment but it&rsquo;s a half baked project, which didn&rsquo;t grow in the last few years. I have decided to make my own comment system. Something as simple as possible, where comments are stored in the most universal way possible. Because systems change, but data? Data is forever.</p> <p>The simplest comment system is an interface to send text data, a way to store it in a structured manner and an interface to retrieve that data or its subset, to present it.</p> 1S Li-Po battery charger https://ciesie.com/project/lipo_charger/ Tue, 25 Jun 2024 14:12:46 +0200 Mon, 10 Oct 2022[email protected] (Michał Ciesielski) https://ciesie.com/project/lipo_charger/ <p>One day I hope to design a product with quality of a commercial product. I do not feel I can go through the entire process by myself. While I might never be able to do that, I still want to close as much of that gap as possible.</p> <p>This time the exercise was to design a PCB that can charge a 1S Li-Po battery. The design is not a product of my lacking, electronics knowledge. It&rsquo;s a modified design of the <a href="https://github.com/particle-iot/xenon">Particle Xenon</a> board. Unfortunately, Particle doesn&rsquo;t produce these boards anymore. I managed to buy two of them some time ago. I find those great for <em>BLE</em> prototyping.</p> MagKnob https://ciesie.com/project/magknob/ Sun, 13 Aug 2023 17:34:08 +0200 Fri, 05 Nov 2021[email protected] (Michał Ciesielski) https://ciesie.com/project/magknob/ <p>Let&rsquo;s control volume with a (moderately) fancy knob!</p> <div style="max-width: 90%; margin-left: auto; margin-right: auto;"> <video style="width: 100%; max-height: 640px;" controls> <source src="a72bc5_magknobVolume.mp4" type="video/mp4"> </video> </div> <p><a href="https://ams.com/as5601">AS5601</a> might be my favourite sensor right now. It&rsquo;s an on-axis magnetic rotary position sensor. It generates a signal typical for encoders, but it does it by detecting the change in a magnetic field of a diametrically magnetized, rotating magnet.</p> <div id="__3d_scene" style="margin: auto; width: 100%;"> </div> <script type="module"> import * as THREE from 'https://cdn.skypack.dev/[email protected]/build/three.module.js'; import { OrbitControls } from 'https://cdn.skypack.dev/[email protected]/examples/jsm/controls/OrbitControls.js'; import { GLTFLoader } from 'https://cdn.skypack.dev/[email protected]/examples/jsm/loaders/GLTFLoader.js'; import { RGBELoader } from 'https://cdn.skypack.dev/[email protected]/examples/jsm/loaders/RGBELoader.js'; var insertPoint = document.getElementById("__3d_scene"); let camera, scene, renderer; const W = 640; const H = 640 * 0.75; const FOV = 25; renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true }); renderer.setSize(W, H); renderer.toneMapping = THREE.ACESFilmicToneMapping; renderer.toneMappingExposure = 1.0; renderer.outputEncoding = THREE.sRGBEncoding; insertPoint.appendChild(renderer.domElement); scene = new THREE.Scene(); var gltfScene = null; const gltfSceneFilePath = "https://ciesie.com/models/as5601_adapter_board.glb"; function init() { camera = new THREE.PerspectiveCamera(FOV, W/H, 0.1, 1000 ); camera.position.z = 2.5; camera.position.y = 1.8; camera.lookAt(0, .3, 0); var pmremGenerator = new THREE.PMREMGenerator(renderer); pmremGenerator.compileEquirectangularShader(); new RGBELoader().load("/models/phalzer_forest_01_1k.hdr", function (texture) { texture.mapping = THREE.EquirectangularReflectionMapping; var radianceMap = pmremGenerator.fromEquirectangular(texture).texture; pmremGenerator.dispose(); scene.environment = radianceMap; } ); var matPlastic = new THREE.MeshStandardMaterial({color: 0x0a0a0c, roughness: 0.55, metalness: 0.0}); const loader = new GLTFLoader(); loader.load(gltfSceneFilePath, function ( gltf ) { scene.add(gltf.scene); gltfScene = gltf.scene; gltfScene.rotation.y = 2.4; gltfScene.traverse(function (child) { if (child.isMesh) { if (child.name == "magknob_base") { child.material = matPlastic } if (child.name == "magknob_knob") { child.material = matPlastic } if (child.name == "magknob_tunnel") { child.material = matPlastic } if (child.name == "magknob_bearing") { child.material = matPlastic } } } ); } ); } function resizeCanvasToDisplaySize() { const canvas = renderer.domElement; const widthTarget = insertPoint.getBoundingClientRect().width; const heightTarget = 0.75 * widthTarget; if (canvas.width !== widthTarget || canvas.height !== heightTarget) { renderer.setSize(widthTarget, heightTarget, true); camera.aspect = widthTarget/heightTarget; camera.updateProjectionMatrix(); } } function animate() { resizeCanvasToDisplaySize(); requestAnimationFrame( animate ); if ( gltfScene !== null ) { gltfScene.rotation.y += 0.01; } renderer.render( scene, camera ); }; init(); animate(); </script> <p>The knob acts as a USB HID device. That means that, currently, it can do everything that a 2 button keyboard could do.</p> Website... this website https://ciesie.com/project/this_website/ Fri, 09 May 2025 13:40:41 +0200 Fri, 05 Nov 2021[email protected] (Michał Ciesielski) https://ciesie.com/project/this_website/ <p>You should start a website. It&rsquo;s quite fun!</p> Bluetooth Graphics Controller https://ciesie.com/project/ble_graphics_controller/ Fri, 09 May 2025 20:43:02 +0200 Sat, 06 Jun 2020[email protected] (Michał Ciesielski) https://ciesie.com/project/ble_graphics_controller/ <h2 id="process">Process<a href="#process"> &lt;</a> </h2> Time tracker https://ciesie.com/project/time_tracker/ Fri, 25 Oct 2024 14:12:50 +0200 Tue, 21 May 2019[email protected] (Michał Ciesielski) https://ciesie.com/project/time_tracker/ <h2 id="this-is-a-work-in-progress">THIS IS A WORK IN PROGRESS<a href="#this-is-a-work-in-progress"> &lt;</a> </h2> <p>Below you will find log entries that describe the design/thinking process.</p> <h2 id="idea">Idea<a href="#idea"> &lt;</a> </h2> <p>The goal is to build a device that could allow me to comfortably measure time spent on a project. I want to have a full history of the time spent on particular project. The time log needs to be plain text, easily queried and human readable.</p> <h2 id="process">Process<a href="#process"> &lt;</a> </h2> <div class="date-decorate" style="margin-left:auto; margin-right:auto; text-align:center; color: #d30054"> <img src="https://ciesie.com/imgs/triangle.svg" style="transform: rotate(180deg); margin-top: 0px; height: 1em;"> <div style="margin-top: 0px;">2023-08-23</div> </div> <p>And here we go with another attempt at prototyping this device. 3D printing is great, as long as it works. Any 3D printer issues can derail the entire process - I&rsquo;m not here to practice my 3D printing troubleshooting skills. Another thing about 3D prints is that they&rsquo;re not a good base to further refine the printed prototype. It&rsquo;s a plastic shell and there&rsquo;s not much you can do to modify its shape, without redesigning and reprinting. There&rsquo;s definitely way more to prototyping than 3D printing.</p> Fuel gauge - Godot Engine https://ciesie.com/project/fuel_gauge_godot/ Sat, 01 Jul 2023 20:01:55 +0200 Sun, 07 Apr 2019[email protected] (Michał Ciesielski) https://ciesie.com/project/fuel_gauge_godot/ <p>I&rsquo;ve made a small visualization of a motorcycle fuel gauge in <strong><a href="https://godotengine.org">Godot engine</a></strong>. It allows you to disassemble the gauge and learn what&rsquo;s inside without actually buying a motorcycle&hellip; I did that for you&hellip;</p> <div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"> <iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/iHdwGIxK8PU?autoplay=0&amp;controls=1&amp;end=0&amp;loop=0&amp;mute=0&amp;start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"></iframe> </div> Wii Nunchuk as a USB HID controller https://ciesie.com/project/wii_nunchuk_usb_controller/ Tue, 22 Aug 2023 18:05:58 +0200 Sat, 02 Feb 2019[email protected] (Michał Ciesielski) https://ciesie.com/project/wii_nunchuk_usb_controller/ <h1 id="tldr">TL;DR<a href="#tldr"> &lt;</a> </h1> <p>You can find the source code <a href="https://gitlab.com/bluewii">here</a>.</p> <p>I used the Wii Nunchuk controller to prototype one handed controller for creating computer graphics. I used the <strong>Blue Pill</strong> board which carries a <strong>STM32F1</strong> microcontroller with a <strong>built-in USB peripheral</strong>. That allowed me to implement it as a true <strong>USB HID (Human Interface Device)</strong> for the <strong>Windows OS</strong>.</p> <p>The results were disappointing. My <strong>USB HID</strong> implementation was poor. I have fixed several important bugs in <a href="http://ciesie.com/project/ble_graphics_controller/">another project</a>.</p> Capacitive buttons keyboard https://ciesie.com/project/capacitive_buttons_keyboard/ Fri, 09 May 2025 20:43:02 +0200 Thu, 05 Jul 2018[email protected] (Michał Ciesielski) https://ciesie.com/project/capacitive_buttons_keyboard/ <p>A video showing the a keyboard made with capacitive buttons.</p> <div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"> <iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/703gc3oGjSU?autoplay=0&amp;controls=1&amp;end=0&amp;loop=0&amp;mute=0&amp;start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"></iframe> </div> <p><a href="cap_buttons.ino">Source code</a></p> Blender analog controller https://ciesie.com/project/blender_three_knobs_controller/ Wed, 31 Dec 2025 16:26:35 +0100 Wed, 13 Jun 2018[email protected] (Michał Ciesielski) https://ciesie.com/project/blender_three_knobs_controller/ <p>In the digital age you stumble on concepts analog in their nature. Modern graphics are created on a computer yet they originate in an analog process. You constantly change the brush size yet the computer allows you to do it in an increments. Do you actually care your color is <em>R=53, G=123, B=200</em> in numerical values except when moving the data?</p> <p>Concept of making an analog controller for art creation on the computer was always interesting for me. An exercise in this was this small controller built with <em>Arduino</em>. It&rsquo;s just a 3 potentiometers dividing voltage. Arduino reads this voltage and sends the numeric values to Blender which can use them in various ways thanks to built-in <em>Python</em> environment. I used it to control color values.</p> Portable power for Yamaha Amplifier https://ciesie.com/project/portable_amplifier/ Sat, 01 Jul 2023 20:01:55 +0200 Sat, 21 Apr 2018[email protected] (Michał Ciesielski) https://ciesie.com/project/portable_amplifier/ <div style="width: auto; height: auto; margin-left: auto; margin-right: auto;"> <figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"> <a href="https://ciesie.com/imgs/176aa1_ampPortablePower04.jpg"> <img itemprop="thumbnail" src="https://ciesie.com/imgs/176aa1_ampPortablePower04.jpg" alt="Voltage converter in 3D printed casing" style="max-width: 100%; height: auto; object-fit: scale-down;"> </a> <figcaption> Voltage converter in 3D printed casing </figcaption> </figure> </div> <p>I&rsquo;m using Yamaha THR5 electric guitar amplifier. It&rsquo;s possible to power it with batteries. It isn&rsquo;t economically good solution though. Something rechargeable would be way better. Since I had a Li-Po battery lying around I made a small dongle which regulates the voltage.</p> <div style="width: auto; height: auto; margin-left: auto; margin-right: auto;"> <figure itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"> <a href="https://ciesie.com/imgs/176aa1_ampPortablePower01.jpg"> <img itemprop="thumbnail" src="https://ciesie.com/imgs/176aa1_ampPortablePower01.jpg" alt="Voltage converter in 3D printed casing" style="max-width: 100%; height: auto; object-fit: scale-down;"> </a> <figcaption> Voltage converter in 3D printed casing </figcaption> </figure> </div> <p>The dongle in a 3D printed casing. Two switches allow breaking input and output circuit independently.</p>