Wiring Advice Needed for Proximity Sensor and Peristaltic Pump Project

Hi there,

I am attempting to make a beverage dispenser for a party and I am not quite sure how to start with the wiring. My basic components so far are:

  • Adafruit VCNL 4010 Proximity/Light Sensor
  • A 12v peristaltic pump with silicon/food grade tubing
  • Arduino Uno
  • 12v battery

My end goal is to have guests be able to dispense their own drinks by putting their glasses close to the sensor in order to activate the pump. When guests' cups are full, they simply take their cup away and the drink dispenser shuts off.

The thing I can't quite wrap my brain around is how to get this 5v sensor in line before the 12v pump without frying the sensor or dropping the voltage to the pump so much that it dispenses too slowly. I am also not sure about the wiring between the pump and the sensor in order to get the sensor to talk to the pump.

Is this best done with a series or parallel circuit?

One idea I had was to start my circuit with a 12v battery and use it for both the sensor and the pump. Before the sensor I would put resistor(s?) in line to drop it to 5v. Then I think I would need some kind of transistor between the sensor and the pump.

I tried to be as specific as possible but with my lack of knowledge I feel like this is just a mound of general questions, so any help would be appreciated! Thanks.

before the sensor I would put resistor(s?) in line to drop it to 5v.

Never use resistors to regulate power. Connect the battery to the Vin or power jack of the Uno and use the 5V output (of the Uno 5V regulator) to power the sensor.

Then I think I would need some kind of transistor between the sensor and the pump.

No, you need a transistor between the Uno and the pump. I would use a logic level MOSFET to control the pump.

The sensor is connected to the Uno via the I2C bus. The sensor would indicate to the Uno that a container is in place or not. If there is a container, the Uno would turn on the MOSFET (and thus the pump) until the container goes away.