Controlling an old 2-pin vending machine motor with a MCU

Status
Not open for further replies.

Thread Starter

evraknotna

Joined Jun 12, 2025
7
I'm working on a project to control an old vending machine (Automatic Products 113 Snackshop) using an ESP32, but I'm having trouble figuring out how to sense a full revolution of the 2-pin vend motor+switch module. To preface, I've already looked through countless forum posts and none so far have given me the answers I've needed, which is why I'm creating another post myself.

Below are photos of the module, and the circuit schematic I've gotten by examining the PCB:
photo_2025-06-12 12.36.56.jpeg
photo_2025-06-12 12.36.59.jpeg
photo_2025-06-12 12.37.00.jpeg
photo_2025-06-12 13.11.28.jpeg
Screenshot 2025-06-12 at 1.45.14 PM.png

As the photos show, the cam turned by the motor presses the NC switch during the revolution, and releases the switch at home position (signalling end of revolution). I've tested the effects of pressing and releasing the switch by running 24V across the module's terminals and probing with a multimeter as shown in the schematic (see voltmeter and ammeter). Here's my observations:

  • Switch not pressed (closed): voltage relatively stable around 24V
  • Switch pressed (open): voltage spikes up to 35-65V range and becomes extremely noisy
  • Whether the switch is pressed or not, there's no change in current based on multimeter readings.
I don't have easy access to an oscilloscope, so I haven't been able to get precise measurements of the voltage and current waveforms.

I've tried using voltage divider, optocoupler and comparator circuits while attempting to get an ESP32 to distinguish between the switch pressed (noisy voltage spike) and switch not pressed (relatively stable 24V) states, but I haven't had any luck. Whenever I use Vmotor as input for a voltage divider, Vout doesn't respond to any fluctuations in Vmotor, and Vmotor stops giving the expected response to the switch being toggled.

I suspect that there's some inductive/capacitive/transient black magic going on, but I can't figure out what it is, why it's happening and how I should proceed from here.

Has anybody had any luck with controlling old vend motor modules like these? I'm open to any suggestions on how I could better detect changes in the switch state.
 
Status
Not open for further replies.
Top