September 12, 2014

The Road Ahead

I haven't been posting much lately, simply because I haven't been programming much in my own time the past couple of weeks. I packed away my microcontrollers because I move in to Drexel next week!

Besides work keeping me busy, I have also been trying various distributions of Linux from live CDs/DVDs. I went a little overboard, I can choose a different operating system every day... for two weeks in a row! Yet it is a good to see the various distributions and evaluate which ones are best for me.

Probably my favorite so far is Xubuntu. More light than Ubuntu, and the particular version of Xfce makes for a nice clean desktop interface.

As for programming, I have no idea what I will be doing next. I need to focus on transitioning to college first, then I'll choose something to work on.

Some possibilities:

  • Try out the Adafruit Neopixels I bought
  • Try out new I2C sensors such as an IMU (position sensor that measures acceleration, rotation, and orientation with respect to the Earth's magnetic field
  • Try again at making a serial library
  • Try using bluetooth to control a single-board computer (BeagleBone Black or Raspberry Pi) from an Android phone
  • Or maybe something else entirely!

September 10, 2014

Sig Figs Explained

Today I noticed one of my friends were having trouble with significant figures in chemistry. Here is a post to help people figure out some of the more ambiguous cases.

Case 1: Inexact quantity

Suppose we have some sort of salty food. On the label it says:
"Sodium: 300 mg"

Sig Figs: 1

Why: Due to rounding in the label and the fact that each serving might not have exactly the same proportions, you could easily have 290 mg, 320 mg, 310 mg, or anything that's between 250 and 340 mg. Otherwise, the number would be 200 or 400 mg. Since we can't figure out what the tens or ones place is, the only digit we know is exact is the 100s place, hence 1 sig fig.


Case 2: Exact quantity

Suppose we are counting ducks in a pond. We count them a few times to make sure we have an exact count:
"1, 2, 3, 4, ... 298, 299, 300"
"1, 2, 3, 4, ... 298, 299, 300"
"1, 2, 3, 4, ... 298, 299, 300"

Sig Figs: Infinite

Why: This is an exact count. You are absolutely sure that you do not have 299 or 301 or 302 or 300.5 ducks, so there is no uncertainty. It is not 3 sig figs, for we know that the tenths place is 0. it's not 4 sig figs for we know that the hundredths place is also 0. In fact, we know that there are 300.00000000000000... ducks on the pond.

Case 3: Defined Quantity

The conversion factor from inches to centimeters is defined as:
2.54 cm = 1 in.

Sig Figs: Infinite

Why: The conversion factor is a definition; there is no uncertainty. Even though the number goes to 2 decimal places, there is no possibility of 2.55 cm equaling 1 inch due to the way that the quantities are defined.

Case 4: Textbook Ambiguity

Suppose a textbook problem talks about a 300 L tank of water.

Sig Figs: Depends. 1 if interpreted as a measurement, infinite if interpreted as a definition.

Why: This really depends on the textbook.

Some textbooks might treat it as a measurement. Then it would be one sig fig for it might not be exactly 300L in real life.

Other textbooks might give an answer with more sig figs than should be needed. If so, it is either because they treat it as a theoretical example where numbers can be exact, or just provide extra sig figs so you can check your math before rounding.

All in all, check your textbook carefully. If the questions denote different numbers of sig figs differently, they probably treat numbers as measurements. If not, the textbook might treat it as a definition.

If you are not sure, talk to your teacher.

Avoiding Ambiguity

When writing numbers, there's a number of conventions to help determine how many sig figs for a measurement. Take these for example:

300 - 1 sig fig
300. - 3 sig figs. the decimal shows that we know up to the decimal place for certain
300 - 2 sig figs. an underline explicitly shows the last significant figure.
3x10^2 - 1 sig fig. In proper scientific notation, every number shown on the left of the x is significant.
3.0x10^2 - 2 sig figs. Same rule as the previous example.

I hope that helps to explain some of the more challenging aspects of sig figs, particularly zeros. 

August 28, 2014

LED Pulse Network: Part 3

Today I managed to get 2 out of 3 devices to talk together properly. When the chipKit receives a pulse message, it lights up its LEDs, then sends a message to the Teensy++. The Teensy++ does the same thing.



Right now I am using a Python script to control the system, eventually the Arduino will control everything.

Here is a vid of the demo in action:


August 25, 2014

LED Pulse Network: Part 2

Lately I've been working on the serial communication portion of the pulse network I am making. The details get rather technical, but so far it is going well. I am testing one device at a time before I start wiring devices together. 

In this test, I made my chipKit respond to certain serial messages by turning on its on-board LEDs or pulsing the light through the line of LEDs forwards or backwards. 

I then put together a quick Python script to help automate the testing process. It gives me a command prompt and I can type one of the following commands to send messages to the device:

on - turn the on-board LEDs on
off - turn the on-board LEDs off
pulse forwards - "pulse" through the LEDs in the forwards direction
pulse backwards - "pulse" through the LEDs in the backwards direction

Here is a video:

August 22, 2014

LED Pulse Network: Part 1

Today I finally got around to starting a new project: making a ring network of three Arduino-compatible boards so they can talk to each other and pass around a "pulse" of light that will be displayed on a large number of LEDs.

Today I just set up the LEDs and made a rough sketch of the LED animation. Here's a pic of the setup:
I would have made an actual ring shape of LEDs, but considering that my other breadboards are currently in use, it was easiest to just wire them in rows. 

Currently, each device is its own separate circuit. Soon that will change, I will connect them together soon.

In the meantime, here's a video of the lights in action:



August 21, 2014

Invisible Light

Ever wonder what it's like to see infrared and ultraviolet light? Our eyes cannot detect such wavelengths of light just outside the range of visible light. Yet cameras can detect both types of light!

Check out this picture (Left LED is infrared, the right LED is ultraviolet)

The dark LED on the left is an Infrared LED. the pinkish/purplish white dot in the center is infrared. Here's a better picture taken from above with the UV light off:
In real life, the IR LED doesn't look like it turned on at all. The dark plastic filters out everything except UV. It's only when you use a digital camera (phone cameras work just fine!) that you can "see" the light.

To try this at home: get a TV remote and look at the end of it with a camera as you press buttons. You'll see pulses of IR light!

The UV LED (or black light if you wish) does emit visible light in the violet range, so it appears to be a purple LED. However, when you look at it through a camera, you see that there's way more light to be had, which is why in a photo it seems to glow so brightly!

This one is a bit harder to try at home, but if you ever go to a party with black lights, try taking pictures of the black light bulbs!

August 20, 2014

Dabbling With Yet Another Microcontroller

Finally got a chance to try out my Parallax Propeller QuickStart microcontroller. The programming language it uses is unusual to me, as it is closer to assembly language compared to C/C++ which is used in Arduino and other microcontrollers. Yet it's pretty cool to learn.

I also like how this board has 8 surface mount LEDs on it, makes it easy to test things without needing to find the right LEDs, resistors and jumper wire for the job.

Here's a vid of one little test I made:

Notice how the lights blink so fast it appears like it is a solid light! This effect is called Persistence of Vision (POV).