Pattern recognition, including handwriting recognition, has become increasingly common in everyday life, as is recognizing important files, agreements or contracts that use handwriting. In handwriting recognition, there are two types of methods commonly used, namely online and offline recognition. In online recognition, handwriting patterns are associated with pattern recognition to generate and select distinctive patterns. In handwritten letter patterns, machine learning (deep learning) is used to classify patterns in a data set. One of the popular and accurate deep learning models in image classification is the convolutional neural network (CNN). In this study, CNN will be implemented together with the OpenCV library to detect and recognize handwritten letters in real-time. Data on handwritten alphabet letters were obtained from the handwriting of 20 students with a total of 1,040 images, consisting of 520 uppercase (A-Z) images and 520 lowercase (a-z) images. The data is divided into 90% for training and 10% for testing. Through experimentation, it was found that the best CNN architecture has 5 layers with features (32, 32, 64, 64, 128), uses the Adam optimizer, and conducts training with a batch size of 20 and 100 epochs. The evaluation results show that the training accuracy is between 85, 90% to 89.83% and testing accuracy between 84.00% to 87.00%, with training and testing losses ranging from 0.322 to 0.499. This research produces the best CNN architecture with training and testing accuracy obtained from testing. The developed CNN model can be used as a reference or basis for the development of more complex handwriting pattern recognition models or for pattern recognition in other domains, such as object recognition in computer vision, facial recognition, and other object detection.