MagicMirror² v2.13.0 is available! For more information about this release, check out this topic.

Need Guidence, Or Someone To Make A Module For Me, Uses GPIO

  • Hello All!

    My name is Anthony, AKA Spicy Jelly. I am a High School Student in the US, with little knowledge in Python, C+, and JavaScript. My idea for a module was displaying a local image as a background. I know this has already been done, but I wanted to put my own twist on it. My plan was to use a Piezo element, as a input for vibrations, from me knocking on the wall, using the RPi’s GPIO pins. When the element detected a vibration input, the local image background would fade, and the mirror would reappear. I would want the other elements to be displayed when both background, and mirror.

    ~ I have no clue where to start, so if someone would be interested in making this for me, or guiding me in making it, it would be greatly appreciated

    • Feel free to contact me

    Thank you in advance


  • Project Sponsor

    @SpicyCoding It’s not nearly as much fun if someone makes it for you.

    This might get you started:

    Once you can successfully detect a vibration/knock in your Python script, it should be pretty easy to use that code in a node_helper.js to send messages to an image module.

  • @SpicyCoding

    For the coding part, you might consider using CSS to create your transparency:

    .module .knockknock {
      background: url("img_tree.jpg") no-repeat fixed center;
      opacity: 1.0;

    Then for each knock, it could then increment opacity by 0.1. If you wanted to keep the other modules visible, you can position a separate element over the other modules. You could then have a timer running that after X amount of time the opacity resets to 1.0. (Or you can increment the opacity of the body and reset the opacity of all child elements/modules to 1.0.)

    You can also get fancier and use CSS animations to create transitions between each step, and to make it reappear, but best to get a proof-of-concept first.

  • Module Developer

    Maybe you saw this thread. I made a module for duedahlb that shows a full size image when the module MMM-Button registers a button press. I think that could be a good start to study and maybe reverse engineer some parts from both modules.

Log in to reply