Thursday, December 8, 2011

LTSpice simulation of Chua's circuit

[EDIT 2012-03-25: fixed a stupid error on the sample rate]

From time to time I get spam from Farnell (a component distributor), and on their newsletter they're promoting a free webinar by Elektor magazine, titled "Let's Build a Chaos Generator!". The event is due 15th of December at 6:00 PM EET, so if you have nothing better to do, that's one good way to waste your time.

I had been reading on chaos generators in the past, and this e-mail got me interested again. Their design is somewhat complicated, with a total of 13 stages of 7 different circuit blocks. You can read all about it in the PDF they published.

Elektor's Chaos Generator won't fit in your pocket.

A much simpler chaos generator that can be built with a lot less components is called Chua's circuit. The downside with this simple circuit is that you need an inductor which you might have to wind up yourself. Also there should be much less variety than in the waveforms of the Elektor circuit. It has so many stages that can saturate to give different waveforms.

Still, Chua's circuit is very interesting to fiddle with. I haven't built the circuit yet, but I did some simulations with LTSpice IV and here's what I found out.

First, I googled for schematics. The first result was this great page giving me a nice schematic and details on the circuit. Another page I found had a quite similar circuit but with a little bit different component values. I built a circuit with LTSpice based those two pages.

My LTSpice version of Chua's circuit.

If you want to try simulating the circuit yourself, click here to download the .asc file.

The circuit is powered by two 9V sources, one positive and one negative. Would be nice to see a single-supply version by the way! There are two outputs, nodes V1 and V2. I chose the LT1351 op amp, since it should be quite near the common TL071 series op amps, and the model comes ready with the LTSpice installation.

The circuit can be tweaked by varying R6 from 0 to 2k. Somewhere in between lies chaos. I found 1.6kohms a good value.

A transient simulation to 1/10th of a second gives the following waveforms for V1 and V2:

From up here, voltage V2 (blue) seems to be bouncing around two different DC levels at the same time!

A closer zoom on the waveforms shows some detail:

And if we change the x-axis to be V2 and the y-axis to V1, we get the beautiful double scroll plot:

I also ran an FFT for the signals, to see what kind of frequencies are involved:

Hmm, seems like it's audible... and so I couldn't stop there. I wanted to hear what it sounds like, so I made a simulation which outputs .WAV files.

Since LTSpice IV clips WAV outputs with an amplitude over 1V, I had to attenuate the two signals with voltage dividers. Here's the LTSpice circuit I used:

LTSpice simulation with WAV output!

If you want to simulate this one yourself, download the LTSpice project here.

The simulation for 10 seconds of audio took some time with my settings, and generated 500MB of raw data. Looking at it now, the time step (0.1ms) is lower than the sampling time... You might want to simulate with approximately 1/44100 time step, but that will produce even more data.

After all this, I could finally listen to the horrible screeching noise of chaos.

And so can you: The signal V1 (.wav) is more high-pitched, while the V2 (.wav) has lower frequencies in it's spectrum (like you can see from the FFT).

What it sounds like is noise, and a very annoying kind of noise.

I don't know yet how changing the value of R6 realtime will affect the sound. For that I would need to build the circuit and try it. With low values of R6, the circuit oscillates with a constant frequency. It would be neat to hear the moments at the edge of chaos. So I'll be probably building this one sometime. If someone has already built it, go ahead and post a comment!

Tuesday, September 27, 2011


When walking home from the uni today, I found this dying snake on the road. I quess it was hit by some car, or the cold finnish autumn had taken it's toll on it...

After taking some pictures, I left it to die in peace.


Tuesday, September 13, 2011

Portable speaker for MP3 player

I made this portable speaker in the summer. It mixes the stereo input into a mono signal, which is then amplified. It's powered by a six pack of AA batteries. The batteries are held in an external battery pack, so they are easy to change on the fly, without the need of a screwdriver.

Completed speaker pumpin' out some bass

I was going to a cabin with the guys to celebrate juhannus (midsummer) the next day, and there was going to be no electricity. Juhannus without music wasn't an option, and I'm not too impressed by the portable speakers available in stores (overpriced and shit sound). So I built my own blaster that evening.

The circuit is a modified version of the portable guitar amplifier I've built many times. I found the original circuit years ago from the great site Red circuit designs. The circuit is modified to have a simple stereo-to-mono mixer in the input, consisting of resistors R1 and R2. I chose 1k as their value, that should be enough to isolate the left and right channels from each other, since the headphone output on an MP3 player has a low impedance.

There is no volume control, instead I just use the volume control of the MP3 player. If someone wants to add one, just replace R3 with a potentiometer and connect "In+" of the TDA7052 to the middle pin of the potentiometer...

Schematic of the amplifier.

Going through my sizeable e-trash collection I found an old pairless computer speaker. It would get a new life soon.

The victim, a pairless computer speaker.
It was a left speaker, with just a speaker inside and an RCA jack on the back. I was going to use that as the power jack.

An RCA jack on the back was going to be the power input.

I took the metal leg off to access the screws and opened the case. Next I cut the wires off the speaker. There was some foam padding inside, which I removed for a while.

Case opened and wires cut.

I soldered all the amplifier circuit on a small piece of stripboard and then the speaker and the jacks. A single screw hole in the back of the case was used to fasten the thing there.

The amplifier circuit board is fastened to the wall with a screw.

I glued some mouse pad pieces to the most critical places to ensure there's no unwanted vibrations. To top it off I put back the original foam padding.

Some pieces of old mouse pads ensure the wires don't vibrate around.

I put also the original foam padding back to further eliminate vibrations.

Here is the backside of the finished speaker. I sticked an inspirational sticker on the back. The RCA jack on the left is for power and the 3.5mm jack is a stereo line input.

Connectors on the back.

I used some part of an old projector as a vise when gluing the battery pack together. Very handy. Another gem saved from the trash.

Gluing the battery pack together...

The power packs are also 100% recycled: the battery holders and the piece of RCA wire were also found in e-trash.

Finished test battery pack, with random AA's I had at hand.

The speaker was a hit in Juhannus and got very good feedback from it's bassy and clean sound. Just have enough batteries with you - it ate 3 six-packs of AAs during the 3-day trip and would have eaten even more. Of course, the speaker was on all the time. When the batteries are running low the sound starts to get distorted but turning down the volume a bit helps. This way you can also extend the battery life a bit.

That's all folks!

Red free circuit designs -  Mini Portable Guitar Amplifier
My mini guitar amplifier build

Monday, June 20, 2011

Repairing a pitch bend wheel with style

These pics are from 2008. I had a Swissonic CK490 USB MIDI keyboard. It was a super-cheap controller with a lot of pots and 49 keys. The response was never very good with these things, especially with the velocity sensitivity, and it slowly deteriorated over time. It's enough for making some computer music, but I would never use this thing live.

Here is the keyboard before the repair. Or actually it's just a similar one. Notice the kitchen studio setup...

The Swissonic CK490. In a kitchen.

The keyboard was actually made by M-Audio, the former Midiman. The same keyboard has been marketed also under the Evolution brand. It's not as good as M-Audio products in terms of quality.

Since it was very light to carry, I used it for practicing quite a lot. At some point the pitch bend wheel stopped working, and the pitch of the whole keyboard became unstable. It was basically unplayable. The potentiometer had clearly given up.

So I decided to repair the wheel. After opening the thing and ripping the wheel out, I noticed it would be hard for me to find a similar linear 10k pot that would fit in. The two important properties were the physical size of the pot and how many degrees the thing rotated. Both would have to be exactly same with the replacement pot...

Don't pay any attention to the tablecloth. Please.

The modulation and pitch bend wheels ripped off from the CK490.

Closeup of the pitch bend wheel.

The pitch bend wheel in pieces.

Both the pitch bend and the modulation wheels used a similar 10k linear pot. After a bit of thinking I decided to use the mod wheel as the pitch bend wheel, and replace the mod wheel with just a normal pot. Since there was no spring in the mod wheel, I took that from the old pitch bend.

It worked great, and the new modulation pot didn't take a long time to get used to. It also looked great, see for yourself!

The result looks so f*cking ghetto!

Some time later, I sold the thing, as I had gathered some better keyboards. I wonder if it's still in use somewhere...

Mini guitar amplifier

[EDIT: also check out TDA7052 portable speaker for MP3 players I made.]

I've been building this circuit again and again since 2006, when I first built it.

It's an extremely simple mini amplifier. It has a single TDA7052 amplifier IC, a couple capacitors and one resistor... The circuit is designed and documented by RED free circuit designs. The TDA7052 datasheet also shows a very similar application example.

There's no volume control. You can use your guitar's volume knob. With full volume, there's usually some distortion, especially when the battery starts to drain up. But the distortion actually sounds pretty cool.

I've used this thing also as a speaker for my MP3 player. I just wired the left channel to the input of this thing. Works fine, but don't expect much from the sound quality...

My first amplifier build looks like this.

I had found some very cool old telephone routing / answering machines from Philips and decided to use one as the case. They're wooden and feature some very cryptic buttons...

Neat case!

You can see there's plenty of room left in the case... Note also the old film container I used as the battery holder.

The downside with the case is that it's far from airtight and doesn't give the best bass response.

Once a friend tried to use a wall wart to power one of these. He got the polarity wrong and blew the TDA7052, leaving a crater in the chip. I was called to the rescue. I had luckily used an IC socket, so I could replace the chip without any soldering.

Poor TDA7052...

Floppy disk drive motors...

...are some of the most beautiful things in the world.

Found these pics on my HD among other old stuff... I took them somewhere in 2006.

Friday, June 17, 2011

DIY analog sequencer from 2006

I just found a directory tree full of pictures of my old creations. There's many strange, forgotten instruments and sound samples. I'll post them from time to time.

Let's start from one of the craziest.

This one is a 4-channel, 10 step analog sequencer. I still have it around.

Now that's just crazy...
The idea started back when I was 18. I had this vision of creating a sequencer-based tremolo for the guitar. I got it after hearing the song Stüldt Håjt from Kingston Wall (youtube link), I couldn't help but think how cool a hardware effect like that would be to have around. Actually I didn't like the song all that much, I just couldn't help but think about the guitar effect.

It took me three years until I realized that I could finally do it. The device would be modular and I could use it also to trigger whatever else I wanted it to, like some toy synths or other shit.

Of course, now that I look at it, I could do it better, and would go definitely digital, with some fancy LCD screen, unlimited steps, and stuff like that. And still, it would be a breeze to create, compared to all that soldering I had to go through with this clicking analog beast.

The thing is powered by a 4066 decade counter that is clocked by a 555 timer. The circuit is very simple but all the switches took a fucking long time to solder. Everything is enclosed in the shell of some old toy computer my then-girlfriend gave for me to hack.

Here's a feature list I wrote back then:
- Selectable pattern size with min. 2 and max. 10 beats
- 4 channels:
    - 2 channels with two outputs each
    - 2 channels with two outputs each, one output being inverted
- 10 LED display
- Fine & coarse BPM knobs

I had my reasons to put inverted relay outputs (normally closed) there, I was hoping that when combining a normally opened and a normally closed relay output, I could maybe trigger some sounds on each beat. I never got around to test this, though... I don't think it even works because of the extremely small time it takes for the relay to switch.

For those asking, I don't have the full schematic anywhere. That is because I never made one. Back then, I was a bit unorganized in my DIY projects. Anyway, I have some bits and pieces of the schematic, and an old write-up of the whole project. If there's enough interest, I might do some research and eventually post instructions.

Well, here's pics I found of the creation process.

Internals of the sequencer. On the left is the main circuit board. On the right is the relay board and the RCA outputs.
I remember taking the RCA outputs from some old stereo amplifier I found in the trash... I still use a lot of recycled parts in my projects.

Here's the insides combined. There seems to be some little additional breakout board on the right.
A dark picture of the unfinished case.
Beginning of the soldering nightmare...

Still missing the beat size selection switches and the BPM knobs.

All done! It was a pain in the ass...
When making the device, I left no way to open the case without cutting the wires to the control panel. I drilled a hole in the case, put the wires through, left no extra and just soldered it all to place. That's why I can't even find out the exact schematic anymore...

The set-up to achieve a sequenced tremolo guitar effect.
The cone with the yellow "egg" is an input/output box, which takes the signal through and RCA plug to a relay, which is controlled by the sequencer. The signal is taken to the device on the right, which is a very simple guitar amplifier I built. The guitar amp circuit is enclosed in an OLD Phillips answering machine thingie.

And here's the real beef. It's a sample of me playing a guitar through the above set-up, just before taking that picture, somewhere in 2006. I just used some cheap 5€ dynamic microphone. If you listen closely, you can hear the relays clicking inside the sequencer.

I'm still very pleased to hear this effect, even though I really haven't used the device for almost anything after recording this 42 sec clip. Well, I have sequenced a (very shitty) toy synth with it, but I don't have any samples of that... Maybe I should make some.

Stay tuned...

Thursday, June 16, 2011

Insides of the Boss BR-1180

While I was replacing the hard drive for a Boss BR-1180, I decided to snap some photos of the insides for those interested (myself).

BR-1180's insides...
I didn't open it fully, this is just the backside, but anyway the most interesting circuits are here. I'm quessing the other side has only some simple circuits for the knobs, sliders, buttons and the LCD screen.

Boss has a cute little 5V power supply inside. I'm guessing this powers the whole thing and also gives power to the HD.

The 5V power supply.

Some chips on the mainboard.

Another shot, showing a couple more chips.
I looked up some of the most interesting chips on the board. Included were a Boss S1L50753, Roland RO223J767, Hyundai GM71V18163CT6, Hynix HY57V641620HG, Boss R02900434, and a Fujitsu 29LV160BE.

There was no search results for the proprietary chips Roland R0223J767 or the Boss R02900434. I'm quessing thefirst is the main CPU of the whole thing and the second is the BOSS effects DSP.

The "Boss" S1L50753 seems to be an FPGA by Epson. The GM71V18163CT6 is a RAM and the HY57V641620HG a DRAM chip.

The Fujitsu 29LV160BE is a 16M Flash memory.

Here's the analog board, covering all the input and output ports and related circuits.

The analog board of the BR-1180.

What do we learn from all this?
Absolutely nothing.

Boss BR-1180 hard drive backup & replacement

The victim, a Boss BR-1180.

One beautiful day, while we were recording some gangsta rap our trusty home studio Boss BR-1180 gave up and went insane. After a reboot, the thing gave a HD read error. The beat must've been too fat...

So it was time to change the internal hard drive, and see if I can safely back up all our white ass beats from it.

In addition to this guide I'm writing, there's another repair guide on the net by some "PJ". It's a good guide, but it has some problems. You don't need to format the new hard drive, even though PJ's page claims so.

If you're planning to follow my footprints and change the internal hard drive, I recommend first updating the firmware of the BR-1180 to v.2.01. After the update, you can initialize one partition a time with it, which gives you a bit more freedom.

OK, back to the issue. Opening the thing wasn't too hard, just had to keep note of all the different screws on the thing. If you manage to mix them up, PJ's page has them color-coded.

Backside of the BR-1180... Why do I take these pictures?
All opened up...

The hard drive, with some foam to get rid of vibrations.
The hard drive has a nice suspension rack that's easy to open. Some silicone pieces minimize the movement of the drive in case the BR-1180 gets hit. The IDE and power connectors are covered with some plastic foam, to kill resonances and vibrations. You have to destroy part of it to get the connectors out. I carefully shredded the foam with scissors and knifes, spilling just a little blood.

The hard drive and it's metal holders.
The internal hard drive is a 5400RPM Matrox 541D Ultra ATA/100 Hard Drive with only 20GB of capacity. The drive is one third thinner than a normal 3.5" hard drive (only 17mm thick). There's no space for a normal HD in the BR-1180. If you can't find a small HD like this, you could just use a longer IDE cable, extend the power wires, and connect a hard drive externally! That would be AWESOME. Stupid, but AWESOME.

Close-up on the hard drive.

The hard drive can be easily read with an USB-IDE adaptor or hard drive enclosure. Or you could just shut down your PC and put it in the IDE bus, but then you might also need to make some changes to the HDD jumpers (to select master / slave / cable select).

My Black Box USB IDE HD enclosure has been well worth the 20€ I paid for it...
So I put the drive into my USB enclosure, plugged into my PC and there you go! A drive popped up, containing all kinds of cryptic files that I backed up to my internal HD.

Listing of the hard drive contents. The .BR1 directories contain the individual songs, and there's also some other shit.

You can supposedly turn the BOSS track files into WAVs with this piece of software. I haven't tried it out yet though. 

Properties of the BR-1180 hard drive.
The backup process took some time, but eventually it finished and there was no errors. So it looks like the HD is not totally dead yet.

I used chkdsk to correct errors on the old hard drive, just for fun (yea I know, I'm fucked up).

Correcting the old HD's errors.
There was 50 megabytes of lost information on the disk. I'm quessing it was the track that was being recorded at the time of the crash.

Even though the internal hard drive seemed to work fine now, it would be a good time to change to a new one to minimize any future troubles. I could also increase the HD space...

I happened to have a hard drive with similar dimensions at hand: a seagate ST340015A. This one is also an Ultra-ATA/100 drive and has twice the capacity of the original one (40GB). You could also use UATA/133 according to the comments on PJ's page.

The new HD, a thin one like the factory HD.

I plugged the new HD straight in. The HD had some old Linux Ext2 partitions on it, but that was no problem for the BR-1180 to format again. Again, you don't need to format the HD, the BR-1180 does it for you.

When I started the BR-1180, it asked "New HD, initialize now?". I hit no, since it would by default create a single partition on the HD. I have been experimenting with the partitions and it seems the BR-1180 cannot handle more than 20GB partitions. Or, you can use bigger ones, but only 20GB of them will really be in use.

So the best way to initialize the HD is to go to UTILITY -> HDD -> INITIALIZE and from there, select the format mode to be DIV 2, DIV 3, or so on, depending on how many partitions you want. Since I had a 40GB, I wanted to have two 20GB partitions, and I selected DIV 2.

Now initializing...
After the initialization, I checked the partitions from UTILITY -> HDD -> INFO, and two partitions, both 19072 megabytes in size, were listed.

Then I shut down the BR-1180, took the hard drive out, put it again to my USB-IDE enclosure and copied all the old files I had backed up from the old drive. I put the old stuff to the first partition and left the second partition empty as it is (or actually it has one empty song automatically generated by the BR1-1180).

After the copying was done, I put the drive back to the BR-1180 and voilá! I had the old stuff there, and an extra 20GB partition that could be used for new recordings. 62 hours more remaining recording time for free... nice!

Fuck you BR-1180, I win.

But still, one more thing to do: put some plastic foam around the HD like Boss had done. It probably reduces some resonances the hard drive causes. For this purpose I used an old mouse pad. What do we learn from this? Always have a couple of mouse pads ready, you can do anything with them!

Hard drive in it's place, before adding the foam.

After gluing the foam.

That's all, folks.

Related links:
Boss BR-1180 owner's manual
Boss BR-1180 owner's manual - addendum
Boss BR-1180 applications guide

PS. PJ, smoking around your equipment doesn't cause hard drive failures. I'm pretty sure the fag packs would have a warning sign for that.