3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Microcontroller Fabric Tone Generator in C-code

Microcontroller Fabric Tone Generator in C-code
At the end of October last year instructables user carmitsu sent me a message after seeing my lunchbox synth. From his message:

I teach music in elementary school. We play a lot of recorder music. i.e. the kids play little flutes...... I have several special needs kids who can are using these black poster boards with circles that have the name of the note on them. These students push on the circles with notes names at the same time the rest of the students are playing a song..... Most of the special needs kids can do this fairly well and in time with the music.
What I am looking to to is build a very simple sound generator so that these kids could play the same pitch as those being played by the students on their recorders. I would only be a few pitches. I thought I could attach some kind of small button to the bottom of their round circles so that when they push on them the sound would come out of a small speaker, loud enough so they could hear.

Having a mother who is a teacher and having liked school, how could I resist? Truth be told I couldn't. This is pretty much a chronicle of the project and instructions on how to build your own.
 
Remove these adsRemove these ads by Signing Up
 

Step 1The beginning or why I couldn't stick to analog

The beginning or why I couldn\
The good stuff starts on the next page. If you want to know how I ended up using the parts I did, read on.

The veritable timer:
After giving the project some thought I immediately thought of the piezo tone generator from my op-amps Forest Mims III book. Seemed like a good way to go, it's just a piezo, an 741 IC and a couple passive components. No big deal right? Well it has 2 problems, 1) when you depress the switch, it's possible to change the pitch 2) it's damn near impossible to tune. The first could likely be overcome with with some debounce technology, though i didn't know how to do that without adding another counter. It could also be an issue with using a piezo. The second issue just got unwieldy when you started trying to hit a certain pitch. What about the 555? The datasheet shows a time dlay function based on resistors and capacitors. Which is great until you start typing in actual values of real world parts, that's when you'll find hitting a 440Hz pitch starts to get a little difficult. You can use trim pots to get it tuned in, but over time they tend to move. Constantly tuning the instrument, compiled on top of rapid increase on cost and quantity of parts, and my wife making the pitch change when she pushed the button killed the 555 for this project.

Op-amp:
No problem, people have been making synths with op-amps since before I was born. How hard could it be to make a really simple one, with few parts and specific notes? Harder than I thought. Most of the designs out there are very over complicated for this project. Synth designers are out for the perfect waveform/tone. This directly conflicts with a project that is supposed to be cheap enough for school or teachers budgets. Building a keyboard is easy enough, it's just a bunch of resistors and power or a bunch of diodes and power. It's the rest of the circuit design, and the cost of custom pcbs that starts to get out of hand for someone at a beginning electronics level.

Project redefinition:
So the project got redefined before i even really got going. I needed something that could toggle a speaker pin, in time, with the press of a button. I didn't want to have to design and buy a PCB. This had to use as few components an possible, and be assembled as a beginners kit. It was staring me in the face the whole time. Duh!! Microcontroller!

Microcontroller:
So after purchasing both an Modern Devices Bare Bones Arduino kit and an Evil Mad Scientist Simple Target Board and letting them sit on my desk for months not being used, I had the perfect introductory project. I started looking at the time it takes to put both together, the learning curve for the code, cost, the additional parts needed and make it do what I want and settled on the target board.
Cost was pretty even, $15 plus a $20 FTDI cable for the Arduino, $12 plus a $22 USBtinyISP programmer. I already knew C++ from the little college I could stand and figured C for microcontrollers wouldn't be that bad, while other than blinking a light to make sure I put my kit together properly, I had no Arduino experience. Both could be mounted. It was pretty much a toss up, so I decided on the fewer parts of the two, the target board.
« Previous StepDownload PDFView All StepsNext Step »
13 comments
Jan 16, 2010. 10:05 PMShortedOut says:
Weren't sure you were aware of this (from your comment that you knew C but didn't know Arduino), but the Arduino is actually programmed using C, just plain ole C. So I guess I don't understand the comment that you think the Arduino adds a lot of bloat.

Also, just to clear up confusion for anyone about Bekathwia's comment... Early reviews of this thread stated that it tended to fray quite a bit, which could cause shorts. For this reason it wasn't recommended for top thread in a sewing machine. Because the bobbin thread in a sewing machine lies straight (it's the top thread that forms the loops around the bobbin thread), there is less fray.
Jan 21, 2010. 8:04 AMShortedOut says:
Well! I guess I should respond that you should go trash Arduino users somewhere else! There are a lot of us Arduino users, especially when it comes to fabric. We use LilyPad Arduino. Just realize that when you go getting all uppity about your work, and slam other platforms, people do have the right to respond and defend their platforms. The "go troll somewhere else" comment is totally inappropriate to this community of users!

I will admit that I was incorrect about the bobbin thread lying flat. The recommendation not to use this thread as a top thread stemmed from the fact that the top thread has to go through many more twists and turns through the machine and then through the eye of the needle. In tests by the experts in fabric electronics, this tended to cause more fraying.
Jan 21, 2010. 9:05 AMShortedOut says:
Apology accepted. :) I'm sorry that I gave the impression that I was trashing you.

I went and looked at the Arduino site for information about the pinMode statement (which is a function). Arduino is said to be totally open-sourced (I thought), so I figured that anybody who is interested in how the wheel they're using was built should be able to go there and find the source code. Except that I couldn't find it...

You are right that many (and in my estimation, a fairly sizable number) of people who use the Arduino platform don't understand the code they're using. However, that's not all bad, in that it has opened up microcontrollers to many more people (artists, for example).
Jan 27, 2010. 10:40 PMShortedOut says:
Thanks for the tip on Arduino. Sorry about the slow response to this. I am not at all well, and have to take my good days when I can get them. :)
Jun 8, 2009. 12:12 AMMcLightning says:
there is no demonstration video yet?
Jun 4, 2009. 7:32 AMbekathwia says:
If you put the conductive thread in the bobbin side of your sewing machine and use a regular thread on top, it won't break quite as much. I also find the kind from Lame Livesaver is a lot stronger:

http://members.shaw.ca/ubik/thread/order.html
Jun 3, 2009. 4:55 PMjessyratfink says:
What a great project! I love that the buttons are color coded. Very functional and really cute too! :D

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
9
Followers
7
Author:pstretz