Whilst its perfectly feasible to build a DIY TENS device for low-level pain relief it generally isn't worth the effort as they are readily available for a few 10s of $. More sophisticated/powerful muscle stimulators such as my $700+ HasoMed undergo rigorous safety certification as a CAT2 medical device before they are sold and are generally only available with training through specialist suppliers as they can be damaging if misused.