Sleep is a natural state of rest for the body and mind. It is essential for a human’s physical and mental health because it helps the body restore itself. Insomnia is a sleep disorder that causes difficulty falling asleep or staying asleep and can lead to several health problems. Conventional sleep monitoring and insomnia detection systems are expensive, laborious, and time-consuming. This is the first study that integrates an electrocardiogram (ECG) scalogram with a convolutional neural network (CNN) to develop a model for the accurate measurement of the quality of sleep in identifying insomnia. Continuous wavelet transform has been employed to convert 1-D time-domain ECG signals into 2-D scalograms. Obtained scalograms are fed to AlexNet, MobileNetV2, VGG16, and newly developed CNN for automated detection of insomnia. The proposed INSOMNet system is validated on the cyclic alternating pattern (CAP) and sleep disorder research center (SDRC) datasets. Six performance measures, accuracy (ACC), false omission rate (FOR), sensitivity (SEN), false discovery rate (FDR), specificity (SPE), and threat score (TS), have been calculated to evaluate the developed model. Our developed system attained the classifications ACC of 98.91%, 98.68%, FOR of 1.5, 0.66, SEN of 98.94%, 99.31%, FDR of 0.80, 2.00, SPE of 98.87%, 98.08%, and TS 0.98, 0.97 on CAP and SDRC datasets, respectively. The developed model is less complex and more accurate than transfer-learning networks. The prototype is ready to be tested with a huge dataset from diverse centers.Copyright © 2023. Published by Elsevier Ltd.