A device (1) comprising a sensor module (2) with a package (3) is produced at reduced costs by providing the package (3) with two or more substrates (4,5) each with a functional layer (14,15), at least one sensor (24,25) such as a magnetometer and / or an accelerometer being located in at least one functional layer (14,15), and by providing the package (3) with a system comprising solder bumps (7-12) for aligning the functional layers (14,15). The system either comprises a first number of solder bumps (7,8) for coupling the functional layers (14,15) electrically and mechanically to each other via first bonding elements (31) or comprises a third substrate (6) with a third functional layer (16) and a second number of solder bumps (9,10) for coupling the first and third functional layers (14,16) electrically and mechanically to each other via second bonding elements (32) and a third number of solder bumps (11,12) for coupling the second and third functional layers (15,16) electrically and mechanically to each other via third bonding elements (33). Mechanically and / or electrically dummy solder bumps improve the alignment of the functional layers (14,15).