Apparently there is an off-the-shelf version of this ("Twinkly" - check out Techmoan's review) but I console myself that it seems to only map the 2D surface of the tree. So at least my effort got me a third dimension! Albeit a low-res one. If there is enough interest and support: I'll go bigger next year. So share this video and (if you can, no pressure) support me on Patreon. patreon.com/standupmaths
Next year - SmarterEveryDay vs Mark Rober vs some of the other more eccentric RUclipsrs in a contest of tree displays... Maybe have them released like an Advent Calendar?...
Techmoan just reviewed a product just like this, but it was much more restrictive and app based, and relied on a cloud service for the spacial mapping. This is much more open to possibilities, not to mention more impressive that you did it yourself from scratch!
I came to make the same comment. But even the Techmoan product is just a turnkey version of more general stuff. There is a whole community of people using standard addressable lights and controllers, with free software for mapping them and doing displays.
Was about to comment about that video as well even went as far as to have the video link ready, oh well seems a shame to waste a perfectly good link so here you are, ruclips.net/video/DYVMeyGEWes/видео.html
gorgeous, yes. Completely unique, not exactly. It might be unique to a small homemade Christmas tree installation of 3D mapped LEDs but definitely not unique to 3D LED mapping in general. Search RUclips for CUBATRON . I've seen the exact effect you mentioned in person back in 2012 on the cylindrical shaped CUBATRON at the Burning Man art festival in Black Rock City, Nevada, USA.
smart friends are unsurprisingly effective for solving problems i just feel like im cheating when im not smashing my head against the wall until i figure stuff out, but yeah pretty much
@@officer_baitlyn lol i agree so much, the satisfaction when figuring out something on ur own is unmatched but trying to do projects like this without those ppl helping seems futile
More people - more effects based on complexity of the system. Like ants or bees do a great work together, but don't know what exactly to do by their own
That's what I thought when he showed how he changed the angle of the plane - shove the _tree_ through a matrix instead of the plane? And here until he said that I was thinking how he could have made his code into a program that ran user snippets as if they were shader programs for the tree-pixels (trexles?)...
Right? A video about geomeTREE like this needs some good puns. I also think he maybe should've used ROOTS in the equations, but those might be more ORNAMENTal than really necessary.
I like how Eugénie put in the work to model a Christmas tree to block out the lights on the back, I would've just stuffed a solid cone inside the lights' area
That was my 1st thought, but because the lights are at varying distances from the trunk it means the cone would either be too small and not obscure enough, or it would obscure those on the front too (or most likely both). You could go really simple and just shove a triangle in on Z = 0 that literally just blocks out everything nearer the back, would mostly work...but at this point I'm looking for the laziest solution to something that I'm too lazy to try and do in the first place ☺
I love the fact that you mentioned that the LED's are numbered 0 through 499 and your top three tips were 0, 1, 2. It is nice to see someone how actually knows how to count!
I think the lattice would be difficult to map to the lights and difficult to interpret visually, but I could see how you could see "waves" of activity in the light emerge, flow and disappear before eventually settling to a vaguely oscillating but ultimately static display.
I can imagine everyone having something like this in 5-10 years, maybe even trees that come with lights pre-set that you only have to put the baubles on, which is the most fun and traditional part of the whole process anyway. your result looks way better than I thought it would, too. your coordinates were obviously pretty accurate. I would have liked to see you rotate a 3d model around using the lights, but I suspect the resolution would be too low to make out complex shapes anyway.
Hm, you could have something like this commercial by next Christmas from the technology side. The scanning could be done by phone. The lights could be connected to a Raspberry pi zero W that could either talk directly to your phone or hook up to your home WLAN. All that's missing is basically that app on the phone and probably ironing out some quirks. Should be possible to hack something like that together in a couple of months.
@@standupmaths How cool would it look to walk around the tree while it's displaying an image: at first it would look like a semi-random scattering of colored lights, until you get to just the right angle out front 🎄
@@edwardlane1255 I can actually imagine some people trying to do that! The tree equivalent of buying a replacement hamster for kids ☺ They'll never notice...
Hi Matt, not sure if you will see this, but I wanted to tell you that I just received the "Get Well Soon" video you made thanks to my friend Zack's request and I want to thank you from the bottom of my heart. Thank you so much. It means the world to me. I am recovering and back to virtual teaching middle school math.
I was thinking you could also do a binary search - light up half the lights, and press a 1 if your light is on, and 0 if it's off, and then subdivide until one light is left. 9 Button presses would identify any light on the tree. It might be easier than trying to pick out the binary sequence your single light is blinking out among the chaos of the whole tree.
When Matt explained that I thought he meant he turned on every light with 0000001 in its ID, and then every light with 00000010, then 00000100, etc. But maybe I misunderstood.
@@peevester9987 This is essentially what he did. The first bit selected even/odd, then next bit selected the even/odd half of the first selection. Yes maybe the binary search could eliminate half the leds each "trial" assuming you answer the "is it on or off now" after each trial. (2 steps/bit) but in the end I suspect his mapping was the most efficient. I considered all of this then bought the twinkly strings. The family likes it. good job Matt.
My favorite part was when he commanded the lights to identify themselves in binary. Matt: LITTLE ONE, STATE THY NAME. Little one (sheepishly): 0001000101
@@standupmaths you can stream real-time video on your leds laying in chaotic order. Create a pixel map from leds, take contours from image, send pixels for making a frame Drawing with drones in the night sky (already exists)
"Bundle adjustment" is the name of the algorithm you want for localizing Christmas lights from photos. The ceres-solver library is a good place to start.
I'm sure someone is already working on it, but if someone could make a Beat Saber map of the christmas dubstep standupmaths theme, that'd be the bee's knees
Once you start thinking about it and how the maths works it stops looking so simple. I’m running thought experiments in my head as to how spinning the tree 90 degrees then using the same frames of reference will allow 3D pinpointing. He must know the exact distance between the camera and the tree’s axis, and then I’m stuck on how rotating the reference frame of the tree can improve 3D estimation. I’m so close to the answer, but rather annoyed with myself - I work with 6D pose estimation software daily - this should be easy to think about! Impressive!
seriously! I've had an idea for a project I've been bashing my head against for years, and finally earlier this month i decided to handwave a step that i just don't find enjoyable and it's made it so much easier to get the rest done. made more progress in two weeks than the past three years
I don’t think I saw this in the other comments, but I had half an idea on speeding up the mapping using a bit of physical geometry. Presumably the lights on the strands have a uniform and finite length to the wires connecting them. Also, as you mentioned, the light address numbers are sequential along the strand. So if you don’t get a good reading from one address but know the coordinates for the one next to it, you at least have a maximum distance that the missing light can be away from the know coordinate. You can use the radius/sphere to create a “rough” cluster of coordinates that you can use to test /identify the position of the unknown. Since a good chunk of the sphere extending from the known light to the unknown light should be visible from the previous position, since the known light was visible, you can further narrow down positions. Also, you are only mapping 1 light per photo for coordinates. I suspect you could at least light up 3 points at once, if you command one lamp to pure red, one to pure blue, and the third to pure green, and mapped the brightest color value of each color as its own point, assuming it isn’t too bright to mess up the tracking. Should reduce your scan time to a third of what it currently is. Of course your comment on the twinkly brand lights does merit some discussion in that they seem to fairly rapidly map the tree using a video of the lights flashing colors similar to what I describe, so this seems to be a good avenue to explore. Also, photogrammetry may be an area to investigate as well. Maybe if you can take a few dozen very rapid sequential photos with the lights strobing synced to the camera, and then simply move the camera a few inches rather than spinning the tree, the small angular change would be enough to work out half the tree at once, and then you simply have to scan each side twice. The matrix math used to render a rotating 3D model plays into this, but in the opposite way to how you were doing it in your video to generate your effects.
Given the colour gradients I was wondering if low-res pics was where this was going to end. Alternatively, I wonder about reading in shape files for 3D printing (very simple obviously) and rotating those.
The binary debugging method that you used can also be used to speed up your initial scanning. You need 9 bits for 500 LEDs, so if you take 10 pictures - One with them all on and then one for each bit, you then have the over-all positions of every LED and each bit in sequence. You can further speed this up by using different colours to scan multiple bits at once. This is a similar mechanism to how the Oculus Rift calculates it position with IR cameras and IR LEDs. I'm going to have to try this myself now, thanks for giving me yet another project!
@@toniokettner4821 like a normal person. Start at the first one and stop at the first one. Why you would start at tree(1) I have no idea and most people don't do 3 either.
Finding the address of the light with binary was so clever. I love when something in real life has a nice solution that feels like the solution to a math puzzle.
The first stage was pretty similar to a flash test of a theatrical lighting rig. Fire up each address sequentially, note which fixture turns on, then tell the console what channel you want to use that address for. This makes it much more portable, someone can design pretty much a whole show offline and just bring the console file and a patch list. They can make their design with arbitrary channel assignments, and when they get to the theatre they can simply patch their channels to the addresses of the fixtures as they are hung. So if you make an effect using channel 1 for the top most light, then increment channels in a clockwise spiral with channel 500 at the very bottom you can code effects pretty easily, and then any time you want to run that effect on any system, if you re-hang the lights or next year plug them in in a different order or whatever. You just use the flash test to figure out where each light is then you just configure your channels to the appropriate addresses and any effect should work just fine even with the lights plugged in in an arbitrary manner. Also you might want to look into the EOS software for theatrical lighting, it might simplify some of your operations, as these LEDs are... probably using DMX, or something that DMX signals could probably be converted into by a r-Pi with relative ease.
There is free open source software that can accomplish this in 2D space. I actually do something similar, and while I don’t map the tree to a custom model I use a raspberry pi and Falcon Pi Player software to run the outputs to my LEDs. I then sequence my lights to an approximate spiral tree model in xLights. It makes sequencing and timing to music easy and it supports lot of controllers and outputs. xLights does use a program that can map a model in a 2D plane so the extra dimension here is impressive, but you can get cool effect if you do it right with xLights.
Wow, this is brilliant, mind-blowing, I especially love the image-based position detection. A technical hurdle to take first, but then you can unleash your creativity in the patterns.
And “it’s just how he does it” is a very good reason, because the worst thing you could do is switch between 1-indexing and 0-indexing at random between projects.
Based on the Houdini code - they called that function exactly once. Basically a backwards way of defining a constructor... not great practice, but won’t hurt efficiency. Don’t take notes, kids.
In some cases in Python it does make sense. For example some optional function that needs some heavy import, that would not make sense to load always. But in this case i cannot see any reason for that.
A lot of the things inside the function can be moved outside just fine. It is nice to have it all bunched together though. In reality the function call is unnecessary in and of itself given it is the main body of the code. It's really just there as a stylistic thing so putting the imports in there too is fine. Though I will admit I haven't seen it done before.
@@iykury It works. You can even catch the import error and import something else instead. You'll know it when you need it, this is not something you generally want to do.
I saw a commercial implementation of this last week at the Indianapolis Zoo. There was a large tree, about 20-25' tall with thousands of RGB LEDs on it. In addition to colorful patterns, the lights were dense enough to display images such as falling snowflakes and gifts, and it even had an animated deer that would gallop around the perimeter. I immediately thought of this video of yours. I have a goal of some day wiring up my tree similarly. I have the parts, just need the time to do it.
The differences between the Queen's English and our American English never fail to surprise me. Here in the states I learned it as y=mx+b not y=mx+c Side note, we need a cool moniker for American English. "The President's English" just doesn't have the same style as The Queen's
I am german it's y=mx+b here asswell, so it's definitely not an American thing. I although don't think it's a British thing but rather a Matt Parker thing, could be wrong about that.
Here in the UK we call Queen's English "English" and American English "wrong" ☺ ...sorry it's just too easy! Edit: P.S. Merry Christmas, since it's past midnight here.
Dude, I never thought for one moment you were stupid. In fact I thought of you as more intelligent than most. But running the binary sequence to get the light's coordinate... That is next level genius! *Respect!*
This brilliant. The programming, the "Christmas tree light" sophistication, the thought process. Love it. My lights are 50 years old, yellowy-white and blink on and off every couple of seconds.
This is the most Matt Parker Christmas tree I could imagine. Also there's a company called Twinkly that makes this product and you can set it up from your smartphone. It's not nearly as cool as wiring and coding it yourself though.
As an engineering undergrad many years ago, I bought the Dover book on Vector and Tensor Analysis with Applications. Looks like Matt has come up with a new application!
As a software developer in test, my reaction was that you could locate bad light locations and fix them by calculating the distance between adjacent bulbs. If it is higher than a reasonable threshold based on how much wire is between the bulbs, you could relax the location to put less stress on that part of the network.
if you know the location of the next and previous LED, you could also use some approximation to calculate where the LED in between would be. Something like this should make the scanning a lot more robust. It's basically an interpolation problem, so there are probably many solvers availiable in common libraries.
@@sebastianjost FYI, when I said "relax the location to put less stress on that part of the network", I was proposing using a generalization of what you are describing.
@@sergey1519 Well, without the 4th dimension you don't actually have control of the lights. Bc, u no, u can't light up the lights in sequence.if there's no time.to define such sequence
That's a really good example of how hardware problems causes software headache. If I were you I would concentrate more on a hardware: mainly I would place the LEDs zigzag from the bottom to the top only on the facing surface of the tree and count the number of LEDs in each "layer". And all the problems you had would disappear. But for sure I'm in love with the solution you made because it's the first idea came up to my head when you asked how would you find out coordinates of each led. I'm a little bit jealous of those people who could realize their ideas in codes, because as an engineer I have a lot of ideas about automatisation of many annoying and time consuming processes, but I'm not able to do it... I had some experience with Arduino and rpi, but it was for me so annoying... The main reason that most of the examples that are on the internet doesn't work even if you copy paste them, because all the libraries update really frequently and the commands are replaced with another ones and parameters in the brackets also change. My dream of programming for now is to have some visual interface when you drawing a program scheme with blocks but not with some.stupid.words.(with brackets, dots, and, etc) because this language is not absolutely clear as for human who explains his logics in logical block scheme as for a machine who understands only high and low. As for me it's not absolutely clear why no one have already done it... Programming for now looks for me like as if you wanted to print a document from ms word and you have to send not a document to the printer but a hand.writing.code.with(coordinates X, Y, dot color, amount of paint to be extruded, speed of the extrusion, and etc) for each dot on the A4 paper sheet. And also in my dream program should be 2 windows: first with logical blocks connected with arrows, and second with interactive hardware blocks (like sensors, buttons, screens, motors and etc) connected with virtual wires to the specified by person pins on rpi or Arduino or any other controller, and after you've done the wiring and the code you'll be able to check the simulation by pressing buttons, making some virtual influence on sensors and etc. As for logical blocks I imagine that it shouldn't be the same as in line by line codes separate words (like print.ln(), digital.write()), but some more complex pieces of code. All this blocks should be separated in three groups: input, processing, output. In input there'll be some things like read sensor parameters, check buttons state and etc. As for processing there'll be some basic math operations, logical operations (if, else, or, and etc), on/off regulator, PID regulator and something else. As for output some commands like move motor or servo on specified angle, show information on the screen, beep, save a CSV file and etc. Also if the programming is going to be about some visual interface and menus you'll be able to draw it as simple as it realized by MIT app Inventor...
The weird thing is that if you look at the lower level code which controls the lights, you can see that it doesn't REALLY address and individual LED. It puts your demand on the first LED and then clocks it along the wire imperceptibly quickly. To the coder, it looks like individual LEDs can be tweaked, but in reality, each time we change and LED, we're actually "refreshing" the whole string. I love this project. Some day I'll get around to it. I want to display scrolly messages on my Christmas tree.
Someone needs to support on patreon using a name that has all the letters of the alphabet, so they can re-edit the video to make the tree say rude things XD EDIT: Yes, I've seen Matt's twitter post. I thought it was funny too
To find the index of an led you could turn the first 250 on and the rest off, then hit a key to say it was on or off. Now the program knew which half it was in, it could turn half of the new selection on and half of and allow it to narrow down on the location without you doing the binary yourself. But forget binary, use base 8 (off, red, green, blue, cyan, magenta, yellow, white) and you can find any ID with 3 answers.
Just because the power supply can deliver multiple amps doesn’t mean the scale draws that much - my guess is they have a generic adapter as the “optional” piece Matt mentioned that they provide for all of their 6V compatible scales. (Edit: 6v not 12v) Especially as it can run off 2xAA batteries: www.scalesworld.co.uk/bench-scales/1770-sf-400d-electronic-compact-scale.html
Those scales are rather precise for kitchen scales. How many recipes call for units of 0.01g or 0.1g? My far cheaper kitchen scales can only manage 1g precision, but they do run for years off a single CR-2032 battery.
@@ijabbott63 0.1g resolution is useful for making coffee (and wouldn't require any extra power, my kitchen scale has that level of resolution and also uses a coin cell)
@@ijabbott63 I use one and it’s AWESOME. Having the ability to do small measurements for precise baking, but not have to pull out a separate scale to measure 5kg of flour, is amazing.
An idea for a Pong like game to be played on it: the paddle is at the base of the tree and is an arc of say 30 degrees. It moves left and right around the circumference of the base of the tree (clockwise and counter-clockwise). The ball falls down the surface of the cone and when bounced, rises to the apex. From there, it will reflect down another surface path. The tree would need to be in a central location so that the player can run around the full 360 degrees. Difficulty can be controlled by the speed of the ball, and the angle of reflection coming off the apex!
It’s nice to see someone who shares my affinity for Christmas based exterior illumination. Great job!!! The debug made a great application for implementing a binary search :) Can find each bulb address in 9 or fewer steps.
Apparently there is an off-the-shelf version of this ("Twinkly" - check out Techmoan's review) but I console myself that it seems to only map the 2D surface of the tree. So at least my effort got me a third dimension! Albeit a low-res one.
If there is enough interest and support: I'll go bigger next year. So share this video and (if you can, no pressure) support me on Patreon. patreon.com/standupmaths
Actually Twinkly can map in 2D or 3D
Was gonna say, nice one!
I came here to just to post this.
But yes you walk around the tree and it finds them all.
I meant that there are not LEDs inside the Twinkly tree (only on the surface). My LEDs are mapped right to the trunk. LOOK LET ME HAVE THIS.
@@standupmaths heroic effect, I loved it
THIS IS INCREDIBLE
Who's this guy?
What I find amazing is that Destin, you and I are watching the same video at just about the same time from miles apart. Idk I find it amazing haha
hi destin
Next year - SmarterEveryDay vs Mark Rober vs some of the other more eccentric RUclipsrs in a contest of tree displays...
Maybe have them released like an Advent Calendar?...
Collab, please
Man, they surely taught binary trees in my CS program all wrong.
You've made my day man
You have 444 likes so I can't like it
nope they actually didn't :)
this video overcomplicated the problem with all "2d image scanning". You could have easily done it manually :D
@@alshbsh2 coughs and sputters. easily???
"I wrote some terrible code."
Who hasn't?
People who’ve never written code?
I doubt i've ever written good code.. but it still works!!
All code is terrible.
Signed: a professional.
The only clean code that anyone will ever write is:
#include
int main() {
std::cout
If it works, it is NOT terrible
"first order approximation of a Christmas tree" had me in stitches
A.K.A. a Parker tree
Techmoan just reviewed a product just like this, but it was much more restrictive and app based, and relied on a cloud service for the spacial mapping. This is much more open to possibilities, not to mention more impressive that you did it yourself from scratch!
I came to make the same comment.
But even the Techmoan product is just a turnkey version of more general stuff. There is a whole community of people using standard addressable lights and controllers, with free software for mapping them and doing displays.
Came to make the same comment.
Was about to comment about that video as well even went as far as to have the video link ready, oh well seems a shame to waste a perfectly good link so here you are,
ruclips.net/video/DYVMeyGEWes/видео.html
The Twinkly tree is crazy expensive, compared to what you can get WS2811 LEDs for on AliExpress ... Of course, not as user friendly though!
Look up ws2811 pixels. and xlights/wled
"ordered the LEDs 3 years ago", "got the controller years ago", "never got the time to get down to it" - story of my life. Glad you got it sorted out.
+1
And so often these days it is because of RUclips videos that distract 😜
Ok but seriously that snow/raindrop effect is gorgeous and completely unique to your 3D lights
gorgeous, yes. Completely unique, not exactly. It might be unique to a small homemade Christmas tree installation of 3D mapped LEDs but definitely not unique to 3D LED mapping in general.
Search RUclips for CUBATRON .
I've seen the exact effect you mentioned in person back in 2012 on the cylindrical shaped CUBATRON at the Burning Man art festival in Black Rock City, Nevada, USA.
Moral of the story: Get a bunch of smart friends from different disciplines and get them to help you on your wacky projects
smart friends are unsurprisingly effective for solving problems
i just feel like im cheating when im not smashing my head against the wall until i figure stuff out, but yeah pretty much
@@officer_baitlyn lol i agree so much, the satisfaction when figuring out something on ur own is unmatched but trying to do projects like this without those ppl helping seems futile
That is the basis of my career.
More people - more effects based on complexity of the system. Like ants or bees do a great work together, but don't know what exactly to do by their own
My aspiration is to be that smart friend.
When your only tool is a hammer, every problem looks like a nail, when you are a mathematician, every problem looks like an isomorphism...
i thought this was gonna be some motivational stuff.
When you're a Haskell/functional programmer, every problem looks like a monad...
That's what I thought when he showed how he changed the angle of the plane - shove the _tree_ through a matrix instead of the plane?
And here until he said that I was thinking how he could have made his code into a program that ran user snippets as if they were shader programs for the tree-pixels (trexles?)...
*clap*clap*clap*
@@colinframe9634 ITYM **map*map*map**
7:29 You missed the opportunity to say you needed to find their "tree d coordinates"!
Oooooooooo hahahahahaha
Here we go......!
Don't be a sap and stop needling Matt!
Right? A video about geomeTREE like this needs some good puns. I also think he maybe should've used ROOTS in the equations, but those might be more ORNAMENTal than really necessary.
I thought the way Matt conifermed which were the missing bulbs was brilliant.
I was waiting for a "binary tree" quip.
17:18 fun thought: Rotate the tree in real life and have the lights adjust such that they appear stationary lol
I’m disappointed he hasn’t done that yet
I would love to see this… if he ever makes a video like this pls let me know!
I like how Eugénie put in the work to model a Christmas tree to block out the lights on the back, I would've just stuffed a solid cone inside the lights' area
That was my 1st thought, but because the lights are at varying distances from the trunk it means the cone would either be too small and not obscure enough, or it would obscure those on the front too (or most likely both). You could go really simple and just shove a triangle in on Z = 0 that literally just blocks out everything nearer the back, would mostly work...but at this point I'm looking for the laziest solution to something that I'm too lazy to try and do in the first place ☺
@@ApothecaryTerry how about a semi transparent cone
Wha.. I just saw you in the comments of a speculatively unrelated channel(Zame), 2 minutes ago.
@@anch95 Well hi! Fancy seeing me here.. or something like that
I love the fact that you mentioned that the LED's are numbered 0 through 499 and your top three tips were 0, 1, 2. It is nice to see someone how actually knows how to count!
2:50 “The pi can put out 3 and a bit volts”
3.14... pi...
WELL PLAYED!
I think it’s probably 3.3v, but it’s fun to imagine! 😂
I want Conway's game of life in 3D on a christmas tree.
YESSS!
He needs to do this!
Yes, he could program any 3D cellular automata on the raspberry pi, would be awesome!
Please have a go at this! There was a 3D game of life problem on day 17 of the coding challenge "Advent of Code 2020".
I think the lattice would be difficult to map to the lights and difficult to interpret visually, but I could see how you could see "waves" of activity in the light emerge, flow and disappear before eventually settling to a vaguely oscillating but ultimately static display.
You're a pretty good engineer for a mathematician
I‘m imagining Gimli saying this to Legolas after the battle of Helms Deep
I can imagine everyone having something like this in 5-10 years, maybe even trees that come with lights pre-set that you only have to put the baubles on, which is the most fun and traditional part of the whole process anyway. your result looks way better than I thought it would, too. your coordinates were obviously pretty accurate. I would have liked to see you rotate a 3d model around using the lights, but I suspect the resolution would be too low to make out complex shapes anyway.
It's called Twinkly. It basically does this in 2D.
@@danielplusben there is also 3d mapping
So you want to grow them with lights on?
Hm, you could have something like this commercial by next Christmas from the technology side. The scanning could be done by phone. The lights could be connected to a Raspberry pi zero W that could either talk directly to your phone or hook up to your home WLAN. All that's missing is basically that app on the phone and probably ironing out some quirks. Should be possible to hack something like that together in a couple of months.
Artificial Christmas trees already come with lights already attached, so there’s not much left before we’re there.
500 programmable, individually addressable RGB LEDs... so, you could theoretically turn your tree into a low-res display!
I plan to test exactly how theoretical that is.
@@standupmaths How cool would it look to walk around the tree while it's displaying an image: at first it would look like a semi-random scattering of colored lights, until you get to just the right angle out front 🎄
I'd like to see that!
Pong on a Christmas tree
@@standupmaths I was thinking this, watching the video. You could grab a pi-camera, and have it display live what it sees!
All youtubers: "there is some noise that may end up in the video."
Video in reality: **absolute silence**
I don't think I could trust myself to not accidentally knock over the tree after spending hours mapping the coordinates
This would not combine well with pets or children...
just put them back in the right spot ;)
@@edwardlane1255 I can actually imagine some people trying to do that! The tree equivalent of buying a replacement hamster for kids ☺ They'll never notice...
Hi Matt, not sure if you will see this, but I wanted to tell you that I just received the "Get Well Soon" video you made thanks to my friend Zack's request and I want to thank you from the bottom of my heart. Thank you so much. It means the world to me. I am recovering and back to virtual teaching middle school math.
The trick of getting each wrong LED to blink out its number in binary was really clever!
I was thinking you could also do a binary search - light up half the lights, and press a 1 if your light is on, and 0 if it's off, and then subdivide until one light is left. 9 Button presses would identify any light on the tree. It might be easier than trying to pick out the binary sequence your single light is blinking out among the chaos of the whole tree.
When Matt explained that I thought he meant he turned on every light with 0000001 in its ID, and then every light with 00000010, then 00000100, etc. But maybe I misunderstood.
@@JBLewis I understood it that way too
@@peevester9987 This is essentially what he did. The first bit selected even/odd, then next bit selected the even/odd half of the first selection. Yes maybe the binary search could eliminate half the leds each "trial" assuming you answer the "is it on or off now" after each trial. (2 steps/bit) but in the end I suspect his mapping was the most efficient. I considered all of this then bought the twinkly strings. The family likes it. good job Matt.
@@peevester9987 Heh - that was exactly my immediate thought!
My favorite part was when he commanded the lights to identify themselves in binary.
Matt: LITTLE ONE, STATE THY NAME.
Little one (sheepishly): 0001000101
One of my favorite RUclipsrs branching into my realm! WS2811s rock!
Exactly this! My worlds just collided!
A wild Rob has appeared!
Thanks! I really should do more smart-home stuff.
@@standupmaths you can stream real-time video on your leds laying in chaotic order.
Create a pixel map from leds, take contours from image, send pixels for making a frame
Drawing with drones in the night sky (already exists)
I'm more into WS2812Bs ;)
"Bundle adjustment" is the name of the algorithm you want for localizing Christmas lights from photos. The ceres-solver library is a good place to start.
"If there's enough demand, we'll make a Christmas album"
Demand!
Yes please!
demand +=1;
I demand a christmas album!
...please.
heck yes I demand
Demand++;
Most People: "Merry Christmas!"
Matt Parker: "I wired my tree with 500 LED lights and calculated their 3D coordinates."
:D Love it!
I'm sure someone is already working on it, but if someone could make a Beat Saber map of the christmas dubstep standupmaths theme, that'd be the bee's knees
The unnecessarity of this is beyond comprehension. I love it!
Christmas nerd-ery I didn’t even know I wanted
Plz upgrade my iPad. I need this.
@@oldmech619, did Santa bring you an old one?
@@eugenecbell No, no iPad LEDIC controller program launches. Oh so so sad
@@oldmech619, lol
It's somehow the perfect way to show the Christmas spirit.
Such a simple, elegant way to map the coordinates. Love it.
Once you start thinking about it and how the maths works it stops looking so simple. I’m running thought experiments in my head as to how spinning the tree 90 degrees then using the same frames of reference will allow 3D pinpointing. He must know the exact distance between the camera and the tree’s axis, and then I’m stuck on how rotating the reference frame of the tree can improve 3D estimation. I’m so close to the answer, but rather annoyed with myself - I work with 6D pose estimation software daily - this should be easy to think about! Impressive!
"Choose which bits you want to do yourself" is great advice! Lovely to see a wonderful fun project! Happy Christmas!
I choose the bit where I tell somebody else to do it.
seriously! I've had an idea for a project I've been bashing my head against for years, and finally earlier this month i decided to handwave a step that i just don't find enjoyable and it's made it so much easier to get the rest done. made more progress in two weeks than the past three years
I don’t think I saw this in the other comments, but I had half an idea on speeding up the mapping using a bit of physical geometry.
Presumably the lights on the strands have a uniform and finite length to the wires connecting them. Also, as you mentioned, the light address numbers are sequential along the strand. So if you don’t get a good reading from one address but know the coordinates for the one next to it, you at least have a maximum distance that the missing light can be away from the know coordinate. You can use the radius/sphere to create a “rough” cluster of coordinates that you can use to test /identify the position of the unknown.
Since a good chunk of the sphere extending from the known light to the unknown light should be visible from the previous position, since the known light was visible, you can further narrow down positions.
Also, you are only mapping 1 light per photo for coordinates. I suspect you could at least light up 3 points at once, if you command one lamp to pure red, one to pure blue, and the third to pure green, and mapped the brightest color value of each color as its own point, assuming it isn’t too bright to mess up the tracking. Should reduce your scan time to a third of what it currently is. Of course your comment on the twinkly brand lights does merit some discussion in that they seem to fairly rapidly map the tree using a video of the lights flashing colors similar to what I describe, so this seems to be a good avenue to explore.
Also, photogrammetry may be an area to investigate as well. Maybe if you can take a few dozen very rapid sequential photos with the lights strobing synced to the camera, and then simply move the camera a few inches rather than spinning the tree, the small angular change would be enough to work out half the tree at once, and then you simply have to scan each side twice. The matrix math used to render a rotating 3D model plays into this, but in the opposite way to how you were doing it in your video to generate your effects.
He's used at least one of these ideas in this year's tree. 🌲
Next year, Matt's tree gets a higher resolution and the video ends by showing his face in the tree.
It should read in the excel spreadsheet he does in his standup
Given the colour gradients I was wondering if low-res pics was where this was going to end. Alternatively, I wonder about reading in shape files for 3D printing (very simple obviously) and rotating those.
The binary debugging method that you used can also be used to speed up your initial scanning. You need 9 bits for 500 LEDs, so if you take 10 pictures - One with them all on and then one for each bit, you then have the over-all positions of every LED and each bit in sequence. You can further speed this up by using different colours to scan multiple bits at once. This is a similar mechanism to how the Oculus Rift calculates it position with IR cameras and IR LEDs.
I'm going to have to try this myself now, thanks for giving me yet another project!
Pls update
Gonna try this on some Christmas trees
Started on tree 1
Won't stop until TREE(3)
Ayyyy captures captures!
i stopped at TREE(0)
@@toniokettner4821 like a normal person. Start at the first one and stop at the first one. Why you would start at tree(1) I have no idea and most people don't do 3 either.
@@oliverdowning1543 he didn’t start on TREE(1), he started on tree 1 like a sensible person (assuming he’s using 1-indexed ordinals)
@@SpencerTwiddy it was a joke. A very merry one but it was meant as a joke. Sorry if that wasn't clear
I'm waiting for the "tree on fire" effect to show up...
Finding the address of the light with binary was so clever. I love when something in real life has a nice solution that feels like the solution to a math puzzle.
That solution using binary to find the number of the incorrectly placed lights seems like such a classically Matt way of doing it - I love it!
The first stage was pretty similar to a flash test of a theatrical lighting rig. Fire up each address sequentially, note which fixture turns on, then tell the console what channel you want to use that address for. This makes it much more portable, someone can design pretty much a whole show offline and just bring the console file and a patch list. They can make their design with arbitrary channel assignments, and when they get to the theatre they can simply patch their channels to the addresses of the fixtures as they are hung.
So if you make an effect using channel 1 for the top most light, then increment channels in a clockwise spiral with channel 500 at the very bottom you can code effects pretty easily, and then any time you want to run that effect on any system, if you re-hang the lights or next year plug them in in a different order or whatever. You just use the flash test to figure out where each light is then you just configure your channels to the appropriate addresses and any effect should work just fine even with the lights plugged in in an arbitrary manner.
Also you might want to look into the EOS software for theatrical lighting, it might simplify some of your operations, as these LEDs are... probably using DMX, or something that DMX signals could probably be converted into by a r-Pi with relative ease.
I was going to suggest the Chamsys software, has a built in media server and pixel mapping and a couple of universes of dmx for free.
There is free open source software that can accomplish this in 2D space. I actually do something similar, and while I don’t map the tree to a custom model I use a raspberry pi and Falcon Pi Player software to run the outputs to my LEDs. I then sequence my lights to an approximate spiral tree model in xLights. It makes sequencing and timing to music easy and it supports lot of controllers and outputs.
xLights does use a program that can map a model in a 2D plane so the extra dimension here is impressive, but you can get cool effect if you do it right with xLights.
Wow, this is brilliant, mind-blowing, I especially love the image-based position detection. A technical hurdle to take first, but then you can unleash your creativity in the patterns.
"If you send me code I will run it on the tree" - - Is oddly not that weird in 2020.
The future is finally here
I for one, am very excited to see more IOTree devices in the future.
If you hack this code the result will be out of the tree
Cyberpunk 2020
So, you scanned it in "TREE-D"?
..... I'll show myself out..... :/
This is gold
@Danny Dolan because youtube is like high school and it knows that I'm not popular. lol
Dude! That's awesome! 500 LEDs AND their 3-D coordinates???? At my age I just light 3 candles and I'm damned lucky if I can even find the matches.
next to the tree? do you have insurance?
@@1224chrisng lol! no, in my later years I no longer really decorate for Christmas, so no tree to worry about.
17:16 I hear that quaternions are useful for rotations in 3D so you have no worries about the order.
I love how Matt just casually 0-indexes his lists. No big deal, just how he does it.
And “it’s just how he does it” is a very good reason, because the worst thing you could do is switch between 1-indexing and 0-indexing at random between projects.
If zero is good enough for railway platform numbering it should be good enough for Matt. However, it means nothing to me!
I mean, it's what your supposed to do.
I can't say how much intriguing and inspirational this video is. It is clear how much you enjoy solving problems.
10:50 Importing inside a function call?! Academic folks can be rather peculiar.
It's sometimes used for optional dependencies, in this case it doesn't make much sense though
Based on the Houdini code - they called that function exactly once. Basically a backwards way of defining a constructor... not great practice, but won’t hurt efficiency. Don’t take notes, kids.
In some cases in Python it does make sense. For example some optional function that needs some heavy import, that would not make sense to load always. But in this case i cannot see any reason for that.
A lot of the things inside the function can be moved outside just fine. It is nice to have it all bunched together though. In reality the function call is unnecessary in and of itself given it is the main body of the code. It's really just there as a stylistic thing so putting the imports in there too is fine. Though I will admit I haven't seen it done before.
@@iykury It works. You can even catch the import error and import something else instead. You'll know it when you need it, this is not something you generally want to do.
Ok, this Standup Maths theme album needs to become a real thing now! These have been getting unreal, and this is no exception! Merry remiXmas!
This was so awesome that I was only slightly disappointed that it didn't result in a conic sections lesson on Matt's Christmas tree.
Coniferic sections.
My favourite video thus far as it shows math and computer science having a tangible effect in the real world.
I'll risk a hypothesis it is absolutely the best video I watched in 2020. simply spectacular.
I saw a commercial implementation of this last week at the Indianapolis Zoo. There was a large tree, about 20-25' tall with thousands of RGB LEDs on it. In addition to colorful patterns, the lights were dense enough to display images such as falling snowflakes and gifts, and it even had an animated deer that would gallop around the perimeter. I immediately thought of this video of yours. I have a goal of some day wiring up my tree similarly. I have the parts, just need the time to do it.
That intro tho! Wow...just wow.
The standard of the videos are clearly getting better and better! Love it.
Yea....ikr.
The plane bisecting the tree looks like how you generate conic sections!
I've never bought a christmas tree before. You have now got me seriously tempted. Maybe for next year.
In 2016 I made programmed LEDs on my tree to respond to music and I have been using the same setup for 4 years now it never gets boring.
The differences between the Queen's English and our American English never fail to surprise me. Here in the states I learned it as y=mx+b not y=mx+c
Side note, we need a cool moniker for American English. "The President's English" just doesn't have the same style as The Queen's
I thought POTUS is also called Commander-in-Chief? So maybe Commander's English? I'm not a US citizen tho so correct me if I'm wrong
Especially given the quality of the English spoken by two of the last three American Presidents.
I am german it's y=mx+b here asswell, so it's definitely not an American thing. I although don't think it's a British thing but rather a Matt Parker thing, could be wrong about that.
Here in the UK we call Queen's English "English" and American English "wrong" ☺
...sorry it's just too easy!
Edit: P.S. Merry Christmas, since it's past midnight here.
Dude, I never thought for one moment you were stupid. In fact I thought of you as more intelligent than most.
But running the binary sequence to get the light's coordinate... That is next level genius! *Respect!*
howard carter does amazing jobs remixing the theme every time haha
Man, your enthusiasm is so infectious, an enthusiasm super-spreader if you will.
Yes, there is enough demand for a christmas album
I dont understand all of it and how you do it, but so much fun to watch you explaining and seing how much passion and satisfaction you you have for it
You totally missed a tree d pun opportunity
and the christmaths
This brilliant. The programming, the "Christmas tree light" sophistication, the thought process. Love it.
My lights are 50 years old, yellowy-white and blink on and off every couple of seconds.
Had this exact idea this year for decorating a house. I'm very excited to see it executed!!
Definitely worth doing it! Give me a shout if you get stuck.
That's a lot of lights
I’ve always thought your theme tune is absolutely bangin.
This is the most Matt Parker Christmas tree I could imagine. Also there's a company called Twinkly that makes this product and you can set it up from your smartphone. It's not nearly as cool as wiring and coding it yourself though.
a more parker christmas tree would have almost, but not quite, have worked as intended
perhaps a tripped breaker or a small but festive fire hazard
@@evilotto9200 and have it calculate π using the coordinates
As an engineering undergrad many years ago, I bought the Dover book on Vector and Tensor Analysis with Applications. Looks like Matt has come up with a new application!
As an aerospace engineering student, I got quite excited when I realized you were going to be using some good ol' Euler angles
I was much more in the "terrified about order and gimbal lock" camp, with some hope for quaternions.
That “photogrammetry” method is brilliant!
That's some good geometree!
Loved this! I used the same rotational matrices to create a 3d graph program on my TI calculator for a Linear Algebra project in the late 90's
As a software developer in test, my reaction was that you could locate bad light locations and fix them by calculating the distance between adjacent bulbs. If it is higher than a reasonable threshold based on how much wire is between the bulbs, you could relax the location to put less stress on that part of the network.
if you know the location of the next and previous LED, you could also use some approximation to calculate where the LED in between would be. Something like this should make the scanning a lot more robust.
It's basically an interpolation problem, so there are probably many solvers availiable in common libraries.
@@sebastianjost FYI, when I said "relax the location to put less stress on that part of the network", I was proposing using a generalization of what you are describing.
@@richdobbs6595 nice to know ^^
I wasn't sure what that part was supposed to mean.
Thanks 😊
@@sebastianjost Look up "relaxation in numerical calculation" in your favorite search engine.
This is the best thing to ever come out of RUclips recommendations.
You scanned the Christmas tree in three dimensions? You really missed a chance to scan in a fourth dimension
Technically he did. The fourth dimension in this case would be time. He just didn't actually have it log it.
What would he do in the 4th dimension tho?
@@sergey1519 Well, without the 4th dimension you don't actually have control of the lights. Bc, u no, u can't light up the lights in sequence.if there's no time.to define such sequence
Every time I realise the number of dimensions I have to add another.
@@ashtonhoward5582 Each of the R, G, B also sort of add their own dimension so the whole tree is 7D.
Seems like a very elaborate way to be able to write off your Christmas tree as a business expense!
Past Matt created the Parker Square of Christmas lights
Great! The math approach is my favourite. Next class: mix your formula into a FFT of live music and use 2000+ LEDs
Matt, you are a treasure. Merry Christmas!
That's a really good example of how hardware problems causes software headache. If I were you I would concentrate more on a hardware: mainly I would place the LEDs zigzag from the bottom to the top only on the facing surface of the tree and count the number of LEDs in each "layer". And all the problems you had would disappear. But for sure I'm in love with the solution you made because it's the first idea came up to my head when you asked how would you find out coordinates of each led. I'm a little bit jealous of those people who could realize their ideas in codes, because as an engineer I have a lot of ideas about automatisation of many annoying and time consuming processes, but I'm not able to do it... I had some experience with Arduino and rpi, but it was for me so annoying... The main reason that most of the examples that are on the internet doesn't work even if you copy paste them, because all the libraries update really frequently and the commands are replaced with another ones and parameters in the brackets also change. My dream of programming for now is to have some visual interface when you drawing a program scheme with blocks but not with some.stupid.words.(with brackets, dots, and, etc) because this language is not absolutely clear as for human who explains his logics in logical block scheme as for a machine who understands only high and low. As for me it's not absolutely clear why no one have already done it... Programming for now looks for me like as if you wanted to print a document from ms word and you have to send not a document to the printer but a hand.writing.code.with(coordinates X, Y, dot color, amount of paint to be extruded, speed of the extrusion, and etc) for each dot on the A4 paper sheet. And also in my dream program should be 2 windows: first with logical blocks connected with arrows, and second with interactive hardware blocks (like sensors, buttons, screens, motors and etc) connected with virtual wires to the specified by person pins on rpi or Arduino or any other controller, and after you've done the wiring and the code you'll be able to check the simulation by pressing buttons, making some virtual influence on sensors and etc. As for logical blocks I imagine that it shouldn't be the same as in line by line codes separate words (like print.ln(), digital.write()), but some more complex pieces of code. All this blocks should be separated in three groups: input, processing, output. In input there'll be some things like read sensor parameters, check buttons state and etc. As for processing there'll be some basic math operations, logical operations (if, else, or, and etc), on/off regulator, PID regulator and something else. As for output some commands like move motor or servo on specified angle, show information on the screen, beep, save a CSV file and etc. Also if the programming is going to be about some visual interface and menus you'll be able to draw it as simple as it realized by MIT app Inventor...
If you had three of those, you could animate The Tower of Hanoi. Just saying.
great idea!
but who has three cristmas trees?
maybe you could do something similar with scratch posts for cats.
BEST IDEA
The weird thing is that if you look at the lower level code which controls the lights, you can see that it doesn't REALLY address and individual LED. It puts your demand on the first LED and then clocks it along the wire imperceptibly quickly. To the coder, it looks like individual LEDs can be tweaked, but in reality, each time we change and LED, we're actually "refreshing" the whole string. I love this project. Some day I'll get around to it. I want to display scrolly messages on my Christmas tree.
Someone needs to support on patreon using a name that has all the letters of the alphabet, so they can re-edit the video to make the tree say rude things XD
EDIT: Yes, I've seen Matt's twitter post. I thought it was funny too
Sounds like you need to sign up with the last name of, "The quick brown foxed jumped over the lazy dog"
With hyphens of course.
@@mattsmelser But then you don't get an S
@@hayashi-stl16 "The quick brown foxed jumped over the lazy dogs"
and a cocknballs program!
@@shedactivist "the quick brown fox jumps over the lazy dog"
12:07 "So I've just built this very simplified version of a Christmas tree..."
and up pops a really complex looking 3-D model of Christmas tree...
I was expecting to see just a cone or a cylinder...
I just told my dad 4 hours ago people have Christmas Lights like this
To find the index of an led you could turn the first 250 on and the rest off, then hit a key to say it was on or off. Now the program knew which half it was in, it could turn half of the new selection on and half of and allow it to narrow down on the location without you doing the binary yourself.
But forget binary, use base 8 (off, red, green, blue, cyan, magenta, yellow, white) and you can find any ID with 3 answers.
21:26 "...it's not great, kinda works..." that seems oddly familiar on this channel. XD
Merry Christmas to all of you.
The infamous Parker Square?
Being math person really helps with such things. I never thought about this until I heard map 3d coordinates. Then instantly knew how to do it.
More like tree-D coordinates, amirite? -insert Hades GIF here-
Lol. How did you get that strike through? It looks pretty cool.
@@shreddedtwopack6625 Completely by accident. I put a hyphen either side of the sentence.
9,9 M views on second channel, 639k on main, youtube algo is really amazing
just wait until someone programs a Parker square for the Christmas three...
This is the reason I subscribed to this channel all those years ago. Love his commitment to maths in day to day stuff
Matt P - "Help I've just got my Christmas tree into gimbal lock"
- why did you not see this coming and choose to use quarternions?
Was about to say exactly the same ;-)
Gimbal lock is a problem with Euler angles, not DCM's or quarternions which have no hierarchy of axes.
That's an audiovisual masterpiece that last one
It kind of reminds me of the sherlock theme.
We're just going to gloss over the fact that your kitchen scale need multiple amps at 6v...?
Just because the power supply can deliver multiple amps doesn’t mean the scale draws that much - my guess is they have a generic adapter as the “optional” piece Matt mentioned that they provide for all of their 6V compatible scales. (Edit: 6v not 12v) Especially as it can run off 2xAA batteries: www.scalesworld.co.uk/bench-scales/1770-sf-400d-electronic-compact-scale.html
Maybe it has the ability to charge batteries?
Those scales are rather precise for kitchen scales. How many recipes call for units of 0.01g or 0.1g? My far cheaper kitchen scales can only manage 1g precision, but they do run for years off a single CR-2032 battery.
@@ijabbott63 0.1g resolution is useful for making coffee (and wouldn't require any extra power, my kitchen scale has that level of resolution and also uses a coin cell)
@@ijabbott63 I use one and it’s AWESOME. Having the ability to do small measurements for precise baking, but not have to pull out a separate scale to measure 5kg of flour, is amazing.
An idea for a Pong like game to be played on it: the paddle is at the base of the tree and is an arc of say 30 degrees. It moves left and right around the circumference of the base of the tree (clockwise and counter-clockwise). The ball falls down the surface of the cone and when bounced, rises to the apex. From there, it will reflect down another surface path. The tree would need to be in a central location so that the player can run around the full 360 degrees. Difficulty can be controlled by the speed of the ball, and the angle of reflection coming off the apex!
This is simultaneously the coolest and nerdiest video
It’s nice to see someone who shares my affinity for Christmas based exterior illumination. Great job!!! The debug made a great application for implementing a binary search :) Can find each bulb address in 9 or fewer steps.