Greetings, fellow Spark enthusiasts!
I recently fried one of my Cores by inadvertently touching the uFl swivel connector to pin D0 which, at the time, was programmed as an OUTPUT:
This made me wonder about best practices when building a robust hardware system using the Core/Photon/Electron.
Suppose I have a circuit that has a bunch of sensors, switches, etc. all configured to be inputs for the Core with potentially very low (or zero in the case of a normally closed switch) impedance. Suppose now that I incorrectly flash the Core with firmware that sets those input pins to OUTPUT. Because the components attached to those pins now effectively short the output, the Core is instantly fried. If there are enough of these happening at the same time, there may even be potential of an electrical fire, though I am not sure how likely that is.
A more extreme scenario: a hacker breaks into the Spark Cloud and flashes all online cores with a simple program that sets all the pins to OUTPUT in the hopes of damaging them in the process. This is not about Spark Cloud security per se, but rather the potential consequences of someone getting hold of your auth token.
So, the question I have for you is:
Does it make sense to ALWAYS design a circuit where every pin connected to external components goes through a 220 Ohm resistor, effectively preventing the fatal over-current in the scenarios described above?
And if so, would adding these adversely affect the functionality of attached peripherals, especially something running I2C or SPI?
Would love to hear everyone’s thoughts!