The project demonstrates how to make an IR sensor–activated coke dispenser.
Circuit
We are using 2 devices in this project:
- IR Sensor: The IR sensor provides information if there is an obstacle in front or not. The IR sensor connections are as follows:
- GND Pin connected to GND of the Quarky Expansion Board.
- VCC Pin connected to VCC of the Quarky Expansion Board.
- Signal Pin connected to D3 of the Quarky Expansion Board.
- The Water Pump Connected to the Relay: The water pump is turned on and off by a relay connected to a smart switch in the IoT house. When the relay is turned ON, the smart switch also turns ON, activating the water pump. The relay has the following connections:
- GND Pin connected to GND of the Quarky Expansion Board.
- VCC Pin connected to VCC of the Quarky Expansion Board.
- Signal Pin connected to Servo 8 of the Quarky Expansion Board.
Script
The script is simple. The relay turns ON when the IR sensor is active, else OFF.