Useless box

A character in a box

useless box

Introduction

The useless box is a legendary little electronics project: a box that switches itself off every time you switch it on. The joke may be simple, but behind it there is a combination of mechanics, electronics and programming.

In this project students use an Arduino and SG90 servo motor(s) to build a box that opens its lid, pushes the switch back and returns to its hidden position. While having fun along the way, they practise working with a PWM signal, analyse how a servo draws current under load and see why a good power supply matters just as much as the program itself.

Project goals

  • Explain how the Arduino reads the state of the switch and starts the servo based on it.
  • Describe how much voltage and current an SG90 servo needs to work reliably in the box.
  • Recognise the difference between the servo’s resting position and its loaded state when it pushes the switch and the lid.
  • Spot typical problems: jerking, lack of torque, a weak power supply, annoying buzzing and instability.

Research and analysis

Task 1: Analysing the function and the block diagram

  • Draw a block diagram of the circuit:
    switch ⇒ Arduino input ⇒ program ⇒ PWM output ⇒ SG90 servo ⇒ mechanical lever/lid.
  • Clearly mark that the servo has its own 5 V and ground, and that the ground is shared with the Arduino.
  • In one sentence, describe what happens when the user flips the switch on.

Task 2: Analysing the power supply and current

  • Starting from the SG90 specifications (4.8–6 V, typically a few hundred mA under load), work out why it is not a good idea to power the servo directly from the Arduino’s 5 V pin, especially if you are using USB or a weaker power source.
  • Make a table of estimated currents:
    • servo at rest (holding the park position),
    • servo coming out slowly,
    • servo suddenly pushing the switch (higher load).
  • Discuss how much current to plan for one SG90 in a project like this (say 0.5–1 A of headroom on the 5 V supply), and why that is still small, but much safer than powering it only through the Arduino.

Task 3: Mechanical load and torque

  • Identify everything the servo motor has to overcome.
  • Estimate the order of these resistances, which is the hardest for the servo and at which moment it probably draws the most current.
  • Think about and explain what can happen if the arm is too long or the box is heavier than the SG90 likes.

Task 4: Analysing stability and edge cases

  • List situations in which the box might start behaving strangely.
  • Think about and discuss the causes of the strange behaviour.

Experiments

Experiment 1: Servo on the Arduino vs. servo on an external 5 V supply

  • First power the servo motor directly from the Arduino’s 5 V pin (under supervision and only briefly), and watch how it behaves during fast arm movements.
  • Move the servo motor to a separate 5 V supply (a battery pack or an adapter) with a common ground.
  • Write down the differences in jerking, speed, sound and any resetting of the Arduino.
  • Write down your conclusion.

Experiment 2: Different personalities of the box

  • Download or write several Arduino routines for the useless box (fast opening, slow shy opening, delays, switching off twice, etc.). Examples of such projects with several different behaviours exist and include extra random sequences.
  • Observe whether the sequences use different servo speeds and angles, and how that affects the duration of the movement, the amount of noise and the apparent personality of the machine.
  • Write down your conclusion.

Experiment 3: Noise on the switch input

  • Upload a version of the code without INPUT_PULLUP and with a floating switch input.
  • Then upload the version with INPUT_PULLUP and the switch correctly wired to ground.
  • Observe how chaotically the device behaves in the first version (false triggers, random movement) compared with the second.
  • Write down your conclusion.

Questions

  • Why does a useless box need a proper power supply for the servo, even though it looks like a toy?
  • How do the servo position and the lever length affect the force needed to flip the switch?
  • Why is INPUT_PULLUP (or an external resistor) important for the switch input?
  • What would have to change for the same concept to work for years, not just during the workshop?