Archive for the ‘Electronics’ Category.
I saw this cool sound sequencer ( arduino punk console ). I don’t much about sound and that kind of stuff, but i thought it was quite nifty. And I had just gotten a ps2-mouse to work with the arduino. And hmmm, I had to use it for something. So why not try to make a sound sequencer with it ?
So I started hacking away. Unfortunately I don’t have any nice video or sound clip, but then again its more like a noisemaker and its just a mess of wires. I’ll try to get something up soon.
But it does work, you have to take my word for it or download the sourcecode and wire up your arduino and try it out.
How does it work ?
There a two modes of operation “play mode” or “sequencing mode”, and it shift between modes by clicking the middelbutton (mousewheel button) and it starts out in sequence mode.
- moving the mouse changes the frequency of the sound. It’s very simple the more you move, the more it changes (just by (X + Y) *magic_number)
- pressing the right mouse button reduces the duration of the sound
- pressing the left mouse button increases the duration
- turning the mousewheel selects a tone in the sequence, either an existing or adds a new one to the sequence.
- it plays the sequence of tones you’ve recorded.
- the mouse wheel changes the playback speed.
So it keeps track of both a duration and a frequency, it uses a queue and its possible to add sounds to both ends. I haven’t yet hit a maximum but since its in a int array my guess is that it should be able to hold a lot 100 or 1000 of tones. And it should be possible to do some bytepacking to reduce the memory requirements, but since you have to enter each sound manually and there are no persistent storage you really don’t need that to hold a lot of tones.
Sound Sequencing Mouse sourcecode
I have been tinkering a bit with the arduino the last couple of days. Mostly small experiments with some of the junk had around, after some frustrations with a circuit for a rotary encoder, i “gave up” and tried hooking up a ps2 mouse. There are a nice tutorial at the arduino playground. It seemed complicated to interface with a mouse this way. But it proved to be so much easier than trying to build a circuit. The software coding is so much easier than the electrical circuits.
It was a matter of connecting 4 wires and uploading the code to get it running. But then i found out that there wasn’t support for the mouse-wheel, so i googled the datasheet for the IC, and started hacking. I ended up getting the mousewheel to function and getting output for the buttons. Along the way I refactored some of code, in order to better understand what was happening.
I still haven’t figured out what I should use the mouse for, but it was a fun hack.
Here is the sourcecode, if you want to try something with it : ps2mouse for arduino
I tried to make nice comments so it should be very straightforward to work with. As mentioned a haven’t made most of the code, just some additions and refactoring.
The mouse and the annoying encoder i couldn’t build a circuit for. It can be attached to a motor where there are a slotted wheel.
(21 nov updated code)
Yesterday I finally got the Arduino, I ordered from Segor Electronics. Which by the way had a good service and packed it securely.
I had a plan to create a Ambient dashboard, that is to have some analog meters that would convey some digital information. In an non obtrusive way, i think it has a very fine name, peripheral awareness.
I found it easy to code the arduino and to work with, so far that is. Using ubuntu I for some peculiar reason had to uninstall braille support, as it automatically recognizes it a braille device.
In order to communicate with the arduino it uses a usb serial connection, that is its connected to the usb port, but it behaves like a serialport. The simple way to send data to the arduino is setting up stty and then you can do stuff from bash like echo “data” >/dev/ttyUSB0 and voila it receives the data.
Here is the prototype setup in all is lousy light condition for mobile cam glory.
There are 5 different meters and they all use PWM, without any capicitors or filters, and it just works, most of the time. Its coded so that when its send a string like 23#34#23#34#34 terminated by a newline, it adjust the displays to the values.(0-254).
Now the next part is to make some kind of script to read relevant information and pass it along to the dashboard, since i use linux some information is available trough acpi as virtual files. But the hunt for easy accessible and relevant data has started, i would really like to display bandwidth usage but so far i haven’t had any luck figuring out where it resides.