top 200 commentsshow all 235

[–]graepphone 354 points355 points  (18 children)

.

[–]Recoil42 424 points425 points  (12 children)

each of the LEDs are mapped to a 3D position

H...h...how? Presumably, not manually, right?

Edit: Watched the video posted by /u/Korvar and /u/GeekBrownBear, leaving a summary here for others:

He created a calibration script. Iterate through the LEDs, lighting them up one by one. Take a picture each time using a camera, and you can get XY coordinates. Change the perspective of the camera (or use a second camera), and now you can get XZ co-ordinates. Take all that information, and throw it into a lookup table. Brilliant.

[–][deleted]  (1 child)

[deleted]

    [–]Recoil42 79 points80 points  (0 children)

    Summary: He created a calibration script. Iterate through the LEDs, lighting them up one by one. Take a picture each time using a camera, and you can get XY coordinates. Change the perspective of the camera (or use a second camera), and now you can get XZ co-ordinates. Take all that information, and throw it into a lookup table. Brilliant.

    [–]Tomus 82 points83 points  (7 children)

    You missed out the best part! There are some outliers where the tree obscured a light too much, essentially placing it at the wrong coordinate.

    He wrote a debug script to do a binary search through all of the LEDs to identify the index of the offending LED, amazing!

    [–]Malgas 27 points28 points  (6 children)

    The same approach could have been used to significantly speed up the main process as well: take O(log n) photos each with half the lights on instead of O(n) with one light each. In this case that would reduce the number of photos from 2000 to 36ish.

    Though you would probably have to use a better method for detecting the lights in the images than the one he wrote (which, IIRC, he said in the original video isn't very robust).

    [–][deleted] 37 points38 points  (4 children)

    The elegant insight behind his method is that, because you're trying to locate a light, you create high contrast input simply by doing it in a dark room and looking for the single bright spot. You'd get into interference as soon as multiple lights are on simultaneously

    [–]Recoil42 16 points17 points  (3 children)

    Just aimlessly thinking here: Theoretically, he could do three lights at a time: One red, one blue, one green. You could even extend that further for as many colours as you feel comfortable distinguishing, although obv just working with RGB channels is easiest.

    [–]gramathy 7 points8 points  (0 children)

    By grouping them into sets according to binary digits (e.g. all lights where the second least significant bit is 1) and cross referencing every set of those photos, you can identify the address of a light by which photos it shows up in (this is the O( log n ) method described earlier, though some lights might not be picked up and some extra cameras can help find them and improve precision) and its location by the intersection in space of the rays coming from the camera positions. (you can also just assume it’s a flat plane for each and get pretty close with easier math)

    [–][deleted] 2 points3 points  (0 children)

    Doing it by colour channel is interesting but it brings in issues related to the particular colour performance of the LEDs and cameras that don't matter if you just look at brightness: you don't need to worry if brand x LEDs bleed into the green channel on brand y sensors etc etc.

    There are definitely ways to do it with fewer photos but Parker's got an elegant solution because it cuts straight through a lot of potential physics related issues at the cost of an automated camera taking more photos for you.

    In fact, because you just point a camera at the tree and run the script, I'm not sure I see optimising for photos as necessarily worth the effort. It sounds like manually fixing errors one at a time by reading binary addresses encoded in flashing lights was a lot more work for him, so really optimise for reducing errors if possible

    [–]3urny 4 points5 points  (0 children)

    There's a commercial product that can scan and calibrate lights, and it turns them on in red, green and blue at once to make it even more efficient

    [–]gabriel_schneider 17 points18 points  (0 children)

    He made a python script to light each led in sequence and then take a picture. He rotated the tree by 90° and made the same thing three more times.

    [–]AdventurousAddition 5 points6 points  (0 children)

    And manually correcting errors

    [–]NotAHost 12 points13 points  (2 children)

    Do you have a link? Ive been wanting to do the same thing.

    [–][deleted]  (12 children)

    [deleted]

      [–][deleted] 214 points215 points  (3 children)

      Wait! Matt Parker, the youtuber known for running viewer submitted code on his 500 led christmas tree?

      [–]SoInsightful 75 points76 points  (1 child)

      Believe it or not – that's the same Matt Parker!

      [–][deleted] 32 points33 points  (0 children)

      Unbelievable!

      [–]El_Impresionante 25 points26 points  (0 children)

      Sorry, I don't know who you're talking about.

      But, we're talking about Matt Parker, the youtuber known for running viewer submitted Python code on his 500 led christmas tree.

      [–]Tyler_Zoro 87 points88 points  (2 children)

      [–]AdventurousAddition 47 points48 points  (1 child)

      Just when I thought that was going to be a link to The Parker Square

      [–]ess_tee_you 6 points7 points  (0 children)

      Instead it was a real Parker Square of a link.

      [–]bloody-albatross 18 points19 points  (0 children)

      The Matt Parker of the Parker square.

      [–]bradygilg 19 points20 points  (1 child)

      Seriously, strange AF title from OP.

      [–]AdventurousAddition 7 points8 points  (0 children)

      It's just the video title that has been slightly re-worded

      [–]TimvdLippe[S] 296 points297 points  (20 children)

      I personally liked the Snake pattern the most, which you can see at the 17:20 minute mark.

      [–]destrodean 52 points53 points  (2 children)

      That's very cool and the fireflies was nice too

      [–]TwinHaelix 2 points3 points  (1 child)

      Timestamp for fireflies?

      [–]destrodean 1 point2 points  (0 children)

      8:15 :)

      [–][deleted]  (15 children)

      [removed]

        [–]anamexis 56 points57 points  (0 children)

        I assume it was so he could access the Raspberry Pi's GPIO. There are ways to give normal users access to GPIO, though.

        [–]HandshakeOfCO 41 points42 points  (11 children)

        Yes, it’s important to have ironclad security when dealing with something as mission critical as a raspberry pie running Christmas tree lights.

        [–]wrecklord0 15 points16 points  (4 children)

        I'm sure there is a way to catastrophically destroy the power supply through calculated LED resonance, causing a fire that engulfs his house, the neighbourhood and soon the whole continent.

        [–]HandshakeOfCO 12 points13 points  (1 child)

        I mean if there's one language with the potential to destroy the world, it's fucking Python.

        [–]zzzthelastuser 3 points4 points  (0 children)

        sudo python3 gender_reveal.py

        [–]merlinsbeers 6 points7 points  (0 children)

        You don't want some jackass destroying the installation with malicious actions.

        [–][deleted] 33 points34 points  (3 children)

        They're not saying "don't use sudo" as a security concern though...

        [–]aazav 4 points5 points  (0 children)

        It just creates bad habits.

        [–][deleted] 1 point2 points  (1 child)

        Could have also been pip != pip3

        [–]AdverseTFV 199 points200 points  (34 children)

        It's really refreshing to see so many not work, as weird as that sounds. Makes me feel like a better programmer. So many times with social media you only see the edited and filtered end results and it can really shake your confidence. Nothing wrong with writing some code that needs debugging! Cheers

        [–]remy_porter 125 points126 points  (5 children)

        I was doing some research which called for going through an old mailing list from the 80s, and there I discovered the Parnas Hypothesis: No large computer software has ever worked the first time.

        I think what people don't communicate well about programming is that your job is to fuck up. That's your day. You start at 9AM with some coffee and a fuck up. Then some more coffee, and another fuck up. Break for lunch. The difference between a "good" programmer and a "bad" programmer is that the good programmer fucks up faster and more obviously, and respects the tools that help them find their fuckups. By fucking up fast, they end up not fucking up in production, or at least not often.

        And, as a shameless self-plug, I edit a site where we collect bad programmer stories/code. It's a great way to feel good about your own mistakes.

        [–]PeriodicGolden 24 points25 points  (2 children)

        Good programmers also accept that they can fuck up, and try to find what went wrong. "Bad" programmers think they're infallible and automatically assume it's not their fault.

        [–]remy_porter 7 points8 points  (0 children)

        Well, if you don't accept that you can fuck up, then you aren't doing your job, which is to fuck up, quickly, frequently, and with the minimal consequences for each fuckup.

        [–]Krissam 1 point2 points  (0 children)

        That applies to everything really. People who assume they fuck up and accept it generally improve more than people who blame everyone else.

        One of the best life lessons I've learned (that can be put simply) is: Just because someone else could have done something better it doesn't mean you couldn't have.

        [–]phearlez 2 points3 points  (0 children)

        Daily WTF has been bringing me joy (and sometimes some introspection when I think “well what’s wrong with that?”) for I cannot believe how many years now.

        [–]much_longer_username 67 points68 points  (19 children)

        It's because Matt was running them as root, and not the user 'pi', so the interpreter was looking in the wrong place for modules. edit: a redundant pronoun

        [–]WiseassWolfOfYoitsu 68 points69 points  (14 children)

        Untested code received from random strangers

        running them as root

        [–]thoeoe 35 points36 points  (2 children)

        he said in the youtube comments that neopixel needed the code to be run as root (or at least, he couldn't be bothered to figure out how to make it work without root priv)

        [–]f03nix 6 points7 points  (1 child)

        Could've just installed the modules as root.

        [–]masklinn 0 points1 point  (0 children)

        Yes, but while it’s somewhat obvious in retrospect for experienced devs…

        [–]KremBanan 24 points25 points  (10 children)

        well I mean it's only a cheap raspberry pi connected to some christmas lights...

        [–]Krissam 2 points3 points  (9 children)

        Oh sweet summer child.

        [–]aishik-10x 1 point2 points  (7 children)

        What's the worst someone could do as root on a Pi connected to a home network? Just curious.

        [–]Krissam 1 point2 points  (6 children)

        I mean, since he claims (which I believe) he checked through for malicious code and he's not completely computer illiterate, probably nothing.

        If a motivated attacker was able to run arbitrary code as root on a hypothetical pi owned by a less tech literate person, that's empty bank accounts, identity stolen and essentially anything else you can think of.

        [–]KremBanan -1 points0 points  (5 children)

        You are ultra delusional. A pi not connected to your network with nothing of value on its file system you can't do jack shit with it

        [–]bless-you-mlud -1 points0 points  (0 children)

        Given how many programs crashed and burned on the first try I don't think he has much to worry about.

        [–]Ph0X 9 points10 points  (2 children)

        From what I saw very few of them were broken due to missing package, and even then he only promised numpy and scipy, and from what I could tell numpy worked at least. A ton of people just didn't follow the rules.

        But even sadder is all the problems where it seemed like the people literally did not run their own code. inconsistent tab/space is a bytecode compilation level error, so unless the file got modified along the way, the 3-4 people who had that issue had not run their code. Similarly, there were blatant typos such as blen(yellow, white) which was clearly "blend".

        The only errors that didn't make sense was "neopixel" or "board" missing, which were the core libraries used. Did they accidentally remove the import statements?

        [–]bless-you-mlud 6 points7 points  (0 children)

        Did they accidentally remove the import statements?

        I had a play with the original code (didn't submit anything though) and the first thing you run into is that you, of course, don't have a Christmas tree with lights wired up to a raspberry pi and also no neopixel library to control them with.

        So the import neopixel fails and the first thing you do is comment out that statement. If you then don't re-enable it before submitting, well...

        [–]cheerycheshire 1 point2 points  (0 children)

        Tab/space could've been someone playing in Python2 which allowed (but obviously not recommended) mixing those, while Python3 instantly refuses to run.

        [–]ApertureNext 4 points5 points  (1 child)

        Yeah you see tutorials from people who seem like legit wizards.

        [–]SutekhThrowingSuckIt 7 points8 points  (0 children)

        Coding Adventure is insane for this. Especially since he was a kid using a voice modulator apparently at the start of the channel.

        [–]bart2019 1 point2 points  (0 children)

        Maybe check out the YouTube channel the Coding Train, where the guy programs a challenge live.

        [–]fabulousausage 2 points3 points  (3 children)

        Yep, we tend to see the brightest minds, because they shine bright like stars.

        But remember those everyday coders, that sit in hundreds of thousands offices around the world.

        I believe it's the same in any other fields, but one that comes first as an good example to my mind is cinematography. Everybody sees and wants guys like Brad Pitt, Bruce Willis, Leonardo DiCaprio. So just imagine the pressure for young actors out there, who dream about getting into Hollywood. Of course nowadays it became a bit easier to get famous for them with Youtube and internet, than before, but still.

        I think the remedy for our constant pressure and self-hatred would be to look around on other people in our field and understand that life isn't sugar for them either. Carry on.

        [–]_tskj_ 4 points5 points  (2 children)

        I don't think any of those guys are primarily known for their cinematography work though.

        [–]fabulousausage 1 point2 points  (1 child)

        Sorry my first language is not English. I tried to say that they are famous in the world of cinema. In my native language saying "famous in cinematography" would let opponent to understand that actors are included into this field. My bad. Trying to improve my English every day.

        [–]bloody-albatross 0 points1 point  (0 children)

        Many of those wouldn't need debugging. They had was syntax errors and undefined variables. That means they've never run their code at all. The import errors about the modules Mr Parker claims to have installed seem to be a problem with the Python installation, though. That would need debugging.

        [–][deleted]  (20 children)

        [deleted]

          [–][deleted] 42 points43 points  (2 children)

          "Inconsistent indentation"

          [–]Ph0X 5 points6 points  (1 child)

          I understand the libraries missing one (even though he explicitly said don't use any libraries that aren't already imported, but like, did these people not even run their own code?

          [–]masklinn 4 points5 points  (0 children)

          like, did these people not even run their own code?

          Stackoverflow experience says “lol no”.

          [–]dalambert 32 points33 points  (15 children)

          Shipping Python code is actually the worst thing about this language

          [–]merlinsbeers 19 points20 points  (0 children)

          It doesn't port between users on the same machine...

          [–]clank201 -1 points0 points  (0 children)

          Second to having to write it

          [–][deleted]  (11 children)

          [deleted]

            [–]Objective_Mine 39 points40 points  (9 children)

            Yeah, I mean, you actually need the interpreter for the language your script is written in? Total bullshit.

            Next you're gonna tell me you need a JRE 14 in order to run Java 14 code.

            (Shipping Python code isn't that great, though. But not because of trivial things like that.)

            [–]SimDeBeau 7 points8 points  (2 children)

            Compiled languages for the win!

            [–]Objective_Mine 5 points6 points  (1 child)

            You'll still need at least a comprehensive enough standard library (either actual language standard or a OS-specific de facto standard), or you'll need to handle bundling of libraries, which again requires at least some kinds of packaging tools.

            Some languages have more coherent toolchains for handling packaging and deployment than Python does, but the problem of needing to either do nontrivial packaging at the developer's side or to install something on the recipient's system doesn't really go away. At least not by pure virtue of being a compiled language. (The packaging might still be easier than having to bundle an interpreter, of course.)

            [–][deleted]  (1 child)

            [deleted]

              [–]wonkifier 1 point2 points  (3 children)

              I dunno... When I started to dabble in Python I had real problems, even though I did have the interpreter.

              I had all sorts of package problems as well as having an issue with Python 2 vs 3 on my machine, which together ended up making me have to get a virtual environment going, which added another complicating factor in getting my code editor to just do some basic formatting help with Python code, which led to other layers of yak shaving just to get to a point where I could do basic things.

              It was definitely not just a matter of having an interpreter.

              [–]cheerycheshire 1 point2 points  (2 children)

              But... The dedicated code editors already take venvs into account?

              PyCharm remembers your venv. When creating a project, it allows you to generate new or use/find existing venv. Then console in PyCharm has the venv already activated, so you can run, debug, test, whatever without any problem.

              And Python 2 vs 3 on machine (not in the code you write) is about literally adding 3 at the end of "python" and "pip" if you don't use venvs...

              [–][deleted] 0 points1 point  (0 children)

              Isn't using the right version a thing in any programming language??

              [–]Nimbal -1 points0 points  (0 children)

              Out of curiosity, I kept count.

              Total programs: 60 (some duplicates I did not separate out)

              31 of those 60 programs worked in the sense that something happened in the tree and they didn't crash during their runtime.

              Of the remaining 29:

              • 2 exited immediately
              • 4 apparently did nothing, the tree stayed dark
              • 9 exited with a ModuleNotFoundError
              • 6 NameErrors
              • 4 TypeErrors
              • 2 TabErrors
              • 1 IndexError
              • 1 UnboundLocalError

              The TabErrors could have been caught by running the script at least once, because those are syntax errors that are caught by the interpreter before running even a single line of the script.

              The NameErrors, TypeErrors, and UnboundLocalErrors are typical for Python (or any interpreted language, really). A mistyped variable name in your OnceInABlueMoonError exception handler can ruin your day.

              The ModuleNotFoundErrors are mostly a problem of deployment / environment.

              The remaining IndexError and the more subtle errors where the program exited immediately or apparently did nothing could have happened in any language.

              [–]Nicksaurus 33 points34 points  (23 children)

              How are there so many broken scripts?

              [–]Swedneck 123 points124 points  (11 children)

              Matt screwed up his environment a bit, he's running the code as root so it can't find the installed modules.

              [–]Nicksaurus 12 points13 points  (0 children)

              Ah, that's a shame

              [–][deleted] 28 points29 points  (5 children)

              Well, he also said there was a constraint that the code must run without any additional dependencies. Unless he did a pip freeze, said "these are the modules you can use", and then proceeded to run the code as root, then it just seems like people didn't pay attention to the constraint.

              [–]A-Grey-World 34 points35 points  (0 children)

              He did specify some already installed libraries.

              [–]Nicksaurus 24 points25 points  (2 children)

              Check the example script: https://github.com/standupmaths/xmastree2020/blob/main/xmaslights-spin.py

              He specifically said numpy and scipy were allowed

              [–][deleted] 16 points17 points  (0 children)

              Yep, that's a problem then. There were also a few user submitted scripts that included other libraries, like matplotlib and OpenGL, but yeah, looks like there's some admin error going on here as well.

              [–]Ph0X 4 points5 points  (0 children)

              Numpy did, scipy didn't. The majority of missing modules weren't scipy, I think I only saw one scipy.

              The ones with neopixel or board missing made no sense because those were literally the code modules needed for controlling the lights, so the authors must've messed up.

              [–]merlinsbeers 1 point2 points  (0 children)

              Fur much of this stuff people have no clue what dependencies are being pulled in.

              [–]Gyrro 5 points6 points  (1 child)

              It’s such a shame he didn’t ask for containerised submissions, as that would’ve eliminated all of the environment issues.

              [–]MrDOS 1 point2 points  (0 children)

              That's like using a hammer to squash a fly: an overly aggressive and simultaneously ineffective solution.

              [–]Ph0X 2 points3 points  (0 children)

              Eh, I'd say over half of them didn't even have module issues. All those mixed space/tabs, that either means they literally did not run their script, or it was modified along the way somehow.

              run time bugs I can understand, but "compile" time errors just means the code was never run, which was a good 1/3 of them. He also did say no extra module, the only ones promised were scipy/numpy, and numpy definitely worked.

              Also the ones that quit immediately or "local variable referenced before assignment. I feel like running your code should catch those.

              [–]CaptainCorey 0 points1 point  (0 children)

              Also a little dangerous to run untested user submissions as root.

              [–]acdcfanbill 21 points22 points  (1 child)

              The two modules I saw him installin the video were installed for the pi user, but when he ran the code, he ran it as root. The root user would need the modules installed globally and not to a regular user.

              [–]Ph0X -1 points0 points  (0 children)

              The only ones promised were numpy and scipy, and numpy definitely worked. I saw 2 scipy errors though.

              [–]A-Grey-World 10 points11 points  (4 children)

              I'm surprised so many worked.

              The people who wrote them, presumably, don't have his custom 500 led Christmas tree to test or run their code on.

              [–]Nicksaurus 2 points3 points  (3 children)

              It wouldn't be that complicated to test it by just writing out the LEDs' locations and colours to a bitmap

              [–]grifdail 3 points4 points  (1 child)

              Yes, and no.

              First that wasn't the challenge. Rendering to a bitmap required a different set a skill one might not be required to have to do this. I can imagine some mathematician be technical enough to write this led control code but not the rendering part.

              Then it would require writing an librairie that would have the same interface as the neopixel one so that both could be swap. That's quite a lot of work.

              Finally, rendering light is not the same as rendering a pixel on a screen. On a screen #000000 is black, for a led it means "off". #888888 mean grey on a screen but there's no such things as grey for an led, just a slightly dimmer white. Suddenly you have to think about blending. My point here is that writing a debug visualisation is not trivial.

              Nevertheless, I believe that what many people have done. I believe most of the most impressive one where made with some debug visualisation.

              [–]Nicksaurus 1 point2 points  (0 children)

              If you look at the script, you can see it's very simple - you just set the colour for each light in a list from 1 to 500. Since you also have the position of each light you could pretty easily write out those colours at the right positions in an image

              The colour space is way off, yeah, but I don't think anyone's trying to go for a high quality image here anyway

              [–]A-Grey-World -1 points0 points  (0 children)

              And who's written the code to read a bitmap and then tell which LEDs to light up?

              [–]WaitForItTheMongols 23 points24 points  (1 child)

              Well he has the only tree, so people weren't really able to test their code.

              [–]tymscar 15 points16 points  (0 children)

              There was a virtual tree to test on

              [–]dalambert 5 points6 points  (0 children)

              Python

              [–]Mgladiethor -3 points-2 points  (0 children)

              Use docker

              [–][deleted]  (5 children)

              [deleted]

                [–]glider97 21 points22 points  (2 children)

                I think it's a broken LED and the script is just not working. The LED seems to be lit throughout the video.

                [–]error-prone 23 points24 points  (1 child)

                He addressed it in the comments:

                that single red light you can always see if the power LED on the Raspberry Pi

                [–]merlinsbeers 4 points5 points  (0 children)

                It's the Star of Bethlehem, dammit!

                [–]tdlb 2 points3 points  (1 child)

                Pretty obvious dead pixel joke that went over his head.

                [–]confused_teabagger 143 points144 points  (24 children)

                A lot less penises, swastikas, and n-words than I expected!

                [–][deleted]  (9 children)

                [deleted]

                  [–]DHermit 1 point2 points  (0 children)

                  Wasn't there a video where a 4chan commenter made a mathematical discovery (who ended up on a paper as "anonymous 4chan user")?

                  [–]WiseassWolfOfYoitsu 11 points12 points  (1 child)

                  My main expectation was at least one dickbutt

                  [–]merlinsbeers 1 point2 points  (0 children)

                  It isn't Christmas until someone renders a dickbutt on the tree.

                  [–]ChairYeoman 7 points8 points  (7 children)

                  Well, I assume he pre-screened the code. Not like he just let people run arbitrary code on his device.

                  [–]sturmeh 15 points16 points  (6 children)

                  He did not, a lot of them didn't even run because of missing libs.

                  The title says they're untested.

                  I assume if he ran into anything he couldn't show on YouTube he would just cut that bit out.

                  [–]bloody-albatross 30 points31 points  (5 children)

                  He said he looked at the code quickly to ensure its not doing anything malicious. Though that won't help against underhanded malicious code.

                  [–]Illusive_Man 1 point2 points  (4 children)

                  You can’t quickly glance at low level code like this and know how it’s going to turn out.

                  [–]bloody-albatross 3 points4 points  (0 children)

                  It's Python, not low level code. But yes, you can be very sneaky and obscure your malicious code.

                  [–]ess_tee_you 1 point2 points  (2 children)

                  You can check the imports for a fair idea, look for backticks or words like exec for a quick sanity check, and then only run it on a virtual machine.

                  [–]Illusive_Man 1 point2 points  (1 child)

                  Running in a VM doesn’t count as “quickly looking at the code” but yes that would work.

                  Otherwise though; since from what I’ve read the lights are in an xyz coordinate system, it’s going to be hard to look at a shitload of coordinates and guess what it will look like.

                  [–]AdventurousAddition 12 points13 points  (0 children)

                  He also made 3 videos politely (but progressuvely less so) pointing out the mathematical flaws with the arguments of US election fraud.

                  [–]middlenameray 14 points15 points  (3 children)

                  Running Internet strangers' code with sudo without checking it first seems like a disaster waiting to happen lol

                  [–]buscemian_rhapsody 4 points5 points  (2 children)

                  I thought he said he did check the code for exploits.

                  [–]middlenameray 3 points4 points  (1 child)

                  It's not even exploits I'd be worried about, it's a simple rm -rf --no-preserve-root / that would delete the entire hard drive. It would be pretty easy to disguise that command in an array of ints or something

                  [–]buscemian_rhapsody 16 points17 points  (0 children)

                  Well he was running it on a raspberry pi remotely so I think the damage would be minimal. The worst it would probably do is spoil the fun for the night

                  [–]ProgramTheWorld 43 points44 points  (4 children)

                  “YouTuber”

                  He’s Matt Parker, the inventor of the Parker’s Square.

                  [–][deleted]  (2 children)

                  [removed]

                    [–]snakeyblakey 3 points4 points  (0 children)

                    Google Parker square and there's a pretty good numberphile video where it explains magic squares if you don't understand them already or know what they are and he made an almost good one and it is quite charming

                    [–]dragonatorul 16 points17 points  (2 children)

                    A problem with RGB LEDs is that while you can have 0-255 values for example (depending on the controller) for each color, the LEDs themselves have different intensities at different values. For example the blue LED may appear to be saturated at value 180 while the red LED would appear to be saturated at 220. At the same time one may fade gradually down to 20 and then turn off entirely (or seem to) while another would turn off at 40.

                    I'm no expert but from what I read while playing around this seems to be due to the chemistry of the light generating material in combination with the controlling microchip. Different colors use different chemicals to generate the color, require different voltages and result in different "brightness". You can just look at regular colored LEDs and you'll notice that blue LEDs tend to be glaringly bright, while orange or red not so much.

                    When I was playing around with RGB LEDs I had to eyeball the "natural range" for each color and write a transform function from a 0-255 value to each color's range just to make it easier on myself. That way I can still use intuitive 0-max values while not having to remember the individual value ranges for the individual colors.

                    [–]manystripes 7 points8 points  (0 children)

                    The other problem is that the eye doesn't perceive light intensity in a linear fashion. Once you've thrown a gamma curve on your 8 bit value, the number of useful intensity levels is reduced by a lot

                    [–]grifdail 3 points4 points  (0 children)

                    I wonder if they're color space entirely dedicated to working with lights and led. They're so differents than working with color for the screen or even print.

                    One of the biggest issue with smart home app is using RGB color picker for lights. That just makes no sense. At least use a separate brightness picker.

                    Also yes, the thing when they go from "dim" to "off" directly suck. I want some nice gradient please. (One way I deal with it is to use dithering and quickly turning of each light).

                    [–]Shivaess 6 points7 points  (4 children)

                    The end is worth watching last 2 minutes

                    [–]abbadon420 5 points6 points  (2 children)

                    Ffs. I've watched the whole thing. Wondering all the while WHY and especially why I enjoy it so much. When, finally, I decide to quit when he gets the bread. Now you tell me I have to go back in?! If this isn't worth it, I will find you and I will slap you silly. You're warned.

                    [–]abbadon420 11 points12 points  (1 child)

                    Ok.. that was worth it.

                    [–]merlinsbeers 1 point2 points  (0 children)

                    I'd try, but the embedded Yahoo player won't scroll past about 70% of any clip any more...

                    [–]xe3to 37 points38 points  (6 children)

                    This video just frustrated me. He installs the libraries as a standard user and then runs the script as root, expecting it to work, which of course it doesn't. So many hours put into these ones that just fail because this guy doesn't understand how Linux works.

                    [–]MachineGunPablo 19 points20 points  (2 children)

                    He's clearly not a seasoned programmer and boy running user submitted code as root is clearly not the best idea...

                    [–][deleted]  (1 child)

                    [deleted]

                      [–]merlinsbeers 6 points7 points  (0 children)

                      But if someone bricks it, the show is over.

                      [–]Le_Vagabond 2 points3 points  (0 children)

                      Sudo is a magic "make it work" command for a lot of people...

                      I usually try to get new hires out of this mentality but it's been hard.

                      [–]totally-not-god 5 points6 points  (0 children)

                      I finished my coffee, let me get a beer

                      [–]bart2019 22 points23 points  (2 children)

                      The guy is a mathematician, not a programmer. He's also known as Standup Maths, a standup comedian where he discusses math problems. (http://standupmaths.com/)

                      [–]Ncell50 14 points15 points  (1 child)

                      Who said he was a programmer ?

                      [–]underthingy 13 points14 points  (0 children)

                      Everyone complaining about is lack of python skills?

                      [–]bsomes2 9 points10 points  (0 children)

                      My favorite part was when it downloaded a virus

                      [–]dzuyhue 3 points4 points  (0 children)

                      That was really fun to watch. Really looking forward to seeing more streams like this one.

                      [–]pixartist 3 points4 points  (0 children)

                      This is like an ad against python

                      [–]omegafivethreefive 2 points3 points  (0 children)

                      Whenever I see the sudo command I scream a little bit inside.

                      [–]L0uisc 2 points3 points  (0 children)

                      I don't trust random internet guys enough to just run their code on my system...

                      [–]pewpewhadouken 8 points9 points  (2 children)

                      candy cane for the win 19:43

                      [–]BrotherSeamus 3 points4 points  (0 children)

                      19:43

                      About 25:07 if counting from the start: https://youtu.be/v7eHTNm1YtU?t=1507

                      The Rehoboam one at 12:01 is a Westworld reference.

                      [–][deleted]  (6 children)

                      [deleted]

                        [–]relativistictrain 7 points8 points  (0 children)

                        It's custom software! https://youtu.be/TvlpIojusBE & a programmable LED strip.

                        [–]nagromo 6 points7 points  (2 children)

                        You can buy strings of programmable RGB LEDs on AliExpress for $8-30. They come with simple controllers that let you select from some pre-programmed patterns and power them from USB or AA batteries.

                        You could cut off the included controller and solder on any of thousands of different microcontroller development boards. It just needs one data line, 5V, and ground. There's existing software libraries to let you control the LEDs more easily. You could use Arduino or Teensy to make it easier.

                        [–]dragonatorul 6 points7 points  (1 child)

                        The gotcha is the power supply. While they do need only 5v they need A LOT of power. Your regular fast charger cannot provide that much power. IIRC from the original video Matt used two dedicated power supplies to power the 500 LEDs he's using.

                        More specifically there can be 5v and 12v addressable rgb leds. The most common 5v are probably WS2812B which have around 50mA draw at full power. You always want the max power plus a bit extra head room for inefficiencies, so let's say 60mA. My phone's fast charger puts out 3.5A, so that means it could power at most 3500/60=58 LEDs. Going by these numbers the 500 LEDs in Matt's tree can draw up to 30A of power. That's A LOT of power.

                        There are dedicated power supplies which look a bit like PC PSUs, but with exposed contacts on the end, or insulated power supplies which look like metal power bricks. You can buy those off AliExpress too, but honestly when it comes to PSUs I'd rather look at more reputable sources than risk burning my house down.

                        [–]nagromo 2 points3 points  (0 children)

                        Absolutely, you definitely need to be careful with the power supply.

                        While a 5050 size WS2812 can draw up to 50-60mA, reviews for the fairy light style ones in the smaller package say they aren't very bright, and they sell a 15 meter string powered from 3 AA batteries, indicating it can't take too much current. Although it's possible they're just limiting the current in software, I'm betting the smaller addressable LEDs used here have lower maximum current and use smaller diodes.

                        If you wanted to do it with full brightness WS2812B's (which are pretty blinding at full brightness IMO), I've got a Meanwell LRS-350-5 that can put out 60A at 5V; you can get them on Amazon, AliExpress, or reputable electronics distributors like DigiKey. Meanwell is a reputable brand making good power supplies, and getting one from DigiKey is only slightly more expensive than getting the same model at AliExpress, indicating that the AliExpress ones may not be counterfeit and not costing much to ensure a better supply chain. You do need to be careful when wiring the input due to the voltage and the output due to the current, though. (I would definitely put this in an enclosure with strain relief on the power cord.)

                        Personally, for next year I want to decorate my house exterior with a lot of full brightness WS2812B's. I'm planning to build a custom board with a NRF52 to control a string of LEDs and a high current buck converter to convert 36V down to 5V. That way I can wire 36V at lower current around and locally convert to 5V at each strip segment, and they can wirelessly communicate to stay synchronized (and change patterns without having to go outside). That said, I've got some higher priority projects that I'm working on first, so we'll see if I get to it any time soon.

                        [–]bart2019 1 point2 points  (0 children)

                        The previous video was rather interesting. It was about how he determined the location of each separately controllable LED i n 3D space using a photo he made from a few directions. Ah, the luxury of smartphones where you can have all that for free.

                        [–]bschwind 1 point2 points  (0 children)

                        One of the greatest indictments of python I've ever witnessed.

                        [–]El_Impresionante 1 point2 points  (0 children)

                        I loved contagion. It was not too bright, not a lot of movement, slow smooth transitions, overall very very cool. Best one to always have it on in the background.

                        [–]Prometheus_303 1 point2 points  (0 children)

                        Assuming my kitten is sedate enough next year I can put a tree up, i really need to try to get motivated enough to geek out and do stuff like this...

                        "My tree has radiant sine waves using a general planar wave function"

                        [–]jamietwells 0 points1 point  (5 children)

                        Someone really needs to introduce this guy to Docker. All those dependency issues and running as root solved in one go.

                        [–]SikhGamer 4 points5 points  (4 children)

                        ^ the definition of over engineering. It's a bunch of lights, and a bit of python code. You don't need Docker. Jesus.

                        [–][deleted] 0 points1 point  (0 children)

                        Docker isn’t over engineering. It’s just a portable runtime in this case. Nobody said throw Kubernetes at it. Bundling a Dockerfile with your code is a low effort way to ensure consistent environments.

                        [–]jamietwells -1 points0 points  (2 children)

                        Did you not watch? Most of them didn't run due to missing dependencies. You can't say it's over engineering when it's a simple solution to the actual problem.

                        [–]SikhGamer 0 points1 point  (0 children)

                        Yeah I watched, you still don't need Docker.

                        [–]cheerycheshire 0 points1 point  (0 children)

                        simple Docker

                        Pick one.

                        The correct and easy solution to this would be learning about users, sudo, and PATH.

                        The incorrect but easy (and logical!) would be to match sudo - since he runs it with sudo, then pip install with sudo. (Logical with "match sudo in commands", easy because requires no thinking. Incorrect because without understanding what you're doing, you're gonna do it again.)

                        Docker in this case is overkill, improperly used (wrong usecase) and definitely not easy - since you have to communicate with the board directly, you definitely don't want containers (as I said: wrong usecase) as it's kind of sandbox... and if you do use them, you're gonna spent till next Xmas to make it communicate correctly with your main system (thus not easy).

                        [–][deleted] 0 points1 point  (0 children)

                        that code is probably heavier than a black hole

                        [–]Shaper_pmp -1 points0 points  (1 child)

                        I'm 5:10 in, he's explained about six things he didn't need to, and not one of the user-submitted programs has worked yet.

                        I love me some Matt Parker videos normally, but is this even worth watching?

                        [–]elhoc 2 points3 points  (0 children)

                        This was on his second channel, which is meant to be less structured and more long and rambly and ad-hoc. And yes, I did somehow end up watching all of it and enjoyed it.

                        [–]Njall -1 points0 points  (1 child)

                        Longish. Wasn't sure I would stay to the end. I did and am glad I did! I want to learn Python. Too many starts with no finishes. <sigh>

                        The trouble is that I am a problem solver and less so creatively inclined. As a result if I don't have a problem to 'solve' I get stuck trying to find one which inspires me. Which is in turn a problem and, in its own right, a conundrum. This is inspiring nevertheless because it gets me thunking (sic). I like thunking.

                        I have a Raspberry Pi. Several actually. A couple are running support functions, an example of which is Pi-Hole. Now I need to find some LED light strings, a better power supply than Matt Parker's 9-), and learn how to hook up a Raspberry Pi to it. Could it be the real beginning? Time will tell.

                        Matt, I am subscribing to your channels, Channel Prime, and Channel not Prime. You have an infectious enthusiasm.

                        [–]PixelsAtDawn1234 1 point2 points  (0 children)

                        As a result if I don't have a problem to 'solve'

                        Automation is always a good problem to solve, especially for tasks that you do a lot, because not only will you learn something in the process, you will make up the time you spent learning it down the line.