All prices in Canadian dollars. Free shipping on orders over $150!

News

June 12, 2017

Posted in neopixel, projects, store news


Clap on 👏👏, Clap off 👏👏

The offices next to Elmwood's must be wondering what we've been up to over the last couple of days. They would have heard sudden bursts of applause, then giggling, then more applause, and so on. There is, I can now reveal, a very good reason for this odd behaviour.

We've been testing Verbal Machines' Hand Clap Sensor VM-CLAP1. While it might look a bit like a cheap “noise detector” board, VM-CLAP1 has a bunch of clever signal processing built in so that almost all background noise is filtered out. Only handclaps or finger snaps will make the sensor trigger, and will do so over a range of a few metres.

We tried it with a speaker blaring right next to the microphone, and it could still pick out our handclaps over the noise. Really short percussive sounds like sharp snare hits might confuse the VM-CLAP1, but the board makes audio control of your electronic projects much simpler.

VM-Clap1 is really easy to set up, with only three connections:

  1. GND – to your system's ground
  2. PWR – anything from 2.5 – 5.5 V, so it will work with all common micro-controller project boards, including the Raspberry Pi. It draws only 1.7 mA at 3 V, too.
  3. OUT – this is an open collector output, which means the sensor sinks current when it is triggered. To use it with an Arduino, be sure to set INPUT_PULLUP for the VM-CLAP1 pin, or use an external pull-up resistor. Output is normally HIGH but is held LOW for 40 m/s when triggered.

I've written a couple of Arduino demos to show off what the VM-CLAP1 can do. The first is a very simple “clap twice for on, clap twice for off” script that switches the built-in LED on and off. Flashing LED_BUILTIN is no big deal, but choose a different pin, add a coffee maker and a Power Switch Tail II, and you've got a clappuccino machine!

Wiring is as follows:

  • OUT → Pin 2
  • PWR → 5 V or 3.3 V
  • GND → GND

And here's the code for Arduino:

/*
    Verbal Machines VM-CLAP1 sensor test
    clap twice within ¼ second to turn Arduino LED on or off

    by  scruss - 2017-06
    for Elmwood Electronics - https://elmwood.to/

    Sensor wiring:

      OUT   → Arduino Pin 2 (use INPUT_PULLUP)
      PWR   → 5V or 3.3V
      GND   → GND
*/

#define CLAPIN  2             // pin must be interrupt-capable
#define CLAP_DELAY   250      // max gap between claps to trigger

volatile boolean clap = false;                // clap detected state
boolean led_state = false;                    // LED on/off state
unsigned long clap_time, last_clap_time = 0;  // clap time records

void setup() {
  pinMode(CLAPIN, INPUT_PULLUP);
  pinMode(LED_BUILTIN, OUTPUT);     // control built-in LED by clapping
  Serial.begin(57600);
  Serial.println("# Clap sensor test ...");
  attachInterrupt(                  // register Interrupt Service Routine (ISR):
    digitalPinToInterrupt(CLAPIN),  //   pin to watch for interrupt
    heard_clap,                     //   void function to call on interrupt
    FALLING                         //   trigger interrupt on HIGH → LOW change
  );
}

void loop() {
  digitalWrite(LED_BUILTIN, led_state);  // set LED based on clap status
  if (clap) {                       // we heard a clap from ISR
    clap = false;                   // make sure we don't trigger again too soon
    last_clap_time = clap_time;     // store old clap time
    clap_time = millis();           // note current clap time
    if (clap_time - last_clap_time < CLAP_DELAY) {  // if two claps heard in ¼ s:
      Serial.println("clap clap!");                 //   notify
      led_state = !led_state;                       //   and switch LED state
    }
    else {
      Serial.println("clap!");                      // notify of only one clap
    }
  }
}

void heard_clap() {
  clap = true;      // just set clap state in ISR
}

 The next demo is a "clapometer", where we use an Adafruit NeoPixel Stick - 8 x WS2812 5050 RGB LED as the indicator. The faster you clap, the more LEDs light up - and in different colours, too!

Wiring is as follows:

  • VM-CLAP1 Sensor OUT → Pin 2
  • VM-CLAP1 PWR → 5 V or 3.3 V
  • VM-CLAP1 GND → GND
  • NeoPixel stick DATA IN → Pin 6
  • NeoPixel stick PWR → 5 V
  • NeoPixel stick GND → GND

You'll need to install the Adafruit NeoPixel Arduino Library to use the code:

/*
    Verbal Machines VM-CLAP1 sensor test
    clapometer with neopixel output

    by  scruss - 2017-06
    for Elmwood Electronics - https://elmwood.to/

    Sensor wiring ("open collector"):

      OUT   → Arduino Pin 2 
      PWR   → 5V
      GND   → GND

    8 Neoxpixel strip on Arduino pin 6
*/

#define CLAPIN          2     // pin must be interrupt-capable
#define CLAP_INTERVAL   600  // time over which claps are counted
#define MAX_COUNT       7    // max claps to count
#define NEOPIN          6     // 8 px strip on pin 6
#define NUMPIXELS       8     // 0 ..7

// this is a colour table of pleasing(ish) HSV hues:
unsigned long hues[] = {0x7F0000, // 0 degree hue
                        0x7F5F00, // 45 deg
                        0x407F00, // 90 ...
                        0x007F40, // 135
                        0x007F7F, // 180
                        0x00407F, // 225
                        0x40007F, // 270
                        0x7F005F  // 315
                       };
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif

volatile boolean clap = false;          // clap detected state
unsigned long clap_times[MAX_COUNT];   // clap time records
int array_pos = 0;                      // index of current time record
int clap_count = 0;                     // count of claps within CLAP_INTERVAL
unsigned long current_time = 0;
int i, j = 0;
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, NEOPIN,
                           NEO_GRB + NEO_KHZ800);

void setup() {
  pinMode(CLAPIN, INPUT_PULLUP);
  Serial.begin(57600);
  Serial.println("# Clapometer ...");
  pixels.begin();
  for (i = 0; i < NUMPIXELS; i++) {
    // turn all pixels off
    pixels.setPixelColor(i, 0);
  }
  pixels.show();
  attachInterrupt(                  // register Interrupt Service Routine (ISR):
    digitalPinToInterrupt(CLAPIN),  //   pin to watch for interrupt
    heard_clap,                     //   void function to call on interrupt
    FALLING                         //   trigger interrupt on HIGH → LOW change
  );
}

void loop() {
  if (clap) {                       // we heard a clap from ISR
    clap = false;                   // make sure we don't trigger again too soon
    clap_times[array_pos] = millis();
    array_pos++;
    if (array_pos == MAX_COUNT) {
      array_pos = 0;
    }
  }
  current_time = millis();
  clap_count = 0;
  for (i = 0; i < MAX_COUNT ; i++) {
    if (current_time - clap_times[i] <= CLAP_INTERVAL) {
      clap_count++;
    }
  }
  // set neopixels to clap count in right hue

  for (i = 0; i <= clap_count ; i++) {
    pixels.setPixelColor(i, hues[i]);
  }
  if (clap_count < NUMPIXELS) {
    // blank any unused pixels
    for (i = clap_count + 1; i < NUMPIXELS ; i++) {
      pixels.setPixelColor(i, 0);
    }
  }
  pixels.show();
  Serial.print("clap count: ");
  Serial.println(clap_count);
  delay(10);
}

void heard_clap() {
  clap = true;      // just set clap state in ISR
}

Have fun with your new 👏-enhanced projects!

 

Stewart  would like to thank/blame Brent Marshall and Anna Humphrey for the idea of the "clappuccino" machine.

June 05, 2017

Posted in projects


Build your own retrogaming joystick

Retrogaming joystick

Tracking down old Atari-style joysticks for retrogaming can expensive, and it’s hard to tell if you’ll get something reliable. So I made one for less than the cost of a used stick on eBay.

To build this, you will need:

  • 8-way joystick , or any stick compatible with the industry standard Sanwa JLF-P1 mounting plate. This has M4 holes at 84 × 40 mm.
  • Two concave momentary arcade push buttons.
  • DE-9 (DB-9) Female Socket Connector
  • Terminal block, with at least seven connectors. You’ll likely want more, so this 12 position screw terminal block should work.
  • 4× M4 countersunk (oval head) machine screws with nuts and lots of washers. You’ll need washers to act as spacers between the box and the joystick mounting plate. This allows the joystick’s dust washer to move freely.
  • a couple of metres of 8-core stranded signal cable
  • hookup wire and spade connectors for building the button harness.

The case is made from 6.4 mm high quality plywood, using a template generated by BoxMaker.  The external dimensions of the box are 163 mm x 143 mm x 83 mm. I haven’t included any kerf width in the design, so the edges should fit together easily for gluing.

Joystick box plan

Joystick box plan for download: joystick-box-201706.svg (SVG: best in Inkscape); joystick-box-201706.pdf (PDF).

If you want to make your own design, here’s the top plate plan: joystick-box-top-201706.svg (SVG); joystick-box-top-201706.pdf (PDF).

The basic DE-9 pin wiring for Atari-style joysticks goes like this:

1 — Up
2 — Down
3 — Left
4 — Right
6 — Button
8 — Ground

There are many variants that add features to this scheme, however. If you’re building for a specific computer, Tomi Engdahl’s Joystick information page has the details.

Many thanks to Andrew Horsburgh for the use of Protolab‘s laser cutter.

May 23, 2017

Posted in projects


Raspberry Pi Powered Temperature Logger

We just moved to a new office, which has been great, but as the outside temperature reached 30°C the other day, we realized that our air conditioning was not working!

Our landlord is great and we suspect he will fix the AC quickly, but we figured it would be a good idea to track the temperature.  There are many ways to do this, but we thought it would be most fun to use Python on a Raspberry Pi.  

We really like the DS18B20 temperature sensor, as you can communicate with them via I2C.  We have several flavours of these sensors, they all work the same:  bare sensor, waterproof, and high temp waterproof.

We started with Adafruit's excellent tutorial on the DS18B20 for the Raspberry Pi.  There you can learn the basic wiring and how to hook it up to the Pi.  We will also use their example code in our program below.  This example will work on Raspbian and other similar distributions.  

Next, we created a database to log the temperature. There is a great Python library called sqlite3 that allows you to make simple or powerful databases.   SQlite is not installed by default on Raspbian, so we need to install it:

sudo apt-get install sqlite3

We also need a few Python libraries for managing time, so install these as well:

sudo pip install python-dateutil

Now that we have all the dependencies installed, we can get to coding.  The below code is available for download here.

First we get the required libraries:

import sqlite3
import os
import glob
import time
import dateutil.parser
from datetime import datetime

Now we connect to the database:

conn = sqlite3.connect('temp.sqlite3')
cur = conn.cursor()
And we create the table if it does not yet exist:
CREATE TABLE IF NOT EXISTS templog
(date TEXT, hour TEXT, temp_f FLOAT, temp_c FLOAT)''')
Here we connect to the temperature sensor and tell the program how to read it:
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
And now we read the temperature
def read_temp_raw():
    f = open(device_file, 'r')
    lines = f.readlines()
    f.close()
    return lines
def read_temp():   
lines = read_temp_raw()   
while lines[0].strip()[-3:] != 'YES':       
time.sleep(0.2)       
lines = read_temp_raw()   
equals_pos = lines[1].find('t=')   
if equals_pos != -1: 
temp_string = lines[1][equals_pos+2:]       
temp_c = float(temp_string) / 1000.0       
temp_f = temp_c * 9.0 / 5.0 + 32.0       
return temp_c, temp_f
Here we grab the time and temperature and print it to the screen:
while True:       
timenow = datetime.today()        
timedate =  timenow.strftime("%Y-%m-%d")      
timehours = timenow.strftime("%H:%M")       
print timedate, timehours, read_temp()       
temp = read_temp()       
temp_f = temp[1]       
temp_c = temp[0]
And now we write the temperature and time to the database
cur.execute('''INSERT INTO templog (date, hour, temp_f, temp_c) VALUES (?, ?, ?, ?)''',(timedate, timehours, temp_f, temp_c))
conn.commit()
Lastly we sleep for 60 seconds before we start all over again:

        time.sleep(60)

 

With that done, our next step is to run the code and log the temperature!  Just type the following:

python readtemp.py

You should see the temperature and time output to the screen, and a new file will appear called temp.sqlite.  

Now you can simply connect to your Pi, get the temp.sqlite file, and open it up in a database browser!  We prefer to use DB Browser for SQLite, which is a simple and high quality open source tool for viewing and editing databases.  Here is a screenshot:

Within DB Browser you can do many things, but if you are comfortable in Excel or similar spreadsheet programs, many find it easiest to just export the data to CSV.

Once you have the CSV, you can plot or do anything you like.  Here is a plot of 3 days worth of temperature collection. 

You can see that the temperature does not vary much.  The X-axis shows time, we did not clean this up but you get the idea!

We hope you enjoyed this post, thank you for visiting our site! 

 

 

May 11, 2017

Posted in


Escape Room Part 4: Keypad Lock

This post is part of a series I am writing about my senior thesis project. Please check out the other parts of the series to learn even more about my project: Part 1, Part 2, Part 3, Part 4, and Part 5.

One of the common components that can be found in almost any escape room are locks. The reason they are so common in escape rooms is because they can easily fit into almost any puzzle. From standard number locks for math related puzzles to letter locks for word puzzles, the perfect lock exists for almost any type of puzzle. They also work well in escape rooms because they make it easy to hide clues until the time comes for the players to find them. Also, finding the right combination for a lock and finally being able to open it is extremely satisfying.

For my escape room, I knew I would have some form of padlock on the refrigerator with the blood samples. Ideally, I wanted one with individually numbered/lettered wheels rather than a dial since it would be more user friendly. But aside from that, I wanted to have another locked area of the room where I could hide the UV flashlight that would be used to reveal clues in the later portion of my escape room. The UV flashlight would be in a cabinet and I knew I wanted some form of digital lock to go along with the mostly digital puzzles in my escape room. Since most digital locks are expensive, I decided that I wanted to make my own. I thought of many methods for doing this, but eventually decided to use a keypad that would communicate with a magnetic door lock through Particle's publish and subscribe events. This idea was further made plausible when I found an inexpensive magnet lock on eBay.

Using a keypad seemed like a good choice since there is a keypad library for Arduino that has been ported for use with Particle devices. When it came time to choose a keypad, there were three that I was considering: SparkFun's 12 Button Keypad, Adafruit's 3x4 Phone-Style Matrix Keypad, and Adafruit's 3x4 Membrane Matrix Keypad. In the end, I decided on the 3x4 Phone-Style Matrix Keypad for many reasons. First, I thought it looked the nicest and matched with the aesthetic of my escape room. I also liked the fact that it had built-in headers and letters on the buttons in case I wanted to do a word puzzle.

Wiring and programming the keypad was relatively straightforward. There are eight pins on the keypad. Pins one through three are for the columns, pins four through seven are for the rows, and pin eight is an unused pin that can be left disconnected. You can connect the column and row pins to any digital inputs on the Photon (I used pins D0-D6). As for programming, the library takes care of reading key inputs so I just had to write the logic for making the correct code unlock the magnet lock. I also wrote logic to make it so that the players could press the * key to clear their input if they made a mistake and that they had to press the # key to submit their code. You can see the code I used to program the keypad here.

Wiring the magnet lock was slightly more complicated. At first, I tried to power it with a transistor circuit that would convert the 3.3V output by the Photon to the 12V necessary to power the magnet lock. After many frustrating attempts at doing this and almost burning out my transistor, I decided it would be better to just use a DC power supply for the magnet lock. I did not have any 12V power supplies lying around, so I decided to use the 15V power supply from my Wii U. I knew that by exceeding the voltage requirement for the magnet lock that I risked breaking it, but I did not have the time or money to buy a 12V power supply so I tried it anyway. Fortunately, it worked and by combining the Wii U power supply with a PowerSwitch Tail II I was able to control the lock with the keypad. You can see the code I used for the PowerSwitch Tail II to control the magnet lock here.

I decided that I wanted to 3D print a case for the keypad because I knew it would look nicer than just having it in a breadboard. I wanted the back of the case to be able to contain the wiring, Photon with Power Shield, breadboard, and LiPo battery I was using to power the Photon. So I measured all the components and created a 3D model using PTC Creo Parametric, which is my favorite 3D modeling software. I then printed it out of PLA which took several hours. You can see the STL file for my model here. After I printed it, I went to put all the components in only to realize that it was slightly too small and they were not going to fit. Since I was in a time crunch, I used my soldering iron to melt away parts of the PLA until all the components fit. This actually worked pretty well, especially since the parts I melted were in the back and would not be seen, but I would not recommend doing it because it is really bad for the tip of the soldering iron and really easy to slip and burn yourself.

Overall, the keypad magnet lock worked really well. I did have trouble getting the magnet lock to stay in place (since I could not screw it into the cabinet door in the lighting studio) and I had issues placing the spring so the door would pop open, but in the end hot glue and duct tape solved those problems. It worked really well in the flow of my escape room and the players were surprised when they entered the correct code and the door swung open.

April 23, 2017

Posted in


We have moved!

We are pleased to announce that we have moved!  Until now, we have been working out of MakeWorks, which is a co-working space in Toronto.  Due to our tremendous growth, we needed a little more space, so we moved to a new office in Bloor West Village.

As a result of this move, our process for local pickup orders has changed.  Our friends at Cards & Such, located at 2336 Bloor Street West in Toronto, have agreed to let our customers pickup orders from them.  For this service, we must charge $1.50 for pickup orders under $100.  The good news is that pickup hours are now dramatically expanded, as shown in our About Us page.  

As always, thank you for your business and your support!

April 20, 2017

Posted in


Escape Room Part 3: Health Monitoring Vests

This post is part of a series I am writing about my senior thesis project. Please check out the other parts of the series to learn even more about my project: Part 1, Part 2, Part 3, Part 4, and Part 5.

It was a very arduous process, but I finished making the first vest for my escape room. This was my first experience actually working with wearable devices so it involved a lot of trial and error. The components I used were a Particle Photon, a Photon Wearable ShieldRuby Red and Emerald Green LED Sequins, a Piezo Buzzer, a switched JST connector, 3 ply conductive thread, regular threadneedles, jumper cables, a 1200 mAh Lipo Battery (with charger), a hot glue gunwire strippers, and a soldering iron (with solder).

I started by sewing the Wearable Shield into the upper left pocket of the vest and the switched JST connector into the lower left pocket of the vest. I then attempted to connect them using the conductive thread, but the distance between them was too long and not enough power could get from the battery attached to the JST connector to the Wearable Shield. So, after ripping out all the conductive thread from my first failed attempt, I decided to cut the ends off of some jumper cables and use them to connect the JST connector to the wearable shield. I soldered the wires to the JST connector, wove them up the inside of the vest, and then soldered the other ends to the Wearable Shield. I held the Wearable Shield in place with regular thread and used hot glue to secure the JST connector (I sewed the Wearable Shield in upside down so the VIN and ground connectors I needed would be closer to the JST connector).

After I had a reliable power source setup, it was time to sew in the LED Sequins and Piezo Buzzer. I did this by sewing the ground connectors on all of the components together with the conductive thread and connecting them to the ground connector on the Wearable Shield. I then connected the positive ends of the LED sequins to D5 and D6, and connected the other end of the Piezo Buzzer to A4 (one of the pins that supports the tone() function).

The vest is currently set up so that the green LED is illuminated while the player's health is above 25%. When the player's health drops below 25% the green LED turns off and the red LED and buzzer turn on. The Particle code includes a Particle Variable for the health that can be accessed by the Node server I created. The server gets the player's health once every second and stores it in a Firebase database. The web app is set up to allow the player to input their name and vest number. Once they do this, a health bar displays the health associated with their vest from the Firebase database. The health bar is green if the player's health is above 50%, yellow if it's below 50% and greater than 25%, and red if it's below 25%. There is also a faux EKG, but that's not working yet (I decided not to use the pulse sensor because I was having trouble interpreting the data from it and it was not comfortable enough for long term use). The styling of the web app is also not final and I still have to add more features unrelated to the vest (such as a heal feature and hint system). Additionally, I have to add on to the server to accommodate for the other four vests when I finish them. Here is the code for anyone who wants to see how I programmed the back-end of my vest system. I removed all personal info from the code such as API keys, auth tokens, and Firebase URLs.

Overall, I am very happy with how the vest came out. The process was extremely time consuming and at times painful (thanks to the sharp needle), but it was worthwhile. I now have a system in place that will allow me to create the rest of the vests in a more timely fashion. The vests will be a nice touch for the final room and provide for a unique experience that most escape rooms don't offer.

April 10, 2017

Posted in projects


Solar Powered Beckoning Cat

I picked up a battery powered "beckoning cat" on a to Shanghai, and it has consumed 3 "AA" batteries over a period of 36 months.  Seems like a silly waste of batteries, right?

With spring upon us and some sunny days in Toronto, I decided it was time to put one of our Adafruit Solar Badges to work.  These little badges output 40 milliamps @ 5 volts in direct sunlight, which seemed like enough for our cat.

 

The cat was originally powered by a single AA battery, which provides 1.5 volts.  Being a good engineer, I thought it would be best to give it around the same voltage.  One way accomplish this is with voltage dividing resistors.  

 I won't get into the theory here, but I knew that using lower resistance would consume less power, so I went with 10 ohm and 18 ohm resistors.  This would provide 1.79 volts.

You can learn more about this calculation at LearningAboutElectronics.com

 

It turned out that my efforts to match the voltage were in vain, as with the resistors the cat's arm barely moved in direct sunlight!

Resistors dissipate energy, and it turns out that even these low impedance resistors were sapping too much energy. 

I thought about it, and realized that the reason the cat had an AA battery probably wasn't due to delicate electronics that could only tolerate 1.5 volts...rather, it was for cost savings and packaging.  So I thought, why not just hook the solar cell directly to the cat.

It turns out that this is all the cat needed!  

 The cat even works in lower levels of sunlight:

 

Here's a picture showing how I soldered the wires to the AA battery terminals:

1 2 3 Next »