热度 4
2014-11-12 18:13
1684 次阅读|
0 个评论
Well, things are bouncing cheerily along, as they do. With regard to my previous column about locking down the final layout for my Vetinari Clock, we've pretty much boiled things down to the two choices shown below. In the upper image, we have our tree-switch group on top; also, the "peaks" in the black cabinet located over the big meter to the left and the switches to the right are on the same horizontal plane. By comparison, in the lower image we have our two-switch group on top and the tips of the "dips" in the black cabinet are on the same plane. Now it's time to consider the operating modes we are going to implement along with any associated sound effects. But before we go there, I'm afraid I have to confess to having been lured to the "dark side" by the somewhat naughty project suggested in a recent Practical Joke column. Inspired by that column, I'm going to have an additional three-way toggle switch on the back of the clock. This switch will select between three super-modes: Standard Mode: This will be the switch's center position. In this case, the clock will behave according to the current sub-mode as defined by the switches on the front of the clock. Modifying the state of the switches on the front panel will simply change the current operating mode. Loki Mode: This will be the switch's up position. When this mode (which is named after the Norse god of mischief and trickery) is entered, the clock will continue to behave according to the current sub-mode as defined by the switches on the front of the clock. However, modifying the state of any of the switches on the front panel will cause the analog meters to start oscillating wildly and the LED's on top to flash enthusiastically, all accompanied by some heart-stopping sound (to be determined). Returning the three-way switch on the back of the clock to its center position will cause the clock to resume its Standard Mode operation. Test Mode: This will be the switch's lower position. In this case, the clock will perform a variety of test sequences (to be determined) as defined by the switches on the front of the clock. All of this is going to be controlled by two Arduino Uno microcontroller development boards. One of these Arduinos will be the master in charge of orchestrating operations. This board will access data from a real-time clock (RTC), drive the meters, control the LEDs in a NeoPixel Ring mounted under the vacuum tube on top of the case, decide what sounds are to be employed, and so forth. The second Arduino will set up as a slave on the I2C bus. This Arduino will be in charge of handling the sound effects themselves. When the master Arduino issues an appropriate I2C command requesting a particular sound, the slave Arduino will make it happen. With regard to the sounds themselves, I'm using a Wave Shield from Adafruit. This little scamp can play uncompressed 22KHz, 12-bit, mono Wave (.wav) files of any size. But now we have to decide what modes we wish to implement and which sounds we'll use to accompany and complement these modes. What modes? We already discussed the fact that we need some sort of sound effect for use with the Loki Mode -- when someone modifies the state of a front-panel switch, this sound will start up. Maybe we should have a number of such sounds and randomly move between them as the operator frantically manipulates the front panel switches. With regard to the switches themselves, my original thoughts were that one of the two-switch group could be used to turn the sound on/off (except in Loki Mode, of course), while its companion could be used to enable/disable any lighting effects associated with the vacuum tube located on top of the cabinet. This would leave the three-switch group to define one of eight operating modes. The more I contemplate and ruminate on this, however, the more I'm coming to the conclusion that the switches to enable/disable the sound and light effects can live quite happily on the back of the clock. Actually, the more I think about this, the more I think we are going to need some additional switches on the back of the clock anyway, because I'm not sure how we can achieve everything we want to achieve using only the five switches on the front. Let me share my current thoughts with you, and then we'll see if we can decide how to accommodate things using our existing front-panel switches, along with any additional switches we can add to the back of the clock as required. Let's start with the main modes I'm considering as follows: Standard: In this case we just need a regular "tick-tock" sound effect. Vetinari: Remember that this is our namesake mode. This is the one where the clock continues to keep perfect time overall, but the ticking of the clock follows a disconcerting rhythm, something like "tick-tock tick-tock tick... ... ... tock-tick-tock..." and so forth. Clockwork: In this case, I'm envisaging the constant sound of clockwork gears and other mechanical mechanisms beavering away in the background. The regular "tick-tock" sound would be modified to fit in with this theme. Also, there would be additional effects accompanying things like the rollovers at the end of each minute and at the end of the hour. Air and Water: In this case, the "tick-tock" sound would be replaced with the sound of water drips. Also, there would be additional background sounds of running water and pneumatic bursts of air accompanying things like the rollovers at the end of each minute and at the end of the hour. As you see, thus far I've only come up with four main modes. Can you suggest any others? Now, although I'm considering the modes described above to be the main modes, I'm also thinking of an additional characteristic that "overlays" all of them. We might think of this as "analog versus digital." In the case of a regular analog clock, as the "big hand" moves around the clock, the "little hand" gradually progresses between adjacent hours in an analog fashion. This is one of the things that makes a regular analog clock tricky to read for younger folks. In the case of our Arduino-based clock, we have much more control. We can certainly have an analog operating mode in which the needle on the Hours meter gradually progresses from one hour to the next. But we can also support a digital alternative in which this needle remains pointing at the current hour until the rollover at the end of the hour, at which time the needle could move directly to point at the next hour. Another effect I want to include is something I think of as the "Straining" mode. This could be used to augment any of the four main modes, but only if we were using the digital characteristic we just discussed. Let's start with the Standard and Vetinari modes. I'm imagining that -- assuming the "Straining" mode is engaged -- when we reach the end of the hour, the needle on the "Hours" meter will start to quiver and we will hear some sort of a straining sound with tension building until... the "mechanism" releases (with an appropriate sound effect) and the needle moves to point to the next hour. If you were here in my office, I could mimic an appropriate sound for you. As it is, you'll just have to use your imagination. Ideally, I'd also like equivalent "Straining" sound effects to accompany the Clockwork and Air and Water modes. OK, I have a couple more supplementary modes, but I'm not quite sure how they should fit in with everything we've discussed far. What I'm talking about is to have a sort-of "Cuckoo Clock" effect, but with an amusing/strange cuckoo sound; also a sort of "Westminster Chimes" effect, but -- once again -- an unusual/amusing version on the basis that the only time I like hearing traditional versions of these chimes is when I'm standing outside a real church tower. Actually, I think these supplementary modes could augment all of the four main modes, and they would work with both the analog and digital operating modes, but they would be dominant over (or subservient to) the Straining mode -- that is, you couldn’t have these supplementary modes and the Straining mode active at the same time. So, before we proceed to the next page, are there any more modes you think we should implement? Also, can we map the various modes discussed above onto our five front-panel switches, or do we need to add additional switches on the back of the cabinet? Which sounds? Based on our earlier discussions, the next step is to decide which sounds we wish to use. Originally I'd thought of synthesizing the sounds, but real-world versions sound (no pun intended) so much better. This is why I opted to use the Wave Shield as noted earlier. So, we know we need a "tick-tock" sound. We also need a selection of sounds to accompany the Loki mode. Similarly, we're going to need suites of sounds to complement the Clockwork mode and the Air Water mode, where these suites cover both the regular running and the rollovers at the end of each minute and the end of each hour. Then we are going to need the various "Straining" sounds to augment the four main modes. And, finally, we need additional sounds to implement our "Cuckoo Clock" and "Westminster Chimes" modes. Now, there are a variety of websites from whence one can download free sound snippets, such as FreeSound.org . For example, consider this slow-ticking pendulum clock . Once we've located appropriate sound snippets, we can chop out the parts we need using the free Audacity audio editor. The only problem is that there are so many options that my head is spinning. I was rather hoping that you might help out by rooting around and suggesting appropriate sound samples we could use. What about an amplifier and speaker? The last point to consider is the audio system itself. I've not found the time to assembly the Wave Shield yet, but I'm assuming the little speaker that comes with it won’t provide the "rich and fruity" tones I desire. I'm thinking I'll need a bigger, better speaker and a little amplifier to accompany it. The inside of the cabinet will be able to accommodate anything up to 8" in height. Sad to relate, however, I'm not an expert in the audio side of things, so I'm more than open to suggestions. All of which leads me to ask if you have any ideas you'd care to share. How about your thoughts on mapping the modes described in this column onto the five switches on the front panel -- will we need additional switches on the back of the case? Are you bursting with inspiration regarding additional operating modes? And, last but certainly not least, any suggestions with regard to appropriate sound samples would be very welcome, as would proposals with regards to my choice of speaker and amplification.