The following worked from a google search. The screen still dims, but at least it doesn't totally timeout.
If it's sufficient for you to only keep screen on when charging, you can turn on the Stay awake option in Developer options.
To do this:
Open Settings, navigate to About [device] (tablet, phone etc.)
Find Build number entry there. If there's none, it may be in Software information subsection.
Tap Build number 7 times
Make sure that a message pops up saying that you've become a developer (or that developer mode is already enabled)
Go back to Settings main menu
Find the newly-appeared Developer options item
Turn on Stay awake option