I agree with Patricia. The device on a dog alone in a crate is cruel, the dog has no real idea why the pain in his ears and there isn't even a chance to reward him.
Personally, I'd drop the use of the hand held device too. But if you are going to use it, consider it in the same manner of any other physically punishing action-- a shock collar, a prong collar, etc. It is using a pain as positive punishment (aversive consequence after an undesired behavior) and don't minimize that it can be very unpleasant for the dog.
Try playing "crate games", somewhere around here there is a post I wrote detailing a crate games seminar as an outline for a starting place. Youtube should also have options. You want the crate to feel safe, homely, cozy. Barking in a crate is generally a sign of stress, rather than barking AT something like a dog that runs to the window to bark at the mailman or a squirrel etc. Feed meals in the crate, try using some white noise or soft classic music to mask outdoors sounds when you are gone, leave the door to the crate open when you are home and reward the dog if he naps there voluntarily.
If the dog shows signs of greater stress such as self harm (biting at feet or tail, scratching excessively, etc), lots of drooling, doesn't quit barking after maybe 15-20 minutes, or similar then consider alternatives to crating and/or some vet prescribed calming medication.
Oh, and a fair number of younger people (kids, teens, early 20s) can hear the ultrasonic devices and its not pleasant for them either. Most people lose that frequency of hearing as they age. In a campground or RV park, a device like that could be really rude to your neighbors. Kinda worse than a barking dog since adults might not hear it and not believe their kids/teens complaints.