Friday, August 30, 2013

Building High School Computer Labs

Many teachers spent this week organizing classrooms and curriculum or coaching some early Fall sports in preparation for the first day of school next week. I had the unenviable task of converting 2 classrooms into computer labs - with a little help from admin, staff and students. I've lost count of the number of times I've built or upgraded labs during the summer, 7 or 8 I think. It has become routine. The task went very well this week so I thought I'd write about it, about what works and what doesn't, in case you find yourself tackling a similar project.

The 2 new labs at Craig Kielburger are classrooms so the projector and window blinds were already in place.

Last Spring after the decision was made to go ahead and use the classrooms the tenders went out to get more electrical circuits and network drops installed.  This usually takes 2 or 3 months to complete. We asked for drops and outlets around the room perimeter and on a jiffy pole in the centre of the room. We got outlets and network drops around the perimeter but only electrical in the jiffy pole. So now most of the drops and outlets are not in a good location for any layout that I could see. That leads to rule #1.

RULE #1: Make a scale drawing of the room and put scale tables, computers and chairs into it. Figure out precisely where you want the outlets and drops and then go into the room and mark those spots with a marker. Leave copies of the layout taped to the walls and in the hands of admin. This could be a summative project for some Tech. Design students.

Most of the labs I've built in the past had no windows. I was glad to see the blinds in good working order in this classroom and I hope they are enough since those windows face south! In the past the ventilation was a problem in a basement lab and 2 labs at the core of the building. If classrooms are normally a bit too warm then turning them into a computer lab is a bad idea.

We ordered 50 refurbished computers last spring and they were delivered during the summer and then set up by technicians to be ready to go. We still encountered some minor problems with a few of the computers after they were installed in the new labs so rule #2.

RULE #2: Ask for an IT technician to be on call on setup day.

The computer tables were ordered last spring but did not arrive until setup day - phew! Close one.

RULE #3: Insure that all the materials you might need are in the building before setup day.

The classrooms still had books and unwanted shelves in them. Fortunately some staff were around in July and agreed to clean out what they could. Our caretaker took care of the rest.

RULE #4: Work with the caretaker. No one likes surprises or being left out of plans that affect them.

The admin were supportive and it goes without saying that losing 2 classrooms is going to make timetabling tough. Purchasing all the hardware and wiring takes planning and work by admin and staff so make sure everyone is kept up to date on the projects progress.

RULE #5: Work with admin.

Setup day actually spanned 2 days. During day 1 students hauled tables into the room, assembled them and then hauled computers into the room. Day 2 saw several student volunteer their day to position everything and plug everything in. Hopefully the word will get out that students built the lab - giving students the inclination to look after it.

RULE #6: Work with students. I've done one or two labs on my own. Its boring. This way students earn volunteer hours, I don't get a sore back and everyone has fun playing network games that are normally banned during school!

There we go. Some of my thoughts. I know I've missed something. Oh yea! Printers!

Wednesday, April 24, 2013

Raspberry Pi Computers in the classroom

On April 23 I hosted a student conference at Craig Kielburger Secondary School for students enrolled in the ICT SHSM program at my school and TA Blakelock HS in Oakville. In the morning the students enjoyed a Career Mash panel where 4 local business volunteers talked to the students about careers in the IT sector. Later the students heard about some of the excellent programs at Conestoga College including some degree programs like Integrated Telecommunications and Computer Technology Bachelors program. In the afternoon the students had 10 Raspberry Pi computers and had a First Look at this fascinating little computer.

Here is a quick 30 second video showing the students setting them up.


My August 6, 2012 post talks about my own Raspberry Pi set up. It still works well. The new kits comprise a Raspberry Pi, an Adafruit 1151 HDMI to VGA adapter, a 4 GB SDRAM card with the same version of Wheezy I used last August, mouse and keyboard, VGA monitor and 1A USB power supply. I had to modify the config.txt file and then clone 10 SD RAM cards for the students so that they would be able to boot up and get a graphics output to the VGA screen the first time. One of my students helped me out with this the week before the event and sure enough much head scratching ensued.

I started with my older version of Wheezy because I knew it worked with an HDMI to VGA adapter. I used a nearby Mac and an SD card adapter to quickly make changes to config.txt to try and find the correct settings for the Adafruit adapter. For the most part it looked to the other students as if we were staring at a black screen all afternoon! We were never able to get the latest version of Wheezy to display anything. That is why I stuck with my old version from last August. Adafruit's own forum was helpful in finally getting us going. These 2 commands will tell you which video modes the adapter supports:
/opt/vc/bin/tvservice -m CEA    // to get the CEA modes
/opt/vc/bin/tvservice -m DMT    // to get the DMT modes
It turns out that our brand new adapters only support CEA mode 1 (640 x 480 VGA), or just about the lowest resolution you can imagine. I'm waiting to see what Adafruit says about this.

Despite being limited to 640 by 480 the students quickly figured out how to make Scratch and Idle work to make Hello World programs. They got into the console and were able to use the command line for directory listing, running nano, ifconfig and ping and use the internet to find answers to their questions. There was much positive response and interest in learning more about this device. I'm going to repeat this exercise in a couple of days with some high school teachers.


Monday, January 7, 2013

Making Arduino Shields in the classroom

Last month I challenged my grade 12 Computer Technology class to make traffic light simulator Arduino Shields. We used Fritzing to lay out the traces and Inkscape to make them thicker. We used a laser printout as a mask to etch the boards and finally the students put their skills to work assembling and programming the shields.

FRITZING
Fritzing.org is the source for a free neat circuit board layout utility. You can also use Fritzing to make schematics and bread-board layouts. I have tried to use Fritzing to do the bread-board, schematic and PCB all at the same time but the process became too complex and frustrating. Its better to use Fritzing to do one thing at a time. If you want to do a PCB, start there. As a teacher I like to use Fritzing to do bread-board layouts that my students can follow. I will lay out the circuit and then take a screen shot to generate the diagram.

When you pull an Arduino into the PCB in Fritzing you see two rows of points that match the i/o pin configuration. At this point you need to remember that the headers will be inserted from below and soldered on this side, the PCB trace side of your project. Components like resistors can be inserted on the underside as well but components like LEDs need to be seen and other components like transistors are too tall. These components need to be soldered onto the PCB trace side of the shield (see photos below). This is somewhat irregular but students who had minimal soldering practice were able to do this without any problems. I buy SH-2 snappable headers. You get 40 pins for 69 cents. Clearly you need to have a good understanding of the circuit before you begin. My students completed several labs involving LEDs and push buttons before starting this assignment.

Here is a dual H bridge shield layout in Fritzing.

Export the file as an 'etchable' SVG file. We use Inkscape to increase the trace width to 4 px and the donuts to 3 px. Group and flip horizontally. Print it out using a laser printer.


ETCHING
Next a piece of copper clad board is cut to size and the edges sanded. Safety glasses and a dust mask should be employed. The board is cleaned with acetone then buffed with an abrasive nylon scouring pad to get it as clean and shiny as possible. Real elbow grease should be employed. Finally the board is cleaned with rubbing alcohol. We use Nitrile gloves to protect our skin from the chemicals.

The printout is cut to fit the board and then arranged on top of the copper clad board toner down. The arrangement is passed through a common office laminator set to high at least 20 times in a row. After the second pass the paper becomes stuck to the copper and will not move. After 5 passes you will need pliers or tweezers to handle the hot board. This process fuses the toner into the copper. Let the board cool for 5 minutes and then place it in a bowl of water. After 5 to 10 minutes you can remove a thick layer of the paper by rolling your thumb over the surface. Check first to see if more soaking is indicated by carefully working on a corner. (Thats why I add some text to one corner of the board.) With the first layer of paper gone another 5 to 10 minute soak and you will be able to 'roll' the rest of the paper off. Let your board dry over-night.

We use hot Ammonium Persulphate etchant in a bubble tank to do the etching. The hotter the better but watch out for the fumes. A fume hood or exhaust hood is mandatory because the ammonia gas can burn upper respiratory tissue. Nitrile gloves and safety glasses should be employed. A lab coat will keep your Maple Leafs Hockey Jersey clean. For ease of handling we drill a small hole in one corner of the board and hang it from a popsickle stick using some string. When the board is done etching wash it with water, dry it and then wash the toner off with more acetone. Buff up the copper using the scouring pad just before soldering your components in place.

Why use Ammonium Persulphate? The alternative is Ferric Chloride. This liquid is black and stains anything it touches. Even one drop in a stainless steal sink will discolour the sink almost instantly. When the Ammonium Persulphate is exhausted and has turned dark blue you are left with a strong solution of Copper Sulphate which can be used to grow Copper Sulphate crystals by evaporation. Either chemical should go to a hazardous waste depot when you are done with it.

ASSEMBLY

Top view: Two set of lights (RYG) and one Walk-Dont Walk (RG) with a PB to call for a walk signal. Notice how the LEDs and PB are soldered to the copper trace side of the board.



Bottom view:


All the resistors in the traffic light simulator tie in to ground so we used a 330 ohm SIP Common Bus package bent at an angle to avoid hitting the Atmel chip on the Arduino. 

Once the package is ready to test insert shield onto the Arduino and start by rewriting Blink to test each LED independently. If you get a USB bus overload warning on your computer you need to unplug the Arduino immediately and test your circuit for shorts. We found it was best to leave the shield in place on the Arduino until the project is finished and marked.

Thursday, January 3, 2013

Line Follower part 2

In the next phase of this project I attached 2 QRE 1113 Line Sensor breakout boards to the Arduino Line Follower and tried out a simple line-following algorithm.



I decided to put the QRE1113 breakout boards onto movable arms so that I could experiment with the spacing between them.  The breakout boards themselves are soldered to 3 lengths of 22 gauge hookup wire. Three different wire colours makes hookup simpler. The wires are enclosed in a 3" length of straw. The arms are made out of found pieces of plastic moulding attached to the Line Follower base with a single #6 bolt and nut. The hole for the straw is a tight fit so that the height of the QRE1113 can be easily adjusted.


The QRE1113 is connected to +5V power and ground and the signal wires (out) connected to digital inputs 2 and 3.
This is the code used to verify the operation of the detectors:
//Code for the QRE1113 Digital board
//Outputs via the serial terminal - Lower numbers mean more reflected
//3000 or more means nothing was reflected.

int QRE1113_Pin = 2; //connected to digital 2

void setup(){
  Serial.begin(9600);
}

void loop(){

  int QRE_Value = readQD();
  Serial.println(QRE_Value); 

}

int readQD(){
  //Returns value from the QRE1113 
  //Lower numbers mean more reflective
  //More than 3000 means nothing was reflected.
  pinMode( QRE1113_Pin, OUTPUT );
  digitalWrite( QRE1113_Pin, HIGH );
  delayMicroseconds(10);
  pinMode( QRE1113_Pin, INPUT );

  long time = micros();

  //time how long the input is HIGH, but quit after 3ms as nothing happens after that
  while (digitalRead(QRE1113_Pin) == HIGH && micros() - time < 3000);
  int diff = micros() - time;

  return diff;
}


The simplest line following algorithm is to stall the wheel on the same side causing the platform to move away from the line. If the left hand detector encounters the line then the left hand motor stops for a period of time while the right hand motor continues causing the platform to turn left or away from the line. This assumes that the line is always between the 2 sensors. In the code below the amount of time the wheel stalls is the variable turn.


int M1F = 6; // motor 1 forward
int M1R = 5; // motor 1 reverse
int M2F = 11; // motor 2 forward
int M2R = 10; // motor 2 reverse
int turn = 120;
int forward = 2000;
int leftPin = 2; //left detector connected to digital 2
int rightPin = 3; //right detector connected to digital 3
int rightQRE_Value;
int leftQRE_Value;


void setup(){
  //Serial.begin(9600);
}

void loop(){
  rightQRE_Value = readQD(rightPin);
  leftQRE_Value = readQD(leftPin);
  //Serial.println(rightQRE_Value);
  //Serial.println(leftQRE_Value);
  if (rightQRE_Value > 100){
    analogWrite(M2F,0);
    delay(turn);
  }
  else if (leftQRE_Value > 100){
    analogWrite(M1F,0);
    delay(turn);
  }
  else{
    analogWrite(M1F, 150);
    analogWrite(M2F, 150);
  }

}

int readQD(int pin){
  //Returns value from the QRE1113 
  //Lower numbers mean more reflective
  //More than 3000 means nothing was reflected.
  pinMode( pin, OUTPUT );
  digitalWrite( pin, HIGH );
  delayMicroseconds(10);
  pinMode( pin, INPUT );

  long time = micros();

  //time how long the input is HIGH, but quit after 3ms as nothing happens after that
  while (digitalRead(pin) == HIGH && micros() - time < 3000);
  int diff = micros() - time;

  return diff;
}

A little adjustment to the speed (ended up at 150) and turn (ended up at 120) and the platform was able to follow this path.


Here is the PCB pattern for the dual H bridge:
... and reversed, ready to print: