The layers correspond to thousands of years, i.e. 23,000 years in Spain in the Danien timeline:
The page sais that there is a variation of 23,000 for precession of the equinoxes and 100,000 for variation of ellipticity. https://planet-terre.ens-lyon.fr/image-de-la-semaine/Img421-2013-04-15.xml
To piggyback on Gimelist's answer:
Another important tool X-ray diffraction. XRD is used to determine crystalline structures. Specifically, XRD sees the dimensions of different crystals (and most "rocks" are crystalline). When used with the information that XRF or other elemental analyses produce, skilled operators can identify what specific materials are ...
You are looking for a portable XRF.
It does (almost) exactly what you said. It sends electromagnetic radiation to the rock (X-rays), which excites electrons in the atoms and when they bounce back they return X-ray of different energies which are detected by the instrument. It looks like this, for example:
Using the different peaks you can figure out what ...