Atom visualization Quickly adapted from Peter Chestna's original work ! Code to be found

Atom visualization

Quickly adapted from Peter Chestna’s original work !

Code to be found here: Atom - Pastebin.com

I had to introduce a delay(20); after each show to slow it down to what you see in the video.

I am struggling a bit to ‘dissect’ the sketch and would appreciate some help.

1st issue: The following definition #define NUM_PIXELS 0

I can’t understand why it works as many loops use NUM_PIXELS to draw and I am still getting nucleus and electrons with this set at 0 !?

2nd issue: Slowing down the electron spinning without the use of delay

I tried setting const uint8_t kFracs = 16; to higher values but it did not work well. Likely, I need to change the code in some other place(s) !?

3rd issue: Different rotational planes for electrons.

The electrons currently cross paths at the top and bottom of the cube, any suggestions on how I can have some electrons crossing paths on the front and back !? on the left and right sides !?
What about how to get some of them to spinning backwards within the same plane !?

Thank you for any help, suggestions…

For the delay, have you tried EVERY_N_MILLISECONDS(20)
{
domyroutine();
}

Hi @Andrew_Tuline ,
No, I would prefer to have the fractional part of the pixel movement to be in 1/32 or 1/64 to slow it down with more movement steps !

Have you tried increasing THETA_RES and PHI_RES? I won’t be able to test or verify until tonight, but I think that might slow down the rotation.

Hi @Jason_Coon , changed from…
from… PHI_RES 30 to… PHI_RES 300
and it effectively slowed down the electrons spin to the point I could remove the delay !
Thanks!
Anywhere I can find info about these parameters !?

No problem, glad I could help!

Theta and phi are commonly used as angular symbols in trigonometry and polar/spherical coordinates: https://en.wikipedia.org/wiki/Spherical_coordinate_system

My other guess for slowing it down was going to be reducing the amount added to theta and phi each loop, but they’re currently ints, and only get incremented by 1 or -1 each loop. They would need to be changed to floats in order to be incremented fractionally.

@Jason_Coon Excellent thanks !!!

Hi again @Jason_Coon , with that wiki on spherical coordinates, I was able to fix that 3rd issue by myself.
Now I am able to set electrons to spin about in any of the 3 X, Y Z axis AND reverse the rotation in all 3 cases !
Fun to learn something new… thanks again !!

Is that built with dumb or addressable LESs?

That brings back memories of the paper I wrote in my high school pre-calculus class on 3-dimensional rotations in space, using Euler’s formulas. I wrote a program in BASIC on the Apple II (and also a version for the Radio Shack Color Computer I had at home) which displayed the XYZ coordinate axes, prompted you for the three rotation angles, then displayed a unit cube with the projected orientation.

It would have been way cooler with an LED cube, though. :wink:

@Will_Tatam Sorry for delay, I just noticed your question now…

They are adressable LEDs. They use the same protocol as the WS2811/WS2812. The actual circuitry is ‘built-in’ to the 8mm bullet shape LED package.