A persistance of vision lightsaber heavly inspired by bitluni(original build).
Introduction
A LED Lightsaber equipped with an onboard IMU and ESP32 to detect the current angle of the lightsaber and accordingly light up the LED’s to display images in the air as the saber is swung around.
Hardware
- ESP32
- 1 Meter WS2812B Strip (144 LEDS per meter density)
- Buck Converter
- 3S 35C 2200mAh Lipo
- MPU6050
- PVC Pipe
- Wooden strip
- Basic power tools
Software
Given that the lightsaber had 144LEDs and each LED is supposed to represent the color of 1 pixel, we needed to scale images to 128x128 pixels before they could be used in the lightsaber
Since the pivot point of the lightsaber will be at the bottom center of the image, the side length of the image, given its diagonal size is fixed at 144, turns out to be 128, as shown in the figure below.
The current angle of the lightsaber is calculated using the MPU6050. The LED colors’ corresponding values are picked by overlaying a straight line over the image array and extracting the pixels that coincide with the above-mentioned imaginary line.