Sunday, 29 July 2012

An IR Synthesizer

I had a dream about theremins the other day (those things that make noises in response to you moving your hands) and pondered how to build one, or something similar, or just something that makes noise. Having pondered how to build one, I thought of some stuff and had absolutely no choice but to try it out :)

My initial plan was to use 1 or more IR range finders to measure the distance of an object from a sensor, then use that distance (or some function of it) to choose a pitch. An Arduino then generates a wave and pumps it out through a speaker, so the very simple circuit would be along the lines of this:

Simple circuit for Arduino to drive a speaker using IR sensor readings

In case you're wondering, that little speaker circuit is genuinely all you need to generate noise from an Arduino - a little 80ohm speaker plus a small resistor and you can send it a wave (potentially using the handy 'tone' command) to generate a noise. However this has some major floors:

  • It's fairly quiet, as you're powering the speaker off the Arduino
  • You can only really generate square waves, as the GPIO pins are either on or off
  • Again, due to the binary nature of the GPIO pins you can't digitally control volume
Anyhoo, it quickly became apparent that this wouldn't do the job. Initially I had a blast at building an R2R ladder digital-to-analog converter (excellent web page on them here), which would allow the Arduino to output a 10 bit binary value, which is then converted to a voltage and pumped into the speaker. Unfortunately once this was working the signal was so weak that it couldn't drive the speaker. Fortunately, I then remembered my Speak Jet chip from this earlier post.

The Speak Jet is a speech synthesis chip, which internally uses a 5 channel synthesizer to produce phoneoms. However you can take direct control over the synth if you prefer, which is exactly what I decided to do. So first step is to expand the circuit to this one:



I haven't shown the whole speak jet setup (which you can peruse at your leisure from earlier posts), but it's basically the speak jet chip plus a *20 gain audio amplifier built with an LM386 op amp. A bit of wiring later and....


That bread board is the speak jet and op amp squeezed into a neat little circuit that I'll probably never dismantle again. Although it looks a little complex, it's mostly just the right organisation of capacitors and resistors to build a simple audio amplifier from an LM386 as specified in their manual. In addition to the circuitry, you can see the oscilliscope attached to the speaker output, with the wave being generated on it.

With a little bit of code to read values from the sensor, convert them into a frequency range and then send over serial to the speak jet (which I might post at some point), I end up with this ear bleeding monstrosity:


If you had headphones on when you played that then I am sorry.

Anyhoo, it makes noise but isn't particularly useful. A real instrument does more than make noise - it is controllable, so the user can choose when it should make noise. I decide the key to this instrument is to add a push button to 'strum' the note. So with a small tweak to the circuitry:


I now have a push switch in there, and update the code so it sends volume commands to the speak jet in addition to pitch commands. When the user is holding down the push switch the note is played at full volume, and after releasing it the note decays for half a second. In addition, the pitch can only change when the button is down, allowing the user to bend the note as they play it. Unfortunately my musical abilities are limited to the listening side of things, so I grab Mark.A from his work and hand him a plank of wood and a push button:


And there you have it! An Infra Red Synthesizer :)

-Chris




Monday, 23 July 2012

Table update

Not done too much more on the table, but I've put together a few photos and a video to show it.

First up, here's the video, build in OpenSCad of the components falling into place and then rotating the table central section:


It gets the idea across pretty well. Once the key switch is activated and the push button is hit, that central section will spin round 180 degrees to flip from poker to coffee mode, or visa versa.

Now these are the actual components I have so far:


Note the plastic connector that attaches the motor to the steel axle. After wondering how to do this for ages, it suddenly occurred to me I could just design them in a CAD package and print them off on my 3D printer. The connectors have correctly sized holes in at each end, so all that's left is to sand off the axle a bit (so it has a rough surface), then glue it in with high torque super glue or epoxy resin.

All I'm missing now are some springs to fit into the solenoid, a battery and the key switch.

So as I said, we've actually done a bit of work as well - one table lid coming up:


That central section is the bit that'll have glass on one side, and felt on the other.

And finally, a sneak preview of my design for telescopic legs (which won't be in version 1):


Ultimately this is a home made rotary linear actuator, which uses a threaded rod attached to a motor to push a bolt forwards or backwards, translating rotary movement into linear movement. Whether or not I end up using this for the table, it's a nice design for a powerful and accurate home made actuator, which typically cost quite a bit to buy pre-made.


Sunday, 22 July 2012

Auto Poker Table

For a long while I've wanted to create a poker table (cos I play poker), however my small flat doesn't have room for one. As a result, I decided to create a coffee table that could transform into a poker table... electronically of course. Originally I was going to get cooler and add an entirely pointless auto-levelling telescopic leg setup as well, but I'm gonna leave that till later or it'll take ages!

I started from this basic design, which is based around the idea of a rotating midsection controlled by 2 motors at each end:


On John's advice we decide to build the table out of marine ply wood - a very high quality and strong material, ideal for projects like this. It turns out you can only by 2.4mx1.2m sheets, so I grab one that is 18mm thick and another that is 12mm thick, which comes to quite a lot of money, but what the hell - this is a piece of furniture so needs to be beautiful as well as functional!

Anyhoo, once the basic idea is down on paper, the actual mechanism needs designing. After some pondering I came down to:
  • 2 miniature high torque geared DC motors to turn the central section
  • 4 solenoids placed along the sides of the table that retract when the lid turns, then pop back out to lock it in place
  • 4 microswitches placed along the sides of the table to detect when it is in the correct position
  • An Arduino Nano to drive it all
  • A rechargeable battery stashed in one of the legs
  • A pair of switches (one of which is a key switch) to trigger a revolution.
The pair of switches is quite crucial, as the last thing we want is accidental table turning. Hence I'll have 1 switch that you must turn on with a key, before hitting a push button to actually trigger the turn. Once this has happened, the key switch must be de-activated before another turn can occur. I'm also tempted to set it up so the push button must be pressed within 30s of the key switch being activated. Super careful basically. I don't want my dinner suddenly flipped upside down accidentally!

So, with this in mind, I switch to a CAD program to model it. First up, a view of the actual table:


As you can see, it looks like a fairly classic 2 shelve design, the real difference being that the glass central section can spin round to reveal a felt lined surface, ideal for poker.

These next 2 images show some of the intended components:

Components embedded in table

Components raised out of the table so you can see them.

You can see the key parts here - a solenoid and microswitch to make up the detect/lock mechanism, and a motor with a long axle to turn the central section.

The few remaining bits to work out are:

  • Where to put the battery? I'm thinking a rechargable battery embedded in one of the legs would be ideal. I'd rather not have a mains cable trailing to my table the whole time :)
  • Should the table talk? It only seems logical for the table to say 'table taking form of poker' when you press the button....
  • Will it actually work?

We've started actually building now, so next post I'll add some pictures of the components and the wood work itself. I'm also planning to blow a load of money on some nice new power tools, so I'll probably post pictures of them too.


-Chris