<sec>With the advance of the fourth industrial revolution, a wave of emerging industries and interdisciplinary research is breaking out, such as the Internet of Things, megadata, humanoid robots and artificial intelligence.The rapid development of these functional electronic devices is changing the way people communicate with each other and their surroundings, thus integrating our world into an intelligent information network. The applications of flexible wearable electronic devices in intelligent robots, health and medical monitoring and other fields have attracted great attention. Following the human skin, the device can respond to external stimuli and should also have stretchability and self-healing properties. In practical applications, a large network of sensors is needed to connect with humans or robots, so the supply of energy is crucial. Several forms of green and renewable energy have been searched for, such as magnetic energy, solar energy, thermal energy, mechanical energy and microbial chemical energy. However, high cost, limitations in the choice of materials, and other disadvantages have become serious bottlenecks.</sec><sec>The advent of nanogenerator brings a novel and effective solution to the above problems. Here in this work, the triboelectronic nanogenerator (TENG) and the piezoelectric generator (PENG) are taken as two representative objectives, which are, respectively, based on the triboelectronic effect and piezoelectronic effect to realize the collection of mechanical energy, and each of them can be used as a self-power sensor, which can generate electrical signals, respond to environmental stimuli, and need no power supply any more.</sec><sec>The optimization and design of nanogenerator is always a key factor to improve its performance and wide application. At present, the methods commonly adopted in optimization schemes mainly include material selection, design and optimization of structural layer and electrode. The selection of materials should be based on low cost, stretchability, transparency, stability and biocompatibility. Firstly, for the optimization of structural layer, there are mainly two ways of designing the materials, one is the microstructure of the material surface, and the other is the functionalization of materials.The performance of the nanogenerator is proportional to the charge density of the contact surface. The square of the charge density is the main parameter to quantify the performance of the nanogenerator. Therefore, increasing the charge generation has been the main strategy to improve the output power. The microstructure of materials can be realized by means of colloidal arrays, soft lithography, block copolymer components and surface nanomaterial manufacturing. The same materials can be functionalized by ion doping, plasma treatment, electrical polarization, laser induction, and the formation of nanocomposites. In practical application, more attention is paid to the electrode with excellent performance which can simplify device structure, improve device performance and expand application field. The design of the electrode more focuses on the features such as flexibility, stretchability, high transparency and excellent electrical conductivity. The touch sensors based on TENG and PENG such as pressure sensors, strain sensors, pressure distribution sensors and slip sensors have shown excellent performances in application. Self-powered pressure sensors are used most widely because they are highly sensitive to and can detect the subtle pressure changes such as respiratory or arterial pulse-related changes. Strain sensors can detect signals produced by the body during mechanical movements, such as walking and joint movements. Pressure distribution sensor and slip distribution sensor play a key role in touch screen and smart prosthesis and so on.</sec><sec>In this article, first, we introduce the mechanism of TENG and PENG, and summarize the way of performing the optimization design of the nanogenerators. Then, we discuss the self-powered sensors based on the nanogenerators such as stress, strain and distribution and slip sensors by combining the marerials and the design of device. Finally, the problems and challenges of the tactile sensor based on the nanogenerators are discussed, and the future development is prospected.</sec>