This is just a general technique that might apply here. One thing that beginners often do is to try to start and end a conversion in a single pass. For example,
start the conversion
kill some time
read the input
use the data
The problem with this is that you need to wait long enough for the inputs to become stable, but you don't want to wait too long because doing so eats into your periodic's time slice. The usual solution is to turn things around, like so -
read the input
use the data
start a conversion
it looks backwards, but what it does is let the hardware do its thing for the entire length of the periodic. For example, let's say a conversion takes 50 usec (for argument's sake, combine the time to select an input and the ADC time), and you're trying to read the device every 1 msec. The first way, assuming you wait the bare minimum 50 usec, then 5% of every 1 msec interval is wasted, and the hardware has only the minimal allowable settling time. Done the second way, by the time you read the input, the hardware has had a full millisecond to do its thing, the data is available immediately at the start of the periodic, and the processor can get back to doing whatever it does between times with no cycle wasting delay loops.
Of course you do take a latency hit this way; in the example, all your data is 1 msec old, but usually the latency incurred this way is acceptable. In return you tend to get more stable input and more efficient cpu usage.
By the fact you're using an Arduino I suspect your project is not done in a professional framework, but it is some hobby or research project, i.e. something with relatively low budget. Please, correct me if my assumption is wrong, because I'll start from there in my answer.
In these conditions, I fear the answer is no, you cannot protect your weather station from direct lightning strikes, unless you spend much more money than the cost of the entire project.
That's because lightnings are extremely nasty beasts (much more than one could imagine!), and to justify my claim I'll cite some sources from the Internet below.
First of all, for the public at large, a brief introduction to what lightning are by an expert in that subject. And here is a more comprehensive
scientific article on the subject.
Let's get a bit more technical and tackle lightning protection: here is "How to Protect Your House and Its Contents from Lightning", a guide for technicians by IEEE. Some excerpts (emphasis mine):
Lightning is a natural phenomenon caused by separation of electrical
positive and negative charges by atmospheric processes. When the
separated charge gets very large, the air between the positive and
negative regions breaks down in a giant spark (an intra-cloud stroke),
or a charged region breaks down to ground (a cloud- ground stroke).
The resulting current flow ionizes and heats the air along the path to
~30,000 K (54,000 ° F). The ionized air glows brightly (the
lightning), and the sudden increase in temperature expands the channel
and nearby air, creating a pressure wave that makes the thunder.
...
Most lightning properties are beyond normal human experience. The
cloud-to- ground voltages leading to the discharge are tens of
millions volts or more. The peak discharge currents in each stroke
vary from several thousand amperes to 200,000 A or more. The current
rises to these values in only a few millionths of a second
(microsecond), and the major part of each stroke usually lasts much
less than a thousandth of a second. Each visible event, referred to as
a flash, typically consists of 1–6 (or more) individual strokes,
separated by <0.1 second.
That guide focuses on household protections, so it is not aimed at your use case. There is this further guide which may be more relevant: Lightning Protection, Grounding, Bonding, Shielding, and Surge Protection Requirements, from the US National Weather Service. It is a rather technical manual on the protection requirements for weather stations. Not a smooth reading, but you'll get a glimpse of the difficulties you face when trying to protect sensitive equipments and installations out on the field. Some excerpts:
2.6.6 Externally Mounted Electronic Equipment
When landlines are directly connected to externally mounted electronic equipment, the
landline SPD specified in this document for both facility and
electronic equipment entrances will be provided at the electronic
equipment entrance. This combined protection will provide separate
high- and low-energy components with a single grounding path. The
high-energy suppression components will be grounded directly to the
EES. This connection should be accomplished with a minimum No. 4 AWG
insulated copper conductor. The low-energy suppression component will
be grounded to the reference ground used by the circuit to which the
landline is connected, or to the electronic multipoint ground system.
The grounding conductors for the high- and low-energy components
should be of minimum length and routed to avoid sharp bends, kinks, or
loops. Access should be provided for visual inspection of these
suppressors and for their replacement.
...
2.7 Lightning Protection System Requirements
The intention of the lightning protection system (LPS) is to provide
preferred paths for lightning discharges to enter or leave the earth
without causing facility or equipment damage or injury to personnel.
The essential components of an LPS are:
a. Air terminals
b. Roof, bonding, and down (main) conductors
c. Ground rods
d. Surge protection.
These components act together as a system to dissipate lightning
energy. The LPS will meet or exceed the requirements of National Fire
Protection Association (NFPA) 780, Standard for the Installation of LP
Systems. Materials used for an LPS will follow the lightning
protection components selections shown in the UL 96, Lightning
Protection Components.
Let's summarize the key points: one big problem is that the lighting strike acts like a current source, not a voltage source (as one may expect): there is some charge that must travel through the objects the bolt meets on its way. Until that charge has traveled to earth and dispersed into the mass of the planet, current will keep flowing, no matter what. To protect things you should provide low-impedance paths to earth for that current, so that only low voltage surge will develop. But that's a hard thing to do: even a meager (for a lighting) 10kA will cause a 10V voltage drop across a 1mΩ (some PCB traces have higher resistance!). That's reasonably safe for a human being, but it's enough to kill sensitive 3.3V or 5V powered ICs instantly!
You may shield a circuit with a Faraday cage, which is an effective countermeasure, but that cage must be massive and of well conductive material, so that such a huge current is presented with 10s of μΩ paths or less! And note that any aperture in the cage can provide paths with higher resistance.
Then there's the problem of the huge EMP (Electro-Magnetic Pulse) generated by the lighting. People think that lightning is static electricity, but that's wrong! The static charges are those on the clouds that are the cause of the lighting. The lighting in itself is a time-varying pulsed current, so it develops harmonics of huge amplitude. Even if you succeeded in shielding your circuit from the conduction currents, there are the induced currents: any aperture in the cage is a path for EM radiation from the EMP, and any PCB trace can act as an antenna inside the cage. Enough energy could be transferred to the circuit and fry it, unless proper countermeasures are taken.
EDIT (after the answer was accepted, to cite an interesting and spot-on source)
I just found this ON semiconductor application note on Transient Overvoltage Protection, which is just on-topic, especially when it describes lightning protection. Some excerpts (emphasis mine):
A severe lightning model has also been created, which gives an
indication of the strength which can be expected during worst case
conditions at a point very near the strike location. Figure 2 shows
this model. Note that continuing current is present at more than one
interval, greatly exacerbating the damage which can be expected. A
severe strike can be expected to ignite combustible materials. A
direct hit by lightning is, of course, a dramatic event, and probably
non-recoverable. In fact, the electric field strength of a lightning
strike some distance away may be excessive enough to cause
catastrophic or latent damage to semiconductor equipment. It is a more
realistic venture to try to protect equipment from these nearby
strikes than to expect survival from a direct hit.
Best Answer
You could just use a transistor for the input (assuming reasonably low frequency, as your 40Hz indicates- this will easily work to tens of kHz):
simulate this circuit – Schematic created using CircuitLab