With pinhole photography, everything is "in-focus" all the time. Objects one inch away to infinity appear to have the same focus. The smaller the pinhole, or aperture, the sharper the image but also the less light that is available to the sensor. The larger the pinhole, the duller the image. Modern, high-ISO cameras aid in exposing the image created by the tiny pinhole.
Pinhole cameras are very easy to create. A camera with a high ISO and a matching body cap will be needed. The body cap is used for the pinhole. Remove the center of the body cap (ideally, with a dremel tool) and super-glue a piece of aluminum foil over it. Use foil that is not too thin as it will be too fragile; however, the thinner the foil the better the results. Then use two pieces of thread to find the center of the body cap by laying them cross-wise (perpendicular) to each other. Take a needle and prick the smallest hole possible. For best results, try not to insert the needle all the way through the foil, just the tip of the needle.
Another approach is to use a piece of a coke can as the foil, which is thick. Indent the foil using a large needle or small nail/tack. Then take sand paper and carefully sand the indent down until a tiny hole forms. This will create a hole with the thickness tapering down to nil and will produce very good results.
Using flat black paint, paint the inside of the foil to lessen light reflections inside the mirrorbox of the camera.
It is very hard to see, but there actually is a tiny hole in the center of the foil in the first picture. To increase the focal length, use an extension tube between the camera body and the pinhole body cap. To decrease the focal length pray for a miracle because it is not possible to go much shorter without hitting the mirror. Also, a short focal length pinhole has high vignetting.