Silicon ChipSuper sound effects module – Part 2 - September 2018 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Streaming will make broadcast television obsolete
  4. Feature: Augmented GNSS promises accuracy down to mm! by Dr David Maddison
  5. Project: Dipole guitar/PA speaker without a box! by Allan-Linton Smith
  6. Project: Digital white noise generator by John Clarke
  7. Project: Steam loco or diesel engine sound effects module by John Clarke
  8. Subscriptions
  9. ElectroneX Feature by Ross Tester
  10. Product Showcase
  11. Serviceman's Log: The aircon that nearly made me lose my cool by Dave Thompson
  12. Project: Add wireless remote to your motorised garage door by Design by Branko Justic; words by Ross Tester
  13. Project: Super sound effects module – Part 2 by Tim Blythman & Nicholas Vinen
  14. Feature: El Cheapo modules Part 19 – Arduino NFC Shield by Jim Rowe
  15. Review: PICkit 4 in-circuit programmer by Tim Blythman
  16. Vintage Radio: The Ekco Gondola RM 204 Mantel Radio by Associate Professor Graham Parslow
  17. PartShop
  18. Market Centre
  19. Notes & Errata: Wide-range Digital LC Meter, June 2018; Notebook: Low-cost Automotive Ammeter, June 2018; El Cheapo Modules 16 – ADF4351 4.4GHz DCO, May 2018; 6GHz+ Touchscreen Frequency Counter, October-December 2017
  20. Advertising Index
  21. Outer Back Cover: Hare & Forbes MachineryHouse

This is only a preview of the September 2018 issue of Silicon Chip.

You can view 53 of the 112 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Items relevant to "Dipole guitar/PA speaker without a box!":
  • Panel artwork for the Dipole Guitar Speaker (Free)
Items relevant to "Digital white noise generator":
  • PIC12F617-I/P programmed for the White Noise Generator [0910618A.HEX] (Programmed Microcontroller, AUD $10.00)
  • Firmware (ASM and HEX) files for the White Noise Source and Steam Train Whistle/Diesel Horn [0910618A/M.HEX] (Software, Free)
Items relevant to "Steam loco or diesel engine sound effects module":
  • Steam Train Whistle / Diesel Horn PCB [09106181] (AUD $5.00)
  • PIC12F617-I/P programmed for the White Noise Generator [0910618A.HEX] (Programmed Microcontroller, AUD $10.00)
  • PIC12F617-I/P programmed for the Steam Train Whistle/Diesel Horn [0910618M.HEX] (Programmed Microcontroller, AUD $10.00)
  • Pair of PIC12F617-I/P chips for the Steam Train Whistle/Diesel Horn [0910618A/M.HEX] (Programmed Microcontroller, AUD $15.00)
  • TDA7052AT 1.1W audio amplifier IC (SOIC-8) (Component, AUD $3.00)
  • Firmware (ASM and HEX) files for the White Noise Source and Steam Train Whistle/Diesel Horn [0910618A/M.HEX] (Software, Free)
Items relevant to "Super sound effects module – Part 2":
  • Super Digital Sound Effects PCB [01107181] (AUD $2.50)
  • PIC32MM0256GPM028-I/SS programmed for the Super Digital Sound Effects Module [0110718A.hex] (Programmed Microcontroller, AUD $15.00)
  • Firmware (C and HEX) files for the Super Digital Sound Effects Module [0110718A.HEX] (Software, Free)
Articles in this series:
  • Miniature, high performance sound effects module (August 2018)
  • Miniature, high performance sound effects module (August 2018)
  • Super sound effects module – Part 2 (September 2018)
  • Super sound effects module – Part 2 (September 2018)
Items relevant to "El Cheapo modules Part 19 – Arduino NFC Shield":
  • Software for El Cheapo Modules: NFC Shield (Free)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)

Purchase a printed copy of this issue for $10.00.

SFX Super Sound Effects Module Part 2: construction & set-up You will be amazed by what this tiny powerhouse can do. Whatever sound effect you need, of whatever length, for whatever purpose . . . this little beauty will do it. And it’s even got an audio amplifier on board! Now it’s time to put it together and get it to do some real work . . . By Tim Blythman & Nicholas Vinen T his new Super Sound Effects Module is tiny and not particularly complex. But it is very flexible and capable, thanks to its smart software. We described the circuit and some of the software features last month. Even since then, we’ve made some refinements – see panel opposite. Now let’s get into assembling the module. We’ll also describe how to test it, configure the software and put it to use. us with very few options. That meant the only suitable package for microcontroller IC1 was the 28pin Small Shrink Outline SMD package (SSOP). But don’t let the closely spaced pins put you off because, with the right tools, it is not difficult to solder. Most of the other components have much larger pins Construction Board design We’ve made the Super Sound Effects Module very compact so that it can fit just about anywhere. We’ve also given it flexible supply options. And while it is tiny, we’ve avoided using any parts which make assembly too difficult. The most difficult compromise we’ve had to make is with the micro. We needed one with more than 20 pins to provide all the required functions, as well as enough computing power for all the input/output tasks while mixing digital audio data in real time. Since we also wanted a very low standby power consumption, that left 78 Silicon Chip 0805 (imperial) packages which have a 2.0 x 1.2mm footprint. These are slightly smaller than components in 3216/1206 packages, which are also quite common. We find they are not really any more difficult to solder, while saving quite a bit of space on the board. So they are the obvious choice for this project. Because many of the components (especially the capacitors) don’t have any visible markings, it pays to work with one value at a time. so once you’ve fitted IC1 to the board, you should find the rest of the construction process quite straightforward. We highly recommend that you have a magnifying lamp on hand, some precision tweezers and a temperaturecontrolled soldering iron (ideally with at least one fine and one medium tip). You will also want some good quality flux paste and desoldering braid in addition to your usual tools. As shown in the parts list published last month, most of the passive components are in 2012 (metric) or Australia’s electronics magazine While today’s PCBs are of a very high standard, it is always a good idea to check for shorted or broken tracks before fitting any components. Check carefully around where IC1 will sit, as this is where the finest pitch pins are located. Having said that, the chances of finding a problem on the boards we supply is very low. As we go through the assembly, we’ll mention component orientations with respect to the board having the microSD card socket on the left, as shown in the main overlay diagram, Fig.3. As most of the components are small, we siliconchip.com.au suggest that you set the temperature of your soldering iron a little lower than you would for soldering larger, through-hole components. Fig.3 shows the position of all the components on the top of the board but note that you would fit only one of LK1 or LK2, not both. There are a few components on the bottom side and their locations are shown in Fig.4 but you should fit these last, otherwise, the board will not sit flat on your bench. If you are planning to use a 5.5-18V DC supply, you can leave off some components, as shown in Fig.5. For a 3V DC supply only, fit the components shown in Fig.6. Note though that if you need to be able to change the supply arrangement later, it will be easier to fit all the components now, except for one of LK1/LK2 (as shown in Fig.3). The kit of parts that we supply comes with all these parts; the only real advantage of leaving some off is that you save a bit of time. Fine-pitch ICs first Start by soldering IC1 first since it has the closest pin spacings. It comes in an SSOP-28 package, which has pin 1 marked by a small circular dot on the top surface. With the microSD card slot to the left, pin 1 goes to the bottom right and this is indicated by a white dot on the PCB. Apply some flux to the pads on the PCB and place IC1 in position as closely as possible. Hold it in place by gently pushing down on it and carefully tack one of the corner pins in place. Some constructors like to use a wooden (spring) clothes peg to hold the IC in position while soldering – as well as giving you back a hand, it precludes that awful smell of burning fingers! At this stage, it doesn’t matter too Some revisions since last month Inevitably, we’ve made some tweaks to the software since writing the article last month, in order to simplify it. That’s what happens with software; it is always capable of being refined. The first change is to the pin used for varying the playback speed (pitch). Rather than using separate pins depending on whether you are using an analog voltage or pulse rate to control playback speed, we found a way to combine both of those functions into pin 10 of IC1, which is connected to pin 5 of CON4 (the SW4 input). So now there is a single configuration setting for the playback speed control function. This was achieved by using the audio output interrupt service routine (ISR) to count pulses, rather than using the hardware pulse counter (TIMER3). Since this ISR runs 46875 times per second to feed the DAC, by checking the pin 5 state in this routine, pulse rates up to 23kHz can be measured, assuming a 50% duty cycle (or 4.7kHz with a 10% duty cycle). We’ve also made it possible for this pin to control playback volume as well as speed. Any input can have its speed or volume (or both) controlled by the signal at the SW4 input. For example, with a model train, you could use read the locomotive’s motor voltage (via a suitable divider) as a proxy for speed and use that to control the engine sound. At low motor voltages, the volume and pitch will be low and will steadily increase from a low rumble to a loud roar, giving the impression of having higher RPM and working harder as the motor speeds up. Alternatively, a potentiometer or variable resistor can be connected to this pin and used as a simple hardware volume control. The SW4 input can also be set up so that an increasing analog voltage can be mapped to a decreasing volume or speed. This is set for each input individually, so effects like cross-fades, where one sound increases in volume as another decreases, are possible. The section in the main text on configuration explains all these settings and how the input signal controls the output sound. much if you bridge some of the pins together, as it’s possible to remove the bridges with solder braid later. If IC1 is sitting flat and all the pins line up correctly with their pads, tack down the pins on the other corners to lock it in place. If it is not correct, apply the iron to the first solder joint and nudge IC into the correct location. It may take a few tries before it’s perfectly aligned. Try to avoid spreading the solder too much to adjacent pins during this process. Once you are happy with the location, solder all the pins to their pads. If you have applied flux, then all you should need to do is load some solder onto the tip of the iron and touch it to the ends of the pins where they contact the board. This will draw a small amount of solder from the iron, using the minimum necessary to make the joint. Keep the tip of the iron clean, and add a small amount of solder directly to the iron each time it runs low. Now use a magnifying lamp to check thoroughly for any bridges. These can be removed by applying some flux to the top of the affected pins and then pressing some clean solder braid to the pins with the iron. Repeat until all the pins are soldered and not bridged. We also found it helpful to use a Fig.3 (left): component overlay diagram for the top side of the board, shown at twice actual size for clarity, with a matching 1:1 scale photo above (CON2, 3 & 4 not yet fitted). Do not fit both LK1 and LK2 ; LK1 is for a 3V DC supply while LK2 (as shown above) is fitted for the 5.5-18V DC supply option. siliconchip.com.au Australia’s electronics magazine September 2018  79 Fig.4 (right): similarly, the underside overlay, also shown twice actual size, with 1:1 photo above. Seven 1kΩ resistors are located on this side of the board, along with optional tactile switches S1 and S2, which can be used to trigger the first two sound channels. smartphone (a digital camera will do a similar job) to take a close-up photograph. If you do this, you may not have to strain your eyes as much, especially if you look at the photos on a large screen. When you are happy with the soldering job you’ve done for IC1, move on to the microSD card socket and REG1. Their pins are not as closely spaced as those of IC1 but other nearby components will make it more difficult to solder them later. The microSD card socket should be a bit easier to align than IC1 as it has plastic pins which go into holes on the PCB to help locate it. Apply some flux to each pad before dropping it into position. Holding it in place, tack down one of the larger tabs on the shell to ensure it stays there. Once it is flat and you are sure that it is correctly aligned and located, solder all the larger tabs to hold it in place. Now, in a similar fashion to IC1, apply a small amount of solder to the iron, then carefully touch the iron to each pin to solder them to the PCB. You can use the same technique as for IC1 to remove any accidental bridges. Be careful not to bridge any pins to the shell, as this is connected to ground. If you are using REG1 then it is fitted next. It also has a dot to indicate pin 1 but since it is so small, it is difficult to see. You will probably need to use a magnifying lamp to see it. Place REG1 in its spot towards the bottom right of the PCB with pin 1 to the top right, near the REG1 marking on the PCB, with the small dot under the R. As before, tack one pin in place, confirm the other pins are correct, then solder them all and remove any bridges as necessary. Remaining components Now we can mount the passives, 80 Silicon Chip which are larger and easier to solder. A pair of fine tweezers will be handy here and a small amount of flux on the pads can even help in this case, too. There are seven resistors and one 0Ω link to mount on the top side of the board. Refer to the relevant overlay diagram to see which resistors go where. Table.1 shows the codes likely to be printed on the top of each value of each resistor. The 0Ω resistor is for LK1 or LK2, depending on your power supply; fit LK1 if you installed REG1 earlier, otherwise fit LK2. While it’s a bit tricky, it is possible to solder a 2-pin header onto each set of pads for LK1/LK2 so that you can use a jumper shunt to select between the two supply options. But that would only be necessary if you are not sure which one to use in your application. There are up to thirteen capacitors on the PCB. Be careful not to get these mixed up after you remove them from their packaging as they will not be marked with any values. The only way to identify them if you get them mixed up is with a capacitance meter. Fit these in a similar manner as you did for the resistors, again using the overlay diagram and PCB silkscreen as a guide as to which goes where. If you fitted REG1 earlier then solder inductor L1 in place now. Like the resistors and capacitors, it is a 2-lead device but it is a bit larger. You can solder it in much the same manner but it will probably take a little more heat to form good solder joints. If you did not fit REG1 then you will need to fit diode D1. This is also a 2-pin device but is polarised and must be orientated with the cathode stripe to the left. LED1 is next and it goes in the topleft corner of the PCB. It too is polarised and normally it will have a green dot or other marking to indicate its cathode. Australia’s electronics magazine However, we have seen SMD LEDs with a dot to indicate the anode (ie, the opposite end) so you should use the diode test function of a multimeter to check which end is which. It will light up with the red multimeter probe to the anode, so the black probe will indicate the cathode. If it doesn’t light up either way around, either you are not making good contact with it or your multimeter is not supplying enough voltage to light it up. Once you have identified its cathode, solder it in place with the cathode facing to the left. The last components to fit on the top side of the board are regulators REG2 and (if fitted) REG3 and chips IC2 and IC3. Solder them in that order, by tacksoldering one pin first and then checking the placement of the other pins before soldering the rest. REG2 and REG3 can only be fitted one way but you will need to be careful with the orientations for IC2 and IC3. If fitting REG3, smear some flux paste on its pads first and note that you will need to heat its tab for longer than the other pins, to ensure the solder has formed a good joint. IC2 should have the number 4334 visible on top while IC3 will be marked 4991. There will be a small depression on the top of IC2 adjacent to its pin 1, which should be orientated so that it is closest to the ICSP header (CON3). IC3 is soldered near the top of the board with its pin 1 is towards microcontroller IC1, ie, facing the same way as IC2.Now flip the board over and solder the seven 1kΩ resistors onto the pads as marked. The two tactile pushbuttons, S1 and S2, can now be fitted if you want to use them. Additional components If you want to solder headers for CON2 (the speaker output), CON3 siliconchip.com.au SMD Resistor codes Qty Value 1 1 1 1 2 8* 1 1MΩ 330kΩ 270kΩ 47kΩ 22kΩ 1kΩ 0Ω 4-digit code 3-digit code 1004 3303 2703 4702 2202 1001 0 105 334 274 473 223 102 0 * 7 are mounted on the underside of the PCB Fig.5: this diagram shows which parts you can omit if you only want the 5.5-18V DC supply option. In this case, power is applied via pin header CON5 or supply wires soldered directly to its pads. (in-circuit programming for IC1) and CON4 (trigger inputs) then do so now. These can be vertical or rightangle headers and can be soldered on whichever side of the board you prefer. Or you may simply prefer to solder wires directly to the pads on the board instead. The staggered pins on the ICSP header (CON3) allow you to “plug in” a header to the board without soldering it. This can be useful if you want to program IC1 but don’t want a header sticking out of the board when you’ve finished. You will need to attach a speaker or piezo transducer to get sound from the module. An 8Ω speaker is recommended if you are using the 5.5-18V input, but is too much of a load on its own for the 3V battery input, as its amplifier output power is very close to the maximum output of the boost regulator. For the 3V battery input, the piezo transducer is the simplest option but an 8Ω speaker in series with a small value resistor (say 100Ω) ) will reduce the load on the circuit and as a result, it will likely sound better too. Programming the microcontroller If you purchased the micro from the SILICON CHIP Online Shop, either by itself or as part of a kit, it will have already been programmed so you can skip to the Testing section below. If we do release an updated version of the firmware later, you could use these instructions to load it into your PIC to take advantage of any improvements. It’s easiest to program the micro once it has already been soldered to the board. You will need an in-circuit serial programmer (ICSP) like the PICkit 3 or new PICkit 4 (see the review in this issue). Take a standard 5-pin header and Fig.6: this diagram shows which parts you can omit if you only want the 3V DC battery supply option. In this case, power is applied via wires soldered to the large pads marked “+” and “-” (or pins 2&3 on CON3).. siliconchip.com.au Australia’s electronics magazine SMD resistors are marked with a 3 or 4-digit code to indicate their value; however the numbers are pretty small and you may need a magnifying glass or loupe to read them! push the short end into the staggered holes for CON3. It should be a relatively tight fit and the header won’t immediately fall off the board. You don’t need to solder the header as friction will make good enough electrical contact to enable programming. However, try to avoid wiggling the header or applying force as it will eventually become loose and will no longer have good electrical contact. You will need the HEX file which can be downloaded from the SILICON CHIP website as part of the software package for this project. You will also need a recent version of Microchip MPLAB X installed on your system. It is a free download; you can get it from www.microchip.com/mplab/ mplab-x-ide It includes an integrated development environment (IDE) and an integrated programming environment (IPE). For this task, it is easiest to use the IPE so when installation is complete, launch that and select your programmer and set the IC type to PIC32MM0256GPM028 (see Screen1). Next, click the Browse button to the right of the Source: field and select the HEX file that you downloaded earlier. Plug your programmer into CON3 on the board, ensuring that its pin 1 lines up with the pin 1 marker on the board. You need to apply power to the PIC so that you can program it. You can either do this by connecting the power supply that you intend using to run the board later, or you can set up the PICkit to supply power to the chip. To do this, switch the IPE software into Advanced Mode via the Settings menu, “log on” using the default password, click the Power button at left, September 2018  81 Fig.7: this is one way to drive the Super Sound Effects Module from an Arduino Uno. The red wire provides 3V power from the Uno (the black wire is the ground connection). The seven schottky diodes protect the 3V inputs on the SFX module from the 5V outputs of the Arduino. enable the “Power Target Circuit From Tool” checkbox (see Screen2). Having done that, click the “Operate” button at left to return to the original screen. You can now program the chip by pressing the “Program” button. Check the output window below to make sure that programming is successful (see Screen3 below). If you get an error message, check that there is a good electrical connection between the programmer, header and board and that pin 1 is in the correct position. Check also that the board is receiving power as expected. Once the chip has been programmed, the board is ready for testing. Testing You will need a power supply that can deliver up to 250mA in short bursts. Refer to Figs. 5 & 6 for an overview of where power can be supplied to the PCB. If you have built the board for the 3V supply option (by fitting REG1) then a battery holder with two AAA cells is a good option. During development, we tested using the 3.3V supply from an Arduino board, two AAA cells and both a PICkit 3 and PICkit 4 to supply power. All four options provided suf- Screen1: the MPLAB X IPE programming software is a free download and can be used in conjunction with a PICkit to load the firmware (HEX) file into the PIC microcontroller. 82 Silicon Chip Australia’s electronics magazine ficient current for the Super Sound Effects Module to operate adequately. You may have noticed the footprint for a button cell holder on the back of the PCB. We originally intended this unit to be able to be powered from a lithium button cell but the cells we tested could not provide enough current. Hence, our recommendation that you use AA or AAA cells. When the unit is powered up without a microSD card present, it starts in a mode which allows you to trigger the built-in samples. So the simplest test is to connect up a speaker or piezo transducer, apply power and then short pins 1 and 8 of CON4, pulling the SW7 input low. Note that these pins are at opposite ends of the header. You should hear the word “zero” being played back on the speaker. If you do then that suggests it’s all working normally and you can proceed to test with a microSD card, as explained below. But if you don’t hear that word then you will need to check that the supply voltages on the board are correct and that there are no construction errors such as bad solder joints or swapped or incorrectly orientated components. Voltage checks If using the 3V supply option, you have about two minutes between applying power to the unit and REG1 being shut down when IC1 goes into sleep mode. So make sure to do your Screen2: this advanced options screen in the IPE software allows you to control whether the siliconchip.com.au Interfacing with the Super Sound Effects Module You might be satisfied experimenting with the Super Sound Effects Module on a breadboard with jumper leads but if you are looking to incorporate it into another project, you will need to come up with a way to interface to it. In some cases, you may want to trigger sound effects using something like an Arduino. Keep in mind though that most Arduinos run from a 5V supply while microcontroller IC1 in the Super Sound Effects Module runs from 3 – 3.3V. The 1kΩ series resistors on the trigger inputs do allow you to connect them directly without risking damage but there are some techniques that you can use to make the interfacing a bit smoother. Since the trigger inputs on the Sound Effects Module have on-board pull-ups, you only need to actively pull those pins low. To set those pins to a high state, the driving device can simply set its output pin to a high impedance and they automatically return to a high level. So in the case of the Arduino, we can switch the corresponding output pin to a logic low output to activate the trigger and then set it to input mode (instead of driving it to logic high) to release the trigger. Using pin D2 as an example, the Arduino code to set the pin as an active low output is: digitalWrite(2, LOW); pinMode(2, OUTPUT); and the code to set it to a high impedance and allow it to return to a high level is: pinMode(2, INPUT); If for some reason you are using a control device which can not emulate this type of open-collector/open-drain output, the alternative is to connect a schottky diode in series with each input, with the anode toward the input. It will be forward-biased when the output is low, pulling the input down, but reverse biased with the output is high, preventing current from feedback back into the Sound Effects Module (see Fig.7). You may also want to generate a square wave with a variable frequency to apply to the SW4 input of the Sound Effects Module, to vary the volume or playback rate of certain sounds. If you are using an Arduino Uno for control, you can easily do this by connecting the SW4 trigger input to digital pin 5 on the Uno. You can then use this line of code to control the frequency: tone(5,300); In this case, it will generate a 300Hz square wave. It would be a good idea to use the schottky diode in this case since the output pin will be actively driven high half the time. Interfacing with a DCC decoder We’ve said that the module is ideal for model railways and if you are running a DCC system, you are probably interested in connecting the Super Sound Effects Module to a DCC decoder for installation in a locomotive (or even simply connected to the track and hidden in an item of scenery). If you aren’t running DCC, the options are more limited, especially as the track is not powered when the locomotive is stationary. Since DCC decoders may provide a 12V (or higher) swing from their digital outputs, you should connect schottky diodes in series with each output that goes to the Sound Effects Module, unless you know for sure that those outputs are “open-collector” types. checks within this time-frame. First, check the 5V rail voltage. You can measure this between pins 4 and 8 of IC3 (which are in opposite corners) and you should get a reading in the range of 4.9-5.1V. If you don’t then either REG1 or REG3 is not operating properly (whichever is fitted). If you have fitted REG3 and are not getting a steady 5V reading (and assuming the supply has not timed out as noted above), carefully check the soldering on REG3 but also on L1, the nearby 1MΩ and 330kΩ resistors and PICkit will supply power to the micro being programmed via the checkbox near the bottom. Screen3: once the PICkit is plugged in, the HEX file loaded and power applied, click Program and if the operation is successful, you will get a similar output to that shown here. siliconchip.com.au Australia’s electronics magazine the two 10µF capacitors. A problem with any of these could prevent REG3 from operating. Assuming the 5V rail is OK, check the 3.3V rail next. This can be measured on the bottom pad of LK2 (closest to the edge of the board), regardless of September 2018  83 whether LK2 has been fitted. For a negative reference, the tip of the black multimeter probe can be pressed into the tab of REG3 (or the pad for the tab, if it has not been fitted). You should get a reading between these two pads in the range of 3.253.35V. If it’s outside this range then something is amiss. Since you’ve verified the 5V rail voltage, it’s likely to be a problem with REG2 or a short circuit elsewhere. Remember to check this soon after applying power if running from a battery, as this rail will also be shut down eventually to save power. Testing with a microSD card We supply some example WAV files and a configuration file (“CONFIG. TXT”) in the software download package for this project. Copy those files into the root directory of a microSD card, plug it in and power the unit up. If LED1 is flashing then you may have a problem with the soldering on the SD card socket or there may be a compatibility problem with the card. We’ve tested the unit with a range of cards and it works well with all of them but it’s possible that some cards are not supported. So if you can’t get it to work, we suggest you try a different brand/model of card just to eliminate that possibility. If LED1 is not flashing then you can short pins 1 and 2 of CON4 (or press pushbutton S1 if you’ve fitted it) and you should hear the first sample being played back. That will confirm that the unit is fully operational. Configuration file format The configuration file (CONFIG.TXT) is simply a text file consisting of several lines which set the various parameters for the device. It does not matter what order the settings are listed unless a parameter is repeated, in which case the last instance will override any previous settings given for that particular parameter. The line starts with the name of the parameter to set, followed by an equals sign (=) and then the value(s). If there is more than one value for a given parameter, they are separated by commas (,). For example, one line may look like this: Configuration parameters MAINMODE Currently, the software only has one mode which is called “mixed” and this refers to the fact that if multiple sounds are triggered, they will be mixed together before being played back. We suggest that you include the “MAINMODE=MIXED” line in your configuration files to ensure compatibility with future software versions which may add other modes. MASTERVOLUME This sets the volume for all channels. Its sole parameter is a whole number between 0 and 256. 256 means maximum volume, however, this can lead to clipping and distortion if multiple loud sounds are played simultaneously. You may need to experiment with this value. A good value to start with is 128 (ie, half maximum volume). LOGIC The LOGIC parameter can be set LOW or HIGH, which dictates whether sounds are triggered when an input is pulled low (the default) or high. The pins have internal pull-ups in either mode, so sounds can be triggered using external switches, relays, transistor collectors or FET drains to pull these pins to ground. STANDBY This sets how long the Sound Effects Module will wait after playing the last sound before it goes into low-power sleep. 84 Silicon Chip If set to zero, the module will never go into sleep mode. Use this setting if the power supply cuts out when the module is not in use. The SPEAKBACK function will say “power standby off” in this case. The value given is in seconds, up to a maximum of 357 (which is just under six minutes). When it goes into sleep mode, current consumption is around 20µA if running from a 3V battery. If a sound is triggered in this mode, playback will take up to half a second to resume (but typically around 250ms). This is because the SD card needs to be re-initialised each time it is powered up. So the standby timer provides a compromise – there will be a slight delay between the first trigger event in sleep mode and the sound being played back but the unit will then remain in idle mode for the specified time so that subsequent trigger events will not incur any delay. So if you are running the unit off the battery, you will want to have a non-zero sleep mode to avoid draining it too quickly. But if running from mains-derived power or if you are cutting the power externally when the unit is not being used (eg, using a physical switch) then you can set the idle period to zero to disable sleep and avoid the delay upon wakeup. In the case of a non-zero timeout, the speakback will read back as “power standby” followed by the number of seconds. In the low power mode, the amplifier and boost regulator are shut down, which also means that the microSD card will shut down. SWITCH1 to SWITCH7 The number following “SWITCH” refers to Australia’s electronics magazine a trigger input. The parameters dictate what sounds are triggered when that input is activated. These are five control values, followed by between one and ten file names. The first control value is the playback mode for this input which also dictates how many sound files can be referenced. This is either LOOP, SINGLE, CROPLOOP, CROPSINGLE, ASR, ALTLOOP, ROUNDROBIN or RANDOM. The first four modes require just one file, while ASR takes up to three and ALTLOOP takes two. The last two modes, ROUNDROBIN and RANDOM can use between two and ten files. If more files are listed than necessary for a given mode then they are ignored. If a file name is left blank then no sound is played in that case. The second and third control values set the volume for files triggered by this input. The first volume is what we call the low volume and the second one is the high volume. They only need to differ if you are using the variable playback volume feature which requires a control signal to be applied to the SW4 trigger input. The SW4MODE parameter is used to enable this (see below). If enabled and the low and high volumes are different, then the playback volume for sounds triggered on this input will vary between those two values, based on the signal at the SW4 input. The fourth and fifth control values are used to vary the playback speed/pitch, with the values being the low sampling rate (#4) and the high sampling rate (#5). These work in a similar fashion to the volume parameters, and also have a nominal value of 256. So with a value of 256, the siliconchip.com.au switch1=loop,256,dtmf.wav Note that file names cannot contain an equals sign or a comma as this would cause problems parsing the configuration file. Note also that there cannot be spaces before or after the equals sign or commas. The configuration file is parsed in a non-case-sensitive manner, ie, it doesn’t matter whether names are written using lower case letters, upper case or a mixture. This is also true of how file names are handled; like Windows, they are matched in a case-insensitive manner. So a file called “Train Horn.wav” can be referred to as “train horn.wav” or “TRAIN HORN.WAV” and it will still work. Refer to the panel listing the con- playback rate will equal the file’s sampling rate, while higher values will play it back faster and lower values slower. The minimum possible playback rate is 1kHz and the maximum is 65kHz. Generally, you would use files with sampling rates around 8-22kHz so this gives plenty of scope for adjustment. It is possible for the low volume to be higher than the high volume, in which case the volume will decrease with an increasing control signal on the SW4 pin. And the same comment applies for the playback rates. Any subsequent values after these five parameters are interpreted as file names. Files must be stored in the SD card’s root directory. They must be in PCM (uncompressed) WAV format, with either 8-bit or 16-bit samples and in mono or stereo. SW4MODE The first value for this parameter is either TRIGGER, FREQUENCY or ANALOG. If the mode is set to TRIGGER then the SW4 input can be used to trigger sounds like any of the other trigger inputs. If the mode is set to ANALOG then the voltage on that pin instead controls the volume and/or playback rate of audio samples triggered by other inputs. Two additional parameters must be provided and these are the lowest and highest expected voltages (in a whole number of millivolts) on this pin. These correspond to the minimum and maximum volumes and playback rates specified for the affected trigger inputs. If the mode is set to FREQUENCY then siliconchip.com.au Here’s an example of a typical configuration file: MASTERVOLUME=128 LOGIC=LOW STANDBY=120 SWITCH1=ASR,64,256,112,384,DIESEL1.WAV,DIESEL2.WAV,DIESEL3. WAV SWITCH2=ASR,256,256,256,256,HORN1.WAV,HORN2.WAV,HORN3.WAV SWITCH3=LOOP,256,256,256,256,BELL.WAV SWITCH5=SINGLE,256,256,256,256,ANNOUNCE.WAV SWITCH6=ASR,256,256,256,256,WHISTLE1.WAV,WHISTLE2 WAV,WHISTLE3.WAV SW4MODE,ANALOG,1000,3000 SPEAKBACK=NONE figuration parameters below for an understanding of what each line does. If you are familiar with programming or shell scripts, you might be accustomed to placing a hash (#), a double slash (//) or single quote (’) at the start of a line to “comment it out” so that it is ignored. Any of these characters can be used in the CONFIG.TXT file to achieve that effect. the pulse rate/frequency applied to this pin is used to control volume and/or playback rate of audio samples triggered by other inputs. Two additional parameters must be provided and these are the lowest and highest expected frequencies (in Hz) on this pin. These correspond to the minimum and maximum volumes and playback rates specified for the affected trigger inputs. If the voltage/frequency at SW4 is outside of the specified range then the volume or playback rate will be “pegged” at the minimum or maximum value; ie, if the voltage/ frequency is below the minimum voltage then you will get the minimum volume or playback speed and if it’s above the maximum then you will get the maximum volume or playback speed. Within the specified range, the effect is a smooth transition between the limits. Note that if you are using the ANALOG mode, the software enables an approximately 350µA pull-up current on the SW4 pin. If this pin is driven from a low-impedance voltage source then the pull-up current will be overwhelmed by that source. But this allows you to connect a variable resistor between SW4 and 0V and then control the voltage on this pin by varying the resistance. For example, a 5kΩ variable resistor will give a voltage of between 0.35V and 2.1V (note that there is already a 1kΩ series protection resistor in the circuit). But the pull-up current value is nominal and the actual voltage range may vary slightly. In FREQUENCY mode, the maximum frequency is around 23kHz (assuming a 50% duty cycle) and the resolution is about 5Hz. Again, the pin’s internal pull-up is enabled, allowing a transistor collector or Mosfet drain to pull this pin low to control the frequency. Australia’s electronics magazine SPEAKBACK The SPEAKBACK debugging parameter can be set to ALL, SUMMARY or NONE, and defaults to ALL to make troubleshooting easier. When set to ALL, the values provided for all the above parameters are “read out” via the audio output when the Super Sound Effects Module starts up. This is done by playing back audio samples stored in its internal flash memory (these samples take up about 95% of the flash space). It is not possible to read out the individual file names, so in each case where a file name is encountered, you will either hear “OK” if the file is present or “NOT OK” if it has not been found or is too small to be a WAV file. Note that at this point, the unit has not actually checked the contents of the file, so you may hear “OK” even if a file is corrupt or is not in the correct format When SPEAKBACK is set to SUMMARY, the result is the same as above except that it skips over the settings of the SWITCH1-7 parameters to save time. If set to NONE, no reading out occurs and the unit starts normal operation immediately upon power being applied. So you would normally have a line reading “SPEAKBACK=NONE” in your configuration file once you are sure SC the settings are correct. September 2018  85