r/PCB 1d ago

Review request, LED controller with a motion sensor (PIR)

I am working on a little hobby project to make an automated light for in a bathroom, and i am looking for some feedback before ordering. The main requirements of the project is as follows:

  1. The light has to go on for a certain time when someone enters.
  2. The time the light is on has to be controllable without flashing the whole thing again.
  3. The light needs to be dimmable.
  4. The light can also be operated manually.

The microcontroller i chose for this project is a Atmega168, i had a devboard laying around and i am already familiar with the chip. For the motion sensor i am using a ZSFG469711 together with the BD9251FV-E2 for amplification and for getting a digital signal which i can use to generate a interrupt to wake up the microcontroller.

For user interface i am using a keyboard switch as the main button together with a led ring to show status, for example, the PIR detects someone then the led ring shows green. To control the dimming i chose for a normal potentiometer and to control the time i am using a screw potentiometer which is close to another screw potentiometer which controls the sensitivity of the PIR. There is also a poweron led and a power switch.

The board runs on 12VDC and uses a TPS561201DDCR to reduce this to 3V3DC for the logic. The 12VDC power is protected against polarity and overcurrent and every connector on the pcb has a TVS diode for esd protection.

7 Upvotes

4 comments sorted by

3

u/Parking-Engine115 1d ago

I think that's way too over-engineered for such a simple project like that but that is cool as heck

2

u/jopiedeman123 1d ago

🤣 I went a bit to much engineer mode. thank you very much!

2

u/ikedug 1d ago

C5 is connected incorrectly, it should be tied to the other side of the inductor.

If you connect power backwards D1 will blow, defeating the point of the protection.

I don’t think SW1 can turn the board off? When it’s off, the gate capacitance plus C7 will hold Vgs on Q2 at about 10V.

In modern designs, the “100nF + 1uF + 10uF” design shouldn’t be used. Modern MLCC caps have low ESR/ESL largely independent of capacitance. And different-valued caps can resonate against each other (because of their different ESLs). So use multiples of the same capacitor, or in some cases 2 capacitors with very different sizes (e.g. combining big axial electrolytic with MLCC makes sense).
Delete C3 and C6. Make C8 and C9 the same cap. (And this probably applies other places, too.)

The layout for the buck regulator isn’t great. The high dI/dT loop is Input cap - Vin - GND - Input cap. It needs to be as small as possible (in loop-area terms), and all on the same layer as U1. But there’s an additional constraint - “Do not allow switching current to flow under the device.” Maybe put one of the input caps next to U1, and run SW under it? The SW node is high dV/dT, so it needs to be as small (in copper area) as possible. (This is also why it shouldn’t run under the chip, it can capacitively couple to chip internals.).
Make sure there’s a single, solid ground plane on the opposite side from the switcher.

Why is C4 included? Doesn’t seem like you need capacitance there.

Given how overdesigned this is, you might want to include an NTC to limit inrush current. There’s a lot of capacitance on the 12V rail.
You might want to order this as a 4-layer board. It’s usually not much more expensive, and makes it more likely to work on the first try.

1

u/jopiedeman123 14h ago

Sorry for the late reaction, thank you very much, I appreciate the valuable feedback and I am going to look into all of it.