Image comparison flow (or node)

Hi there

This might be similar to Image analysis and comparison

I have following Idea. I want to use a Node-RED on Raspberry Pi for some functional visual inspection of a PCB where different LEDs are lit in some order. Basically the NodeRED should tell to the PCB "Please turn on this and this LED" and then check with a USB Webcam that appropriate LEDs are on or off". Preferably also light colour should be checked. And then next step and so on.

In order to realize this idea I want to take some reference photos of the PCB during these test steps with the same webcam. So the work for Nodered will be just a comparison of actually taken image from the camera with a reference one for this test step.

The problem as I see it - different ambient conditions, light, shadow, PCB can be placed with some offset etc. Some problems could be solved by transferring the pictures to gray scale, but then I loose colour comparison,. So the comparison algorithm can not do it just pixel by pixel, but must have some intelligence. Any Ideas on how to easy do it without involving AI, machine learning etc?
It should be quite common machine vision problem, I guess.

Also an option to send the images to some cloud service for analysis would be interesting. Small fee, performance or copyright problem is not a problem. The images do not represent any commercial interest.