Advantages to solder over headers?
Advantages of solder:
- Lower part usage
- Mechanical strength
- Part cost
Disadvantages:
- Effort to replace if needed
- Effort to assemble
There isn't much to worry about for capacitance and noise for a header + connectors vs soldering. It really boils down to assembly cost/time/effort. Keep in mind commercial products use both in similar environments. The most critical thing here is if your use case involves a lot of vibration. Solder would beat a non locking terminal strip.
In addition to what @Passerby said, I can think of few other considerations.
1. Space limitations: Fairly obviously, headers and pin connectors require more physical space to accommodate them without pinching or stressing the wires.
2. Fail-safe needs for wire snags/ tension: Depending on where and how the sensor will be mounted, and how the wires will be secured if at all, the relatively insecure connection of headers vs solder could actually be an advantage. Better to have a connector unplug than to damage a PCB. Of course good wire management and proper strain relief is the best option when possible regardless of termination type.
3. Corrosion risks: Solder is inherently less susceptible to corrosion than pin connectors. Granted, unless you've got a fully potted or well coated board, by the time corrosion becomes an issue with header pins you'll probably also start having to worry about any small pin pitch and sensitive components on the board. Gold plated headers and pins can help here too, albeit more expensive.
4. Redesign and re-purposing flexibility: I do a lot of prototyping work. Sometimes I go with headers simply because I know there are good odds I'll have to change the wire lengths or scrap the project.
No clear overall winner. For me, the decision usually ultimately comes down to how I have to mount it and how likely I am to unplug/replace it. Really just a matter of balancing project needs and life cycle expectations with personal preferences.