I have a working circuit and I'm looking for cues on how to improve it.
I'm building a device with a user controlled small stepper motor. Speed of the motor can be controlled by a pedal connected via audio-jack.
I need to properly recognise a type of the connected pedal and handle its value in the MCU.
There are 3 types of pedals that can be connected:
- Type A - simple momentary switch, user can switch motor on or off.
- Type B - pedal with a (10k) potentiometer, user can control speed with her foot.
- "Type C" - nothing is connected, empty socket
I have a circuit that works using two ADC pins on atmega328p, A5 reads pedal type, A1 reads its value, combination of readings from both pins allows me to control connected motor.
Question: how I can improve, simplify or make it more resilient?
I would be very grateful for tips from more experienced colleagues.