Updating a ThingSpeak Channel Using an Arduino

Basics of ThingSpeak

ThingSpeak is a cloud based internet of things service that allows you to send HTTP requests to interface to a channel of data. You can send data, retrieve data, and even perform actions based on data values. You can configure an Arduino to send data readings to ThingSpeak using HTTP requests.

This video shows the basics of ThingSpeak

This video shows how to obtain data from ThingSpeak

This video is a demo of the ThingSpeak<->Arduino project

Arduino-ThingSpeak project sketch:  elen215_thingspeakandwebserver

Animatronic Hand – Student Project Fall 2014

This project, constructed by Brad Billwiller, uses an Arduino Uno as the interface between a glove and a mechanical hand.  Flex sensors on the fingers of the glove change resistance as the fingers are flexed.  This change of resistance is detected by the Arduino and the amount of flexion (i.e. change of resistance) determines how much to turn a servo motor (one for each finger).  The servos are connected to fingers of the animatronic hand via fishing line and when the fishing line is pulled by the servos the fingers flex.

Continue reading “Animatronic Hand – Student Project Fall 2014”

2D Plotter – A Student Project from Fall 2014

This project, built by Nathaniel Nolt, reuses a couple of old CD ROM drives from a computer, an Arduino Mega and a stepper motor control board to create a 2 dimensional plotter. The plotter is built from mostly scrap parts.  The CD ROM drives were obviously reused, but the project also reuses a switching power supply from an old Nintendo Wii as well as scrap sheet aluminum, aluminum tubing and other hardware.

The picture above is a top down view of the plotter.  On the left hand side, you can see the stepper motor controller which is plugged into an Arduino Mega underneath.  In the middle is a yellow sticky note with the pencil at the bottom right.  On the right hand side is the motor and linear motion assembly from the CD ROM drives.  To draw the y-axis, the pencil moves up and down; to draw the x-axis, the sticky note moves left and right.

The plotter uses the Sprinter firmware to interpret GCode commands and control the stepper motor.  A PC running Universal Gcode Sender v1.0.5 is used to send GCode commands to the plotter.  GCode can either be entered into a command line or can come from a file.  This picture shows the result of a trial run:

According to Nathaniel, he sees this as a prototype for a larger system that would become a router based CNC.  I’ll keep you posted if he makes progress on that more ambitious project.



First Year Electronics Projects 2014

Students in the Introduction to Electronic Engineering Technology class at Okanagan College are required to complete an electronics project for the course.  The course is a first semester course and so many students have never put together an electronics project before.  On the other hand, there are some students who have been electronics enthusiasts for a while and so have played with electronics before.  The projects do not have to be original, students do not even have to design it themselves, they just have to put it together and explain in detail how it works.  Class and lab sessions for three weeks at the end of the semester are dedicated to the project which gives about 16 hours of in class time to work on the project.  Many students spend a lot of time working on the project outside of class as well and almost all of the projects use an Arduino.  The following shows most of the projects that were completed in the Fall 2014 semester (stay tuned for details on each project):


Bella Coola Smart Grid

Clayton Falls

Image: Matt and Betty: Clayton Falls License:  CC BY-NC-SA 2.0

The electrical grid in Bella Coola is an isolated micro-grid.  That is it is not connected to the main grid; all of its electricity is produced and consumed locally.  The two primary sources of electricity are a 2.1MW run-of-river hydro installation and 6.2kW of diesel generators.  The Hydrogen Assisted Renewable Energy Power (HARP) project is a project whose purpose it is to reduce the dependence of Bella Coola on diesel as a source of energy.  According to a smart grid report from General Electric (one of the organizations involved in the HARP project), the peak consumption in the valley is about 4.7MW and the average consumption is about 3.2MW.  The purpose of the HARP project was to store some of the energy from the hydro installation during non-peak hours in hydrogen fuel cells, and then use the stored energy during peak hours to offset some of the diesel usage.  From what I can gather, this cycling of storing and then using the energy will be on a daily basis.  Store energy at night in the fuel cells and use it during the day.

The reported savings will be 200,000 liters of diesel a year.  Here are some rough calculations to support that number.  According to the GE report mentioned above, the storage capacity of the fuel cells is 3.3 MWh (MegaWatt-Hours).  If you assume that about 3 MWh can be stored at night and then consumed during the day every day of the year, at 67% efficiency then the fuel cells will be offsetting  3MWh * 365 * 0.67 = 733.65 MWh.  Further, if you assume that diesel contains about 10 kWh/liter and diesel generators are about 35% efficient, then 200,000 liters of fuel  will deliver 10kWh/liter * 200000 liters * 0.35 = 679,000 kWh = 700 MWh.  That’s pretty close to what we estimated the fuel cells would be able to deliver.  Obviously there are a lot more subtleties that would go into the actual calculations, but as an estimate, we’re pretty close.

The other main aspect of the installation (and in fact what makes the Bella Coola microgrid a “smart grid”) is a microgrid controller from GE that automatically determines what should be turned on/off to respond to changes in demand.

This all sounds fantastic and sustainable and green and fantastic (oops, I said that already), but how much diesel did the community use before these updates, and what percentage of their diesel use are they replacing with the HARP system?  I would like to know these numbers and even further, I would love to see this community and others like it replace 100% of their diesel use with non-carbon producing sources.  Bella Coola seems to have potential for even further micro-hydro production, so I wonder if they have any future developments in the works.

To give a rough answer to my first question in the above paragraph, it looks like there is an average of 1.1MW of power production shortage between the production from the Clayton Falls microhydro plant and the average consumption.  This is making another assumption that Clayton Falls produces an average of 2.1 MW of power, but I think that that number is the peak, not the average.  Let’s go ahead with the calculations anyway…therefore, in a day, the energy shortfall will be 1.1MW * 24 hours = 26.4 MWh.  HARP is providing 3 MWh per day, which is 11.4% of the shortfall (3/26.4 * 100).  So, if my assumptions are anywhere near correct (and they may not be), it looks like in the absolute best case scenario, Bella Coola is saving 11.4% of the diesel that they used to consume.  That’s a good start.

Bella Coola Microhydro

Clayton Falls Microhydro

A few years ago, I went to visit some family in Bella Coola.  In case you don’t know where Bella Coola is, it’s about half-way up the province of BC right on the ocean (it’s actually at the end of a long inlet from the Pacific Ocean).  It’s an isolated and beautiful spot with about 2,000 people living in the area.

Bella Coola River Sunset
Image: Tyler Batty – River Sunset 2. License:  CC BY-NC 2.0

Aside from all of the beautiful scenery, Bella Coola has some excellent and very visible examples of electronic and electrical infrastructure in action.  The Bella Coola Valley is on its own isolated electrical grid.  All of the electricity used in Bella Coola is generated locally from two main sources, a 2.1 MW run-of-river generator and a 7 MW diesel generator.  Peak power demand in the valley is about 3.8 MW, so there is an ample supply of electricity.  The problem of course is that diesel generators produce high levels of greenhouse gases and are also very expensive to run, so there are plans in the works and being implemented to reduce the dependency on diesel.  Before I get in to that, I’ll describe the run-of-river installation first.

Clayton Falls

Clayton Falls Bella Coola

Clayton Falls is a scenic waterfall just outside the town of Bella Coola.  It also has a 2.1 MW run-of-river generator using some of the water that would otherwise go over the falls pictured above.
Clayton Falls Microhydro

I would have loved to have had a tour when I was there, but I didn’t have a chance to set one up.  I did manage to get some pictures:

The Building housing the turbine and generator

The tail race (which can give you an idea of how much water is flowing through…there’s a lot and it is actually still flowing fairly fast)
Clayton Falls Microhydro Tail Race

The buried penstock (or at least the ground underneath where the penstock lies)
Clayton Falls Microhydro Buried Penstock

Penstock Entrance to Turbine Building

I was unable to find any information showing the distribution of power output over the year, but the winter time has the lowest flow.  Unforturnately, the biggest demand for power is also the winter, so the diesel generators are required to make up the large difference between the microhydro supply and the demand.

Stay tuned for another post about the Bella Coola smart grid as well as some projects that are in the works to reduce and maybe even eliminate Bella Coola’s reliance on diesel generation.

Solar Panels on C Building at Okanagan College (Part 2)

This post describes the electrical and electronic circuitry installed that controls and monitors the power generated by the two 130 watt solar panels installed above the electronics lab.  A previous post describes how I installed the panels.

The Okanagan College facilities management was instrumental in getting the panels actually hooked up and generating power.  They gave us permission to put the panels on the roof and even did all of the electrical installation.  The electrical installation needed to be done by an electrician and Zdenek did a fantastic job not only with the installation, but also with laying out the wiring in the installation to make it easy to see and trace (this was very important since the electronic circuit is to be a teaching/demonstration platform for solar energy).  So a special thanks to Zdenek and facilities management department for helping out with the installation.

The wires from the solar panel came in through a conduit in the roof.  In this picture, you can see the conduit at the top and the electronics in the background.

Conduit and PV Electronics

Here is a closer, if unexciting, look at the conduit:

Conduit from Solar Panels

A more exciting and closer look at the layout of the electronics:


The DC voltage from the solar panels comes in to a DC-DC converter at the right. Next to that is a 12 volt, deep cycle, 18Amp-hour battery.  To the left of the battery are some shunts for measuring the charging and discharging current and connected to the shunts is the monitoring equipment.  Finally on the left hand side is the inverter which converts the 12V DC voltage into a 60 Hz, 120V (RMS) AC voltage.

DC-DC Converter

DC-DC Converter with Maximum Power Point Tracking

This DC-DC converter outputs 12 volts regardless of what the solar panel is providing as input.  Since the sun intensity falling on the solar panels can vary throughout the day and throughout the year, the DC-DC converter is a very important piece of electronics for ensuring that the voltage level used by the system stays constant.

This particular converter is a Solar Boost 2412 25 amp, 12 volt Maximum Power Point Tracker (MPPT) photovoltaic battery charge controller from Blue Sky Energy.  Given the voltage and maximum current outputs, what do you think the maximum power output of the DC-DC converter is?

In the picture above, you can see 6 screw connections along the bottom.  The two on the right connect to the PV panels and the next two connect to the battery.  The two that are not connected can be used for charging an auxiliary battery.

Take a look at all of the components in the circuit.  See how many you can identify.  I was interested to see that they use a PIC microcontroller from Microchip  which is a family of microcontrollers the students in the electronic engineering technology program become very familiar with.


DC-DC Converter and Battery

Next to the DC-DC converter is the 12 volt battery.  It is rated for 18Amp-hours which means, in theory, it could output 18 amps of current for 1 hour (or 9 amps of current for 2 hours) etc.  I actually undersized the battery a bit and should have chosen a larger one.  In the wintertime when there is less sun and therefore less energy to recharge the batteries when the bench is not in use, there might not be enough energy to run the lab bench solely from the solar panels.  In fact a couple of times, students had the computer shut off on them as they were working, but fortunately not too much work was lost.  We now plug the computers in to the wall outlets.

Monitoring Equipment

Four points are monitored in the system are monitored by the PentaMetric PM5000 Input Unit:

  • Battery Voltage
  • Current output from the DC-DC converter (source)
  • Current input to or output from the battery
  • Current to the inverter (load)

Pentametric Unit

To monitor the currents, three 100 amp, 50mV shunts are used.  These shunts work by inserting them in series with the point in the circuit you wish to measure, then the voltage across the shunt is accurately measured by the PentaMetric unit.  Since the resistance of the shunt is known, the PentaMetric unit can then calculate the current at the measurement point using Ohm’s Law.

Here is a closeup of the three shunts:

Solar Panel Shunts

The top one measures the current to the system, the middle one measures the current to the battery and the bottom one measures the current from the DC-DC converters.  Unfortunately the supplier mixed up the shunt for measuring the battery and it is rated for 100 A, 100 mV.  Since the PentaMetric unit is expecting 100A, 50mV, the current measurements that it does for the battery current are twice what they should be.  See if you can calculate the resistance of each of the two shunts (one drops 100mV at 100A and the other drops 50mV at 100A).



Finally, the inverter converts the 12V DC signal to a 60Hz, 120V AC signal.  The inverter is a pure sine wave with less than 4% total harmonic distortion.  Inverters involve some pretty cool electronic circuitry which maybe I will get in to in a later post, but basically they take the DC input and using transistors and some control circuitry switch the input between positive and negative which creates a square wave.  Then the signal is filtered to eliminate the harmonics and create a sine wave.
Solar Panel Inverter

The inverter then connects through a fuse to a standard three-prong wall outlet.