Music With A PLC

I've started playing with a fixed IO SLC500 trying to learn how to program PLCs. I've worked in the control industry for some years, but the programming part of PLCs is a new adventure.

I bought a few books, and have been searching the web for tutorial information with some success, and am always on the lookout for useful examples.

My latest project is trying to produce music with a plc. I have constructed an octave of tubular bells that are struck by small solenoids controlled by the plc. I've managed to produce short tunes such as chopsticks etc., but the music sounds less than pleasing as I haven't figured out a successful method for consistently producing the timing necessary for different note values. In the interest of keeping the program as short as possible (not too much memory on the PLC I have). I configured three free running two part timers (one for tone duration, the second for a short delay akin to moving a finger from one note to the next) for 1/8th, 1/4, and 1/2 notes. I utilize the individual note timing duration sequences as needed during the tune rather than using a different timer with each note played.

Playing a series of the same note lengths works out well, but a problem usually surfaces when switching from one note timing value to another as the free running timers being of different lengths can cause a clumsy sounding transition with small but noticeable timing errors at the transition points.

My goal isn't necessarily to produce music (I've done rather poorly so far :o) ), but to learn PLC programming, and specifically timing techniques at this point.

I've searched the net looking for examples of using PLCs to produce music without any hits. I would appreciate any tips on web sites with such examples or information, and/or suggestion as how I might use timing sequences more effectively.

If there are News Groups more suited for questions of this nature I would be interested in hearing of them as well.

Thank you for your time.

Reply to
Knotty One
Loading thread data ...

It sounds like you have found one of the limitations of PLC's Timers are not perfect, they have to work alongside PLC scans. So there will be small variations in the actual time a timer takes. For normal, even high speed, control this is not generally a problem, but for Music these small differences will be very audible. By the way, many PLC's have options for interrupt driven scans (eg STI in Rockwell, Time based OB's in Siemens) that can be configured to run on a more accurate time base than using timers. You might look into that. Sounds like a fun way of learning though.

Reply to
Francis

Reply to
Dennis Mchenney

I have indeed discovered the repeatability of PLC timers can leave a lot to be desired, but that's not the major problem I'm experiencing with my current project. There is so much hysterisis involved with the notes being commanded by the PLC, and being struck with solenoids that minor timing variances tend to be masked. I suspect that I've created my own troubles with the desire to use single timing routines for the three note values I'm using in the tune being played, and having configured them as free-running there is no certainty of what progression of the timing cycle they will be in when I use the /TT bit within the program. Using repetitive notes of the same value isn't a problem as the timing cycle is finished when calling the next occurrence of the value note. Playing a note with a different timing value creates the issue.

I suspect rather than using the timers in a free-running configuration I will have to initiate the timing cycle for each different value when needed so I utilize the timing cycle from the start each time. It would be easier if I were to utilize a new timer each time a note is played, but in addition to wasting memory, it would remove an opportunity to learn.

Perhaps figuring out a clean method to initiate the timing cycle when needed while still maintaining one timing sequence for each note value will result in a more pleasing tune.

Thank you for the response and suggestions.

Reply to
Knotty One

Reply to
Trajen

Stepper motors produce a "note" dependent on rpm. Years ago a salesman had a demo controller that was programmed to spin the motor at different speeds and intervals so that it played a song. You might be able to incorporate this idea into your project if you have a stepper drive to attach to the PLC.

Reply to
A. Paul Montgomery

Reply to
Dennis Mchenney

The difficulty is tempo, not pitch.

Jerry

Reply to
Jerry Avins

In a current and very interesting project that is presented at

formatting link
they are controlling a fire organ ("eldorgel" in Swedish) from MIDI channel(s) synchronized with the music. The outputs for flame/fire/explosion are controlled by a Mitsubishi Electric PLC from Beijer Electronics in Sweden.

/Sven

Reply to
<answerto

I agree that the Sequencer commands would simplify the project and reduce the rungs necessary (I do plan to learn the usage of these commands as I believe they would be most useful in process control applications), however I am somewhat impatient and wanted to hear music before mastering the Sequencer commands. I ended up surrounding each note value sequence with a MCR command allowing the specific sequence to be utilized where needed as opposed to a timing sequence implemented at each note location. While not possessing the unique qualities of music performed by a warm-blooded person, it was rather interesting to watch the electrical/mechanical contraption in action.

Many thanks to those that took the time to pass on suggestions, and encouragement.

Reply to
Knotty One

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.