Experiences with pain stimulator?

I’ve been on painkillers that are no longer working well. The dr suggested a stimulator machine that is put into your back and you use it when you are in pain. Does this work?