This article is actually less about microprocessors and more about physics. A microprocessor is only used to make the physical effect visible using very simple means. It could be the smallest one you ever came across: 3850 bytes FLASH, 328 bytes SRAM, 1 GPIO pin.
If you want an explanation, why white light gets splitted into different colors, read about why depends the speed of light inside of glass on the color.
A very simple project, showing that light of different colors gets refracted by different angles when passing through a prism. To make this more obvious, I used a Neopixel strip of eight LEDs and set some of the LEDs to a different color than the other ones.
Connect Vcc and GND; select anniePin between 2 and A5 and connect it to Din of the strip and use anniePin in the Neopixel constructor.
While all LEDs are arranged in a stright line, when looking through the prism, the ones of different color look a bit displaced. The size of the prism should be about 10x3x3 cm and placed about 6 cm above the LED strip. With some bucks more, you will get a longer prism, don't hesitate to use a longer strip and modify the constants in the code accordingly. Rotate the prism gently a little until you get the best results.
Unfortunately, my attempts to make a video of it failed.
In case you don't see any effect, double-check the angle.
The direction and amount of the displacement depends on the colors.
When I showed it to some friends, they objected because inside a single WS2812 element the three RGB LEDs are located at different positions as shown in this picture:
which is perfectly right, but the displacement caused by the dispersion is much higher than the distance of the three RGB LEDs.
Don't be surprised about the short code. It cycles the color of the "background" LEDs and the color of the "different ones".
const byte LED = 6;
const byte NUM = 8;
const long RGB[] = { 0xFF, 0xFF00, 0xFF0000 };
#include <Adafruit_NeoPixel.h>
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM, LED, NEO_GRB + NEO_KHZ800);
void setup() {
Serial.begin(9600);
Serial.println(__FILE__);
strip.begin();
}
void loop() {
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 8; k++)
strip.setPixelColor(k, RGB[i]);
int ij = (i + j) % 3;
strip.setPixelColor(2, RGB[ij]);
strip.setPixelColor(5, RGB[ij]);
strip.show();
delay(1000);
}
}You might consider to replace the WS2812 strip by discrete RGB LEDs
but I would not recommend to do this.


_ztBMuBhMHo.jpg?auto=compress%2Cformat&w=48&h=48&fit=fill&bg=ffffff)


_3u05Tpwasz.png?auto=compress%2Cformat&w=40&h=40&fit=fillmax&bg=fff&dpr=2)
Comments