Project tutorial
DIY Vending Machine using Arduino & 1Sheeld

DIY Vending Machine using Arduino & 1Sheeld

Simply the machine has four types of candies and each type has it's special code, you should tweet with this special code to get your candy.

  • 7,676 views
  • 7 comments
  • 33 respects

Components and supplies

Ardgen mega
Arduino Mega 2560 & Genuino Mega 2560
×1
Screen shot 2019 03 20 at 2 38 27 pm fqndazqcx1
1Sheeld
×1
SMPS (5V - 5A)
×1
Standard Metal Servo Motor (7.5 kg.cm)
×8
Bolt (M4 x 10mm)
×1
Small breadboard
×1
11026 02
Jumper wires (generic)
Male-Male and Male-Female
×1
3mm Acrylic Sheet
×1
3mm Plywood Sheet
×1
Screws & Nuts
×1

Necessary tools and machines

Screwdriver
Pliers
Flush cutter
Digital multimeter
Double-sided glue or tape
Copper spacers
6mm, Male-Female
Duct tape

Apps and online services

About this project

Simply the machine has four types of candies and each type has it's special code, you should tweet with this special code to get your candy. Actually we participated with this project at Bay Area Maker Faire last week and I intend to continue my last journey to inspire kids to use modern technologies to create their own toys instead of wasting a lot of time in playing with smart phones or PCs.Return back to the machine,If you would like to get a candy from the first flavor you should write C111 between your tweet.

If you would like to get a candy from the second flavor you should write C112 between your tweet.

If you would like to get a candy from the third flavor you should write C113 between your tweet.

If you would like to get a candy from the fourth flavor you should write C114 between your tweet.

That's all :)

Step 1: What will you need!


So here is the list of things you need for this project. 

Tools: 

1. Screwdrivers 

2. Pliers 

3. Flush cutter 

4. Digital Multimeter

5. Double Sided Glue Tape.

6. Copper Spacers (6mm Male - Female)

7. Duct Tape

Materials:

1. Acrylic Sheets 3mm 

2. Plywood Sheets 3mm 

3. Screws & Nuts

Mechanism components: 

1. 8 x Standard Metal Servo Motor (7.5 kg.cm)

2. Bolt M4 x 10mm

Electronics components:

1. Arduino MEGA 2560

2. 1Sheeld

3. SMPS (5V - 5A)

4. Small Breadboard

5. Jumper Wires (Male - Male) 

6. Jumper Wires (Male - Female)

Step 2: Mechanism & Frame Design


It all started with a proper design, in my case a few sketches to get a good feeling for the dimensions and shape. Quickly after the sketching phase came the CAD model. I created my model in SolidWorks. After all the parts were modeled, technical drawings were made. I used these drawings to machine all of the custom parts on the laser cutter.

Since I intend to take this machine with me in a lot of events around the world i designed it to be easy to be disassembled and installed so i used screws and nuts, Martise and Tenon to fix all it's parts.

Step 3: Mechanism & Frame (Fabrication and Assembly)


I used laser cutter machine to cut the machine parts from the plywood and acrylic sheets. Then i used M4*10mm Bolts to fix the servo motors to their carriers.After fixing the servo motors, fix the Arduino Mega & 1sheeld using the copper spacers to their carrier then fix the power supply, Now you can gather all the machine parts together.

Step 4: Electronics & Arduino Code

The most important part here is powering the servo motors, you should power the servo motors from the power supply directly to avoid resting the Arduino board.Don't forget to connect all the grounds with each other After connecting the motors with Arduino & 1Sheeld and power them from the power supply, you should follow these steps:

Step 1: Place your 1Sheeld on your Arduino board then plug the Arduino to your laptop or PC.

Step 2: Download 1Sheeld Application onto your smart phone. The app is available on the Google play store at http://1sheeld.com/app

Step 3: Download 1Sheeld library

Download OneSheeld library to your computer through this link

Step 4: Extract the folder, copy it, and paste it in your Arduino libraries directory.

Step 5: Open my Arduino Sketch ( you will find it in the attached files

Step 6: Upload your sketch Hesre comes the most important part of the whole tutorial, switch 1Sheeld to the Uploading-mode (this is the switch labeled UART Switch on the board) before you upload your sketch to the Arduino board to avoid serial conflicts between 1Sheeld and Arduino, then press the Upload button in the IDE.

Upload mode is turned on when the UART switch is pushed away from the 1Sheeld logo.

Once you have completed your upload you need to switch 1Sheeld back to the operating mode. Don’t forget! If you don’t switch the UART Switch back to the operating mode your project will not work properly as you will have no communication between 1Sheeld and the Arduino board.

Operating mode is turned on when the UART switch is pushed closest to the 1Sheeld logo.

Step 7: Use 1Sheeld Application

Open 1Sheeld application on your Android smart phone. The application will first scan over bluetooth for your 1Sheeld, it will take a few seconds and the phone will find it. Once it appears on your screen as 1Sheeld #xxxx, you will be required to enter the pairing code (the default pairing code is 1234) and connect to 1Sheeld via bluetooth.

NOTE: If you are having trouble please make sure the bluetooth is turned on for your Android phone and that the Android phone is close to your 1Sheeld.

Step 8 : Access Twitter and Terminal Shields

Select Twitter Shield and Terminal Shield from the shields list and press on the multiple shields icon at the top right of the app.


Step 5: Share your thoughts, feedback and opinions with me!


I will be happy if you shared your kindly feedback with me to enhance this machine :)Thanks..

Code

Vending Machine.inoC/C++
#define CUSTOM_SETTINGS
#define INCLUDE_TWITTER_SHIELD
#define INCLUDE_TERMINAL_SHIELD

#include <OneSheeld.h>
#include <Servo.h>

Servo BlockColoumn1;          // create servo object to control a servo
Servo BlockCandy1;            // create servo object to control a servo

Servo BlockColoumn2;          // create servo object to control a servo
Servo BlockCandy2;            // create servo object to control a servo

Servo BlockColoumn3;          // create servo object to control a servo
Servo BlockCandy3;            // create servo object to control a servo

Servo BlockColoumn4;          // create servo object to control a servo
Servo BlockCandy4;            // create servo object to control a servo

void setup()
{
  OneSheeld.begin();

  BlockColoumn1.attach(3);     // attaches the servo on pin 3 to the servo object
  BlockCandy1.attach(4);       // attaches the servo on pin 4 to the servo object
  
  BlockColoumn2.attach(5);     // attaches the servo on pin 5 to the servo object
  BlockCandy2.attach(6);       // attaches the servo on pin 6 to the servo object
  
  BlockColoumn3.attach(7);     // attaches the servo on pin 7 to the servo object
  BlockCandy3.attach(8);       // attaches the servo on pin 8 to the servo object
  
  BlockColoumn4.attach(9);     // attaches the servo on pin 9 to the servo object
  BlockCandy4.attach(10);      // attaches the servo on pin 10 to the servo object

  /* Subscribe to setOnSelected event for the Twitter shield. */
  Twitter.setOnSelected(&shieldSelection);
  /* Subscribe to onNewTweet event. */
  Twitter.setOnNewTweet(&myTweet);
}

void loop()
{

}

void shieldSelection()
{
  /* Track keyword 1Sheeld on Twitter. */
  Twitter.trackKeyword("C111");
  Twitter.trackKeyword("C112");
  Twitter.trackKeyword("C113");
  Twitter.trackKeyword("C114");
}

void myTweet(char * userName , char * userTweet)
{
  /* Check if the tweet has 1Sheeld keyword. */
  if (strstr(userTweet, "C111") != 0)
  {
    BlockCandy1.write(90);
    OneSheeld.delay(400);
    BlockCandy1.write(180);
    OneSheeld.delay(20);
    BlockColoumn1.write(90);
    OneSheeld.delay(400);
    BlockColoumn1.write(180);
    Terminal.println(" C111 Detected");
  }
  else if (strstr(userTweet, "C112") != 0)
  {
    BlockCandy2.write(90);
    OneSheeld.delay(400);
    BlockCandy2.write(180);
    OneSheeld.delay(20);
    BlockColoumn2.write(90);
    OneSheeld.delay(400);
    BlockColoumn2.write(180);
    Terminal.println(" C112 Detected");
  }
  else if (strstr(userTweet, "C113") != 0)
  {
    BlockCandy3.write(90);
    OneSheeld.delay(400);
    BlockCandy3.write(180);
    OneSheeld.delay(20);
    BlockColoumn3.write(90);
    OneSheeld.delay(400);
    BlockColoumn3.write(180);
    Terminal.println(" C113 Detected");
  }
  else if (strstr(userTweet, "C114") != 0)
  {
    BlockCandy4.write(90);
    OneSheeld.delay(400);
    BlockCandy4.write(180);
    OneSheeld.delay(20);
    BlockColoumn4.write(90);
    OneSheeld.delay(400);
    BlockColoumn4.write(180);
    Terminal.println(" C114 Detected");
  }
  else
  {
    BlockCandy1.write(180);
    BlockColoumn1.write(180);
    
    BlockCandy2.write(180);
    BlockColoumn2.write(180);
    
    BlockCandy3.write(180);
    BlockColoumn3.write(180);
    
    BlockCandy4.write(180);
    BlockColoumn4.write(180);
    
    Terminal.println(" Nothing Detected");
  }
}// void my tweet

Schematics

Vending%20Circuit.fzz
Vending%20Circuit.fzz

Comments

Similar projects you might like

Automated Clothes & Shoes Donation Machine

Project tutorial by Mahmoud Ahmed

  • 2,440 views
  • 3 comments
  • 22 respects

Snacks Vending Machine Powered By Arduino

Project tutorial by Sevenmojoe

  • 17,643 views
  • 13 comments
  • 84 respects

Automated Photo Booth using Arduino and 1Sheeld

Project in progress by Ashraf Nabil

  • 3,756 views
  • 0 comments
  • 11 respects

4x4x4 LED cube with Arduino Uno and 1sheeld

Project tutorial by Hassan Ibrahim

  • 31,045 views
  • 7 comments
  • 61 respects

AR DRONE and 1SHEELD - Discover the world around your drone

Project tutorial by Team OMEGA D2

  • 27,728 views
  • 13 comments
  • 166 respects

Controlled Board Eraser using Arduino and 1Sheeld

Project in progress by Mahmoud Ayad

  • 7,473 views
  • 3 comments
  • 32 respects
Add projectSign up / Login