By dkl9, written 2025-054, revised 2025-054 (0 revisions)
Sleep is good in moderation. But staying in bed after sleeping enough is what we may call "bed rot", and is bad. "Zcourge" comes from "zzz" and "scourge", and is the name for an Arduino-controlled device that I designed to deter bed rot.
There are three routes for what a device could do to reliably solve a problem like this:
Directly forcing me to get up would require the device to shove or pull my body or bed. To have much effect, that takes hundreds of newtons of force takes powerful, expensive equipment.
If a device grants pleasure only when I get up as I should, I might pursue the same pleasure at other times, and dilute the signal. That is, I'd have to block myself from wireheading/cheating, which is tricky.
Selectively inducing pain is easy.
Electric shocks (preferably mild) are a straightforward way to cause pain from an electronic device. There are several problems with shocking myself. The most urgent problem is that, short of an enormous power supply, the shocker would have to touch my body to cause any pain.
Annoying sounds are the next best thing. I installed a buzzer in Zcourge. When the program deems it necessary, it plays an irksome little high-pitched tune I composed, which has since gotten stuck in my head at times.
Zcourge is to cause pain when I'm in bed, but should've gotten up. To do that, it must know when I'm in bed.
I equipped Zcourge with an ultrasonic distance sensor, pointed at my bed. That gave too many false positives. More disastrously, that left it all too easy to trick Zcourge, while still lying in bed, by shifting my legs to the side.
I tried a passive infrared motion sensor. As you might guess from the "motion" in the term, such a sensor is silent when I lie still in bed. I gave up on that one much faster than the ultrasonic sensor.
A certain third type of sensor had to be set up in the bed, rather than left to "look" remotely. It was also more expensive than either of the first two, tho still cheap by most standards. Its only advantage was that it actually worked as desired.
Avoiding bed rot entails two challenges:
Challenge 2 is easy: have the program track when you get up after the night's sleep, and play the tune of pain if, shortly afterward, you start to get back in bed. I programmed that solution in quickly enough.
For Zcourge to solve challenge 1, it must know when you finish sleeping. To measure when someone's asleep conventionally takes precise sensors, which touch the body, or are at least held close to it. Sans those, professionals tend to use fancy, machine-learned algorithms, too complex for me to be bothered to set up, let alone to run on Zcourge's Arduino.
One defining feature of being awake is that you can detectably respond to stimuli smaller than what it takes to wake you up. Notably:
Zcourge intermittently beeps, and checks if that leads me to shift around more, and so detects when I wake up. If ever it detects I'm awake, but still in bed, it plays the alarm. This is crude, but experience shows it's partway accurate.
Often, I would awaken naturally after five to six hours, then rot, awake, for an hour or two, until an urge to urinate forces me to get up. The yell of Zcourge would sometimes short-circuit that bed rot, especially when I worry that it may disturb others sleeping nearby. When it bothers me less, I get up somewhat sooner, once the noise wrecks what hope I had — vain anyway — of falling back asleep.
Every [early morning], I lie in bed / The brightest colours fill my head / A million [beeps] are keeping me awake
— The Greatest Showman, approximately
Sometimes I get to lie awake in quiet, having dodged Zcourge's cleverer sensor. After I eventually get up, the better-guaranteed threat of the alarm, shown by Zcourge's lone green indicator light, suffices to keep me up and moving for the rest of my day. Many times have I relied on that deterrent to get to Wakeful Club.
As it happens, the bed-sensor can mistake junk left on a bed for a person. Thus, to avoid false alarms, I have to keep to a minimum the junk I leave on my bed.
For now, the only Zcourge is my personal slightly-messy prototype. If you want something like it yourself, tell me — I can build and sell you a copy. If you want a lot of them, I can sell you detailed designs and software. In either case, you can ask for me to improve or configure it first.