Recycled Arduino Lolly Dispenser




Introduction: Recycled Arduino Lolly Dispenser

About: I love science, lights and robotics! My dad is a builder so i've always grown up building things, pulling stuff apart and experimenting!

This is a quick photo instructable to show how me and my friend Nick built a lolly dispenser to show off the kinds of projects we create at the UTS Robotic Society. It's a project designed to allow us club executives to engage with new members on days like O'day and have a fun talking point.

This project was almost 100% made with parts and materials that were found around our lab, through dumpster diving and lying around the house which makes this project extremely sustainable and is something that the university likes to encourage.

Our website:

Step 1: Materials + Tools

This project was made almost most entirely from recycled parts found around the uni.

Some of the parts included:

  • Heavy weighted stand (off some scientific analytical machine)
  • Large plastic jar (big pack of pretzels)
  • Spiral (stretched out soldering iron holder / stand)
  • Cardboard tube (postage tube)
  • Quirky heat sinks (from iMac G3, the old CRT all in one model)
  • Screws (from pulled apart electronics)
  • Flat cardboard
  • Packing foam
  • Zip ties + tape + super glue

As for the tools:

  • Pliers
  • Screwdrivers
  • Scissors
  • Drill + drill bits
  • 3D printer

Step 2: Attaching the Jar to the Base

Step 3: Attaching Spiral to Servo

Step 4: Cardboard Lolly Chute

Step 5: Arduino Wiring + Programming

Essentially a sonar sensor connected to a servo with and LED indicator light. Use the definitions in the code to know where to put the wires.

The code:

#include <Servo.h>

Servo myservo; // create servo object to control a servo

int pos = 0;
int trigPin = 4; //Trig - green Jumper
int echoPin = 2; //Echo - yellow Jumper
long duration, cm, inches;

void setup() {
//Serial Port begin
Serial.begin (9600);
//Define inputs and outputs
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(13, OUTPUT);

void rotate(){
// goes from 0 degrees to 180 degrees
// in steps of 1 degree


void check(int cm){
int temp;
temp = 0;
temp = cm;
if(temp < 5){
digitalWrite(13, HIGH);

digitalWrite(13, LOW);

void loop()

// The sensor is triggered by a HIGH pulse of 10 or more microseconds.
// Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
digitalWrite(trigPin, LOW);
digitalWrite(trigPin, HIGH);
digitalWrite(trigPin, LOW);

// Read the signal from the sensor: a HIGH pulse whose
// duration is the time (in microseconds) from the sending
// of the ping to the reception of its echo off of an object.
pinMode(echoPin, INPUT);
duration = pulseIn(echoPin, HIGH);

// convert the time into a distance
cm = (duration/2) / 29.1;
inches = (duration/2) / 74;

Serial.print("in, ");




    • Metalworking Contest

      Metalworking Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Tiny Home Contest

      Tiny Home Contest

    2 Discussions

    tell me the connections bro

    Hi, could you explain how and where to connect the wires ?