Novice requesting PCB review and advice for a window / door sensor

  • Hi there,

    I’ve started discovering the world of electronics through Arduino about three month ago and decided recently to get a little bit more serious about it. I’m designing my first custom PCB which should be used as a base for a little door / window sensor with an Atmega328P as its heart and the MySensors library as its soul.

    I’m hopeful to find some knowledgeable guys over here, who could have a quick look at my design, point out flaws, give advice. That’d be awesome!

    Before we go into the details, let’s have a quick look at the schematic and layout:


    Top layer

    Bottom layer

    The GND on the top layer as well as all VCC routes are 20 mil wide, all other signals are 8 mil wide. Clearances in DRC are 8 mil for everything. The bottom layer has a large ground fill, which I tried to keep as clean as possible.

    Part List

    Concept and functionality

    By designing this board I had three main aspects in mind:

    • Should be able to run for (many) years off a single coin cell
    • Keep it as small as possible … (currently ~ 2x the size of an Arduino Pro Mini)
    • … but still solderable by hand (no parts smaller than 0805)

    The circuit goes into power-down mode by default, where it should consume ~ 2 µA (plus whatever leakage current might be introduced by the capacitors, I expect no more than 1-2 µA extra based on my own tests) - I measured ~ 1.5 µA on prototypes I’m currently running, which feature a mechanical reed switch instead of a digital hall effect sensor. When the hall effect sensor detects a change (window opened or closed), it wakes the Atmega via interrupt on INT0. The MCU then sends the current state along with the voltage level over the radio module to the master node and goes back into power-down mode.

    Speaking of the hall effect sensor: the DRV5032 is a ultra-low power sensor from TI, which can be powered between 1.65 and 5.5V. The FB-variant is omni-polar and particularly economical, as it operates at only 5 Hz and has a push-pull output which means that no external pull-up resistor is needed, bringing its current consumption down to an average of 0.7 µA or less at 3V and below.

    You are almost certainly already familiar with the good old Atmega328P and the NRF24L01+ radios, so I won’t waste no words on them.

    Now that you have a basic idea of my thoughts and goals, let’s get to the fun part:

    My questions / concerns / uncertainties:

    1. DRC check yields zero errors, except for the through hole mounting points of the battery holder (marked in purple on the layout screenshots), which are quite close to the edge of the board. That should pose no problem, should it?

    2. Regarding ceramic capacitor positioning and their capacity: I’ve tried to get each MLCC as close to the corresponding GND and VCC pins of the components they belong to, so that they create their own little "current loop". The sensor, MCU and radio each get a single 100 nF capacitor. Is that sufficient?

      Is it advisable to add a second 100 nF cap to the AVCC / GND pair on the right side of the MCU (marked in yellow)?
      [EDIT: The AVR Hardware Design Guide clearly states "For devices with multiple pairs of power and ground pins, it is essential that there is a decoupling capacitor for every pair of pins" and "To improve the accuracy of the ADC, the analog supply voltage must be decoupled separately, similar to the digital supply voltage", but I see that many people don't do so and by trying to keep it simple, I thought it is worth the question anyway.]

      The 220 µF electrolytic cap should protect the coin cell from sudden current spikes when the radio is in transmission mode and should be able to deliver most of the current during this time, so I don’t think the radio needs another ~ 10 µF MLCC near it, does it?

    3. I would like to make use of the FOTA functionality of the MySensors library - not because I expect to change the code frequently, but just in case, for convenience - but I didn’t have time to mess with this yet. So the question is, if I need to be able to upload the actual sketch physically / wired for the first time - like with ArduinoOTA for the ESP8266, before you can use the wireless upload? If not, I’d gladly remove the serial header entirely.

    I might also remove the LED, as I probably won’t use it in the final build to save power - I’m currently using them on the prototypes to see when and for how long they wake up. With the saved space I might either try to make this thing even smaller or a little more versatile by adding additional headers for I2C / SPI instead.

    Thanks for your attention and patience if you actually read everything! 🙂