Category: Compendium

(Re-)Installing and modifying a PIR module

A while back I ordered a cheap 230V PIR of AliExpress to control the light in our washing room because my housemates always forget to turn it back off. I came across a nice model that didn’t use the normal bulky (outdoor-ish) case but rather used a small external eye you could integrate in a ceiling. And because the room has a suspended system ceiling that was perfect.

When I got the device I opened it up, looked at it and thought “Yeahhhh, good enough”.👍 Then I quickly connected it and instead of drilling a whole I just sneaked the wire to the eye/PIR on the side of a panel and just suspended it there. And it worked fine! It turned on the light when you walked in and now most of the time the light was off. Win!😎

Read More

FadeLed Arduino library

This is going to be a small post. I came across the question how to fade a led. In basic it’s not that hard to do, just increment the brightness in steps every x period of time. But when you start to write code for it it starts to become more complicated. Not hard, but only more work then you might initially think. For example, how do you determined the steps and the periods you need? And do you want to fade with a constant speed or in a constant time?

To make it easy for everybody (including future me) to fade a led on an Arduino hardware PWM pin I started to write a small library. But mostly it became a practice of fully documenting a project using Doxygen, putting out releases on GitHub including main pages etc.

If you want to jump straight to the library:  septillion-git/FadeLed

Read More

The big ARM adventure – part 1

I’ve been programming 8-bit micro controllers for some years now. I started with PIC (PIC16F628, like everybody else), bought a PicKit 2 (because that did work on a 64-bit OS) and started coding in CCS C. Looking back it’s all terrible but it got me going. Of course I can across some AVR code but I never used it until the whole Arduino revolution. A friend wanted to do some stuff with Arduino so I helped him out and I started looking at Arduino myself. Mostly because you can buy Pro Mini’s (with all components already on a board) so dirt cheap from China it really is a no-brainer. I looked at some 32-bit stuff and bought some Ti Launchpads etc. But never really got my head around it and because I never needed it I stayed with 8-bitters.

Then I came across a post on Hackaday about repurposing a AVR-programmer as a USB Arduino. I’ve seen those modules thousands of times on eBay but never bought one. (I use a Arduino as ISP.) Although the hack is neat I don’t find it very useful because of the limited I/O. For less you can just use a Nano with a lot more I/O. (Okay, you can’t present it as a HID or something else.) I started reading the comments to see how other people thought about it and then I spotted something that I found interesting. Especially the comment of [wongsta / drojf] about cheap ARM boards. So I fired up eBay and looked up that STM32F103C8T6 he talked about. And well be damned, even cheaper then the $3,50 he talked about. So I ordered a board right away. Together with a STlink v2 that was mentioned there.

Read More