BrookeDot wrote: ↑Fri Jan 20, 2023 2:07 am
My question is do I need (or would it be safer) to use a voltage regulator, diode, etc of some sort to prevent possible spikes or over amprage from damaing the board? If so, what?
The power supply should have its own voltage regulator. That's basically what a power supply is: a voltage regulator that maintains a stable output voltage across a wide range of load currents.
The Photon also has a built-in 3.3V regulator, so the only concern is to avoid spikes which exceed that regulator's maximum input voltage. A good power supply should do that, but voltage spikes are possible when you also have high-current loads switching on and off (which is common for LED projects).
bidrohini wrote: ↑Fri Jan 20, 2023 2:43 am
The LM7805 voltage regulator will be fine, I believe.
The 7805 requires about 1.5V of headroom to work properly. It doesn't regulate well until its supply voltage is around 6.5V.
There are thousands of projects using 3.3V microcontrollers that run from a 5V supply, so thinking stastically, the chance of it being safe is high.
If you want to be extra certain, the first step is to add debounce capacitors.
The voltage between a capacitor's plates is directly proportional to the number of electrons on the plates. The Farad -- the unit of capacitance -- can be broken down to Coulombs of charge per Volt between the plates. To change the voltage across a 1 microfarad capacitor by 1V, you have to add or remove 1 microcoulomb of charge.
Electrons can't move instantly, so it's physically impossible for a capacitor's voltage to change instantly. That means capacitors limit voltage spikes. Real spikes aren't instantaneous (infinitely narrow), but they do contain a finite amount of charge arriving in a short time. That charge can only change a capacitor's voltage by a finite amount, proportional to the amount of charge in the spike. The larger the capacitor is, the smaller the voltage change will be.
When choosing the size of a debounce capacitor, more is always better, but there's a point of diminishing returns. You have to make the capacitor 10x larger to reduce spikes to 1/10th of their initial voltage, and high-value capacitors get expensive. As a rule of thumb, 1uF of capacitance per 1mA of load current is a good starting point.
For extra protection beyond that, the next step is what's known as a 'shunt regulator': a device that only conducts current when the voltage rises above a given level. Routing current away from the load is a way to prevent spikes.
The preferred devices for spike protection are Metal Oxide Varistors (MOVs) and Transient Voltage Suppression (TVS) diodes.
MOVs have high resistance until they start to conduct, then their resistance drops dramatically. The voltage where they do start to conduct is controllable, so manufacturers can design them for specific breakdown voltages. MOVs get hot if they conduct current for too long, so their typical use is for suppression of lightning strikes.
TVS diodes are made from semiconductor powder where the junctions between grains act as diodes. When the voltage rises above a given level, they start to conduct. TVS diodes are better than MOVs for moderate periods when the voltage is a bit too high.
Devices that will be exposed to a wide range of voltages, like multimeters, have both MOVs and TVS diodes connected to the probes.
For your application, a 5V TVS diode would protect against spikes high enough to cause problems for the Photon's internal regulator.