LEDs and the EM Spectrum – Year 9
/0 Comments/in Year 9 Physics Physics Year 9, Secondary/by Jonathan
Worksheet: Light Emitting Diodes and the Electromagnetic Spectrum (Year 9)
We often explore the electromagnetic spectrum in the context of, for example, astronomy. Here’s an example and set of questions for a healthcare-related case, using ideas from County Durham company Polyphotonix.
This worksheet builds on students’ knowledge of LEDs and the EM spectrum.
Download
Tag Archive for: LED
Internet of Trees
/0 Comments/in Advanced/by JonathanThe Internet of Trees
Building a tweetable, colour-changing Christmas tree
The phrase “Internet of Things” gets thrown around rather a lot at the moment. It’s the idea that – in the very near future – it’ll be standard practice for physical objects to be network-connected. Everything from toasters to fridges to medical devices to… er… Christmas trees.
Yes, at Think Physics we thought we’d join the trend (and also help with reforestation of the Internet) by hooking our festive office foliage up to a Twitter account, so anyone anywhere in the world could change the colour it glowed. Not so much an ‘Internet of Things’ as an ‘Internet of Trees.’ Yes? No? Mildly amusing? Just a little bit? Just us? Drat.
Here’s the story, anyway:
Step 1: Make a Tree
We could, I suppose, have bought a tree. But nooooo, that would have been far too obvious. Instead, we followed these marvellous instructions from the Makedo folks. Makedo is the cardboard rapid-fixing system we featured in our Christmas gift guide.
Our plan was to illuminate the inside of the tree, which meant we had to hack holes in the thing to let the light out. If we’d planned ahead a little more (so… “at all” would have been a start) we might have noticed one of the comments on the Makedo tree Instructables page which shows a lovely tree made from coroplast translucent plastic sheet. Bothers. That would have been a really good idea. As it was, we decided to cut festive-themed shapes, which went OK until one of us insisted any snowflake patterns have the correct symmetry.
That took a while.
The Think Physics tree team busily at work
A tiny James inside a cut-out snowman. Or maybe there’s some perspective effect going on here?
Emma plans an incredibly intricate snowflake
Emma and Annie carving snowflakes and stars
Step 2: Twitter Bot
Our code is on GitHub so you can view, reuse or amend it as you wish. It’s probably not a great example of high-quality Python, to be honest – this was the first time I’ve used Python in anger. And I do mean ‘anger,’ at times. Much to learn, I have.
The hardest bit to wrap your head around is probably the Twitter authentication stuff. Or at least, that’s the bit I least understand myself. I’ve somehow ended up authenticating two almost-identical applications with Twitter, one registered to my own twitter username, and one to @thinkphysicsne. That probably wasn’t what I meant to do.
There are all sorts of gnarly problems trying to connect bits of physical computing to internet services. Hanging devices off our university network is merely the first challenge. However, after a little poking around I found some Python sample code which did most of what I needed. Adopting the first rule of programming:
Write less code.
…I hauled out one of our Raspberry Pis and got to work.
Hour 1: Wifi! Try to get the Pi on the university WiFi network.
Result: failure.
Result (final): Connected the Pi to the university’s guest network, which is a bit flaky but hey, it’s a tree. Reliability means ‘not dropping needles everywhere.’
Hour 2: Blinky lights! We already had a Pimoroni Unicorn HAT, which is an 8×8 array of RGB LEDs. I spent an hour playing with that, and preparing some colour conversion functions.
Result: Success! Except I was now suffering huge after-images from looking too directly at the stupidly bright lights.
Hour 3: Twitter! I used an off-the-shelf Python twitter library, the examples for which already did most of what I needed.
Result: Success! Incoming tweet selection, etc.
Hour 4: Glue! Plugging all the bits of code together so they worked more-or-less in concert, and as expected. Involved working out how to extract things like hex colour codes from Twitter text.
Result: Abject failure! Nothing worked, everything that used to work was broken, I had no idea what any of the error messages mean.
Hours 5 & 6: Debugging! I spent a chunk of time googling and reading StackExchange, trying to figure out how Python does things. Things like: allow me to pass a number into a function, when what I have initially is a list of lists.
Result: Success! A working bot which sets the panel of LEDs to a colour determined from incoming tweets. Hurray!
Hours 7 & 8: Publish! Cleaning up the code, commenting it, and posting it to GitHub so other people can use it. Inevitably, I broke it really badly in the middle of all this, but in the process of fixing it I managed to clear out a few nasty bugs I’d backed myself into. The result is much more reliable than it was initially.
Result: Success! My first Python code in Github. I’m so proud, even if the code is fairly horrid.
Step 3: Pulling it all Together
Insert Pi in tree. Take to party:
Tree in Think Lab

Tree at the faculty Christmas party

Step 4: How to Use the Tree
OK, so we have a tree which changes colour. Here’s how you can operate it:
Firstly, check our Twitter stream to see if it’s currently plugged in and turned on. We’ll post when it’s working. If it is, send us a tweet (@thinkphysicsne) with one of two things:
- A hex colour code. This is a six-digit hexadecimal code which is really weird to wrap your head around, but nevertheless the way the Web does colour. #FF0000 is pure red, #00FF00 pure green, #00FFFF a bright cyan blue. Try a tool like Adobe’s Color to explore colours and find their hex codes. Don’t forget to include the ‘#’ in your tweet right before the code.
- A colour temperature in Kelvin. 1000K is very red, 6300K is more-or-less pure white, and 15000K is a bright blue.
Send the tweet, and if it’s online the tree will turn the colour you specify.
Of course, you’ll have to take our word for it, at least until we manage to integrate a webcam into the system so the tree replies with selfies.
Kelvin Colour Temperatures
We’re used to equating colours to temperatures in false-colour thermal images like this. We’re less familiar with thinking about the colour of light given off by objects at specific temperatures, which is what black body radiation spectra are all about.
The sun is usually represented like this – as an orange ball. We see it looking yellow/orange, but we’re always looking through the Earth’s atmosphere, which scatters a load of blue light out sideways.
So what colour is the sun? Yellow? White? Slightly pink?
There’s more physics involved in this tree than you might expect. But hey, did you not notice the name of the project? Did you seriously think our boss let us play with this stuff without it having any relevance to our work? Pfshaw!
If you take a lump of something – like a chunk of iron, maybe, or a big ball of gas like, er, a star – and heat it up, it radiates light. Physicists talk about ‘black body radiation’, which is the distribution of wavelengths – colours – emitted by the theoretically perfect chunk of stuff. It turns out, quite a lot of things (lumps of ion, balls of gas we like to call ‘stars’) fit quite closely to the ideal black body radiation emission spectrum, and we end up using that theoretical basis to describe shades of white.
Ah. I mentioned ‘shades of white’, didn’t I? Well, yes. OK, back up a bit: you know sometimes you take a photograph indoors, and everything looks yellow? Or you take a photograph outdoors and everything looks blue? That’s because your camera has guessed a colour temperature – a colour for ‘white’ – which is way off. It’s assumed the scene is being lit by an ideal black body which is glowing as if heated to a temperature that doesn’t match the light in the room. Your camera has to pick something to represent white, and every so often it simply guesses wrong.
Colour, it turns out, is as much about your perception as it is about the world itself. Your eye and brain are ridiculously good at guessing what colour is neutral – white – at any given, and they interpret other colours by referring to that. This works really well for us, unless we’re trying to decide if a dress is blue or white.
OK, back to ideal black body radiators: by convention, black body colours are described by the temperature of the chunk of stuff, expressed in scientists’ favourite temperature unit, Kelvin. One Kelvin is the same change as one degree Celsius, but with Kelvin you start counting from 0K = -273.15°C. You can’t have negative Kelvin, but that’s another story for another day. For now, roll with it.

The output from our black body radiation function. Temperature along the x axis (Kelvin). Ignore the y axis, it’s just a colour.
Heat a lump of stuff to a mere 1500K (~1225°C) and it’ll glow a nice warming red. Heat it more, to about 6300K (6026°C) and it looks white, in most circumstances. Heat it way way more, to 12000K (11726°C) and it’ll blaze with an icy-looking blue-white heat. So here’s the really weird part: we call the redder-looking colours ‘warm’ and the more blue colours ‘cold,’ when the temperatures which generate them are completely the opposite. ‘Red hot’ is cooler than ‘white hot’ which turns out to be cooler in turn than ‘blue hot.’
In practice, not all that many things stick too closely to the ‘ideal black body’ colour temperature curves. Lumps of iron are pretty close, at least until they start to boil at around 3000K. But boil a big enough lump of iron, wrap it in rather a lot of hydrogen, and you’ve got yourself a star – and it turns out many stars are a reasonable fit to the colour profile above.
Our tree, then, can approximate the colour of a range of stars. Tweet it the surface temperature of a star, and it’ll come pretty close to glowing that colour. So tweet it 5280K, the surface temperature of our Sun, and it glows…
…ah, but then you have to know what colour the Sun is.
Merry Christmas all!

Newsletter
Legal Policies & Notices
Get Involved
Cookie and Privacy Settings
We may request cookies to be set on your device. We use cookies to let us know when you visit our websites, how you interact with us, to enrich your user experience, and to customize your relationship with our website.
Click on the different category headings to find out more. You can also change some of your preferences. Note that blocking some types of cookies may impact your experience on our websites and the services we are able to offer.
These cookies are strictly necessary to provide you with services available through our website and to use some of its features.
Because these cookies are strictly necessary to deliver the website, refusing them will have impact how our site functions. You always can block or delete cookies by changing your browser settings and force blocking all cookies on this website. But this will always prompt you to accept/refuse cookies when revisiting our site.
We fully respect if you want to refuse cookies but to avoid asking you again and again kindly allow us to store a cookie for that. You are free to opt out any time or opt in for other cookies to get a better experience. If you refuse cookies we will remove all set cookies in our domain.
We provide you with a list of stored cookies on your computer in our domain so you can check what we stored. Due to security reasons we are not able to show or modify cookies from other domains. You can check these in your browser security settings.
These cookies collect information that is used either in aggregate form to help us understand how our website is being used or how effective our marketing campaigns are, or to help us customize our website and application for you in order to enhance your experience.
If you do not want that we track your visit to our site you can disable tracking in your browser here:
We also use different external services like Google Webfonts, Google Maps, and external Video providers. Since these providers may collect personal data like your IP address we allow you to block them here. Please be aware that this might heavily reduce the functionality and appearance of our site. Changes will take effect once you reload the page.
Google Webfont Settings:
Google Map Settings:
Google reCaptcha Settings:
Vimeo and Youtube video embeds:
The following cookies are also needed - You can choose if you want to allow them:
You can read about our cookies and privacy settings in detail on our Privacy Policy Page.
Privacy Notice and Cookies 2019