All posts by Michael LeBlanc

Decoding DTMF with Arduino and the MT8870

MT8870 demonstrationLast August I was experimenting with DTMF (dual-tone multi-frequency) and Arduino. I posted a video on YouTube that illustrates a proof-of-concept using the MT8870 tone decoder chip.

A few people have asked me to include the code and schematics for this demonstration: the code is below, and the schematics were derived from the MT8870 datasheet. Look for the figure titled “Single-Ended Input Configuration.”

/***********************************************************
 DTMF Decoding with MT8870 chip
************************************************************/
int keyvalue;  // the number associate with the tone

void setup()
{
 Serial.begin(9600);
 pinMode(6, INPUT); //input binary 1's digit from decoder chip
 pinMode(7, INPUT); //input binary 2's digit from decoder chip
 pinMode(8, INPUT); //input binary 4's digit from decoder chip
 pinMode(9, INPUT); //input binary 8's digit from decoder chip
}

void loop()

// first determine the base ten value of the key, from 0-11
{
 if (digitalRead(6) == HIGH) //if binary 1's is high
 {
 keyvalue = 1;  //make keyvalue equal 1
 }
 else
 {
 keyvalue = 0;  //otherwise make it zero
 }

 if (digitalRead(7) == HIGH)  //if binary 2's is high
 {
 keyvalue = keyvalue + 2;  //add "2" to keyvalue
 }
 if (digitalRead(8) == HIGH)  //if binary 4's is high
 {
 keyvalue = keyvalue + 4;  //add "4" to keyvalue
 }
 if (digitalRead(9) == HIGH)  //if binary 8's is high
 {
 keyvalue = keyvalue + 8;  //add "8" to keyvalue
 }
 // now convert keyvalues 9, 10 and 11 to "0", "*" and "#"
 if (keyvalue == 10)
 {
 Serial.println("0"); //print zero key
 }
 else
 {
 if (keyvalue == 11)
 {
 Serial.println("*"); //print asterisk key
 }

 else
 {
 if (keyvalue == 12)
 {
 Serial.println("#"); //print pound key
 }

 else
 {
 Serial.println(keyvalue); //it isn't a special key so just print it
 }
 }
 }
 delay(100);
}

Creative Commons License
Decoding DTMF with Arduino and the MT8870 by Michael B LeBlanc is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License.
Permissions beyond the scope of this license may be available at mleblanc@nscad.ca.

A Design for a Remotely Readable Fuel Oil Tank Gauge

Last summer when I unpacked my electronics hardware (after 25 years) and began to learn about the Arduino microcontroller, I started on a project that would help be pick up where I had left off. I chose to tackle the problem of remotely reading the level in our residential fuel oil tank.

In Atlantic Canada, residential heating is limited to electricity and fuel oil. Our tank is in the garage, in the far corner from the household access door on the lowest level of our four-level backsplit home. In other words, it’s an inconvenience to determine the level of oil in the tank. This might be a non-issue except for the fact that we are not on a more expensive fuel plan where the company regularly tops off the level. If I don’t keep an eye on it, we’ll run dry. It hasn’t happened–yet.

I did some initial research to get a sense of what was already out there. Google Patents had many filings that were interesting, such as “Residential fuel tank oil level” “Remotely readable fuel tank indicator system” and “Hall-cell liquid level detector“.

One design limitation that I had imposed from the beginning was that I did not want to change anything on the tank itself. The level detector had to be completely passive and unconnected in any way from the tank itself. My reasons were twofold:

  1. I did not want to change the status of my house insurance by affixing a non-standard item to the oil tank
  2. I wanted to be able to easily disconnect the hardware from the oil tank for maintenance of the unit

The above-mentioned patents were interesting to me because they used hall-effect sensors. Used as proximity switches, these devices can detect the change of a magnetic field without being mechanically coupled to the item being sensed. They are very inexpensive and solid state, so they are very dependable and have a practically infinite service life.

There is a commercial product available which already does some of what I was looking for. Syba Systems in Connecticut markets several devices such as the “LED at a Glance” which fits over top of the mechanical tank level guage and shows the level using an array of LEDs. “Oil Alert” is similar except that when a low oil level is detected, the unit beeps.

One last example of ‘prior art’ is Tom Laureanno’s “Oil Level Indicator Project/Idea” where he describes placing a magnet on top of the mechanical level, and effecting a change of state of a reed switch.

The Remote Oil Fuel Level Gauge
The Remote Oil Fuel Level Gauge

Reed switches are mechanical devices, and they tend to be rather large. Rather than actuate just one switch (resulting in an ‘idiot light‘ scenario, I want to get a sense of the level in several stages, which means that I would need several sensors along the length of the float level. I would be able to watch over time the level go down as we use the oil in the tank.

So this is my idea: To build an array of hall-effect sensors and affix them to the outside of the mechanical float level.

  1. On the float level, a small rare-earth magnet is glued to the float indicator.
  2. As the float indicator rises or falls, the magnet field changes are sensed by the hall-effect sensors.
  3. These sensors are read and interpreted by the Arduino, which transmits the float level information by radio to a receiver elsewhere in the house.
  4. The received information is decoded and another Arduino microcontroller drives an indicator, which in the case of my first prototype, a stepper motor, but it could also be an LED array or an LCD display.

In subsequent posts I’ll outline the design and implementation of the system.


Creative Commons License
Remote Fuel Oil Tank Gauge by Michael B LeBlanc is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 Canada License.
Contact the writer for permissions beyond the scope of this license.

Handouts? …you don’t need no stinkin’ handouts!

Today I perused the evaluations that my students submitted for last semester’s Introduction to Interactive Design course. Nobody’s perfect: some of the criticisms are valid. Often I’ll get one or two evaluations that say I’m the best, and one or two who say I’m the worst. This time was no exception, but I also noticed a number of instances of “we need handouts” in the comments section of the forms. Normally when I get five or six students saying the same thing, I take notice. But this time I thought: “Come on, you’ve got to be kidding me…”

The course is a basic boot camp for XHTML and CSS. It’s fairly straightforward and as long as the students tackle each weekly assignment, they will keep up. It isn’t rocket science, but students have to do the work, and for a 3-credit course, students are expected to spend around 6 hours out of class working on their assignments.

As time has gone by, I’ve noticed that the students’ expectations are changing. They are much more demanding, for one, and much less willing to accept that they need to work to find the answers to questions posed by the instructor. Whereas students a decade ago were willing to get their hands dirty, experimenting, discovering, and finding things out on their own, more and more students today are expecting us to give them the answers “on a silver platter.” Hey, Teach–you showed me, but I was up really late last night and I sort of dozed off in class so I didn’t take any notes. Can you give me a handout?

You want a handout? I’ll give you one better. I’ll let you in on a little secret: Google. Heard of it? It’s really cool…

If you forget how to add an image to your HTML page, try googling “image html” and you’ll see that there are 264 million results just waiting for you; ALL of the ones on the first page tell you how. Take your pick. If you forget about server side includes, try googling “server side includes” and you’ll get about a million results. And for the skeptical among you, I can assure you that all of the results on the first page are relevant matches for what you were asking for!

What? You say that you don’t like reading? [ sigh ] Ok, here’s another little secret: YouTube. Don’t tell anyone or you’ll spoil it. Search for “server side includes” in YouTube, and the top result is a 7-minute tutorial on server side includes.

So please. Don’t ask for handouts. That’s so 1990’s.