SALES INQUIRIES: 1 (888) 767-9864

Automatic Stamper with an Adafruit Pro Trinket :: Student Project

Big red button.

Big red button connected to an Arduino.

Big red button connected to an Arduino powering an automatic stamper!

This very cool and amazingly sleek Arduino project was submitted by Emma Lievens, a customer of PEA since early 2018.  Emma (with help from a team at the company she interns with) made this automatic stamper using a servo motor and an Adafruit Pro Trinket to help a disabled boy stamp his name on pieces of paper.

Big red button with wire attached to desktop stamping mechanism

Emma, why the heck did you build an Automatic Stamper?

I did my internship in a company that creates technologies for people with a disability.  This project was designed to help a boy stamp his own name and give him some more independence.

Desktop stamping mechanism with screen in slick hard plastic case, very robust looking

How does your project work?

If you press the big red button a signal is sent to the servo motor to go down.

As the servo is going down, it presses a stamp down with it.

By pressing the stamp down just right, a clear imprint of the text of the stamp is made on the paper.

What was your biggest struggle as you worked through this project?

Getting the correct angle of the servo motor to stamp exactly one page crystal clear

Did the project end up as you expected?

Yes! The little boy was really happy with the end result and his caretakers loved it as well. [Editor’s Note: How cool!]

PCB layout with Adafruit Pro Trinket and other connections

Looking back on this project, what can you say you have learned about programming and/or electronics through the creation process?

I started from scratch programming and now I feel more confident in learning another language if needed

Was the training at Programming Electronics Academy able to help you build your skill?

Yes, thanks to PEA I could finish my project in the way I wanted. [Editor’s Note: Sweet!]

What type of Arduino board, Arduino clone, or Arduino compatible board does your project use?

For prototyping the Arduino Uno, but for the real project a ProTrincket 5V

Components used in your project:

Button, Resistor, LED, Servo Motor, Switch

How do you power your project?

Batteries

Arduino Code:

#include <LowPower.h>
#include <Servo.h>

const byte buttonPinAccesibility = 5;
const byte buttonPinBuiltIn = 6;
const byte motorDriverPin = 10;
const byte ledPin = 12;

const byte currentSensePin = A1;

int delayTime = 0;

// Create an instance of the servo library to give a name to the servo you're using
Servo myServo;

void setup() 
{
  // Set pinMode for button --> accesibility switch
  pinMode(buttonPinAccesibility, INPUT);

  // Set pinMode for button --> built in switch
  pinMode(buttonPinBuiltIn, INPUT);
  
  // Set pinMode for LED
  pinMode(ledPin, OUTPUT);

  // Set pinMode for motorDriver --> turn servo on when there is a pulse send to the motor driver
  pinMode(motorDriverPin, OUTPUT);
  while(digitalRead(buttonPinAccesibility) || digitalRead(buttonPinBuiltIn));
  
  // Attach servo to pin 9 and declare the min and max positions of the servo
  myServo.attach(9, 450, 2300);
  myServo.write(180);
  digitalWrite(motorDriverPin, HIGH);
  delay(250);
  digitalWrite(motorDriverPin, LOW);
  myServo.detach();  
} // Close setup

void loop() 
{
  // Set motor to starting position
  // myServo.write(180);
  
  LowPower.powerDown(SLEEP_60MS, ADC_OFF, BOD_OFF);
    
  // Read the state of the button (Accesibility switch) and save it in a variable
  byte buttonStateAccesibility = digitalRead(buttonPinAccesibility);

  // Read the state of the button (Built In switch) and save it in a variable
  byte buttonStateBuiltIn = digitalRead(buttonPinBuiltIn);
  
  // Read the state of the servo motor
  int myServoValue = myServo.read();

   // If the on/off switch is ON the LED must turn ON
   digitalWrite(ledPin, HIGH);
  
  // If the sequence is started and the motor is moving ignore the button!
  if (((buttonStateAccesibility == HIGH) && (myServoValue != 180)) || ((((buttonStateBuiltIn == HIGH) && (myServoValue != 180)))))
  {
    // Don't do anything when the buttonState is HIGH and the motor is moving
  } // Close if statement --> motor moving

  // If the button is pressed but the motor isn't running then start the motor
  if (((buttonStateAccesibility == HIGH) && (myServoValue == 180)) || ((buttonStateBuiltIn == HIGH) && (myServoValue == 180)))
  {   
    // start motor --> send signal to motor driver to start servo
    digitalWrite(motorDriverPin, HIGH);
    myServo.attach(9,450,2300);
    
    // Turn motor 45° so the motor presses the stamp down
    myServo.write(40);
    delay(300);

    // Read the output from the current sense
    int currentSenseValue;
    currentSenseValue = analogRead(currentSensePin);
    delayTime = 0;
    
    while(1)
    {
      currentSenseValue = analogRead(currentSensePin);                                                                                                                                
      if(delayTime >= 1000 || currentSenseValue > 500)
      {
        // Turn motor back to original possition
        myServo.write(180);
        delay(1000);
        myServo.detach();
        digitalWrite(9, LOW);
        digitalWrite(motorDriverPin, LOW);
        while(digitalRead(buttonPinAccesibility) || digitalRead(buttonPinBuiltIn));      
        break;
      }
        // Wait for 1 msecond
        delay(1);
        delayTime++; // Increment delaytime with 1
    }
  } // Close if statement --> motor not moving
} // Close void loop

About Emma:

emma sand boardingEmma is a masters student studying industrial engineering electromechanics.  She has been “playing around” with electronics for a couple years, and been programming for over a year.

 

 

 

Leave a Comment