24V battery to drive a 5V arduino speed controller and a motor
How can I accomplish this?


I would buy or build a small buck converter that takes a range of input voltages (say 18 V to 36 V) and delivers your logic supply (5 V or 3V3) for the Arduino. Maybe one of these: -



The NPN transistor would probably have its emitter grounded with the motor wired between collector and 24V - you will need a flyback diode across the motor of course. The base of the NPN will need to be driven through a resistor from the Arduino.

If you want speed control you have to use PWM for the above set-up.