Q: When Does “Quality” Mean “Low Quality”?

A: When you work for a North American governmental environment agency.

The “Air Quality Index” is used by the EPA, Environment Canada and other agencies to communicate air quality to the general public. Unfortunately, the term is counter-intuitive: in the up-means-down world of the environmental bureaucracy, the higher the number, the lower the quality! The graph attempts to mitigate the confusion by adding the term “risk”, but in doing so it merely compounds it. The result is confounding and unnecessarily complicated to understand.

The colour coding on the graph is also visually misleading: It goes from blue (cold) to red (hot). Is this a temperature graph–or does this mean the air is better when it’s colder? The graph probably should go from green (good) to red (warning/bad). Somebody should do something!

Asian countries, on the other hand, use “API” (Air Pollution Index), where higher numbers communicate higher pollution. This makes perfect sense to me, and I don’t know why our bureaucrats seek to bury the information in doublespeak, especially when we actually have better quality air than they do in much of Asia.

Here’s the explanation from Environment Canada:

Here’s what the readings mean:

  • If the air quality value is 25 or less, the air quality is considered relatively good.
  • If the AQI value is in the range of 26 to 50 (fair category), there may be some adverse effects on very sensitive people.
  • An index value in the 51 to 100 range (poor category), may have some short-term adverse effects on the human or animal populations, or may cause significant damage to vegetation and property.
  • An AQI value of more than 100 (very poor category) may cause adverse effects on a large proportion of those exposed.

Notice that the explanation refers to “fair category” (another attempt at mitigating the confusion that’s caused when you try to combine the words “high” and “quality” to convey “low quality”) but this is not expressed in the graph.

So am I missing something? Why does Environment Canada do this, other than to repeat the mistake of the EPA? Is there a scientific reason?

Seeed Studio Visit – Shenzhen, China

(Wuhan, China) On Monday I visited Seeed Studio, a small but growing tech startup in Shenzhen. They specialize in open source hardware, and are known for the Seeeduino, an Arduino microcontroller board. Seeed makes open source “brick” addons that allow sensor and actuator connections to the Seeeduino without soldering and they provide economical starter kits that are perfect for our students at NSCAD University.

They generously provided me with a sample Seeduino, and two kits: the “Electronic Brick Starter Pack” and the “Catalyst” kit that they have prepared for Make magazine for my lecture at Shenzhen Polytechnic that afternoon. I’ve used their bricks before and find them very convenient for learning how to use the various sensors, motors, LEDs and other actuators, though I have to admit that I broke a light sensor early on when I plugged it into the brick the wrong way around. Apart from that silly mistake, the brick system is robust and well-designed.

Two of the principals, young engineers Eric and Fan, were my hosts. They showed me a beta version of their soon-to-be-released DSO nano, a small handheld digital storage oscilloscope for people like me. It looks like an iPod Touch, but with a button rose at the right. They tell me that they would like to use a complete ‘glass interface’ like the iPod with their next version of the product.

Eric brought out a development prototype of their Rainbowduino called the 3D RGB Cube, a 3D matrix of RGB LEDs that connect smartly to the Seeeduino. With this system there are no worries about current requirements, all you need to do is plug it into the microcontroller and ensure that you give it enough juice.

Now, off to Beijing!

Interfacing Arduino with SMCC-547 Stepper Motor Controller

This week I received a package from my favourite electronic component supplier Futurlec. It contained a very inexpensive stepper motor controller unit called an SMCC-547, made by a company in Thailand. The motor is small, has very little torque, and it has 18° steps, which is quite coarse as stepper motors go. Since I have no experience with stepper motors, I bought it thinking that I would be able to wire it up quickly to an Arduino microcontroller and play with it using Arduino’s Stepper Library.

Unfortunately, the library does not work for this controller. I have not found anything online that shows how to connect this to an Arduino, so I’m documenting it here, as much a reminder for me in case I want to go back to it, as for anyone else who can use it.

Tom Igoe’s stepper motor circuits page shows most motors as requiring a certain sequence of pulses on the four control wires of the motor:

Step wire 1 wire 2 wire 3 wire 4
1 High low high low
2 low high high low
3 low high low high
4 high low low high

However, all this does on the SMCC-547 is make the motor wiggle nervously.

By successively bringing each input HIGH I was able to learn that the correct logic for this controller is to bring the ABCD inputs high in order to make the motor rotate clockwise: A-B-C-D, and to make the motor rotate clockwise, do the inverse: D-C-B-A.

This required writing an Arduino sketch (program) from nothing, but after an hour or so I had this demonstration circuit running. A light sensor is connected to analog pin 0 on the Arduino. In the demonstration sketch, if there is lots of light on the sensor, the motor turns clockwise, and if the sensor is shaded, the motor turns counterclockwise. The sketch is shown below:

/*
Stepper Motor Demonstration
for SMCC-547 Stepper Module

by Michael LeBlanc
NSCAD University
mleblanc@nscad.ca

It checks analogPin(0) and if it is higher than 512,
it rotates the motor clockwise, otherwise counterclockwise.

August 27, 2009
*/

/*
**************** N O T E **************************************
This unit does not work with the stepper.h library.
It works by setting one pin high and the others low.
To rotate clockwise, set inputs high in order A-B-C-D,
and D-C-B-A rotates counterclockwise.
***************************************************************
*/

int analogPin = 0;
int activePin = 1;
int outputPin[5] = {0,10,11,12,13};

void setup()
{
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
Serial.begin(9600);
}

void rotateLeft()  // rotate counterclockwise routine
{
if (activePin == 4)
{
activePin = 1;
digitalWrite(outputPin[4], LOW);
digitalWrite(outputPin[1], HIGH);
}
else
{
digitalWrite(outputPin[activePin], LOW);
activePin = activePin + 1;
digitalWrite(outputPin[activePin], HIGH);
}
}

void rotateRight()   // rotate clockwise routine
{

if (activePin == 1)
{
activePin = 4;
digitalWrite(outputPin[1], LOW);
digitalWrite(outputPin[4], HIGH);
}
else
{
digitalWrite(outputPin[activePin], LOW);
activePin = activePin - 1;
digitalWrite(outputPin[activePin], HIGH);
}
}

void loop()
{
int v;
v = analogRead(analogPin);
//Serial.println(activePin);  // for debugging
if (v > 512) //choose any number between 0 and 1023
{
rotateRight();
}
else
{
rotateLeft();
}
delay(200); // this sets the speed of the motor
}

This sketch is somewhat “brute force,” but it works. A much more elegant solution would be to populate the array with 4-bit binary values and use bitwise shifting and boolean ANDing to assign each output pin of the Arduino a HIGH or LOW state; I found an example of this technique in the Arduino Playground.

Creative Commons License
Stepper Motor Demonstration for SMCC-547 Stepper Module by Michael B LeBlanc is licensed under a Creative Commons Attribution-Noncommercial 2.5 Canada License.