Tell us about yourself!
They sell regulated AC adapters that output a steady voltage. This is a good idea. I hooked one up to my son's swing years ago for the same reason. I never thought to using a dowel rod and screws to fit inside the battery compartment. It seems like a secure way of hooking it up.