I have a problem with the arduino nano, when this is connected to the PC by the USB cable the serial communication works fine, however when I disconnect it and feed it with a 9v battery the arduino stops sending transmission data.
I am working with a bluetooth transmitter, this works well with the arduino when it is connected to the PC, but when I feed it with the battery, it stops transmitting data completely.
I do not know what is due and I need help with this, anything that can help me is grateful.
Is your battery one of the small rectangular smoke alarm batteries?
Yes, my battery is a rectangular panasonic brand
Those batteries are not man enough for the job of powering an Arduino , as you have found
They can power an Arduino... just about. But not a Bluetooth module, and certainly not an Arduino and a bluetooth module together.
Use AA cells. 3xAA if using non-rechargeables, 4xAA for rechargeables (which I would recommend, for the sake of our planet). Connect them via the 5V pin, bypassing the Arduino's regulator.
It pains me to have to repeat this so often but ...
The "Vin" pin or in fact the "barrel jack" which is the same with a diode, was provided to demonstrate the Arduino. Once you start connecting things that draw current, and that includes connecting things to draw current from the "5V" pin, you are playing with fire - or not! This is even worse for the Mega as it has more pins to connect things to!
The on-board regulator - unless you use a variant such as the "RoboRed" (it has a proper switchmode regulator) - has no heatsink of significance. It may theoretically have a rating of 1 A, but only when bonded to a substantial heatsink. You can barely see it on the Arduino board. You will not get 1 A at 5 V from the board with any "Vin" voltage for more than a second or two before the regulator overheats - and hopefully shuts down peacefully. You may be lucky to get 150 mA.
It is thus extremely bad design to use "Vin" in a serious project. Even if it works at a start, any modification may later cause trouble.
The microprocessor and its peripherals operate from 5 V. If you have 5 V then you provide it to the "5V" terminal. You can fudge it by connecting something such as a USB charger to the USB connector but there is a 500 mA polyfuse on the UNO/ Mega and a diode on the Nano interposed. If you do not have 5 V, then you provide a switchmode regulator to produce regulated 5 V.
Thanks to all, in the end I never found the detail with the arduino nano, I think the problem is manufacturing. I tried some changes among those who mentioned me and the problem persisted.
The solution was to change arduino, i try with an arduino one of Steren and the problem was the same, the one that worked was an arduino Chinese one, I could feed it with the battery and it worked without problems, so I guess it was design problem of the other two.
Thanks again everyone for your answers!