I have a small project for part of an experiment where a PWM controlled DC fan speed will be controlled by a -10/+10V function generator's analog DC output. So basically the chain will be:
Analog voltage——>PWM——->Buffer——>PWM TTL input to the FAN
To convert analog input to PWM I use Arduino Nano as a micro-controller board. I map 0-5V analog input voltage at A0 pin to a PWM pin duty cycle where I set the PWM freq. to 25kHz. I might not need the transistor buffer actually but I don't want to risk the uC.
Below schematics diagram shows the plan in my mind:
I want to power the Nano through its Vin pin by a 12V power supply named as PSU circuit in the diagram above. 5V linear regulator provides power to the buffer.
But since people will use the function generator as input, I need to protect the analog input A0 of the Nano from reverse polarity and maximum limits. For reverse polarity a 1N4148 D2 in the diagram is used. 1Meg R7 resistor is for preventing floating in case there is no input connection. And for limiting the max input voltage I plan to use a 500mW 5.1V zener Z1 in the diagram along with a 220 Ohm series resistor R1.
The Nano uses ATmega328P. I couldn't figure out the maximum analog input the uC can handle. If there is no other fundamental problem, would a 5.1V zener be fine for the analog input pin?
I needed to make an edit with a new alternative after Jack Creasey's answer: