Coding Color

One afternoon, Dimi and I decided to mess with some red, green, and blue LEDs. The three lights were on a chip which was located in the corner of one of those forest green circuit boards you see when you take apart an old DVD player or computer. So the lights were stuck there on the board; they received a voltage and a current that we could not easily change and therefore we had no control over how brightly each LED shone. But we could turn each LED on and off really quickly, like a strobe light in a haunted house, or blinking multicolored Christmas lights, but faster. I wanted to make my favorite color, purple. But how to make purple light with red, green, and blue? First, a bit of Color 101.

The lights in our TV’s, projectors, computer screens, and LED’s don’t follow the same color system as the one you learned in grade school art class.When kids play with finger painting, they learn that there are three primary colors: red, blue, and yellow.  Any combination of those three can produce whatever color you can imagine. If the messy kid next to you decides to go HAM and mix all of the colors, suddenly they are left with brown or black.

But, if you’re working with light, it’s the complete opposite: mix all of the colors together and – as anyone who’s ever played with a kaleidoscope or prism or seen Pink Floyd’s Dark Side of the Moon album cover, you know this one – you get white.

image

With light, the primary colors we use are red, green, and blue – this is why whenever you turn on a projector that funky screen appears with RGB at the bottom. (Random sidenote: RGB is also my initials and I truly believed the CIA was trying to send me messages through the projector – but you know it’s cool it’s this color thing too). Fancy color people call the finger painting system ‘subtractive’ and the light system ‘additive’ when they describe the two color systems, as seen side-by-side in the images below.

image

Like an impressionist painting, millions of these tiny red, green, and blue dots combine on your computer screen to allow you to read these words or watch your favorite movie. (You may even be able to take a magnifying glass to your screen and see it yourself).

image

Back to Dimi’s and my experiment with purple light. We knew combining red and blue make purple. And, since we couldn’t control the brightness or where the LED’s shone their light, we decided to control how long each light was turned on. By quickly switching between the red light being on and the blue light being on, the average could become purple. We did this by sending a square signal to tell the switch when to turn on and off, as seen in the picture below.

image

This is the square signal turning the red LED on and off. The time in between the two red lines represent the period of the square signal – the pattern within the two red lines will repeat over and over again until we tell it to do something else. So if we want red and blue to be on an equal amount of time, we tell the red light to stay on for half of the period time and then turn off for the other half of the period time. The period time can be really small – on the order of microseconds – which means your eye sees the two lights rapidly flickering. When we implemented this and looked at the LED’s directly, they were too bright and you could still see two individual lights – and that wouldn’t work. So we put a piece of paper over the two separate lights to act like a filter/surface for the lights to converge onto, and behold! Purple!

image

But what about orange? In our new RGB system, orange is a combination of red and green. But this time, we needed to combine different levels of red and green light. When we made purple before, we could turn the red light on for half of the time and then turn the blue light on for the other half of the time. But for orange, we needed approximately 80% of the light to be red and 20% to be green – so we told the switches to spend more time keeping the red light on and less time keeping the green light on. (This makes our square signal look more like a rectangle, but for some reason we still call it a square signal.) The signal shown below shows the green LED: the period in between the two red lines shows the green LED is on for a small percentage of the period and off for the rest of it. The signal for the red LED would be exactly the opposite.

image

The piece of paper helps to combine the two lights and shows orange on its surface (the picture turned out more yellow, but you get the point.)

image

Changing that square signal allows us to change what color light we see, right? Congratulations, you now understand Pulse Width Modulation (PWM). In electronics, instead of controlling what shade of color we see on a piece of paper, we use PWM to control other things like voltage. Instead of a piece of paper, we use inductors and capacitors to average things out. Our lightswitch turning each LED on and off is called a transistor. PWM is simply a square signal that turns the transistor on and off – like your finger turning on and off a light switch. Instead of your brain controlling your finger, we use programming to control what the square signal looks like. The square wave is a voltage wave, and thus we can look at the image on an oscilloscope (the fancy machine with all the knobs that showed us the square signals earlier).

image

In truth, color has nothing to do with my research this summer. Dimi and I were just messing around with some indicator lights one afternoon. But Pulse Width Modulation does. My work this summer surrounded building a converter: a device that converts the three-phase alternating current a motor produces to the direct current our laptops and cell phones consume. We use PWM to help accomplish this. See future posts for more on converters!

So…I went to Stonehenge. On the Summer Solstice. (meep)

June 20th – 21st, 2014

Stonehenge immediately solicits opinions from people: a pile of rock, the epicenter of ancient spirituality, a tourist trap, or a mystery (who the fuck builds a Stonehenge?). On most days of the year, I would have to agree with the tourist trap sentiment. It’s expensive, impossible to reach by public transport, and unable to be touched. BUT, on this, the solstice, entry was free, 10-pound round-trip buses took us easily from/back to the Salisbury train station, and we could sleep, eat, pray, dance, drum circle (yes, that is now a verb), face-paint, and laugh amongst the stones.

On the way from London to Salisbury I was so excited to finally be on a British train. I felt like I should channel my inner JK Rowling so I pretended to write for a while on the table Nadia and I had grabbed all to ourselves. Salisbury itself turned out to be more interesting than we had thought. There was a scary moment on the way there when the train stopped completely and we were surrounded by expansive pastures on one side and dilapidated back yards on the other. Suddenly the definition of “small town” and the “middle of nowhere” took on scary new meanings – luckily the train did lurch forward and brought us to a proper train station.

Nadia and I were immediately taken by the narrow cobblestone streets that abutted modern roads and winding paths that led over bridges and through parks into the heart of Salisbury. We stopped in at the Old Ale House for what I described as “our last meal” before Stonehenge. The place was empty save for a handful of locals getting a pint and a very large St Bernard; light streamed in from the windows we sat next to, but the rest of the pub was as dark as the wood it was made of. After lunch we trekked to the Cathedral of Salisbury. We wandered around an outer atrium with signs boasting of an original magna carta hiding behind now locked doors. In the sanctuary we sat in silence as the choir’s voices filled the cathedral for the end of the evening service. The church’s architecture forced your eyes upward in awe. During our walk back to the train station, I tried to tell Nadia whatever I could remember on Martin Luther, Henry VIII’s divorce(s), and the creation of the Anglican church.

image

At 6:30 a long cue had already formed for the solstice bus to Stonehenge. We bought our ticket and tried to guess whether we could make it onto the first bright-red double-decker bus. Happily, Nadia ran into Lydia, a girl she had befriended at a hostel in London earlier in the week. The twenty minute bus ride turned into an hour with traffic as cars and more buses piled onto the two lane road; the wait gave Nadia and Lydia time to catch up and me time to get to know the Dutch-getting-a-masters-in-anthropology-girl sitting beside me.

image

We walked through a mile of fields from the bus into the festival. Beat-up cars, Volkswagen buses, and trucks with people piled into the bed all parked in droves on the grass like at a county fair. We passed drug check points, bag checks, food trucks, concert platforms, and rows of port-a-poties before we finally had the henge in our sights. The sun set behind us over fields as far as the eye could see. On our way there, guards stood by a generator hooked up to one of the many spotlights that would keep everything well lit throughout the night. Nadia immediately pointed and exclaimed that the generator had the words “Power Electronics” on the side (later I think I actually realized it said Power Electrics but whatever). The reason I am here for the summer is for power electronics research; that funding is paying for this entire trip. Excitedly, I went up to the officers and asked if I could have a picture. “With this?” they asked, bewildered. “Sure.” I jumped in and posed, reveling in the dorkiness. Nearby, people with capes and staffs, flowers in their hair, tattoos covering their arms, dreadlocked hair, and outlandish costumes created just for this occasion – all laughed at how ridiculous I looked. Nadia, Lydia, and I laughed hysterically as we continued walking. A tall, dark-haired guy, who had previously been hiding behind his Nikon lens, walked beside us and asked “so, why did you take that picture?” And thus Jon joined our trio and we became a band of four.

image

image

Reaching Stonehenge was both amazing and completely ordinary. It felt natural to be amongst the stones; it was only when you put everything into a sentence that it became spectacular and surreal. “I’m touching Stonehenge” “I’m walking in between the rocks of Stonehenge” “I’m getting my face painted in the shadow of Stonehenge” “I’m sipping chocolate liquer, eating twix, and walking around Stonehenge” “I’m praying with the druids at Stonehenge” “It’s really cold and 3am at Stonehenge” “I’m waiting with thousands of people for the sunrise at Stonehenge” “My hair is caught in Stonehenge.” Stonehenge made the ordinary, extraordinary.

image

Somehow Lydia and Nadia started talking to this Welsh girl who introduced us to her Hungarian boyfriend who introduced us to a French dude, a German dude, and lots of Spanish-speaking people that mostly kept to themselves. And thus we had our base camp of food, tarp, face-painting, plenty of people coming and going, and several eyes keeping a watch on your stuff. One of the guys was an electrical engineer so we geeked out for a second. I struggled to interpret everyone’s amazing English through thick accents as we went through every introductory topic of nomadic young people: stories of where you have been and plans for where you’re headed.

image

The druids floated around the entire venue, greeting one another like family at a reunion and silently watching over the rest of us. But they weren’t enforcers – that duty was definitely left to the understaffed security guards who struggled to push through crowds of people to control little fires of unrest. When a drunken attention-getter climbed to the top of one of the pillars, the druids I saw mostly took pictures and laughed while the security guards surrounded the stone perplexed as to how they might get him down. For such a large group of people, the event was largely peaceful – most offenses were from fireworks, alcohol, drugs, or strained nerves from lack of sleep – but those individuals who had taken the merriment too far were the exception, not the rule – it was a peaceful, ancient holiday and we were all here to enjoy it and each other. The most surprising thing to me were the druids themselves – that they still existed and practiced and wore these fantastic robes and costumes. The older men had silver beards and toothy smiles that made you believe Gandalf could be real. Their religion tied them to the land and in turn you could identify them as environmental activists, trying to keep the church they worship in free from pollution. At the sunset prayer as we cast “ohmmmmmms” in each of the cardinal directions, we were instructed to pray for (1) Peace in the Middle East, (2) the end of hunger and starvation in the world, and (3) the end of fracking. Of all the three things in the world to pray for, these druids had decided that stopping fracking had to be one of them. Throughout the long night, many of them held a rally at the edge of the field surrounding Stonehenge, taking turns standing in the center of the circle and delivering impassioned speeches, original poetry, acoustic songs, tales of horrible things already happening in the US, and commentary on British politics and corporations. This group was mostly lead by women. I understand how Environmentalism and Feminism (let alone Druid(ism?)) may cast your perception of how these middle-aged women must have appeared – but they were regal in their cloaks  (and, yes, they shaved their legs and wore bras and had beautiful long flowing hair). The activist speeches were confined to those who wanted to listen and didn’t supersede the festival; the only hint you could find amongst the center of the mass of people was a US Native American tribal flag (couldn’t tell which tribe) that held some sort of symbolism for the druids and their anti-fracking movement that I never fully grasped.

image

The dead of night was probably the hardest to get through. I went into the festival thinking the shortest night of the year at such a high latitude would be a piece of cake, but the cold set in during the long wait for the sunrise. You weren’t technically supposed to fall asleep on the ground in and around Stonehenge, but we all did. The four of us formed a cuddle puddle using Nadia’s jacket as a makeshift blanket that never quite covered everyone. The drum circles continued unceasingly throughout the night; new ones persistently cropped up whenever old ones began to die. The stadium lights stayed on throughout the night for safety purposes, but sleeping the wrong direction meant getting blinded and we struggled to find any stars in the otherwise clear night sky. We really lucked out in terms of weather. People walked around in rain boots with heavy duty coats and umbrellas in preparation, having clearly dealt with horrible weather in years past. But it didn’t rain a drop. When the sun came up, the atmosphere immediately warmed to a pleasant 70 degrees. And the sky stayed clear for the perfect view of the sunrise.

And oh, that sunrise. It teased us for hours. At 3am small streaks of light began to escape into the night. I got in position at 4am, leaving the group to be absorbed in the moment by myself. I leaned against one of the pillars of Stonehenge, looking out at the furthest stone that was supposed to mark where the sun would rise. I was certain the sun would appear at any moment. It was 5:30, when the sky was filled with light and it felt as if it was already the middle of the afternoon, when we finally saw the outline of that orange ball of light. I never actually saw anything aligned. (Actually, I almost didn’t even see the sunrise until the really nice guy next to me let me stand on his knee while a nearby schoolteacher let me support myself on his shoulder.) Which is funny because that was sort of the point of all this, right? To see the sunrise and the stones align? But in the end it sort of wasn’t, and that was ok. Nadia and I miraculously found each other, and she pulled me up onto one of the center rocks you could sort of stand on to get a view over the crowd. We were both so happy in that moment.

I’m honestly not sure I’ll go back to Stonehenge after that. How could you top it?

image

image