Makerming
Published © MIT

Lucky Money Counting Box for Chinese New Year - Arduino Uno

Lucky Money Counting Box with traditional Chinese spring festival decoration, especially for you to count new year Hongbao easily!

BeginnerFull instructions provided5 hours3,582

Things used in this project

Hardware components

Arduino Uno Rev3
×1
Seeed Studio Grove Base Shield V2.​0
×1
Seeed Studio Grove - IR Distance Interrupter v1​.2
(Could also be replaced to Motor Speed Sensor Module https://www.seeedstudio.com/Motor-Speed-Sensor-Module-p-1969.html)
×1
Seeed Studio Grove - Servo
×2
Seeed Studio Grove - 4-Digit Display
×1
Acrylic Plate (5mm)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Laser cutting machine
Hot melt glue gun
electric soldering iron

Story

Read more

Custom parts and enclosures

Chinese paper cutting design of spring festival elements 3

Chinese paper cutting design of spring festival elements 1

lucky money counting box design - Makerming

Chinese paper cutting design of spring festival elements 2

Chinese paper cutting design of spring festival elements 5

Schematics

Hardware Connection

Code

lucky_money_collecting_box.ino

C/C++
//IR sensor to D2
//4 digit display to D7
//servo1 to D5
//servo2 to D6

#include "TM1637.h"
#include "Servo.h"

const int CLK =  7;
const int DIO = 8;
TM1637 tm1637(CLK,DIO);  //4 digit display to D7

int num = 0;
 
Servo myservo1; 
Servo myservo2; 

void setup()
{

  pinMode(2, INPUT_PULLUP);   //configure digital pin2 (IR sensor)as an input and enable the internal pull-up resistor
  pinMode(13, OUTPUT);
  
  tm1637.init();
  tm1637.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
    
  myservo1.attach(5);  //servo1 to pin5
  myservo2.attach(6);  //servo2 to pin6

}

void loop()
{

 int sensorVal = digitalRead(2); 
 //tm1637.displayNum(num);  
 
delay(50);//this number will affect the refresh time of the IR distance sensor

if (sensorVal == LOW) {
    digitalWrite(13, LOW);
    num = num+1;
    tm1637.displayNum(num);  
 } 
 else{
  tm1637.displayNum(num);  
    }

myservo1.write(10);
myservo2.write(20);
delay(250); //change the number if you want the servo position change in other speed
myservo1.write(20);
myservo2.write(10);  

}
 

Credits

Makerming

Makerming

11 projects • 30 followers
Maker, DIYer, Opensource Hardware Enthusiast

Comments