At present,the number of shared bicycles has reached hundreds of millions,which brings safety risks while facilitating people’s lives. People travel at night because there is no light source to provide illumination,which is very likely to cause traffic danger.The safety of night-time driving of shared bicycles has become a serious issue in the use of shared bicycles.Based on the above problems,the bicycle self-powered lighting device is designed,which converts part of the mechanical energy of people during riding into electric energy as a source of energy for nighttime illumination,providing energy for nighttime driving illumination.And it can also charge electronic devices,while through the STM32 microcontroller to achieve real-time display of user name,speed,battery power and other information.This is important for the popularity of shared bicycles and the safety and convenience of people’s daily lives.