This is only a preview of the January 2017 issue of Silicon Chip.
You can view 40 of the 104 pages in the full issue, including the advertisments.
Items relevant to "New SC200 Audio Amplifier":
Items relevant to "High Power DC Motor Speed Control":
Items relevant to "Programming the ATtiny85 With An Arduino":
Items relevant to "El Cheapo Modules From Asia - Part 3":
Items relevant to "Giving the Ultrasonic Theremin A Volume Control":
Purchase a printed copy of this issue for $10.00.
Improving your Arduino-based Theremin By BAO SMITH Last month we had a short article on building an Arduino-based digital Theremin which may have left some a bit wanting. This month we show how to add a second sensor onto the Theremin which is used to control volume. Y ou can’t really call something a Theremin if all it does is alter pitch. So, we decided to improve on the Theremin kit from Jaycar by adding a second ultrasonic sensor which is used to alter volume. This extra HC-SR04 ultrasonic sensor is cheap – it can be bought from Jaycar for $7.50 (Cat. XC4442). Adding the second sensor The second sensor is aimed perpendicular relative to the first and moving your hand closer to it increases the volume, decreasing it if you move away. While the physical change to this kit is very simple, there is much more that needs to be altered on the software side to provide the volume-altering effect. Because of the lack of space around the DIGITAL pins due to the pitch-controlling sensor being located there, we opted to plug the second sensor into the ANALOG pins. 80 Silicon Chip The second ultrasonic sensor is fitted so that VCC goes to ANALOG pin 2, while Trig goes to pin 3. Note that the amplifier power lead has been bent slightly so that there is better spacing between parts. siliconchip.com.au Conveniently, the ANALOG pins on the Arduino Uno can be used as digital pins, however, when manipulating them, the pin number needs to be prefixed with 'A', ergo A2 corresponds to ANALOG pin 2 on the board. We have placed the addition sensor with VCC on ANALOG pin 2, Trig on pin 3, Echo on pin 4 and GND on pin 5. We also slightly bent the 2-pin male header that the amplifier power supply connection was attached to so the lead does not come into contact with the sensor. As detailed in last month’s article, the pin locations of the new sensor can be altered (if necessary) by changing what is defined in the software. But it’s easiest to use the same pins we have. Then all that needs to be done is upload the new software to the board. The new software will still work with just one sensor, as shown last month, and can be downloaded for free from our website www.siliconchip.com.au Software Once again, the software details are left to an interested reader. Instead, we will just go over some of the more important points. At the top of the Ultrasonic_Theremin.ino file there is a new macro called VOL_SENSOR which is set to 1 by default. When set to 1, the software will act as if both sensors are attached, and thus attempts to request data from both sensors. If set to 0 the software functions as if only the pitch-controlling sensor is attached and thus only polls one sensor. The amplifier’s audio signal level is determined by the value of the 8-bit OCR2B register, which can range between 0 to 255 inclusive. Now that we have the additional sensor, a second distance measurement is computed (simultaneously with the first, to avoid slowing down the feedback loop). This distance measurement is then used to scale the sinewave value written to the OCR2B register, effectively attenuating the sound level depending on how far your hand is from the new sensor. By default, the software uses the same MAX_DIST setting for both sensors to set their maximum detection range. If for some reason you wanted to use a different value for each sensor, you would need to modify the software. The trickiest part of modifying the software to handle two sensors was the code to measure the distance for each simultaneously. This involves sending simultaneous trigger pulses, then waiting for both echo pulses to be received while separately timing the start and end of each echo, so that we can later subtract them and calculate the distance measured. We recommend that interested readers take a close look at this part of the source code to see how we did it. Of course, one of the great things about Arduino is that you can download our software and easily experi- Projects with SIZZLE! Two high-voltage projects which use the same PCB: High Energy Electronic Ignition for Cars Use to replace failed ignition module or to upgrade a mechanical ignition system Published in Nov/Dec 2012 (siliconchip.com.au/project/ high-energy+igniton) Jacob's Ladder A spectacular (and noisy! ) display of crackling, menacing sparks as they mysteriously climb the “ladder” Published in Nov/Dec 2013 Parts available from PCB, IGBT SILICON CHIP On-Line Shop: programmed PIC, siliconchip.com.au/shop Look for all the details at siliconchip.com.au/project/jacob ment with making changes to see what effect they have. More Arduino projects If you’re interested in building other Arduino projects, check out Jaycar’s guides at: www.jaycar.com.au/ arduino SC Are Your S ILICON C HIP Issues Getting Dog-Eared? Are your SILICON CHIP copies getting damaged or dogeared just lying around in a cupboard or on a shelf? Can you quickly find a particular issue that you need to refer to? REAL VALUE AT $16.95 * PLUS P & P Keep your copies of SILICON CHIP safe, secure and always available with these handy binders Order now from www.siliconchip.com.au/Shop/4 or call (02) 9939 3295 and quote your credit card number. *See website for overseas prices. siliconchip.com.au January 2017 81