Tag Archives: Futurlec

Northwest Passage

nwpAs the first completed piece in the series “The Technology of Good Intentions”, “Northwest Passage” is an exploration of the difficulties and risks inherent in development and discovery. In the case of this piece, the end result is a water flow display. When there is no water flowing through the copper pipe, the display reads “noFlow”. When water flows, the display will read “Flow”. However, as experience has taught us, we can often get bogged down in solving a project’s many small technical details and fail to resolve one major one. In this case, while the software and computer hardware have been thoroughly tested, the fatal flaw is in the placement of the sensor: it is positioned out of the way of the water flow. As a result of this error, the display will always read “noFlow”. The title of the piece is a reference to the Franklin Expedition of 1845, which was lost in its search for the “northwest passage” from Europe to the Orient. The ships became trapped in ice and all perished.

The flow sensor is a simple switch which closes when an adequate flow of fluid passes through the device. The switch is connected to an Arduino ATMEGA8 microcontroller, which interprets the signal from the switch to change the reading on three two-element NFD-5421 14-element alphanumeric LED displays. The Arduino passes the data to the LED displays via one 74LS139 Dual One-of -four Decoder/Demultiplexer, and two 74HC164 8-bit Serial to Parallel Shift Registers. The Arduino code for this project can be found here under a Creative Commons Attribution-Noncommerical-Share Alike 2.5 Canada License. Parts for the electronics were sourced from futurelec.com and seeedstudio.com. The circuit schematic sketch is at the bottom of this post.

The electronic unit can be powered with four AA cells, which are hidden in a case behind the circuit board. If they are nickel metal hydride batteries, you can expect to get about 27 hours before the voltage drops below 4.5 volts. The battery performance curves, comparing two common NiMH types, can be viewed at the bottom of this post.

The ATMEGA8 is running at only 8 MHz, so it works very hard to keep up with the needs of the display shift registers; this results in a slight display flicker.

The most expensive component of this piece is the graphic, which is a high-quality inkjet print on semigloss paper and laminated to foamcore. It measures 175cm wide by 38cm high (69 x 15 inches).

As an aside, it is this project that I used to demonstrate my prototyping technique at instructables.com.

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.