1 / 5
Attiny85 small useless-box — image 1
1 / 5

Attiny85 small useless-box

Order a print of this model

We calculate the final price from your selected file. You review and accept it before payment.

Saved on this device.

Small and configurable useless box with ATtiny85 uC. Just one servo motor for movements and there are also lights!

Rating
0 / 5
Likes
3
Downloads
15
Makes
0
Views
362
Reviews
0

Updated at source:

Model information

Category
Electronics
License
Creative Commons — Attribution — Noncommercial

Small and configurable useless box controlled by ATtiny85 uC. Just one servo motor for movements and there are also lights! If you want there are gerber files for a custom PCB board.

Project name:

Small Useless Box

 

Description

Compact (76x50x66 mm) useless box controlled by an ATtiny 85 uC, powered by 9V battery.

 

Functions

  • Useless box with one servomotor and colorful LEDs
  • Programmable behavior
  • Powered by 9V battery
  • Custom PCB available

 

Hardware and Software Used

Hardware:

3D printed PLA components

  • 1 x servomotor RG90 or similar model as MG90
  • ATtiny85 micro controller
  • 2 x 5mm led (fast flashing colors)
  • 1 x switch button
  • 2 x push button
  • custom PCB with SMD and PTH components

Software:

  • Tinkercad has been used to draw all parts
  • Prusa Slicer has been used to obtain gcode files
  • Arduino IDE has been used for the firmware
  • EasyEDA has been used ti draw schematica and create Gerber files

 

Wiring Diagram

Board schematics and footprint

 

BOARD BOM
IDNAMEDESIGNATORFOOTPRINTQ.TY
10.47uC1C08051
222uC2C06031
3470uC3CAP-D8.0×F1.5_BIPOLAR1
40.1uC4C06031
51N4007WD1SOD-123_L2.8-W1.8-LS3.7-RD1
6SERVO MALE HEADERSH1HDR-TH_3P-P2.54-V-M-11
7BTN_CONN MALE HEADERSH2HDR-TH_3P-P2.54-V-M-11
8LED-TH-5mmLED1, LED2LED-TH_BD5.02
9BJT NPN (TO-92)Q1TO-92-BJT NPN1
1022kR1R06031
11180RR2R06031
121kR3,R4,R5,R6R06034
13LM2940IMP-9.0/NOPBU1SOT-223-41
14DIP8-SOCKETU2DIP-81

NOTE: R3, R4, R5, R6 are not mandatory for this project. They are optional components to set pull-up or pull-down aux signal to the uC.

Other electronic components required but not mounted directly to the board:

  • 1 x servomotor SG90 or similar.
  • 1 x switch
  • 1 ATtiny85 uC
  • 2 x 3 pin female headers
  • 1 x 9V battery plug connector
  • wires

Code

/* 
 Firmware for small ATtiny85 useless box

WARNING: Set uC internal clock at 8MHz to run properly

If Servo library is installed to libraries, then that version (which doesn't support ATtiny parts) will be used instead of the one included with the core, which does. To get around this, include Servo_ATTinyCore.h instead - this will always use the version that came with core. */

#include <Servo_ATTinyCore.h>

#define servo_pin 0 #define btnA_pin 1 // Internal switch #define btnB_pin 2 // External switch #define led_pin 4 #define min_ang 5 #define max_ang 78 #define turn_off_time 5000

Servo myservo;

bool A, B, S;

unsigned long t0; int pos = 0; // variable to store the servo position

long rnd;

void setup() { pinMode(btnA_pin, INPUT_PULLUP); // A low at rest pinMode(btnB_pin, INPUT_PULLUP); // B high at rest pinMode(led_pin, OUTPUT); digitalWrite(led_pin, LOW); randomSeed(analogRead(4)); S=0; }

void loop() { A = digitalRead(btnA_pin); B = digitalRead(btnB_pin);

if (!A && B){ S = 1; digitalWrite(led_pin, HIGH); // turn on LEDs myservo.attach(servo_pin); rnd = (random(0, 200))*10; // add chaotic behaviour delay(rnd); turnOff();

digitalWrite(led_pin, LOW);
t0 = millis();

}

if (millis()-t0 > turn_off_time && S){ myservo.detach(); // for energy saving S = 0; t0 = millis(); } }

void turnOff(){ int i = 0; for (pos = 30; pos <= max_ang; pos += 4) { myservo.write(pos);
delay(20);
} for (pos = max_ang; pos >= min_ang; pos -= 2) { myservo.write(pos);
delay(5);
} for (i = 0; i < 10; i++) { myservo.write(min_ang);
delay(5);
} }

Printing Instructions

Filament: PLA

Layer height: 0,3 mm

Infill: 20%

Supports: form build plate only

Note: disable supports inside the holes for screws or pins.

Filament: PLA

Layer height: 0,3 mm

Infill: 20%

Supports: everywhere

Note: disable supports inside the holes for screws or pins.

Filament: PLA

Layer height: 0,3 mm

Infill: 20%

Supports: form build plate only

Note: disable supports inside the holes for screws or pins.

Filament: PLA

Layer height: 0,3 mm

Infill: 20%

Supports: form build plate only

Note: disable supports inside the holes for screws or pins.

Filament: PLA

Layer height: 0,3 mm

Infill: 20%

Supports: form build plate only

Note: disable supports inside the holes for screws or pins.

Filament: PLA

Layer height: 0,3 mm

Infill: 20%

Supports: form build plate only

Note: disable supports inside the holes for screws or pins.

Assembly Instructions

  • Assemble all the components on the PCB (Wire to the switch should be about 33 mm long)
  • Mount the programmed ATtiny85 on the socket
  • Bend the Servo headers as see in the picture above
  • Insert the 2buttons on the switch lid (may be annoying)
  • Insert the switch lever and secure it with a 2x16 mm pin
  • Solder the 3 pin female headers wires as required.
  • Verify correct functionality of the switch (may be very annoying!)
  • Mount the finger on the servo arm accessories (trim if necessary) and fix with a screw.
  • Mount the finger on the servo motor using the arm screw
  • Insert the servo on the proper housing. WARNING!!! Make sure the servo is in it 0 position when the finger is completely down.
  • Plug the servo connector in the board’s servo headers.
  • Carefully insert the board on the main case and make sure it fits well (this can be annoying too)
  • Using a tweezers or pliers insert the power switch in the proper position
  • Lock the power switch with a couple of M2x4 screws
  • Using a tweezers or pliers insert the LED on their housing in the moving lid
  • Prior to hinge assembly use an 2mm drill tip to round the hinge's holes. 
  • Insert 2 x M2x20mm pin in the lid’s hinge as shown in the picture and push them all the way into the hinge
  • Secure the servomotor with the motor holder (you can use screws to lock it)
  • Plug the switch’s lid on the board headers for the buttons (respect the orientation)
  • Secure the switch lid wit 3 x M2x6 screws
  • Plug the 9V battery to the connector and insert into the housing
  • Close the battery lid and secure it with a M3x10 screw

Demo and Usage Instructions

  • Power up.
  • Switch on.
  • Repeat until enough useless work has been done or low battery.
  • Power down.

Photos and Videos

 

Tags