In the above the diagram only the solenoid named C with the 2 MOSFET modules and the sensor circuit were connected along with the buttons. The smoke was observed on the breadboard where there are wires connected at the terminals to power the breadboard which uses the 5V and GND from the Arduino Mega.
