If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.
Special Thanks To:
Aaron Holmes
Aaron Wheeler
Adam Horden
Alan Scrimgeour
Andre
Andrew Haynes
Anonymous000
asabase
Austin Weil
barney
Barry
Bert Hickman
Bill Kukowski
Blitzorn
Brandon Paradelas
Bruce Bowling
BubeeMike
Byong Park
Cesiumsponge
Chris F.
Chris Hooper
Corey Worthington
Derek Woodroffe
Dalus
Dan Strother
Daniel Davis
Daniel Uhrenholt
datasheetarchive
Dave Billington
Dave Marshall
David F.
Dennis Rogers
drelectrix
Dr. John Gudenas
Dr. Spark
E.TexasTesla
eastvoltresearch
Eirik Taylor
Erik Dyakov
Erlend^SE
Finn Hammer
Firebug24k
GalliumMan
Gary Peterson
George Slade
GhostNull
Gordon Mcknight
Graham Armitage
Grant
GreySoul
Henry H
IamSmooth
In memory of Leo Powning
Jacob Cash
James Howells
James Pawson
Jeff Greenfield
Jeff Thomas
Jesse Frost
Jim Mitchell
jlr134
Joe Mastroianni
John Forcina
John Oberg
John Willcutt
Jon Newcomb
klugesmith
Leslie Wright
Lutz Hoffman
Mads Barnkob
Martin King
Mats Karlsson
Matt Gibson
Matthew Guidry
mbd
Michael D'Angelo
Mikkel
mileswaldron
mister_rf
Neil Foster
Nick de Smith
Nick Soroka
nicklenorp
Nik
Norman Stanley
Patrick Coleman
Paul Brodie
Paul Jordan
Paul Montgomery
Ped
Peter Krogen
Peter Terren
PhilGood
Richard Feldman
Robert Bush
Royce Bailey
Scott Fusare
Scott Newman
smiffy
Stella
Steven Busic
Steve Conner
Steve Jones
Steve Ward
Sulaiman
Thomas Coyle
Thomas A. Wallace
Thomas W
Timo
Torch
Ulf Jonsson
vasil
Vaxian
vladi mazzilli
wastehl
Weston
William Kim
William N.
William Stehl
Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Registered Member #95
Joined: Thu Feb 09 2006, 04:57PM
Location: Norway
Posts: 1308
Polyphonic Tesla Coil MIDI Interrupter
This is a little something I've been working on for the last month. It's a modular MIDI player, which can be used as a Tesla coil interrupter or synthesizer. For those who aren't familiar with MIDI, it's a music standard used largely by keyboards and drum pads, in which simple commands are sent serially, such as note on and off information, but not actual musical. That job is left to the synthesizer, which is simply told when a note is on or off, and must create the corresponding sounds (frequency, waveform, etc) itself in order to make audible music. So no matter what the original song is supposed to sound like, the MIDI signals simply tell us when a key is on or off (and a lot of other information, but nothing that's interesting for this project). This is perfect for Tesla coil modulation, as every SSTC or DRSSTC can be interrupted, and by interrupting the coil at the same frequency as the note being played, we can create music!
This project has evolved from a monophonic MIDI player using a single ATmega32, to a multi-channel, multi-note (polyphonic) MIDI player using several ATtiny2313s working together. Each ATtiny2313 can play two notes at once, using Timer1 and the two Compare Match modules. The AVRs are organized so they all receive the same input, but only start playing notes once an enable input (PD5) is set high. Once an AVR has used both it's compare match modules to play notes, ie is full, an output pin (PB0) goes high. This way they can cooperate, and in theory play and infinite number of notes at once. The MIDI channel that the AVRs listen on is set using the four most significant bits on PORTB. I've made a small example circuit where three ATtiny2313s are chained together, and can either play 6 notes on one channel, 4 notes on channel 1 and two on channel 3, or two notes on channels 1,2 and 3. Depending on the switch positions. The firmware was made using WinAVR. Firmware, schematic and a command-line program for determining the compare match values here can be found further down.
For anyone else who wishes to tread down the path of MIDI, I recommend you read this article by Paul Maddox. It was a reference I used throughout the entire process, and saved me a lot of headaches. (not to say I still didn't encounter enough of them.) Also, if you wish to mix several notes together you need to keep the duty cycle low (~5%). This is obvious once it's been pointed out (thanks Steve W), because you can only send one bit of data down the line, and mixing two square waves results in areas at V/2 - which would require 2 bits of data to describe. Keeping the duty cycle low reduces the chance of an overlap. And the more square waves you mix the more bits are required. It's easy to see graphically if my explanation is poor.
The firmware itself is interrupt-driven. MIDI bytes are processed as soon as they are received, and once a full MIDI packet has been received a note is either turned on or off. When a note is turned on the correct off-time and on-time values are looked up and stored for quick access, and interrupts are enabled for one of the compare modules. If both compare modules are now busy an output pin is set high to alert any other AVRs in the chain that it's full. Once a compare module generates an interrupt, an output pin is toggled and the time until the next interrupt is determined depending on whether it's in a high or low state (to get an asymmetric waveform). When a note off event occurs the AVR first checks that it's actually playing the note before stopping one of the compare modules. The main program loop is just used to indicate when notes are being played and check what channel to listen on.
So far I've done little more than test this on a quarter watt PC speaker, but it's plays the Maple Leaf Rag perfectly, so I can't wait to try it on a SSTC or DRSSTC. The next steps in this project are designing a PCB, boxing up the interrupter, and finally making a dedicated SSTC. Don't be afraid to test this interrupter before I do, it'll still be some weeks until I can rig up a TC to test it on.
Wed Nov 18 2009
Progress is still snailing along. I made a PCB for the MIDI interrupter but ordered the wrong box size and only received one of the two 12MHz cyrstals I ordered. Still, I had enough to test the full circuit over a toslink connection, which works great with a small speaker. With a temporary 8MHz crystal on the last ATtiny2313 I couldn't get 6-note polyphony though, only 4-note. I hope this is due to the crystal speed, and not something in the code... I'll publish the PCB design and upgraded firmware once I've pinpointed the problem.
I later dusted off an old secondary and half-bridge from another SSTC project and fired it up using several different drivers. In the end Steve Conner's MKI PLL was the only one that worked reliably, thanks again man. With a 2250µF filter capacitor power draw is almost exactly 1kW and the discharge is fairly silent, no mains hum at least. Heatsinks stay cool and it appears to be able to run continuously in CW mode.
I figured a musical test was in order, so I hooked everything up for a trial run. Results left a lot to be desired... Low frequency notes gave decent sparks, but higher notes gave smaller streamers until I could only hear them without my earmuffs on. Eventually (within 10 seconds) the output died altogether, even when playing low notes. I turned off the coil at this point and removed the keyboard and set the coil for CW. When I turned it on again, after charging up the filter capacitor, I was blinded by an exploding bridge of IRFP450s. The toslink module was unshielded, and I hadn't disabled the IRFP450's internal diodes. Now before I go buy some expensive diodes, was this the likely cause of failure? This coil's resonant frequency is 625kHz.
Sun Nov 29 2009
I've tested the PCB and final source code now which all work, so it's a go for anyone looking to try this! I put the assembly in an ugly project box, and made a little teaser video. An actual Tesla coil test will have to wait until I get the high speed diodes I ordered from China.
Holidays are over and it's back to work! I reassembled the Tesla coil and popped some brand new MUR1560 diodes into the full-bridge this time. So far they appear to have solved the problems I had earlier, and the coil can be interrupted without exploding. I have a habit of turning off the logic supply before the main power, which caused some headaches today. So despite constantly forgetting to power the coil down in the right order, thus loosing at least four full-bridges, I managed to get it functioning again.
At first I tried the MIDI interrupter carefully, in non-inverted mode (like a DRSSTC, so ON-times are short) this resulted in absolutely no output from the coil. I suspect the PLL isn't able to lock quickly enough, so that's one problem which needs fixing. So when that failed I switched the interrupter into inverted mode, so it runs CW until interrupted. And it worked!!! I've made a few videos flaunting my coil already.
The video doesn't do the sound quality justice with all the background noise, in person the sound is quite clear, easily audible without ear muffs on.
Well, there's the evidence needed for this project! I been in contact with another coiler who has been using this interrupter with a DRSSTC, so it works with them too!
Registered Member #1403
Joined: Tue Mar 18 2008, 06:05PM
Location: Denmark, Odense C
Posts: 1968
This is something I wish I had the time and materials to do right now! So I could try pure notes on my SSTC II.
We have yet to see it work, but as this is the first? published midi modulator, at least in this hobby, it will be a instant classic and worldwide standard :)
Registered Member #33
Joined: Sat Feb 04 2006, 01:31PM
Location: Norway
Posts: 971
Excellent work. I really like the way the microcontrollers are cascaded for more notes, very clever.
I have also used common optoisolators for MIDI, but this has given me a lot of trouble. It seemed to be working well together with some MIDI controllers, but would not work, or only work intermittently with others. The recommended PC900/6N138 are darlington optocouplers, so they have a much higher current transfer ratio than common optocouplers. Common optocouplers will work fine together with stronger midi outputs, but with weaker ones it will work intermittently or not at all. I tried adding an external transistor to the optocoupler, to make it into a darlington, and while this improved the situation, it still only worked with about half of the devices I tested it with.
Registered Member #1134
Joined: Tue Nov 20 2007, 04:39PM
Location: Bonnie Scotland
Posts: 351
Nice! I built a similar interrupter based around the ATMega-328, which is coupled to my DRSSTC`s via Toslink fibre optic cable.
Mine is monophonic, because of duty cycle concerns, but the sound is awesome! Very clear and crisp, and is amazing on two or more coils.
Since you have open sourced this, I recommend that anyone wanting to play music on their DRSSTC`s ought to get into µC MIDI control. There are no excuses now and nothing beats it
Registered Member #95
Joined: Thu Feb 09 2006, 04:57PM
Location: Norway
Posts: 1308
Thanks. Do you guys want a video of the prototype playing something, or should I save it until I get some sparks?
Anders M. wrote ...
I have also used common optoisolators for MIDI, but this has given me a lot of trouble. It seemed to be working well together with some MIDI controllers, but would not work, or only work intermittently with others. The recommended PC900/6N138 are darlington optocouplers, so they have a much higher current transfer ratio than common optocouplers.
Good to know, I've change the specified type to PC900/6N138 instead. I just used whatever I had in my junkbox.
GeordieBoy wrote ...
Neat! How did you convert the MIDI note numbers to pitches? Do you use a look-up table in your software?
Indeed, I made a command line program so I didn't have to do 176 calculations every time something in the configuration changed. Here's what the note generation code looks like for one compare module:
// List of Timer 1 values required to generate various frequencies, encompasses full 88 notes.
// Lookup Compare Match B value void set_compB(uint8_t data) {
compareB_playing = data;
// Check if key is in range, if not assign value. if (data > 108) { compareB_off = pgm_read_word(&(compare_off[87])); compareB_on = pgm_read_word(&(compare_on[87])); }else if (data < 21) { compareB_off = pgm_read_word(&(compare_off[0])); compareB_on = pgm_read_word(&(compare_on[0])); // In range! }else { compareB_off = pgm_read_word(&(compare_off[data - 21])); compareB_on = pgm_read_word(&(compare_on[data - 21])); }
// Compare Match B interrupt enable modeB = 0; TIMSK |= (1 << OCIE1B);
}
// Compare Match B interrupt ISR(TIMER1_COMPB_vect) {
PORTD ^= 0b0000100;
// add start value to current timer 1 value ensures that compare match occurrs at set number of Timer 1 increments if (modeB) { OCR1B = TCNT1 + compareB_off; modeB = 0; }else { OCR1B = TCNT1 + compareB_on; modeB = 1; }
Registered Member #95
Joined: Thu Feb 09 2006, 04:57PM
Location: Norway
Posts: 1308
Progress is still snailing along. I made a PCB for the MIDI interrupter but ordered the wrong box size and only received one of the two 12MHz cyrstals I ordered. Still, I had enough to test the full circuit over a toslink connection, which works great with a small speaker. With a temporary 8MHz crystal on the last ATtiny2313 I couldn't get 6-note polyphony though, only 4-note. I hope this is due to the crystal speed, and not something in the code... I'll publish the PCB design and upgraded firmware once I've pinpointed the problem.
I later dusted off an old secondary and half-bridge from another SSTC project and fired it up using several different drivers. In the end Steve Conner's MKI PLL was the only one that worked reliably, thanks again man. With a 2250µF filter capacitor power draw is almost exactly 1kW and the discharge is fairly silent, no mains hum at least. Heatsinks stay cool and it appears to be able to run continuously in CW mode.
I figured a musical test was in order, so I hooked everything up for a trial run. Results left a lot to be desired... Low frequency notes gave decent sparks, but higher notes gave smaller streamers until I could only hear them without my earmuffs on. Eventually (within 10 seconds) the output died altogether, even when playing low notes. I turned off the coil at this point and removed the keyboard and set the coil for CW. When I turned it on again, after charging up the filter capacitor, I was blinded by an exploding bridge of IRFP450s. The toslink module was unshielded, and I hadn't disabled the IRFP450's internal diodes. Now before I go buy some expensive diodes, was this the likely cause of failure? This coil's resonant frequency is 625kHz.
Registered Member #1637
Joined: Sat Aug 16 2008, 04:47AM
Location: Kiev, Ukraine
Posts: 83
Awesome interrupter.
I tryed to play several notes at time on single SSTC using DDS. But intermodulation distortion turned sound to someting awful. That is why I abandoned idea to play polyphony on SSTC. SSTC is monophonic by its nature - its sound contains lots of harmonics.
Registered Member #95
Joined: Thu Feb 09 2006, 04:57PM
Location: Norway
Posts: 1308
Thanks. I've tested the PCB and final source code now which all work, so it's a go for anyone looking to try this! I put the assembly in an ugly project box, and made a little teaser video. An actual Tesla coil test will have to wait until I get the high speed diodes I ordered from China.
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.