In the following circuit I'm using a Raspberry Pi to power a solenoid. I want to prevent any current from damaging my Pi in case I connect something wrong (like D2). However, I am unsure whether I could damage my Pi via the ground connection.
The Pi runs with on 3.3V-5V while the circuit runs on 19V .
Could I use something like a voltage regulator between the transistor and the ground connection of the Pi to bring the 19V down to 5V. If so, how?
simulate this circuit – Schematic created using CircuitLab