A brewing unit (1) of a beverage preparation machine has: a seat (11) for receiving a capsule (2) having an electrically conductive material (21, 22, 23, 24); and a capsule sensing electric circuit with first and second electric connectors (A, B). The first electric connector (A) and the second electric connector (B) are electrically connected through the electrically conductive material of the capsule (2) when the capsule is present in the seat (11) and electrically disconnected when the capsule is not in the seat so as to close and interrupt, respectively, the capsule sensing electric circuit (A, Aa, a, B, Bb, b, abc).