A wearable system for the personalized EEG-based detection of engagement in learning 4.0 is proposed. The system can be used to make an automated teaching platform adaptable to the cognitive and emotional conditions of the user. For example, the teaching strategy could be personalized by an automatic modulation of the proposed contents. The system is validated by an experimental case study on twenty-one students. The experimental task consisted in learning how a specific human-machine interface works. Both the cognitive and motor skills of participants were involved. De facto standard stimuli based on cognitive task and music background were employed to guarantee a metrologically founded reference. The proposed signal processing pipeline (Filter bank, Common Spatial Pattern, and Support Vector Machine), in within-subject approach, reaches almost 77 % average accuracy by a 3 s time window, in detecting both cognitive and emotional engagement.