Machine for preparing and dispensing a beverage, such as tea, coffee, hot chocolate, cold chocolate, milk, soup or baby food, such machine comprising: - an extraction unit for extracting a beverage ingredient capsule to form said beverage, e.g. a unit having a first part and a second part that are relatively movable between a distant position for inserting and/or removing a capsule and a close position, such as a close position in which the first and second parts delimit an extraction chamber, for securing and extracting such capsule, optionally at least one of said parts has a capsule opener e.g. one or more capsule piercers and/or at least one of said parts has an opening for an inflow of liquid to be mixed with an ingredient contained in such capsule; - a control unit for controlling the extraction unit to extract such capsule, such as a control unit powered by the mains e.g. via an electric cord; - an outlet for dispensing said beverage formed by extracting such capsule to a user-receptacle, such as a cup or a mug, located in a receptacle placing area, such as on a receptacle support e.g. an external placement support on which such machine is located or a machine support e.g. a movable or removable machine support, to collect said beverage, - a capsule recognition module for recognizing a capsule inserted in said machine at a capsule recognition position, the capsule recognition module comprising a camera for capturing an image of at least part of said capsule in said capsule recognition position, - at least one source of light, for example at least one LED, to light up a capsule at said capsule recognition position, wherein the capsule recognition module comprises a diffusor for diffusing the light of said at least one source of light towards said capsule recognition position, characterized in that the diffusor further comprises protruding elements formed on its inner surface in order to prevent the light from reaching directly the capsule recognition position. - an extraction unit for extracting a beverage ingredient capsule to form said beverage, e.g. a unit having a first part and a second part that are relatively movable between a distant position for inserting and/or removing a capsule and a close position, such as a close position in which the first and second parts delimit an extraction chamber, for securing and extracting such capsule, optionally at least one of said parts has a capsule opener e.g. one or more capsule piercers and/or at least one of said parts has an opening for an inflow of liquid to be mixed with an ingredient contained in such capsule; - a control unit for controlling the extraction unit to extract such capsule, such as a control unit powered by the mains e.g. via an electric cord; - an outlet for dispensing said beverage formed by extracting such capsule to a user-receptacle, such as a cup or a mug, located in a receptacle placing area, such as on a receptacle support e.g. an external placement support on which such machine is located or a machine support e.g. a movable or removable machine support, to collect said beverage, - a capsule recognition module for recognizing a capsule inserted in said machine at a capsule recognition position, the capsule recognition module comprising a camera for capturing an image of at least part of said capsule in said capsule recognition position, - at least one source of light, for example at least one LED, to light up a capsule at said capsule recognition position, wherein the capsule recognition module comprises a diffusor for diffusing the light of said at least one source of light towards said capsule recognition position, characterized in that the diffusor further comprises protruding elements formed on its inner surface in order to prevent the light from reaching directly the capsule recognition position.