Little Bits Karate Chop Speedometer

One of the projects students can do in Physics 140 is to investigate the physics underlying the breaking of a boards in karate demos.  The process is to

  1. Determine how much energy it takes to stress the board until it breaks. This can be done by hanging weights or pushing on the board until it just breaks.
  2. Determine how much kinetic energy a karateka’s hand or fist contains before it impacts a board.
  3. Calculate how much of the karateka’s kinetic energy can be transferred to the board assuming an inelastic collision.

Part 2 involves measuring the speed of the hand during the karate chop as well as the mass of the hand and or fist.  This speed measurement can be done with a video which is somewhat limited by the frame rate of the video, usually 30 fps.

Using the arduino and the little bits light sensor it’s possible to easily make an apparatus to measure the karate chop speed.

Continue reading

Little Bits Ball Dropper and Timer

The idea here is to drop a ball using the servo motor arm and measure the time it takes to fall a distance down to the light sensor.  A small LED lamp is illuminating the light sensor which the ball falls between. The distance is measured from the bottom of the ball to the light sensor which is only 2 or 3 mm square. The value of the gravitational field strength, $g$, is then calculated.

Continue reading

Little Bits Coin Drop Demo

The coin drop demo demonstrates that the vertical motion of a falling body is not affected by horizontal motion.  For example, in this demo two coins are dropped. One coin is dropped directly down with no horizontal component of velocity. The second coin is pushed horizontally with an initial horizontal velocity which does not change (neglecting air resistance) while the coin drops.  Both coins are released at the same time and both will strike the ground at the same time.

The Little Bits kit can be easily made to do this demo with just the servo motor bit, the power bit and the push button bit. Very simple.  Use two of the base platforms. Construct the mechanism on one of them as shown here.


The battery is positioned on its side so that it can support the second base sheet which will support the coin that is pushed horizontally.  Now put the second base on top of the battery so that the arm will sweep across it when the button is pressed.


Another battery and a rubber band were used to stabilize and secure the top sheet.  Two coins are placed as shown: one to drop when the arm swings and the other to be swept forward.  Here’s a movie of the final demo.


Owncloud updates on Rasberry pi: version 6 —> 8


Update was from version 6 to 8 so there were some hitches.

For one thing the root directory of the installation was changed to




The automatic update procedure didn’t work but a fresh download followed by resynching worked. Otherwise one was presented with a screen that purported to update the apps but that didn’t work given a claimed csfk (or something) error.  There was a command line alternative  (./occ) that did not complete either, claiming that multiple version updates were not supported.

The main source of inspiration was this:

SSL Certificate

This time I wanted to use https to connect. The instructions for creating the certificate were this

sudo openssl req $@ -new -x509 -days 730 -nodes -out /etc/nginx/cert.pem -keyout /etc/nginx/cert.key

It looks like the certificate will expire in 730 days so it will expire on July 14, 2018.

This certificate does work, but since it’s self-signed one gets lots of scary warnings when first accessing the site.

Will explore ways of getting trusted certificates for free. For example there’s “Let’s Encrypt

nginx Configuration

The nginx webserver configuration files are




The nginx.conf file doesn’t need to be modified but it will include all the files in the sites-enabled directory. The owncloud.vhost is the one of interest.


upstream php-handler {
# server unix:/var/run/php5-fpm.sock;
server {
listen 8080;
return 301 https://$server_name$request_uri; # enforce https
server {
listen 4433 ssl;
server_name “”;
ssl_certificate /etc/nginx/cert.pem;
ssl_certificate_key /etc/nginx/cert.key;
# Path to the root of your installation
root /var/www/owncloud;
client_max_body_size 1000M; # set max upload size
fastcgi_buffers 64 4K;
rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect;
rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect;
rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect;
index index.php;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
location ~ ^/(?:\.htaccess|data|config|db_structure\.xml|README) {
deny all;
location / {
# The following 2 rules are only needed with webfinger
rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
rewrite ^/.well-known/carddav /remote.php/carddav/ redirect;
rewrite ^/.well-known/caldav /remote.php/caldav/ redirect;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;
try_files $uri $uri/ index.php;
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
: include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
fastcgi_pass php-handler;
# Optional: set long EXPIRES header on static assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|css|js|swf)$ {
expires 30d;
# Optional: Don’t log access to assets
access_log off;

Because my Telus isp does not permit NAT loopback I have to access the server from when at home and elsewhere. So both urls are listed after the listen 433 line.


ownCloud configuration

The main thing here is to insert the trusted domain names from which the server will be accessed. Here’s the file:

$CONFIG = array (
  'instanceid' => 'ocxoi546wkre',
  'passwordsalt' => 'asdfabafbsdfasdf',
  'secret' => 'a[sdvojaoisdjfoijasidjf',
  'trusted_domains' =>
  array (
    0 => '',
    1 => '',
  'datadirectory' => '/var/www/owncloud/data',
  'overwrite.cli.url' => '',
  'dbtype' => 'sqlite3',
  'version' => '',
  'logtimezone' => 'UTC',
  'installed' => true,
  'mail_from_address' => 'alberding',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => '',
  'mail_smtphost' => '',
  'theme' => '',
  'mail_smtpport' => '587',
  'mail_smtpsecure' => 'ssl',

Opening up the Modem Port

The last thing one should not forget is to open up port 4433 so that one can access the server via https from outside.

  • PortForward


 ioLab Startup and Pairing

The ioLab uses a radio frequency connection to your computer. It is not Bluetooth, but uses a dongle that plugs in your usb port. The dongle resides in the back of the ioLab unit. To remove the dongle, just press down on the metal end and it will tilt up so you can grab it and take it out.

Front panel of the ioLab showing on/off switch and button to pair a 2nd remote.
Front panel of the ioLab showing on/off switch and button to pair a 2nd remote.

Initial Startup

Follow the instructions for your system that are written at http;// Except for the basic start-up process, the documentation is mainly through the youtube videos.  Some of the notes below derive from watching those videos.

Start Button:

  • short press = on (less than 1 second)
  • long press = off (about 2 seconds)

Flashing lights:

  • if flashing alternately, then the unit is paired
  • If flashing simultaneously, then the unit is unpaired

After you start the iolab application, plug in the dongle.  Make sure the Dongle ID icon at the top of the application screen lights up when you plug in the dongle.  Then press the start button   (the right-hand one) on the top of the iolab,  the side with the wheels. If the lights beside the buttons blink simultaneously, then the connection is not working.  When the connection is ok, then the lights will blink alternately and you’re “paired.” The Remote 1 icon on the ioLab application should light up and say “Paired.”


The first thing you should do after you pair is to calibrate.  Before you can calibrate you have to press the Start or the Reset button.  Then click the Gear Icon  and then …Calibrate Force. Follow the instructions that are displayed. When you do this you’ll have to turn the unit and set it on a table with  y direction up. Then hang it from the force probe for a couple of seconds, holding it by the spring or bumper. The force probe caiibrates assuming that the unit’s mass is about 200 grams and that it is on earth where the gravitational field strength is  g = 9.8 N/kg.  I am not sure how the other sensors calibrate, but I suspect that the quantitative outputs may not be entirely accurate. (I found that the gyroscope only measures 5.4 radians when one integrates the omega of a complete 360 deg rotation, instead of 2π= 6.28 radians).

Force Calibration:

  1. set on the unit’s head
  2. hang from the force probe.


To make measurements, choose the  sensors which are to be used and then start the data collection by pressing “Record.”   Let it run as long as you need and then press  “Stop.”  The data will accumulate at the rate indicated at the top of the graph. There is no way to modify the data rate

Pairing a second remote

You can pair a second remote unit with the same dongle so that mutual forces can be measured during a collision.

  • Plug in dongle and pair the first unit, if not already done.
  • Turn on 2nd unit and unpair the second remote unit from its dongle if necessary.
    • To unpair  press the “ON” button while still holding + down for a short time (less than 1 second.)
    • Keep holding the + button until the light beside the + button flashes 3 times quickly in succession.
    • Now cllick on the Remote 2 on the top of the IOLab app and a dialog should appear with a button that says “Find Remote”. If the 2nd remote is flashing with a series of 3 quick flashes then it should be found
    • Then choose “Pair Remote” and the second remote should be paired.
  • Now both units are paired with the same dongle.
  • Here’s a video on pairing 2 remotes that shows the process:

Active Learning Experiments

This series of mechanics experiments is designed to help overcome common misconceptions of beginning physics students.

  1. Position, velocity and acceleration: when is acceleration positive, negative and zero?
  2. Force and its relation to motion.  Does force correlate with velocity or acceleration?
  3. Friction, sliding and rolling. How does one quantify friction? What factors does friction depend on?
  4. Momentum change and force. Impulse-momentum.
  5. Mutual forces during collisions
  6. Simple Harmonic Motion
  7. Torsion Pendulum: moment of inertia and effect on oscillations.

Position, Velocity and Acceleration

Make a small ramp to run the ioLab up and down on its wheels. A board is good, or even a large book could be used.  Make the angle so that when you give a push on the ioLab while sitting on the ramp with its wheels down that it runs up the ramp and comes back down again.

Determine ramp slope using the accelerometer

startup and verifing calibration

Start the software, turn the ioLab on and make sure that the ioLab is correctly paired. Click the box to turn the “acceleration” sensor on. Record a few seconds of data. Check that when sitting on the table a_z is about 9.8 m/s/s. Then check that a_x and a_y is about zero/ Discepancies of around 0.02 m/s/s can be ignored, but if the variation from expected values of 9.8 m/s/s and 0 m/s/s are greater than 0.05 m/s/s then go through the calibration procedures.

The z component of acceleration will read 9.8 m/s/s when the unit is held horizontally because of the pull of gravity on the acceleration detector. The value of 9.8 m/s/s does not mean that the unit is accelerating physically, but that the sensor feels as if it were in outer space, away from any gravitational field, and is accelerating in the z direction. There is no physical way that the sensor can distinguish between a gravitational field of 9.8 N/kg and and acceleration in space of 9.8 m/s/s.

Measure a_y on ramp while cart is not moving

Reset the data — press reset once — and record one data for one second with the ioLab on the table and then on the ramp with the y direction pointing up the ramp and the wheels on top. The y component of acceleration should now be non-zero. The tilt angle of the ramp is given by θ = a_y/9.8 in radians.

Now measure the tilt with a ruler, θ=arcsine(rise/length), and compare the value from the accelerometer.

If the values you got from the two methods are very different, try to estimate whether the difference is because of the random uncertainties of the measurements, or an error in procedure. Discuss and justify your conclusion.

Record position, velocity and acceleration while moving

Now we are going to record the position, and velocity using the wheel encoder. Reset the softward by pressing reset twice.  Now choose the “wheel” option in the software.

Start recording and then gently push the cart uphill.  It should go up, momentarily stop and then roll back down hill. Catch the cart and then stop the recording.  Below is a sample chart of that motion.

You need to display only the y components of the position, velocity and acceleration.. The zero of position is set when you start the recording.  As the cart rolls up and down the ramp there is a curved line, almost parabolic  When the slope of the position vs time graph is zero, notice what the velocity is. What is the acceleration when the velocity is zero?  (To make the velocity graph less ugly, choose a smoothing of about 10 points.)

Look at the region of the graph where the cart is rolling freely after it leaves your hand and before you catch it. You’ll notice that the acceleration as measured by the wheel is noisy because of the surface roughness. Another thing that is interesting about the acceleration is that the value is different when it is going uphill and when it is going downhill.  This change is due to friction. When the cart is going uphill the friction force is pointing downhill, helping the force of gravity to slow the cart down. When the cart is going downhill friction is  in the opposite direction and retards the force of gravity that is causing the cart to speed up.

The statistics displayed on the graph pertain to the shaded area selected.

  • µ: Mean value
  • σ: standard deviation about the mean
  • a: area between the curve and the zero axis
  • s: average slope over the interval
ioLab chart showing position, velocity and acceleration.
ioLab chart showing position, velocity and acceleration.








Smartphone Spectrometer

Making a Spectrometer from a Smartphone Camera

If one puts a diffraction grating in front of the lens of a smartphone the photograph will show the spectrum of a light source. This works best in a dark environment where the spectral lines show up on top of a dark background.  The following picture was taken from about 1 m away from a hydrogen lamp. The  spectral lines of the Balmer series are clearly visible. One can also see the spectrum of the neon pilot lamp below and to the right of the hydrogen lines. (Photo taken in SFU Phys131 lab, March 10, 2015)

Hydrogen Balmer Series

Hydrogen Spectrum made with a smartphone and diffraction grating. Note the little neon spectrum too.
Hydrogen Spectrum made with a smartphone and diffraction grating. Note the little neon spectrum too.
Hydrogen Balmer Spectrum
Colour Actual λ(nm); Measured λ(nm) ni nf
red 656.3 654.4 3 2
bluegreen 486.1 487.7 4 2
violet 434.1 435.7 5 2
violet 410 6 2

The wavelengths were derived my photo-analysis using LoggerPro and calibrated on the red Balmer line.  I assumed a linear relationship between wavelength and distance from the lamp. The second order bluegreen line is visible and its wavelength would be 997/2 nm  = 498.5 nm using the linear relationship between wavelength and distance.


See and this  for a home made spectrometer using a DVD diffraction grating.

Linux on an iMac G5

Making a dual-boot Mac OS X 10.4.11/Xubuntu 14.04

    1. Use DiskUtility to partition the 160GB drive into two 80 GB HFS+ partitions.  The second one is going to be deleted, but that’s what I did.
    2. Had to install 10.3 on the partition because that was the version that came with the machine.  The 10.4 disks from another iMac didn’t work.  The I found a version of 10.4 that would install and upgraded to 10.4.11.
    3. 10.4.11 can be made more useful by downloading 10.4-Fox browser and LibreOffice, both have PPC binaries.
    4. Follow the instructions for getting the linux installation files and copy them to the root:
      The main resource for finding the files for either netboot or live dvd images is here:
    5. Reboot into the open-firmware: hold down  cmd-option-o-f after the chime.  Then type in
           boot hd:3,yaboot

      where the number 3 depends on your partitioning. Use pdisk to find the partition number of the HFS+ partition where the Mac OS is.

    6. At this point you can type install and the installation should proceed.
    7. In order to read/write the HFS+ partition, make it unjournaled and then edit the uid of your linux user to correspond to that of mac
    8. In order to read/write the HFS+ partition, make it unjournaled and then edit the uid of your linux user to correspond to that of mac:
  • Finally got the os x files shared with the linux. First of all, when in the os x system, type

    in the terminal. In my case I got the the uid=501 and gid=501. Then boot into the linux system, login is as root, and use moduser to change the numbers

    moduser -u 501 -g 501 neilx

    The other thing I had to do was to make sure that the hfs+ volume was not journaled. (The little lock icons that the linux file manager showed on the directories indicated read-only.) In fact it was journaled and using the disk utility it was possible to make it unjournaled. The option was under the “File” menu. On some versions of diskutility, you have to hold down the “Option” key to disable journaling.


First-year laboratory equipment

Comments on 1st year lab equipment options.

If one wants to emulate scope and function generator (f.g.) with Labview then sensorDAQ is not adequate. One needs NI myDAQ.
In order to use Vernier’s plug-in sensors then the Vernier myDAQ attachment is also needed to plug in to it.
* 20 kHz max freq
* 0.5 W max total power output for all ports (e.g., 10V, 50 mA)
* only 1 digital and 2 analog inputs for Vernier sensor plugs.
* using the Vernier power amplifier ($247) will allow the computer to serve as a f.g. up to 15 kHz with ±10V, 1A using the computer’s sound card.


Don’t know how well the virtual system will work with both f.g. and oscilloscope emulation vi’s being used at the same time.

Compared to stand-alone
* oscilloscope: 50 MHz or greater bandwidth (
* f.g. max freq several MHz and about 5 to 10 W power output depending on model.

It is possible to design most of our experiments to work in the audio range in most cases, but we do use the max power output of our current function generators. For example in the slinky induction lab we go up to 1 kHz but the pick-up signal is small and we put the f.g. on max output. (

If we use a stand-alone f.g. then we might consider the Labquest mini. The labquest mini has 3 analog and 2 digital ports. It can be accessed with Labview and voltage signals can be input through mini grappler plugs into any or all of the analog ports — no need for tiny screw drivers.


The Pastrack is a plastic multi-segment track It is composed of 50 cm segments that have to be put together. (
This design causes glitches in data when the carts pass over the junction. The FIC instructors don’t like them and have ordered one-piece Al replacements.

The tables work with 1.2 m track lengths, 2m (as shown in Dave’s presentation) would be too long.
The Vernier 1.2 m track is about the same price as Pasco’s ($150) but includes better options for brackets and mounting and include the feet. It allows for a bracket to mount the go-motion so that glitch-free data are usually collected compared to using the pasco tracks without the bracket. ( End stops are $10 extra. (

The optics kit designed to fit on on Pasco’s dynamics track is not comparable to the Pasco introductory optics kits we now hove. (
There are only light source, screen and two lenses.
The lenses are demountable from the holders with fussy 3-screw mounts that will give problems in a first-year lab environment.

The main bulk of the box of the basic Pasco optics kit we now have is the foam rubber cutouts that allows one to quickly verify the many items that are included in the kit. The extra encumbrance of the optics bench only adds about 2 cm to the box width.