The rodent whisker-barrel system has been an ideal model for studying somatosensory representations in the cortex. However, it remains a challenge to experimentally stimulate whiskers with a given pattern under spatiotemporal precision. Recently the optogenetic manipulation of neuronal activity has made possible the analysis of the neuronal network with precise spatiotemporal resolution. Here we identified the selective expression of channelrhodopsin-2 (ChR2), an algal light-driven cation channel, in the large mechanoreceptive neurons in the trigeminal ganglion (TG) as well as their peripheral nerve endings innervating the whisker follicles of a transgenic rat. The spatiotemporal pattern of whisker irradiation thus produced a barrel-cortical response with a specific spatiotemporal pattern as evidenced by electrophysiological and functional MRI (fMRI) studies. Our methods of generating an optogenetic tactile pattern (OTP) can be expected to facilitate studies on how the spatiotemporal pattern of touch is represented in the somatosensory cortex, as Hubel and Wiesel did in the visual cortex.