I design spectrographs, which use devices that are like prisms to split light into its different wavelengths. This spectrum of light then falls onto a detector just like you find in a digital camera (but bigger) which turns the light into electrical signal.
One of the big challenges is that the light is very faint, so we have to keep looking at one place for an hour or so. This means everything has to be very precisely aligned and stable so the instrument doesn’t wobble and blur the image. Also we cool the detectors down to about 70 Kelvin (-200 celsius) because we are measuring heat (infra red light) and so any heat from the instrument itself will ruin the image. Cooling stuff that cold is not super easy.