The newest generations of credit-card-size microcomputers get more powerful every year. In 2020 Raspberry released a high resolution camera named "Pi HQ Camera". Although limited by the processor in its ability to reliably deliver good quality video, this 12 MP camera contains a Sony IMX477 sensor, and produces really good images. By connecting the hardware to the Raspberry Pi (I use the model B-4) it's possible to control the camera's shutter via VNC viewer by using a python script. In combination with a multistack algorithm, the results are at a publication quality level.
GoPro cameras are particularly appropiate for microscopy and macro applications: