Arduino Uno can not read and write data when connected with battery

I'm a beginner with Arduino. I'm using MQ135, MQ2, and DHT11 together and trying to save the data in an SD card.

when I upload the code using a USB cable with my laptop it works fine,It collects data and writes to the SD card.

But the problem happens when I disconnect the USB cable from the laptop and connect the setup with a 12V connection it's powering up but it can't read the data and write to the SD card.

How can I solve this problem?
I read a lot of old posts here.
But not getting help anyhow.
I

Hi, and welcome to the forum.

12volt is the absolute maximum I would power an Uno R3 (assuming) with,
and at that voltage you can't draw more than 100mA total from any/all pins.

The MQ135 alone draws already more than that (150mA), so it's likely that your Arduino ends up in an endless reset loop because of an overheating 5volt regulator.

An easy solution is to power the Uno with a 5volt cellphone charger, through the USB socket.
But if you must use that 12volt supply, then drop it to 5volt with a buck converter, and connect that 5volt to the 5volt pin (and the sensors).

I assume you are using an SD card reader with built-in regulator, connected to 5volt.
Please read the " how to post" guide, so we don't have to guess what you have.
Leo..

1 Like

The Arduino is not a power supply, using it as such can fry it.

Thanks for your quick response.

Please take a look at my setup.

Everything is working fine but suddenly the sensor stops working.

I'm confused why it stops

Put your finger on the black part between the DC socket and the USB socket.
Tell us if it's getting hot.
Leo..

Yes, Its getting hot

So don't power the Uno with 12volt.
I gave you two solutions.
Leo..

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.