How to connect 9V battery to arduino

Hello, I have a 9v battery but the cable does not have a jack to connect it, since I have the one seen in the photo. When I test the project with a usb cable, it works perfect. But when connecting the battery to the breadboard, the arduino board turns on but the project stops working correctly. What is the problem?

You are trying to use one of these

to power your project, right?

Don't

Use something else.

But in the meantime to help solve your issue. post a pic or two of your project with the 9V connected.

Use a high-capacity LiPo with a boost converter. Expensive? Yes.

But it's rechargeable and isn't utter garbage. LiPos can output far more power.

9v smoke alarm batteries cannot supply very much current. If you try to pull very much current from the battery, the battery output voltage will drop. You need to use a power supply that outputs the correct voltage and will supply sufficient current to your project. @ IceChes has a good suggestion.

What Arduino board do you have?

They mentioned a jack so probably an UNO.

How did you wire up the breadboard - without knowing this we aren't in a position to help. ie post your circuit (hand-drawn diagram, photo, something that's complete and accurate please).

I wouldn't personally try to pull more than 50mA from a 9V battery like that, unless its one of the new LiPo-inside type, which can handle loads of current (but which are actually 7.4V, not 9V).