The Auto Straw

This project I was inspired by the retro straw dispensers where you lift the lid to see the straws splay out in a beautiful way. I felt this simple but very elegant mechanism needed some more power, to make it all automated with one button.


The project was my first reasonably sized project using the Arduino Uno, it was completed with in a 3 week timeline from conception to finishing the initial working prototype. This means that it is not too complex.

The components used for the auto straw are as followed…

  • 1 DC hobby Motor
  • 1 Arduino Uno board
  • 1 half bread board
  • 4 LEDs of any colour up to you.
  • 1 Push Button
  • 1 H-Bridge chip (L293D)
  • 2 Resistors (1K)

The Fritzing diagram below shows the wiring and hot all the electronics work…


Auto straw BB


The Code that was in putted to the Arduino is as follows…


int motorpin1 = 3;
int motorpin2 = 4;
int button = 9;
int buttonValue =0;
int LEDS = 11;

void setup () {

pinMode(motorpin1,OUTPUT);
pinMode(motorpin2,OUTPUT);
pinMode(button,INPUT);
digitalWrite(button,HIGH);
pinMode (LEDS, OUTPUT);
}

void loop () {
buttonValue = digitalRead(button);
if(buttonValue == HIGH){
raise();
}}
void raise()
{
digitalWrite(motorpin1,LOW);
digitalWrite(motorpin2,HIGH);
digitalWrite(LEDS,HIGH);
delay (3500);

digitalWrite(motorpin1,LOW);
digitalWrite(motorpin2,LOW);
delay (5000);

digitalWrite(motorpin1,HIGH);
digitalWrite(motorpin2,LOW);
delay (3500);
digitalWrite(LEDS,LOW);

digitalWrite(motorpin2,HIGH);
}


Essentially what happens is when the button is pressed it satisfies the ‘IF’ statement which then initiates the ‘rise’ function. The ‘rise’ function starts by closing one of the gates in the H bridge and turning on the 4 LEDS, which are hard wired in a parallel circuit, for 3500 milliseconds. This raises the capstan, then the closed gate on the H bridge is signalled to open and the motor does not do anything for 5 seconds, allowing the user to take a straw or two. Finally the other gate on the H bridge is closed and the motor spins in the reverse direction slowly lowering the capstan and lid to the rest position, after 3 and a half seconds.

The final working prototype encapsulated in the video below.



In the video the times of the actions are reduces as it was shot just after bug fixing the model.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s