Two different power sources to a single peripheral (switch between the two)

Hey guys.
New guy here.. hopefully you could help, and I'll try and help others out if I ever know anything In return.
I have a question if someone could shed some light on the subject please.
I am building a claw machine and have all the motors, joystick etc working and coded etc.. however my claw solenoid is causing me a bit of an issue.
I'm powering it to a relay and 24v which grabs most medium size prizes well, however I would also like to run 9-12v supply to it, so it realistically let's the toy drop through the claws grasp. I would ideally like voltage change to be controlled by the arduino.. so I can get a realistic payout percentage of games (forcefully) lost, by the machine and a percentage of games allowed to win. I've tried searching for different items to allow this and didn't know if there was anything out there that can take two different power supplies, and allow the arduino to control which power supply is activated. I've tried running through two relays but as they shared a common ground I ended up frying both psus because I didn't leave enough of a gap between switching relays and must've spiked them.
Or failing that.. is there a regulator that I could hook up to a 48v psu and have the arduino regulate the allowed voltage through it.. so effectively could run the 48v down to 9-48v, again all controlled by the arduino.
Hope my description of this is sufficient.
Thank you for your time.

Extremely do-able.

A good MOSFET setup can PWM the voltage up and down. (non tech explanation)

A DPDT C/O relay could also perform the task but with a little less variability than the MOSFET.

There are also voltage droppers (buck / boost) that can also be Ardi controlled but these are usually a little more expensive. and are PWM to VOLTAGE convertors

I suspect you may have had the wrong type of relay as most single contact C/O relays don't have enough time between the C/O to prevent the spikes you saw or the current was maybe high enough to actually cause a mini flashover on a cheaper relay.

I want to make a device that allows the user to switch between two different power sources (a wall mount and batteries).
I could perform this circuit using two DPDT switches, but I would need to switch the two switches each time I want to change sources. Is there a simpler way to perform this function without using relays? KrogerFeed

I remember being with a friend who was very good on those machines, after several wins in a row someone came over and stopped him playing, claiming that the machine was faulty. Yeah, right, of course it was.