The size of the hole is critical, and there are sites on the web that have formula you can use to get the best results from your gear. You need the distance between the body cap and the bit where the image will fall , either the sensor or the film.
One trick I worked out was that guitar strings come in regulation sizes and you can use short sections of those to drill the hole in the coke can or aluminium foil on the body cap. had a fun day with an old Fuji S! and a bit of tape and some short 2cm long guitar string fragments….. warning.though, it’s a hole you are making and potentially a place whee dust can enter your DSLR
I also found the image produced from the pinhole was VERY big , much larger than the cameras sensor, so it didn’t pick up that pleasing astigmatic soft cornering…