Logging Baby’s Day In Linux

There’s plenty of surprises to be had when you become a parent, and one of the first is that it’s suddenly your job to record  the frequency of your infant’s various bodily functions in exacting detail. How many times did the little tyke eat, how long did they sleep, and perhaps most critically, how many times did they poop. The pediatrician will expect you to know these things, so you better start keeping notes.

Or, if you’re [Triceratops Labs], you build a physical button panel that will keep tabs on the info for you. At the press of each button, a log entry is made on the connected Raspberry Pi Zero W, which eventually makes its way to a web interface that you can view to see all of Junior’s statistics.

In terms of hardware, this one is quite simple — it’s really just an array of arcade-style push buttons wired directly into the Pi’s GPIO header. Where it shines is in the software. This project could have been just a Python script and a text file, but instead it uses a MariaDB database on the back-end, with Apache and PHP serving up the web page, and a custom Systemd service to tie it all together. In other words, it’s what happens when you let a Linux admin play with a soldering iron.

It probably won’t come as much surprise to find that hackers often come up with elaborate monitoring systems for their newborn children, after all, it’s a great excuse for a new project. This machine learning crib camera comes to mind.

34 thoughts on “Logging Baby’s Day In Linux

    1. 100%

      A few days I made an android app and a server counterpart running on a pi-zero2w
      The app was literally three very large and clearly labelled text inputs where my grandpa was supposed to enter his systolic and diastolic blood pressure and his pulse rate. All the information easily available on his BP meter, which he uses everyday in the morning to write the readings in a notebook. The server automatically generated graphs so that a doctor family member could track of his numbers.

      He didn’t even use the system for an entire week! It was just too much hassle to first take the blood pressure by himself, then write down the readings, then enter them on the app. I didn’t really mind because I made the entire system in a few hours but that was the point where I learn that unless something is strictly necessary, and easily integrated into a workflow, its going to be ignored and forgotten.

    2. In some cases.

      For harried, half asleep parents, possibly with dirty hands, slapping a button on the way back to bed, in the dark, is much easier than pissing around with pen and paper.

      At certain life stages of a parent, running on instinct and muscle memory is preferable to turning on lights to write, then searching for a pen that hasn’t been taken by the older kids. Now where did the tally sheet go? Somewhere in that pile of drawings the kids made? Thrown out?

      All when you have to get up in three hours for work.

      In other cases, yes, pen and paper is better.

      1. This. Also, we are taking turns to care the baby, and no one ever knows where the heck is the paper and pen…
        I know there are lots of apps for baby tracking, but they are proprietary software with ads and a lot of tracking (i really don’t want sanitary data being sent on a server god knows where…).
        At the end, I decided as well to implement my solution, in the form of an open source Android app: https://git.ichibi.eu/penguin86/luna-tracker
        I published it on F-Droid, should anyone need it: https://f-droid.org/it/packages/it.danieleverducci.lunatracker

    3. Our Pen & Paper was never where we needed it. Getting up and getting the paper once a newborn felt asleep on you is something you don’t want to do (and for us laying our newborn down elsewhere did not work). The only chance to get the newborn to sleep was breast feeding, using up to 13 h a day. This was our only chance to get sleep, too.
      I think that those who have not been in our situation cannot understand that paper can be adding overhead work that we were not in the state of being able to handle.

      Using a phone for tracking, with a screen lighting up, unlocking, swiping was abandoned quickly.

      The solution I used for breast feeding tracking were buttons with a battery sending an MQTT message.
      We tracked “left breast start” “left breast end” ” right breast start” and “right breast end”. With enough buttons on every possible place enabled us to have a complete tracking. The result did not need to be compiled, it was right there, graphically shown.

      You could see in the data, which breast had problems or had rashed and was used less.

      Plus, one of the buttons I used to silently calling me for help by flashing the lights in the rooms where I was present, without creating sounds.

    1. I think this level of tracking is only needed if the doctors are worried about growth or other conditions. Doesn’t necessarily mean that anything is actually wrong, often they just want some monitoring.

    2. Doctors tend to ask “how many changes, wet, dirty, etc” I can see this being used for peace of mind or reference. I can also see it being used to try and solve the “when was the last time the baby ate, and am I ruining our planned nap/feeding schedule?”

      1. Yup, that’s why I mentioned “illness”. The other sentence is setting up Yourself for failure – baby will request nap when tired and food when hungry, regardless of any schedules. And data might end up pretty random as on the blanket above

  1. The current world population is a testament to how successful we are at bringing new humans to breeding age without such technology. Ergo, it not at all required, but it’s a great excuse for a new project.

    But these days, who’s going to lug around a panel like this when a phone is omnipresent and apps are available?

    1. I’m going to! For me, physical interface beats apps hands down. By the time You unlocked your phone I’m done with the button and forgot about the case. Same for taking notes and virtually anything

      1. ” By the time You unlocked your phone”

        This! When we saw our toddler doing something “cute”; by the time the video camera booted, she was in another room doing something else!

    2. “a great excuse for a new project” my thought exactly. After all, it’s more fun to build the tracks than to actually play with the train OR the fun is in the journey not the destination. I do have some questions though:
      – how this project is accepted by the partner?
      – do you press the poopy-daiper-button longer for a big poop then for a small one?
      (or perhaps you must press 1 time for 100grams, 2 times for 200 grams etc. if so how well are the buttons debounced)

          1. The capacity rating of daipers is very confusing. These things always start leaking in horrible ways way before reaching the minimum capacity. I mentioned this in the shop where I bought them but they said I should just change them more often. When I mentioned that the packaging (of that specific model) states 2-5kg so therefore I expected it to hold at least 2kg they looked at me in a very strange way.

    3. I am doing all I can to keep my young kids from seeing me on the phone all the time. How am I going to convince them they don’t need a phone before they start to drive if I am on mine constantly? When I get home from work, the phone goes on the counter top and as much as possible stays there until they go to sleep.

    4. Yeah, we do that by just having enough babies to offset the infant mortality rate. Which is fine if the statistics are all you care about. But if you don’t want one specific baby (i.e. yours) to be one of the dead ones, then you can’t just pop it out and let it fend for itself.

  2. Hey all thanks for the fun discussion under my project!

    This all started because my wife wanted to buy something similar that is commercially available at $100+ and of course included an app subscription. I figured this type of logging is something you would only really want to do for a few weeks or months at most unless there is a real health concern. I took it as an excuse to make a project that helped me to learn some more about python and GPIO on the Pi.

    As [Jan] mentioned above, the fun is in the journey more so than the destination. After the usefulness of this thing fades away I can easily repurpose the box and swap out the button labels for something else down the line.

    At the end of the day the wife was happy and impressed, and we were saved another subscription from latching on.

    Cheers

    1. I know exactly what you’re talking about: I’m dad since 3 months and had the same problem. We couldn’t just download a tracking app on a phone because there’s no control on where the information goes: they all synchronize on some server who knows where… I couldn’t find an open source alternative, so I had to do it on my own… I came up with this: https://git.ichibi.eu/penguin86/luna-tracker (i published on F-Droid at https://f-droid.org/it/packages/it.danieleverducci.lunatracker/).
      I would have done something more elaborate with a real db like yours, but I thought other parents may need it, so i found a more portable solution that does not require to host any service: i sync a json file with WebDAV (or one could as well keep it local on the phone, if syncronization is not needed).
      I’m not sure how this will scale after some years, but I’m sure I’ll come up with a solution in the meanwhile. This was developer in emergency (we really needed it), so it’s more than adequate atm.
      Anyway, I envy your button dashboard, it’s very cool… Maybe I’ll take inspiration and adapt it to my system!

  3. really shoulda been a smartphone app :)

    i keep thinking about that kind of app for tracking various things. diet, illness, headaches, joint pain, indigestion, sleep…so many opportunities to start teasing out some cause-and-effect relationships and cyclic patterns that are surely hiding in plain view. but it’s too much hassle…i just don’t care that much. and as a new parent, soon you won’t either :)

  4. I use “baby buddy” a very nice self hosted open source project for tracking everything about our baby (very useful to identify trends and changes in behaviour)

    It has a great api and integration to home assistant, which I also use, so it is easy to roll out custom hardware with, for example, esphome, to log baby events, or also integrate with voice assistants

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.