Sunday, June 5, 2016

The Internet of Things part 1, the Yun

In the Internet of Things series I will explore the use of WiFi enabled microprocessors like the Arduino Yun and Digispark Oak as tools that students can use to learn how to connect devices to the Internet. The connection of devices and machines to the Internet to allow man-machine and machine-machine interaction is now embodied in the phrase "the Internet of Things". There has been an explosion of interest in industry and commercial markets as the price of WiFi technology comes down. A corresponding surge in the hobby, DIY field can be seen with an ever growing number of products and online tutorials and projects. The Yun was first released in 2013 with the same form factor and IDE as the original Arduino. Recently we saw the release of the Raspberry Pi 3 which has 802.11n and Bluetooth built in. The Digispark Oak, the Omega Onion and a host of other products aimed at the hobbiest, DIY and developer fields are becoming available.

In this post I will write about my first few experiments with the Yun. In the next few posts I will describe early experiments with the Oak and other WiFi enabled microcontroller solutions. I hope to be able to conclude with a wish list for enabling students to learn about this technology in a clean and consistent manner. My early experience with the Yun and Oak indicate that the technology is not straight forward nor for the faint of heart. I hope to finally compare and contrast all the solutions that I tried out.

The first step as it is with any of these things is to follow the Getting Started tutorial that comes with the device. I found that I could connect the Yun easily to my home network (Linksys) or my experiment router (Belkin with no Internet). At school I should be able to connect to our public network since the Yun does not require any special settings at the router. Some familiarity with ip addressing and the Linux OS helps but is not necessary.

"The Arduino Yún is a microcontroller board based on the ATmega32u4 and the Atheros AR9331. The Atheros processor supports a Linux distribution based on OpenWrt named Linino OS. The board has built-in Ethernet and WiFi support, a USB-A port, micro-SD card slot, 20 digital input/output pins (7 of them can be used as PWM outputs and 12 as analog inputs), a 16 MHz crystal oscillator, a micro USB connection, an ICSP header, and 3 reset buttons." - from the website.

The Atheros processor communicates with the ATmega microcontroller using a technology called Ciao Core.  This technology is incorporated into the Bridge library which must be included in your sketches.

Step 2 involved using the Yun just like any other Arduino to verify the correct operation of the following devices:
1. Photoresistor in series with a fixed resistor to measure analog light levels.
    Photoresistor wiring from Arduino Tutorial.
2. DHT22 to measure temperature and humidity. DHT22 wiring from Make Nation.

The sketch worked perfectly using the open source DHT22 Arduino library.

Step 3 used the Weather Station tutorial in Marco Schwartz's book the Internet of Things with the Arduino Yun. The tutorial uses a website/software stack called Temboo as a go-between a Yun and cloud apps like Google docs. You will need to have a Temboo account and a Google account.

Marco's book is 2 years old and Google has changed the way docs are accessed. Instead of good old username and password Google now uses the oAuth protocol. The Temboo website uses apps they call choreos that enable the flow of data from the Yun to be entered onto a spreadsheet. In order to set up a connection you must now run an initialization oAuth choreo and a Finalize oAuth choreo. As you go through the process you collect a client id, app id and other tokens that have to be copied into your code. You can follow the Temboo tutorial which gives you some Arduino Yun code that works. You can find my code, which integrates the original code from the book and the Temboo tutorial on Github. All the account information and tokens are in a separate file called TembooAccount.h. Make sure to change them to your own codes and information.

I found that I had to use my coding skills to solve a couple of issues. I think the level of complexity was medium to hard and beyond the average high school level. That said, I believe that senior high school students could tackle problems very similar to this one by following these directions and using my code. By similar I mean write some data to a spreadsheet collected from various sensors connected to a Yun. I think this has a very high cool factor and will encourage students, and others, to continue to learn and experiment with this technology.

Saturday, August 15, 2015

Rare and Cherished part 2

Now that the Pan Am and Para Pan Am games are over it is time to reflect on the experience I referred to on April 12, In that post I outlined a plan to allow students to use voluntary IT support work at the games as  high school coop hours. Over all this was a positive experience for the students but there were some hitches along the way.

Throughout May and June the students continued to self organize their on line and in person training and the collection of credentials from North York in Toronto. The students also received their shifts and it quickly became apparent that I had overlooked one important factor. Hours. High school students need to complete 180 hours on the job in order to earn their 2 credits. Most of the students did not have near enough shifts to make up these hours. Furthermore some students were conflicted out of the coop course by the necessity of summer make up credit classes. The students had to make up hours by taking on other coop positions at local IT related businesses or by completing some in school hours doing IT related work.. Some elected to give up their Pan Am shifts and work at local IT shops instead. Lesson learned? I should have asked for direct involvement in the students' scheduling at the games. Did it matter? Not much. The students did an excellent job tracking their own hours and all of them had great experiences at the games and at other placements. The students dealt with the "hours" problem through good problem solving and collaboration.

During a Pan Am games "test event" at the Milton Velodrome I elected to drop by to see how one of my students was doing. In a normal coop placement the coop teacher visits the students on sight on several occasions to familiarize themselves with the work place, discuss the learning objectives with the placement supervisor and check for student health and safety requirements. At the test event I had no problem locating the student and viewing the workplace. The volunteer that helped me find the right room was a teacher herself and understood my reason for being there. I was not prepared for the increased level of security at the actual Pan Am Games. Without some form of accreditation I was not going to be allowed onto the sight. The security staff were volunteers themselves and were just doing their job according to the rules. I had to be satisfied with brief emails, a couple of phone contacts and one face to face with a Cisco engineer. Bear in mind that the students' supervisors were themselves volunteers. Lesson learned? If it is a world class event you must have accreditation. Did it matter? Not much. The Pan Am games structure was very well organised and we already had a good look into that organization during our webinar sessions during the last 18 months. The students received good feedback from their supervisors at the games.

After reading the students' reflections and attending some Pan Am events myself I feel confident that the students had memorable and worthwhile experiences. They learned varying amounts about computers and networks but they all gained a good deal of confidence at communication, problem solving and teamwork. I think the Pan Am experience taught us that the GTA can handle any event, no matter the size and it taught me that my students are ready to be leaders in the next big one.

Wednesday, June 24, 2015

Neopixels and ATTiny 85 Arduino shields

This semester the grade 12s had to come up with a unique application of Neopixels using their own ATTiny 85 Arduinos that they built at the start of the semester. The application is implemented on an ATTiny 85 shield that the students design and etch in the classroom.  The shield interconnects the ATTiny 85 Arduino, a strip of 12 Neopixels and a DC Wall adapter type power supply. The shield uses a 9 pin header to connect to the home brew Arduino and screw terminals to connect the power supply and the Neopixel strip.

In earlier blogs I described the very successful ATTiny 85 home brew Arduino my students build in their high school classroom and some grade 12 challenges involving the design and construction of Arduino shields. Last semester the students built motor driver Arduino shields to operate two stepper motors extracted from surplus CDROM drives. The motors were used to drive a CNC pencil built on a simple wooden frame.  Another common challenge I have used in the past is a traffic light simulator built onto a shield. While very successful units were built the students could not work further with their shields unless they purchased their own Arduino Uno.  This year the students could put together their own ATTiny 85 Arduino with a shield to build a project that they can take home.

The shield needs to

  1. provide 5V power to the Neo pixel strip and the ATTiny 85 Arduino.
  2. provide a connection point for the Neopixel strip data and power
  3. contain a 9 pin header to connect to the ATTiny 85 Arduino.
  4. provide connections or house some kind of input such as a momentary push button, light sensor etc.
1. Power. 
The shield needs to support the large 1000 uF capacitor along with a 7805 regulator that takes anywhere from 5 to 25 volts input and keeps the output pin at 5V. C2 provides rf filtering at 0.1 uF. In the photo above you can clearly see the 7805 in front of the large 1000uF capacitor. 6, 7.5 and 9 volt adapters, 200mA or more worked best. 12 and 15 volt adapters caused the 7805 to reach temperatures of 140 degrees C when all 12 pixels were on at full power - white. A couple of students worked directly from 5 volt adapters and had no problems. 5 V switching power supplies are recommended. 30 Neopixels can draw a whopping 2 A current.

2. Connection point.

J1 and J2 are power in and 5V power out. By combining the 2 ground screws into one screw we can use the last unused screw terminal for the data - out to the Neopixel shield. Many of the student designed shields also provide connection points for external sensors.  The shield shown above contains 2 push buttons and between the 7805 and the capacitor is a 3 pin header providing power and data to and from any Arduino compatible sensor. This is the layout for the board shown above done in Fritzing. Soldering wires to the Neopixel strip proved to be a little difficult. Too much stress on the connection will cause the copper to delaminate from the plastic and break off. We glued the pixels down with double sided tape to help prevent this from happening.

3. 9 pin header

The 9 pin header connects our shield to the ATTiny 85 as shown in the photo above. In the diagram the top pin is 0, ground.
1 is unused. On the ATTiny 85 Arduino pin 1 is the reset button.
2 is an extra input for an analog sensor - logical Pin 3.
3 S1 (pushbutton) - logical Pin 4.
4 is unused. It is another ground.
5 Neopixel data - logical Pin 0. In the next revision I will add a 300 ohm resistor in series between the header and the screw terminal to help protect the Neopixels from excessive current on the data line.
6 is unused.
7 S2 (pushbutton) - logical Pin 2.
8 5V power.

4. I soldered in a small 3 pin female 0.1" header so that I could easily connect a sensor that provides an analog or digital voltage.  From top to bottom: data, +5V, gnd.

Here are some examples of the boards and functions the students came up with.

A game using counters.

Light pattern selected by pushbuttons.

Light pattern controlled by a single push button.

Other projects included:
- tic tack toe
- lights controlled via bluetooth from a smart phone
- lights controlled via an ultrasound ping detector
- lights controlled by a temperature sensor

Sunday, April 12, 2015

Rare and Cherished

I’ve been a high school technological studies teacher in Ontario for 27 years. Very early in my career I learned that what students enjoy and remember is the extraordinary. Students tackle thousands of math problems during their education but the measuring, cutting and calculating needed to build something physical are the problems they enjoy and remember. Students learn about economics and history but raising money for a team or a cause are events that stand out. Students learn Newton's Laws in Physics class but applying those lessons to build a working trebuchet is an exercise they’ll remember forever.

Teaching Computer Technology, I know that students learn more and have more fun by building a video editor computer or by building a robot. More than the curriculum, life lessons of the importance of teamwork and cooperation will put these students on a more solid footing then any textbook.

Cisco Canada is the official technology partner of the TORONTO 2015 Pan Am/Parapan Am Games and Cisco Networking Academy students will be taking part in networking the games. I knew immediately that this could be one of those extraordinary experiences; learning that extends and goes beyond the curriculum with life and work meta skills thrown in for good measure. When Wadih Zaatar, Cisco’s Networking Academy lead for Canada, told me about his company’s role in the TORONTO 2015 games and the plan to enroll students through Cisco’s I CAN Develop program, I said yes right away. I started to recruit grade 10 students who would be in between their grade 11 and 12 year during the Games. 

The idea is simple. High school students enrolled in an ICT Specialist High Skills Major program earn two mandatory Cooperative Education credits by taking on ICT support roles at the TORONTO 2015 Pan Am/Parapan Am Games. The timing doesn’t fit the normal mould of the summer Coop course, but the learning opportunity is incredible. I decided to  join my students in the role of summer Coop teacher. Why? Because I’m excited about participating and contributing to the success of the TORONTO 2015 Pan Am/Parapan Am Games.

In the spring of 2014 the students were still in grade 10 and hadn’t started the SHSM program. Nevertheless they chose to stay after school once a month for TORONTO 2015 Pan Am/Parapan Am Games webinars where they met key people, heard key messages and learnt about their role in the Games and the I CAN Develop program.

But the TORONTO 2015 Games aren’t the only opportunity for my students to learn through the practical application of skills. Many of the students participating in the Games are also on my First Robotics team, 4992, the Spartans. The First challenge is to build a 50 kilogram robot in just six weeks. Every year the tasks the robots perform is new, and therefore an engineering challenge. The robots compete in three day-long events where they work in teams. High scores are awarded for both cooperation as well as task completion.

In the midst of our robot build season the students took a day off to attend Cisco’s I CAN Develop kickoff on Saturday, February 7 in Toronto. I’m exceedingly proud of the way the students organized themselves to travel independently and represent Craig Kielburger Secondary School. As I write this piece our second and last robotics competition for 2015 is drawing to a close. The team did well and made it into the playoffs. 

Now I will be able to devote more time to getting ready for the TORONTO 2015 Pan Am/Parapan Am Games this summer. My supervisors at the Halton District School Board support this extraordinary summer internship opportunity. They know that experiences like this one are rare and cherished.

"Trebuchet2". Licensed under Public Domain via Wikimedia Commons -
This blog post is repeated at

Monday, February 16, 2015

FRC 4992 Final week. Introducing Admiral Grace Hopper.

We are into the home stretch of the FRC "build season" and all of the planning, testing and pre-assembly came together during the last week as the students finally completed the base and attached the lift, winch and arm mechanisms to complete our entry. The team worked hard throughout January and also learned a great deal about design and engineering. I was gratified to see the team using our own desktop CNC mill to make aluminum parts and our new 3D printer to make plastic parts to help bring it all together.

The team also decided to draw inspiration from one of the most important people in the history of modern technology and name the robot after her. The well crafted autobiography of Admiral Grace Hopper by Gillian Jacobs will help you to see why the team chose this name.

Programming the Harvard Mark 2 computer must have been a daunting task. Many of the challenges must have been unanticipated. Building an FRC robot is like that too. Many of our challenges could have been more easily overcome through better planning and better organization and of course some just could not have been anticipated. In our second season I have come to realize that it will be necessary to codify better preparation and organization so that the planning and building will go smooth from year to year. This work is necessary because the team of students will change every year as the younger ones gain more experience and the older ones graduate and leave. At this point, with one day left to work on the robot, I am left thinking about this past fall semester and how to make it all work again from year to year. As a teacher it is easy to dream up a curriculum and start designing lessons but another challenge here is that this is a club. The students attend, or don't, depending on how they feel about the activity. If the pre-build season club meetings are all about lessons and skill development the students may feel it is too much like another class. The organization of the team will need to be such that the learning and skill development is student driven. They must feel the need to learn and practice skills through a will to succeed and perform well at a later date. A tough task with a generation so used to immediate gratification.

Admiral Grace Hopper is a good name for a robot. Hopefully it will make the students reflect on an era when solutions took methodical planning and months of work to accomplish. And hopefully they will ponder the outright determination it takes to start out being rejected from the navy for being too old and too small and to work your way up to the rank of admiral.

Saturday, January 17, 2015

FRC 4992 Learn by doing mock-up

It is week 2 in the FRC 2015 build season and team 4992 has made some great plans for a drive and lift system. We were at school all day today working on plans and looking for parts. Many of the parts we ordered earlier this week will not be in until next week but I wanted to make something happen. I challenged the students to build a mock up lift system so that we could look at the pitfalls and challenges. We took the ball grabber off of last years robot and turned it upside down to use as a winch. Up-rights out of wood and nylon rope from the back of my van completed the build.
I enjoyed watching the students work on this project and it is easy to see that this is the best kind of learning. We could see it work - sort of. We could use the mock-up to discuss and further refine the plans for the competition robot. We could see the students learn about making plans that are accurate and that use materials that can be sourced.

If you read my posts about the build season last year you will see that I was the lone adult working with this group during the build season. This year there are 2 other adults. What a difference! Thank you team 4992 mentors.

Wednesday, December 31, 2014

A first look at the Digispark Pro

The ATTiny85 Arduino in my last post was based on the Paperduino - which in turn is based on the Digispark board from  They had a Kickstarter campaign going for the Digispark Pro kit. You could order these tiny Arduino compatible microcontroller boards along with an impressive array of shields. I ordered a couple of Pro boards along with a few different shield kits and they finally arrived a few weeks ago. I've had a bit of spare time so I was able to put together a couple of shields and try out this board.

Pictured are the Digispark Pro board, DigiLED shield and Charlieplex shield.

The Digispark Pro board comes ready to use. You can solder on some supplied female headers to do prototyping or to plug in shields. The USB connection is USB Micro-B. Like the ATTiny 85 the board is unplugged when you start uploading and plugged in when the IDE gives the prompt message. And just like the ATTiny 85, some of the i/o lines, pins 3 & 4 in this case,  are also used for serial communication which means that some circuits will interfere. When this happens the circuit or shield needs to be disconnected during upload and then reconnected after the software is loaded. This can slow down debugging. This board uses an Atmel Attiny85 MCU with about 6 KB of flash memory.

The DigiLED shield kit comes with what looks like an RGB LED. In fact the device is a smart RGB LED or WS2812 compatible LED. These LEDs have become very popular with hobbyists because they contain registers and other circuitry that allows them to be daisy chained. A large number of LEDs can be controlled using just 3 wires! Power, Ground and Data. The price of these LEDs is under a dollar. In fact you can buy a NeoPixel ring with 60 LEDs prewired. The provided code is hard on the eyes. Its easy to make loops that fade each colour in and out for a more pleasing demo.

The Charlieplex shield shows how to control 20 LEDs using just 6 data lines. The Charlieplex trick is to remember that a digital i/o pin can have 2 states in Output, 0 or 1 (ground or +V) and that when set as "Input" the pin really has a third state called Hi Z or high impedence. In the Hi Z input state the pin acts as neither ground or +5 V and more like an open circuit. The Charlieplex LEDS are cleverly wired so that each LED is separately addressable via a combination 1 Hi output and 1 Low output while keeping the rest of the pins at Hi Z.

The Digispark Pro board looks like it could be used in the classroom as long as the students are careful and patient. The low price means that the odd burn out won't be a major pain to the budget. It will be interesting to see how the unit fairs doing some of the basic Arduino tutorials we use in grade 10 and 11.