No surprise there. You need a better power supply, look for one rated at least 2.5A, or if it's a cheap Chinese made one double that as they're always overrated.
By using a 12V resp. 5V power supply with a sufficient current rating.
A buck converter may work, again get one with sufficient power rating. The cheap ones you find listed on e-bay typically need to be downrated by half, to get to the real ability.
40V on 6.5Ω results in a current of 6A and 250W dissipated in the coil. Seems survivable for a second, maybe two.
40V on 1.9Ω results in a current of 21A and 840W dissipated in the coil - and unless you have 2.5mm2 or thicker wires, those may start to burn first. Your battery may also not be all too happy with this kind of current output.
The easiest answer is to use a appropriately rated buck converter. Watch the high voltage side that is close to the limit on some of the inexpensive buck converters.
Solenoid voltage ratings are nominal. For such a short on period, it is OK to exceed the nominal voltage by a small amount. A series voltage dropping resistor should work.
The first thing to do is to establish the minimum DC voltage that will reliably activate the solenoid, mechanically loaded as per the project (9V may work, for example). Then size the resistor accordingly.
Example: if 9V works, then the steady state current draw is 9V/6.5R = 1.4A.
The series resistor for 25V is 25V/1.4A = 18 - 6.5 = 11.5 Ohms. If 42V is applied, the current draw is 2.3A. The power dissipated by the solenoid coil would be 2.3A^2 x 6.5R = 34W, which is unlikely to overheat the solenoid in 3 seconds.
For comparison, the power dissipated when 12V is applied is 22W.
Your two or more topics on the same or similar subject have been merged.
Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.
Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.
Repeated duplicate posting could result in a temporary or permanent ban from the forum.
Could you take a few moments to Learn How To Use The Forum
It will help you get the best out of the forum in the future.