Begin by reading the label on your yarn. The needle size and gauge listed on the label are generally intended for a medium-density fabric, not too loose and not too dense (which we call woolly cardboard). This sample swatch is made of Manos del Uruguay Handspun Semi-Solids, which is typically knit on US size 7 - 9 needles for a gauge of about 4 stitches per inch.
To get an accurate measurement you'll need about 4 square inches in which to measure; for this swatch I cast on 25 stitches with US size 9 needles. The garter stitch border helps keep the swatch from curling around the edges. Depending on what stitch pattern you are experimenting with, you may not need a border at all.