Pages

Sunday, June 10, 2018

UBC Lecture Response: Experimenting with Spectrumlab



Spectrumlab is an interesting program I downloaded a while ago after seeing an interesting lecture at UBC about sound waves. So you can probably guess what it does. SpectrumLab is basically a sound visualizer, which doesn’t sound exciting, but it is, because it allows you to see sound in a completely new way. In Spectrumlab, new sounds coming in show up at the top of the screen, and their left/right positioning represents their frequency.



This image is of Spectrumlab’s output when I hummed a siren like noise, higher and lower, higher and lower. As you’ve probably noticed, the picture doesn’t just show one frequency though, so what’s up with that? As it turns out, no ordinary sound had only one frequency. Single frequency sounds can only be made electronically. The different frequencies in a sound are actually what makes sounds sound different from each other.




For example, when I hum a note and play the same one on accordion they look different in Spectrumlab.


Photo comparing voice and accordion notes


See how the accordion note has more higher notes than my voice? That’s part of what gives accordion it’s distinct sound. Also, notice how each frequency line is actually two lines close together; that gives accordion notes a more full or “wet” feeling, and gives the sound a kind of slight vibrato because of the two frequency waves canceling each other out at regular intervals. Here’s the link to a safe download for Spectrumlab (windows only): http://www.softpedia.com/get/Multimedia/Audio/Other-AUDIO-Tools/Spectrum-Lab.shtml




Here’s some more accordion music for you to visually enjoy:



Tuesday, May 29, 2018

Making a Knife from a Nail

In April I was looking after a fire. We had just finished some yard work, and there were scraps to be burnt. So we made a fire, and I watched it.
Watching fires isn't very interesting. Sure, fire is cool, but after a while you're just sitting there wishing for something to do. That's what I was doing when I decided to make a knife.

Forging things isn't really very complicated, in theory. You just need to make the metal hot enough that it softens, and then smash it into shape. And then repeat, and repeat until it's the shape you want.

Now, the fire I had was big, but not very hot. Not nearly hot enough to practically forge things with. Luckily for me, fires aren't very hard to make hot. they just need air and fuel, which I had plenty of. For the air part, I connected a powerful blower to a metal ventilation tube which I aimed at the fire.

For the raw metal, I used a huge nail. I started by putting the nail in the fire and aiming the blower tube at it. It worked! The nail got red hot pretty quickly, so, I took it out of the fire with a pair of pliers to start hammering it. I did this a few times. Hammering, back in the fire, hammering, back in the fire, h- what?

Well, apparently I had left it in too long. The blade had melted away, leaving a sad jagged edge where it used to be. Let's try that again.

This time I used a bigger nail. Same process as last time, but paying more attention to how hot it's getting. And when it was the shape I wanted, I heated it up and then dipped it in water to quench it, which changes the structure of the metal to make it tougher. The forging was done! I now had a nail with a knife shape on the end. Next step: shaping.

To shape the blade, I used a Dremel (a high speed rotary tool) with a sanding bit to slowly grind away metal where I didn't want it. I also used sandpaper to properly angle the blade on the cutting side, and start to sharpen it. finally, I used a cutting bit to cut the 'handle' to the right length.
Shaping the knife


To finish the handle, I thought string would work well, so I tried winding it up with some ordinary white string. It looked great! I took the string off and did it again, this time gluing it on as I wound. It might seem like this wouldn't make a very strong handle, but in reality it works very well, as well as looking and feeling very nice. It's wound so evenly you can hardly tell it's string!

The last step was sharpening. I had thought it was sharp enough before, but I changed my mind. I decided I needed a sharper angle on the blade, so I took out a grinding wheel and ground! When I was done that it still wasn't sharp enough, so I used a couple sharpening stones. Then, finally, I was satisfied.
Finished!

Friday, May 18, 2018

My robot is complete! (for now)


I've had and been making this robot since around October, and now I've finally decided it's complete!

Here's the story of it's creation.

I used to take apart Roombas. You know, the robotic vacume that cleans your floor automatically? Right. I took them apart. Three of them, which I found at my local recycling depot. I would start by pulling out the bits that are meant to be unattached; the dust tray and the sweeper and the other thing. I'm not sure what to call it, it's kind of a rubber carpet whacker connected to the sweeper, probably makes it vacume better or something.

Anyway, I would start by taking all those things out, and then I would unscrew and rip the top off to expose the insides of the vacume. There's a lot inside a Roomba. Lots of sensors, switches and wires, which are nice, but the parts I liked the most were the two wheel units.

Each one is a motor connected to a big, knobbly wheel, all well behaved and self contained in a plastic case, with two wires sticking to control the motor, and four others connected to a rotation sensor. And I had six of them! As soon as I saw them all together it was obvious I would have to make a robot.
This was the first stage of robot construction: Hot glue and popsicle sticks.
Quickly after deciding to build a robot, and after a few false starts (you can see the remains of one in the background), I put that together. I decided to go simple: skid steering (like an excavator), and four wheels. Although conventional steering might have been more efficient, it was out of the question; Much to complicated, and likely to break (well, more like doomed to break. It's my robot, after all). And yes, six wheels would have been cooler, but it would also mean the robot would have to be longer, which would mean the skid steering would be even less efficient, to the point of not working at all.

After building that, I wasn't really sure what to do next. I have an Arduino, which is basically a tiny computer that you can control electronics with. I knew I wanted to use it as the brain of my robot, but I didn't know how. I couldn't connect the motors directly to the Arduino- it doesn't put out nearly enough power, and the motors create spikes in the electricity that could damage my Arduino. So, I did some research.

According to what I found on the internet, in order to control my robot I needed something called an H-bridge. An H-bridge is kind of like a complex electric switch. Two of it's wires are connected to a motor, two to a power supply, and another two are connected to whatever you controlling the motor with (in my case, my Arduino). Putting power through one of the controller wires makes the H-bridge power the motor in either one direction or another. That seemed straightforward enough, so I went to an electronics store to buy a couple.

I came back from the electronics store not with H-bridges, but with an Osep Motor Shield, which is basically a bunch of H-bridges incorporated onto a circuit board which plugs into the top of an Arduino. "Even better!" I thought. Now I just needed to figure out how it worked. That was harder then I thought it would be.
The Osep motor shield

I looked online, but there was literally nothing that explained how to use it. But eventually I figured it out. I thought. It turned out I needed to program it with some commands for a different motor controller. Great! So I tried writing code to make the robot go, but it didn't work. Then I copied someone else's. It's still didn't work. Then I switched a couple of wires around. Guess what... they had been backwards. It ran fine! I strapped it to my robot, and it ran beautifully.

I made this diagram after figuring out how everything works.
 All it could do was repeat a series of movements that I programmed it to do, but that was OK with me. Now I just had to figure out how to power it.

I had previously been using a variable voltage power supply to power it, but that power supply plugs into the wall and I wanted my robot to be free. I tried some small hobby batteries I have, but they weren't strong enough and I had no way to charge them. And ordinary consumer batteries were out of the question. Not only would they run out of power fast, they would be way to expensive.

I put the problem aside for a while and made the body of the robot bigger. More room for a battery, if I ever found one. And then I remembered something. The three Roombas I took apart had batteries! And they were the perfect size, too. I just needed a way to charge them. Luckily, I have an Irobot (the company that makes Roombas) power supply. I could charge the battery with that. I just needed to find out how. Usually the power supply would charge the battery while it was still in the vacume, so I couldn't just plug it in. But I watched a couple of videos about it, and decided to try wiring the battery directly to the charger. It was a bit scary, but it worked! the battery charged. My robot was free!
The Roomba wheels

A Backyard Adventure!


I wasn't sure what to do next. There were several options. I could make it into a true robot by giving it sensors and programing it to use them, which would mean it could theoretically drive around by itself, or I could have made it remote control, so that I could drive it around places without pre-programming all it's movements.
What I really need is a use for it. And I don't have one yet.
So I decided to let it wait, and be finished for now.

I will find something for it to do eventually, but for now you can enjoy this montage of it's adventures outside! Music: Hans Hylkema, Backyard Adventure


Tuesday, January 16, 2018

How to use an Osepp Motor controller shield

A few weeks ago I bought an Osepp motor controller shield for the robot I'm building. All I needed it to do was control four Roomba vacuum motors, which I thought would be pretty simple. There weren't any instructions that came with the shield, but I figured it wouldn't be to hard to find some online.
But it was. I found almost nothing.

I did get it working eventually though, mostly through trial and error, so now I can explain to other people how it works. (Well, at least how to control DC motors with it.)

First of all, here is a diagram of the board:

This looks complicated, but it's actually quite simple to understand. I could explain what everything does individually, but that would take too long and not be very interesting. Instead, try this simple circuit.

Materials:
  • Arduino
  • Osepp motor shield
  • small DC motor
  • 6 volt power supply (a pack of AA batteries will do)
  1. Start by mounting the motor shield on the Arduino board. Carefully slide all of the leads on the bottom of the shield into the black terminals on the Arduino. They should be around two thirds of the way in. Don't try to force them further, as doing this could make them bend and possibly brake off.
  2. Next, take the two leads from the motor and insert them into the motor one connectors on the shield. Polarity doesn't matter for now. Grab a screwdriver and tighten the screw terminals until the motor leads are secure.
  3. Plug the 6v power source into motor VSrc on the top left corner of the board, with the positive terminal on the right and negative on the left. A light should come on.
  4. Finally, plug a USB cord leaing to you're computer into the USB port on the Arduino board. Open the Arduino IDE and follow the steps to program it, or copy the entire program. Upload it onto the Arduino and watch it go!
  5. Running a DC motor with the motor shield
The Programming
Type the following code into the Arduino IDE, or, if you prefer, copy and paste it.

    #include <AFMotor.h>
    
    AF_DCMotor myMotor(1, MOTOR34_64KHZ); // create motor #2, 64KHz pwm
    
    void setup() {
      Serial.begin(9600);           // set up Serial library at 9600 bps
     
      myMotor.setSpeed(100);     // set the speed to 200 (maximum speed is 255)
    }
    
    void loop() {
      myMotor.run(FORWARD);                   //run motor forwards
      delay(1000);
      myMotor.run(BACKWARD);
      delay(1000);
      myMotor.run(RELEASE);
      delay(1000);   
}




Let's go over all those commands.
  • #include <AFmotor.h> this command tells the arduino IDE to include commands from the adafruit motor controller library. It must always go at the beginning of the program.
  • AF_DCMotor myMotor(1, MOTOR34_64KHZ); this command tells the program to include a motor named myMotor connected to the motor one connectors, which runs at 64 kilohertz. You can change the name of the motor and what connector it's in, but just keep it like this for now.
  • myMotor.setSpeed(100); this sets the running speed of myMotor. It can be used once in the setup area, or to change the speed in the loop area.
  • myMotor.run(FORWARD/BACKWARD/RELEASE); use this command to turn on or off motors and decide which direction they turn. FORWARD and BACKWARD turn the motor on, and RELEASE turns the motor off.
  • delay(1000); this command sets a delay in milliseconds.
Now you can make your own programs! This isn't all you can do with the motor shield, but it's all I know how to do. For more information on commands and programming look at https://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino. You can skip the non-programming parts, as it was written for a different (but code-compatible) shield.

Saturday, January 13, 2018

Quantum Supremacy Experiment: Lecture Response

    I have been going to a UBC lecture every thursday for a while. The most recent one was by John Martinis, who is working with Google to build and test quantum computers. The lecture was about an upcoming experiment by him and his team, which will hopefully demonstrate the superior power of quantum computers by checking the results from one with a classical supercomputer.
So what is a quantum computer? Many people have heard of them, but it’s quite hard to understand how they actually work.
    In normal computers, information is stored in the form of ‘bits’, which can either be 1 or 0. The 1s and 0s are processed by millions of tiny electrical switches called transistors, which can either be on or off. Modern consumer grade computers currently can have up to 7.2 billion transistors, and the number is constantly rising- but eventually it has to stop. Transistors are extremely small, and we’re reaching the minimum size; if they were to get much smaller, electricity starts to behave in strange ways- like jumping from wire to wire through a weird process called quantum tunneling.
    This is where quantum computing comes into play.
Instead of the bits of classical computers, quantum computers have Qubits, which, instead of just 1 or 0, can be 1 and 0, and every combination of the two of them.
If a classical bit was a coin sitting on a table, a qubit would be a coin floating in space. Instead of just heads or tails, it could be at any angle or combination of them.
    So what use are qubits? Are they any better than classical bits? They are a lot better. And their power increases exponentially; For example, a processor with just 50 qubits would be almost as powerful as our best supercomputers, while one with around 300 qubits would be able to process every atom in the whole universe (in other words, 1080, or a 1 with 80 zeros after it). While most computers can only do one thing at a time, quantum computers can do millions, which is water makes them so powerful.
    Why don’t we all have quantum computers, then?
First of all, qubits are quite hard to maintain. Current qubits involving superconductors require complex cooling systems to keep them working. But that’s not the main problem; the most difficult thing about qubits is that they aren't necessarily always accurate in their calculations.
Let’s go back to the coin analogy, with the classical bit being represented by a coin on a table. Classical bits might have some randomness or outside interference, but they always have the restoring force of the table underneath keeping them stable. Quantum bits, on the other hand, are floating in space, and any outside interference can cause them to turn any which way, messing up whatever operation they are trying to complete.
    Despite this challenge, qubit technology has come a long way recently, breakthroughs are being made all the time. Hopefully within a few years we will have a working quantum computer!

The Remarkable Accuracy of Colour Perception: Lecture Response

    Last week I went to a lecture by Lorne Whitehead, who is a physics professor and professional engineer at UBC. The lecture was about new discoveries about colour processing in the eye and brain, and specifically the unlikely-seeming accuracy of colour perception.
I didn’t understand most of it, but I’ll tell about some of the interesting facts that I did get, and then hopefully you will understand them to.
    Trichromatic (colour) vision evolved as a way to see what things were made out of, or what was inside them. Our early human ancestors originally saw light in the UV range, as many birds and other animals do still. But as humans became more diurnal (awake in the day), it became more beneficial to see colour. It helps us judge what fruits to eat, decide when meat is done, tell how healthy people are… and many other things. This is pretty obvious.
    But something unexpected was how accurate our colour perception turns out to be. While most of our senses (smell, temperature, etc.) have around a 50% percent accuracy, the accuracy of colour perception is around 5%.So why is colour vision so accurate? Think about a banana. You can easily tell if it’s it’s good or not with one look- even though it’s colour barely changes at all.
    Another interesting thing Dr Whitehead mentioned was an answer to someone’s question at the end of the lecture. Someone had asked if he was worried about humans losing colour vision, since it wasn’t necessary for survival anymore, to which he answered no, but he said he was “very worried” about what screens did to us. Screens are always getting better, which often includes more vibrant colours and contrast, which he says is very bad for our eyes. According to him, it can take up to a week for our eyes to fully recover from viewing a contrasty screen. Luckily, we can easily avoid this problem; almost all screens have ways of adjusting the colour and contrast.
    Lastly, I want to show you an interesting image that Dr. Whitehead used in his slide show. It shows what the raw signal coming out of your eye looks like.
https://i.pinimg.com/originals/fc/ea/76/fcea76d986367493f568789540cc75b9.jpg
That is all you’re eyes actually see- anything else is a result of your brain’s processing.

A Stars Life

    There are around 1024 stars in the universe, and each one is a bit different from the others. But what every star has in common is their life cycle. From a huge molecular cloud to a main sequence star, to a giant, and then, finally, a supernova, each star lives an exciting life. Read on to find out more!
   
    Stage one: Molecular Cloud
A molecular cloud is a giant accumulation of gas and dust (mostly molecular hydrogen) in outer space. Molecular clouds are quite cool as compared other parts of outer space, at around 10 - 30 degrees kelvin (around -230oC). Molecular clouds can be up to 600 light years in diameter, and their mass can be up to a few million solar masses (around 0.7x1034 kilograms). These clouds aren’t totally homogeneous- they contain areas of higher gas and dust density, known as knots, or cores. It is in these knots where stars begin to form.

    Stage two: Protostar
A protostar is the first stage in a star’s evolution. First suggested by Chushiro Hayashi in 1966, a protostar is formed when one of the knots in a molecular cloud begins to contract, and then gain mass, which in turn causes them to contract further due to increase in gravity. The resulting clump of hot gas and dust is a protostar, which is around the size of a solar system. As the protostar gains more gravity, it continues to heat up and attract material, which is pulled into a disk around the star. In stars the size of our sun this stage last for about a million years.

    Stage three: Proplyd
The proplyd is a large (around 100 AU across) pancake-shaped disk of gas and dust that forms around a million years after the protostar, which has at this point shrunk to around one AU (astronomical unit) in diameter. The proplyd is thought to be what planets eventually form from, with the dust compacting to form planets orbiting the star. These proplyds are strong infrared sources, with hot and active centers, which gradually cool off and bulge towards the edges. Proplyds are also known as protoplanetary disks.
   
    Stage four: T. Tauri star and Bipolar Molecular Outflow
After another million or so years, the protostar has again shrunk to form what is known as a T Tauri star, which is the name of the first star of this type discovered. T Tauri stars are highly active young stars, generally a few times the diameter of our sun, which means they appear brighter than other stars of the same mass. T Tauri stars spin rapidly, and they are characterized by their large solar flares caused by intense magnetic activity, which also causes huge sunspots to form over large areas of the star.
    Bipolar molecular outflow
As a T Tauri star pulls gas from it’s protoplanetary disk, it ejects it outward in two particle beam jets perpendicular to the disk, which light up when they interact the gases surrounding the star. These beams form bright nebulae known as Herbig-Haro objects.

    Stage Five: Main Sequence Star
After around 10,000 years of bipolar molecular outflow, the T Tauri star gets hot and massive enough to initiate fusion in its core. At this point the star is, so to speak, fully grown, or a main sequence star. It is estimated that around 90% of stars in the universe are main-sequence.
Fusion is the process wherein hydrogen atoms combine to form helium, releasing 0.7 percent of their mass as pure energy in the form of heat and radiation. This doesn’t sound like much, but according to Albert Einstein’s famous equation, E=mc2, one gram of mass converted into energy would be around 900,000,000,000,000.0 joules. One joule is approximately the energy used to lift an apple, so you could lift 0.9x.1014 apples with this much energy. Technically.
This means that our sun (an average-sized star) produces approximately 0.4x1014 joules of energy, which is equivalent to the energy produced by about a trillion tons of TNT going off every second.
The lifetime of a main sequence star depends heavily on its size. A small star can last around 80-100 billion years, while a large star (around 100 times the mass of our sun) may last for only around twenty million. The fact that large stars have such short lives seems counterintuitive, but is caused by the fact that they use up their fuel (hydrogen) at a much faster rate than smaller stars.

    Stage six: Giant
Once all of a stars hydrogen is converted to helium, a star’s core will collapse upon itself, causing the outer layers to expand forming a subgiant, and then finally, a red giant, the red colour being caused by lower surface temperature. Red giants are generally 0.3 - 8 solar masses, their size depending heavily on the original size of the star. Extremely massive stars can sometimes even form into an even larger class of giant, known as supergiants, whos size also depends on the size of the star, but is estimated that a large supergiant could be up to 2,600 times the size of our sun.
Stage seven: Core Fusion
As the star expands and the core shrinks, it starts to fuse the helium inside it. This forms other atoms, which also start to fuse, while the core keeps shrinking. This process keeps repeating until iron is formed, which is the first element that takes more energy to fuse then it makes. Since the star has at this point stopped making energy, the fusion stops.

    Stage eight: core collapse supernova
When the core of a massive star stops producing energy, the outer layers of the core collapse, which creates a massive explosion called a supernova.
    According to Dr. Donald Spector, a Hobart and William Smith Colleges physicist, “However big you think supernovae are, they’re bigger than that.” although this claim is obviously and irreparably paradoxical, it is a good rule of thumb when estimating supernova-related numbers.
    Dr. Spector’s rule certainly applies here. The amount of energy produced by a normal-sized supernova is around 1044 joules. To put that into context, that is equivalent to 2.39x1060 megatons of TNT. A supernova can outshine an entire galaxy.
And that is how a star dies.
   
    After Death: Dwarfs, Neutron Stars and Black holes
Not all stars produce supernova. Medium to small stars, such as our own sun, simply shrink to become what is known as a white dwarf. White dwarfs are extremely dense. A white dwarf with the mass of our sun would only be around as big as the Earth. White dwarfs don’t produce fusion; they glow purely from their thermal energy, and last for billions of years.
    When larger stars (between 10 and 29 solar masses) collapse as a supernova, they often form an incredibly dense Neutron stars. These stars are even denser and smaller than white dwarfs, with stars around ten kilometers wide weighing twice as much as our sun. These stars are believed to be made almost entirely of neutrons, and there are a few different types of them. Most neutron stars are known as Pulsars, due to their pulsating radio signal. This is caused by a combination of extremely rapid rotation and a beam of radiation jetting out of the magnetic poles. Another kind of neutron star is the Magnetar. These neutron stars have a huge magnetic field, around a thousand times the strength of an ordinary neutron star.
    The largest supernovae can form Black Holes. These strange objects are so massive that they collapse into a dimensionless point known as a singularity, which has infinite mass. Almost nothing escapes a black hole’s gravity. Not even light, or electromagnetic radiation. Matter can only escape a black hole in the form of hawking radiation, which is still purely theoretical. There is believed to be a supermassive black hole at the center of our galaxy.
And that is a star’s life.
A star’s life

From birth as a protostar, to the formation of a protoplanetary disk, to the transformation into a red giant, then finally, to death as a supernova. Every stage of a star’s life cycle is awesome. To learn more, see the sources page below.

REFERENCES
Molecular clouds
http://www.sun.org/encyclopedia/molecular-clouds-and-dark-nebulae
Energy from sun
http://archive.boston.com/news/science/articles/2005/09/05/how_much_energy_does_the_sun_produce/
Main sequence stars
https://www.space.com/22437-main-sequence-stars.html
Amount of zeros because I don’t know for some reason
https://www.quora.com/How-many-zeros-are-in-1-million
Main stages of a star’s life
https://sciencing.com/7-main-stages-star-8157330.html
Energy conversions
https://www.unitjuggler.com/convert-energy-from-J-to-MT.html?val=1.0E-44
Dr. Spector
http://people.hws.edu/spector/
Info on white dwarfs
https://en.wikipedia.org/wiki/White_dwarf
Info on neutron stars
https://en.wikipedia.org/wiki/Neutron_star
Info on black holes
https://en.wikipedia.org/wiki/Black_hole
Dr. Spector quote:
What if? By Randall Munroe
Info on star life cycle:
The Illustrated Atlas of the Universe By Mark A. Garlick and Wil Tirion

Knife handdle update!

It looks better now! I got a new soldering iron, and it's really hot, so I burnt designs into my handle to make it looker better.