Bookworm - Annoying Personal Lamp
by RoAnWo in Circuits > Arduino
252 Views, 2 Favorites, 0 Comments
Bookworm - Annoying Personal Lamp



.png)
Project by:
Aleks Dukov, Robert Wolf
As part of our digital fabrication seminar, we aimed to design and build the most helpfully useless lamp ever. After long consideration, we ended up with a flexible worm that is able to locate the sudden loud knock or clap and then point to it. If, however, no loud sound has been made in a while, it the lamp goes back into its dangling position, waiting for yet another sudden awakening.
Downloads
Supplies


Components:
Electric Components:
- Arduino Uno
- BreadBoard
- CNC Shield V3 (for stepper control)
- 3x A4988 Stepper Drivers
- 3x NEMA17 Stepper Motors
- 3x Sound Detection Modules (KY-038)
- LED Strip
- Logic-level N-Channel MOSFET (e.g., IRLZ44N, IRL540N...)
- 12V Power Supply (for motors and LED strip)
- 5V Power Supply (for Arduino, or use USB)
- Jumper Wires
Other Components:
- Cardboard
- pneumatic tube ~ 6mm (or similar stiffness tube for Worm "spine")
- Rope/Cable ~ 2m
- M3 screws and Nuts (optional to attach Sound Sensors)
Img Sources and Links to components:
Tools:
- CA-Glue
- Laser Cutter for Cardboard (optional)
- Multimeter (not essential, but helpful)
- Soldering Iron (if not correct connections/plugs already)
- Scissors
- Tape
- Small Electrical Screwdriver (to setup Potentiometers on Sound sensors)
Physical Build







Parts Needed
Laser Cut Parts (3mm condensed carton):
- 1x Base plate
- 2x Upper plates
- 10x Disks (Ø6 mm center hole, 3x Ø2 mm outer holes)
- 6x Cardboard strips (25 mm wide)
- 6x Cardboard sticks (20 mm wide)
Plastic Tube and wires:
- 1x 40 cm long, Ø6 mm outer diameter, 1 mm wall thickness
- 3 x 50 cm long yarn pieces
Step-by-Step Assembly
Step 1: Prepare Laser-Cut Components
- Ensure all parts are precisely laser cut.
- Verify hole sizes: the center holes on the disks should snugly fit the plastic tube.
Step 2: Assemble the Frame Structure
- Position Base Plate on a flat surface.
- Attach the Six Cardboard Strips (25 and 20mm wide) to the corresponding angled notches on the base using glue or hot glue. These will be the vertical supports.
- Secure the Two Upper Plates on top of the strips, aligning their notches to form a rigid triangular prism shape.
Step 3: Build the Tentacle Core
- Take the 40 cm plastic tube and slide the 10 disks onto it.
- Space the disks 3 cm apart evenly along the length of the tube.
- Ensure that each disk is perpendicular to the tube (parallel to each other).
- Make sure the yarn goes through the side holes of the discs.
Step 4: Final Assembly
- Insert the assembled tentacle (tube with disks) through the 6 mm central hole on the upper plates.
- Make sure the disks remain evenly spaced and properly aligned inside the structure.
- Position the electronic on the top of the frame, in whatever way seems fitting, make sure your senors are oriented in a 120° angle
- attach the rope to the motor shaft (e.g. put a tape on the shaft and glue it, but any other way where the motors "roll up" the rope will work)
Tips
- Use spacers or a ruler while placing disks to maintain precise 3 cm spacing.
- Use hot glue sparingly to allow for adjustments during alignment.
- This frame can later be fitted with tendons, servo motors, or an Arduino system depending on your project goals.
- make sure the rope from the motors to the "worm" is moving freely without too much friction
Wiring

Stepper Motors & CNC Shield:
- Plug the CNC Shield onto your Arduino Uno.
- Insert the A4988 drivers into the X, Y, and Z slots.
- Connect each NEMA17 stepper motor to the corresponding X, Y, or Z motor port on the shield.
Sound Sensors:
- Connect the digital OUT pin of each sound sensor module to the Arduino analog pins A0, A1, and A2 (easy acces on CNC-Shield, we use them as digital Pins).
- Connect VCC and GND of each sensor to 5V and GND on the Arduino.
LED Strip:
- Connect the gate of the MOSFET to Pin 13; the drain to the negative side of the LED strip, and the source to GND. (Unfortunatley we didnt have a Logic-level N-channel MOSFET at hand so we used a Transistor (BC547), if the current exceeds 100 mAh use a MOSFET e.g., IRLZ44N, IRL540N...)
- The positive side of the LED strip goes to 12V.
Power:
- Power the Arduino via USB or a 5V adapter.
- Supply 12V to the CNC Shield and positive of LED strip.
Downloads
The Code
The code makes your Arduino system react to sounds detected by three microphones arranged in a triangle. When a sound is detected, the code estimates the direction the sound came from, and then moves three stepper motors in a coordinated way to „point“ the Worm toward that direction. It also activates the LED strip for some Time.
Pin Definitions and Variables:
- soundPins: The analog pins (A0, A1, A2) connected to the sound sensors.
- stepPins/dirPins: Digital pins for step and direction control of each stepper motor via the CNC shield.
- ledStripPin: Pin 13, controls the MOSFET for the LED strip.
Sound Detection Logic:
- The loop constantly checks if any sound sensor is triggered (goes LOW).
- When a sound is detected, it records the exact time (in microseconds).
- Once all three sensors have had a chance to trigger (within a 100ms window), it processes the data.
Direction Estimation:
- By comparing the time each sensor detected the sound, the code calculates the direction (angle) the sound came from.
- Uses trigonometry (atan2) to estimate the angle based on timing differences and sensor distances.
Motor Coordination:
- The angle is converted into weights for each motor, determining how much each should move relative to each other.
- The code calculates how many steps each motor should take, relative to their current position to reach a new Position.
- All three motors are moved in a coordinated fashion to „point“ toward the sound source.
LED Strip Feedback:
- When the motors move, the code also turns on the LED strip for a short Time (e.g. 1sec) making it a useless Light.
Returning to Default:
- If no sound is detected for 5 seconds, the motors automatically return to their initial („resting“) position.
How the Code is Structured:
- setup(): Initializes all pins and serial communication.
- loop(): Continuously checks for sound triggers, processes sound events, and manages motor/LED actions.
- calculateMotorWeights(): Converts the estimated angle into movement weights for each motor.
- moveMotors(): Handles actual stepper movement and LED strip activation.
- estimateDirection(): Calculates the direction of the detected sound and triggers the appropriate motor movement.
Parameters You Can Adjust:
- SENSOR_DISTANCE: Distance between microphones (in meters).
- moveAmount: Factor by which Motor Weights get multiplied for setting the Rotations/movement of rope for the motors. (as float in full rotations)
- detectionWindow: Time window for considering all three sensors’ input.
- interpFactor: Controls how sharply the motors react to direction changes. (1= linear, <1 softer)
- bool useDefaultTransition = true; // Toggle between direct movement between sound sources and through hanging position (if it has a frame where it cant move 360 degrees keep it True)
Downloads
Usage



Power up your system, then Clap or make a sharp sound near the sensors.
The motors and LED strip will respond, „pointing“ toward the sound source.
If it hears another Sound it changes its position to that direction, either directly or through its hanging "default" position.
If no sound is detected for 10 seconds, the system resets to the default position.