The Palomar Transient Factory (PTF) is a synoptic survey designed to explore the transient and variable sky in a wide variety of cadences. We use PTF observations of fields that were observed multiple times (≳10) per night, for several nights, to find asteroids, construct their light curves and measure their rotation periods. Here we describe the pipeline we use to achieve these goals and present the results from the first four (overlapping) PTF fields analysed as part of this programme. These fields, which cover an area of 21 deg2, were observed on four nights with a cadence of ∼20 min. Our pipeline was able to detect 624 asteroids, of which 145 (≈20 per cent) were previously unknown. We present high-quality rotation periods for 88 main-belt asteroids and possible period or lower limit on the period for an additional 85 asteroids. For the remaining 451 asteroids, we present lower limits on their photometric amplitudes. Three of the asteroids have light curves that are characteristic of binary asteroids. We estimate that implementing our search for all existing high-cadence PTF data will provide rotation periods for about 10 000 asteroids mainly in the magnitude range ≈14 to ≈20.