I am trying to write sensor readings (MQ-135 gas and SDS011 particle) on SD card. The attached code works when Arduino ground is not connected to the power supply ground, but as soon as I connect them, Arduino stops communicating with the Serial Monitor and displays nothing.
Is the SD shield faulty or there is something wrong with the code.
The assembly contains one MQ-135, SDS011, a touch button conditioning readings from SD011, a switch for MQ-135 power supply and a switch for the fan of SDS011.
I have attached the code.
Any advice on this is welcomed.