I am designing a PCB and I have a problem with the LDO, the voltage mesured in the output should be 5v but it is over 7v.
I have several PCB's i got assembled from JLC and all of them have the same problem, one is outputting 7,02v, another 7,26v and the rest are somwhere in between.
This is the schematic for the power supply part of the PCB

I used an
AO4407A (P-channel Mosfet) to protect from reverse polarity, and an
AMS1117-5.0 to lower the 12v VCC into 5v to power an ATmega 2560, optoisolators, mosfets, a couple of ULN2003A, a YX5200 mp3 player IC, an oled display and a couple more little things.
I don't know if I did something wrong or the LDOs are defective.
This is the pcb layout:

Any help would be really appreciated.
From datasheet: minimum load 10mA. Did you happen to test the boards without load on the 5v supply?
Yes, that must be it, I tried plugging in the OLED display and it works fine.
This is a really common trap with low dropout regulators and negative 79xx type regulators.
that should be made sticky for every beginner in electronics.most of us saw the same thing at one time
Is there a decent modern jellybean regulator similar to the 1117 types that does not have a minimum load, stable with ceramics, 0.5A+ and such? I'm not sure why, but the most available LDOs/linear regulators seem to be relics with weird requirements like minimum load.
Zero load floating linear reg? Isn't that like trying to charge a cap to 5V with a series 5V zener? If zener leakage > cap leakage it's hopeless.