Applause Meter
Since somewhere around the year 2001 I started taking drum lessons. After ten years, in 2011, I joined my first concertband and I was hooked. Making music together and playing at a concert is exhilarating. Now I am at a different concert band for already more than 5 years. We have two concerts per year and several commissions on the side.
As theme of our new-years concert we wanted to hold an awards ceremony for the best songs we've played. The setup was that we played two songs in each category. For instance "Ice versus fire" for which we played a medley from "Frozen" and one from "How to train your dragon". The audience should then vote for the best song, which then would be awarded a custom 3D printed award.
While brainstorming during the preparations, we had a lot of ideas on how to make the audience vote, from paper votes to apps. But all of those suggestion require the show to be halted for each award, while seriously distracting the audience. When an applause meter was suggested, we all knew we hit gold. But some searching online revealed no real ready-to-go-solution. So I bravely stood up, declared myself a novice maker and claimed I could easily build one from scratch for a rather small budget.
Oh boy was I unprepared for the rabbit hole I would fall into.
Supplies
Tools
- Your favourite cordless drill
- Circular Drill Bit and other bits
- screwdrivers
- 3D printer (optional)
Case
- Plywood. (I choose 8mm multiplex but in hindsight I should have gone for 12mm or even thicker)
- 4 X Magnetic Door Catch (optional in hindsight)
- Screws
Electronics (5V)
- Arduino Nano
- Electret microphone amplifier - MAX4466 with adjustable gain (or similar, whatever suits your needs)
- 2 X 5V 8 Channel Relay Module
- 220V to 5V transformer
- wires, a lot of short ones, and one four-stranded wire of several meters for the 'remote' controll
- two switches
Electronics (220V)
- standard electric cables (leftovers from house construction are ideal, but best flexible)
- Fused AC Power Socket (optional but highly recommended)
- Light bulbs of your choice
- Bulb sockets
5V Circuitry: Arduino
There are three main parts to this build: (1) the 5V electronics which will do the "hard thinking": listening and deciding when and which lights to turn on; (2) the casing to fit everything in nicely, hides away all the 'crimes', and (3) the 220V circuit that is controlled by the 5V circuitry.
Let us start with the 5V circuitry since we can build this on a small scale.
It was not an easy task to find online resources. I envisioned ten lights, which lit up according to the loudness of the applause, but nobody appeared to have done this before. So, I started small; On tinkerCAD I build a online simulation of how I wanted the 5V electronic parts to look like. You can find my very rudimentary design with code here: https://www.tinkercad.com/things/8mnCXXKIs9M or below on this page as "Applause_1.0.ino" file.
Making a draft version online and testing out several Arduino codes on this simulation really helped me to get a better view of what was needed for this build. This way I experimented with adding a way to control the behaviour of the program: I ended up with two switches. One switch turns the measurement on and off, the other resets the score back to 0/10.
I resourced all the necessary components: Some LED's, resistors, an Arduino and most importantly an Arduino compatible microphone.
I build the circuit and tested everything at the next rehearsal, only to realise that the microphone I bought was way to sensitive for my use. Just one clap at a reasonable close proximity, or just the band playing, would saturate the microphone giving a 10/10 score. This drove me to search for a microphone with variable gain. I finally settled on the Electret microphone amplifier - MAX4466. It has a very small screw at the back with which you can set the gain. (side note: I also changed the Arduino uno for an Arduino Nano for no particular reason whatsoever).
The MAX4466 performed better but also maxed out when clapping at close proximity, therefore I decided to also include clap-time as a variable to the formula instead of only the loudness of the applause. I also wrote a little bit more of an elegant code for this version 2.0 of the software (even if I say so myself). If a loudness threshold was exceeded, only the first light would go on followed by a brief pause during which no lights could turn on. After waiting the Arduino would listen if the sound was still loud enough for the second light to go on, if so then the light turns on and the next waiting period would trigger. The waiting time would increase each time a new light came on. An applause would need to last 22.5 seconds at full volume for the lights to show 10/10. You can find the code on tinkerCAD https://www.tinkercad.com/things/lKgWlueZDE3 or below as "Applause_2.0.ino" file
A quick test with the relay modules connected instead of the LEDs taught me that the relays were ON when the signal was LOW and OFF when the signal was HIGH. No problem, just switching out some ONs and OFFs in the code and we were ready to go.
With all this sorted out. I could start soldering everything together. But I needed to know how long all the connections inside the box should be. So let's first build the outside box and arrange all components in it.
Designing the Box
A second aspect of this build was its aesthetics. The applause meter would be in the middle of the attention so it had to at least look good. I chose to build a wooden box since I have the basic tools for it and it is relatively easy.
Having learned on tinkerCAD that experimenting in the digital world is highly educational, I also designed the applause meter box in the popular 3D-CAD program Fusion360 before buying any of the necessary materials.
Over the course of several iterations I finally settled on this design (see pictures). It is a simple rectangular box with the lights sticking out of circular holes in the front panel.
Ugly screws in the front panel were avoided by adding some support bars on the inside of the front panel, where later on magnetic door snappers would be screwed into. The magnetic closing system is in hindsight more of a safety feature than a really necessary one, since the bars held the front plate on by friction alone, just fine .
I also added the electronics to my digital design. This changed some things, so it was already paying off that I first designed it in Fusion360. For example the box needed to be a little wider than the initial 15cm in order for the relays to fit sideways. I also ended up modelling and 3D-printing plastic holders for the light sockets which in their turn would hold the lights in place. This seemed to me to be the option that would give me enough 'wiggle-room' for future mistakes. (I know these holders can also be bought as such, but this costed me three times more and I was on a budget)
I have added the F360 file of my final design here for you to reference and play around with.
Downloads
Building the Box
With the digital design finalised it was time to go to the hardware store, buy a big sheet of plywood and start cutting. With me not really owning such 'fancy' tools I went to my parents place one weekend and cut the wood to size there.
My design did however ended up producing a quite exotic cut-sheet:
- 2 times 16.6x150cm for the front and back
- 2 times 16.6x10.2cm for the top and bottom
- 2 times 10.2x148.4cm for the sides
The supporting bars on the inside of the front panel were leftovers and were used as such otherwise the preferred length would have been 134cm and 12cm.
Once home, I laid out all the parts on the floor and with the help of some (borrowed) corner clamps, started pre-drilling holes and screwing the boards together. Remember that screws only go in the top, bottom and back of the meter for pure aesthetic reactions.
Pilot drilling the holes and screwing all boards together was made to a precarious task due to the plywood being only 8mm thin, I often cursed myself for thinking 8mm would be thick enough.
The front panel needed some carefully spaced holes of around 5cm diameter. I marked the center-line of the front board and started from one side. The center of the first hole was 8mm (the material thickness) + 75mm (half of 150mm) from the edge of the board. All other holes are 150mm apart. In the end I was only off by 2mm when I marked the tenth hole... it was a good day!
The only circular drill-bit that I could borrow was 51mm, more than close enough for me to happily start drilling.
The front plate guides were glued in place on the inside of the front plate with simple wood glue.
Installing the Sockets in the Box
The first components that get mounted in our newly built box, are the light-socket holders. The reason for this, is that the holders should be positioned centred under each hole in the front plate. Because the holder hold the light sockets in position, which on their turn will have the light bulbs screwed in to them, and the light bulbs are literally the only thing sticking out of the front panel and thus are the only thing that cannot be moved to another position inside our box. Since their position is fixed, they should go in first, to make sure I don't make a stupid mistake later on.
As I mentioned before, there are commercially available light sockets with an integrated bracket to mount them perpendicular to a wall, but these cost 4 times more than the simple ones that are made to just to hang from the ceiling without even making a weak attempt to look pretty. So, I went for cheap and 3D-printed holder for the sockets. (STL file below). When making the 3D design I made sure there would be enough of 'wiggle' room to place the sockets at a variety of depths.
I printed just one holder to verify the design. After that I printed 9 holders at once, completely filling up all of my build plate and ending up lasting more than 50 hours.
I arbitrarily marked the top and bottom of the front plate and box (remember I got a whopping 2mm deviation between digital design and reality). Then I started the tedious process of centring one holder with the lid in place, carefully lifting up the front, marking its position with pencil, and moving to the next holder. When all was said and done, I rechecked every position before finally screwing them in the back plate.
A note on screws: my holder design has a pretty thick base, this is done on purpose to make sure that my 16mm long screws don't poke out the back of my 8mm back plate. Yet another reason to go for a thicker plywood. (Forget "live, love, laugh" it's "live, love and learn").
Anyway, the light sockets were up next. I chose the preferred height that I wanted the light bulbs to stick out above the front panel, and then measured the depth the sockets should be at, again by carefully positioning everything while the front is closed and lifting it up and measuring. One little detail: I first had to unscrew and break off a piece of the cable-end of all the sockets that served as a strain relieve for the cables when hideously hanging form the ceiling, but since I was mounting them in custom printed holders, they served no function to me at all. Even worse, the strain relief caused the cables to resist the tight bend I was forcing them in, thereby doing its job perfectly,... so the strain relief had to be eliminated in order for the sockets to fit in the holders the way I wanted.
I glued all the sockets in the holders and let it set overnight with rubber bands holding pressure. Of course, I fabulously forgot that I bought 9 normal light bulbs and one fat one for the tenth light, this larger light is more spherical instead of pear shaped, requiring a socket that is placed closer to the front of the box than all other lights.(Live and learn)
I was therefore forced to break the glue, (only slightly breaking my 3D-print) to free up the socket and repositioning it. After copious amounts of more glue to both fix the holder and join it to the socket at the right height, the mounting of the sockets was done.
I also screwed the connectors of the light sockets to one of the sides of the back plate.
Downloads
Soldering the Low-voltage Electronics
The next order of business is "dry-fitting" all the low voltage electronics in the box to get an idea for how long the soldered connections between the parts should be.
I started by placing the Arduino in the middle between light 5 and 6 and arranging the relays in the adjacent places above and below.
I realised that no wood screws would fit through the holes in the Arduino nano. This is quickly solved by soldering some female headers on a solderable bread board. The headers will hold the Arduino and some drilled holes in the circuit board will accept the wood screws without complaints. This solderable board will also house the headers for the microphone to be connected, the connectors (with cables) to go to the relays and the long cable for the remote control box.
About the remote box; I needed two switches at the end of a very very long cable. I am way at the back of the stage as percussionist, while the meter would be at the very front of the stage. I purchased 20m of 4 stranded wire that is usually used for soldering LED strips. To house the two switches, I designed and 3D printed a simple box (STL and F360 files below) but any rectangular box with some cut-outs for the components and wires will do the job.
After measuring the distance between the components and taking a generous excess on that distance, I heated up the soldering iron and started soldering away.
Soldering all connections requires some patience, and above all some concentration to do it right. I have included the wiring scheme I used to make all connections but be aware that your wiring might be a bit different if you use different components. (Or if I made a mistake in my diagram)
In the end my wiring looked as if a bird was trying to nest there. Nevertheless there were miraculously no errors made and nothing started smoking when turning on the power.
With everything connected I could screw every circuit board to the back panel on 3D-printed standoffs. These standoffs served two functions: (1) it is always a good idea to allow for some room between circuit boards and the plate you mount them on. And (2) have I already complained that I have 16mm screws and 8mm plywood, and that I am therefore in a constant danger of screwing screws straight through the wood? Yep, the standoffs also made sure my screws would not reach the other end of the plywood box.
[NOTE] In hindsight, I would actually recommend using 5 relays per relay module. My idea of using two 8-channel relay modules was to allow for a broken relay, in that case I would simply have to change out connections and the applause meter would be up and running again. This would also divide the 220V connections a bit better over the two modules, making the cable management a bit more ... manageable. (Live and Learn)
Connecting the 220V Components
With all the low voltage components in place it is time for the serious work and install the main voltage circuit.
It goes without saying that while working with the wires you do NOT, under any circumstances, connect them to the mains !!!!!
Together with the technician that would install and control the show-lights for our upcoming concert we decided to use a fused power socket as power input for the applause meter. This made sure that any cable of any length would be able to fit and supply power to our meter.
Also this would add a layer of safety to our setup: These connectors are equipped with a fuse that blows above a certain amperage, making sure nothing caches fire if not supposed to.
For installing this plug we needed its exact measurements. It however has a pretty complex shape. So, the simplest thing I could come up with, is to press the powerplug on a piece of cardboard and trace the contours of the plug. The contour lines can then be cut out producing a template that can be transferred to the wood.
When marking and cutting out the location for the plug, keep in mind that there are already components installed on the inside of the meter which can not be moved anymore, limiting the possible locations where the plug can poke out of the box. The same goes for the exit hole of the 20m long wire for the 'remote' control.
Normally you would cut the hole with a jigsaw, but I don't own such a device and I was impatient, so I simply drilled holes along the contours and just cut out the hole with a sharp blade. This works, but I cannot recommend it since I almost cut my fingers off.
Now it is just a matter of wiring everything together. I have made a wiring schematic of the 220v circuit for easy reference. The hot wire is connected to all lights in parallel while the neutral wire is interrupted by the relays before connecting to the lights. It is as simple as that. Just make sure that you wire the correct light to the correct relay, or you'll have to reconnect either the 5V controlling end, or the 220v wires to fix your mistake.
There is an Instructable on how to connect your wires to the fused power socket that explains everything better than I ever could, so hop over there, but remember to hop back here (https://www.instructables.com/id/Wire-Up-a-Fused-AC-Male-Power-Socket/)
[NOTE] To connect the neutral wires to the centrally placed relays, I connected one wire to the fused socket and split it in ten before connecting it to the relays. I was planning on passing through the neutral cables at the relays, connecting every relay input in parallel to each other. However, the relay terminals did not accept more than one cable forcing me to come up with another solution. To make this split it is advised to use a connector of some sort. I did not have that, (and I was impatient) and just tied up all cables together in one big knot before isolating the hell out of it. I do not recommend this 'knot' due to electrical safety reasons. ESPECIALLY due to its close proximity to the Arduino board. It does however seem to work just fine.
Magnetic Snappers (optional)
This step is completely optional, since the front panel guides sufficiently hold the front plate on just by friction alone. I decided to include the snappers just as a safety feature, so that the front panel would not come loose without me wanting it to come loose.
I lay awake many nights thinking of what would be the best method for holding the front panel of the box where it belonged. In the end, I came up with using magnetic door closers. I doubt it's the official term for these nifty devices but you'll recognise them straight away. The magnetic snappers are most commonly used to keep closet doors closed without using a lock.
I attached the magnetic part to the outside shell of the applause meter (top, bottom, left or right panel). This was done by means of custom 3D-printed spacer and screws (yadda yadda yadda, long screws, thin wood, you know the story by now ☺)
The metal plates were screwed to the wood of the guides. This was also the first time the wood was actually thick enough to no use any spaces (yay). I had some issues though with determining the position of the metal plates. I have come up with a solution:
- Attach the magnetic part to the box
- place the metal plate on the magnet in its perfect position
- on the holes in the plate, place a little ball of "Pritt-buddy" (a sort of chewing gum-type of glue to attach posters to walls without push pins, regular chewing gum would probably work as well)
- with a alcohol marker make a dot on the Pritt-buddy ball on the place where the holes are
- close the lid, thereby transferring some of the marker ink to the wood
- Lift up the lid and tadaa! You have made a little marking where your screws should go
- remove the buddies and the plate and screw it in its correct position, first try
- step 8: profit
I placed four magnetic snappers in the box: one at the bottom, one at the top, one at the middle left, one at the middle right.
The snappers I chose had a holding strength of 6kg. With four of those, they provided enough strength to almost lift up the entire box by the front panel alone.
What I Would Do Differently
While making this applause meter I often cursed my past me for making silly decisions, I will list here the most important lessons I learned:
- USE THICKER PLYWOOD. Seriously, making a box out of 8mm plywood is possible, but it poses a lot of challenges and it enforces some compromises to be made.
- First, pilot drilling all holes for the screws is a challenge because there is no tolerance for wrongly angled drill-bits.
- Second, the screws I had were 16mm (have I mentioned this before?). This forced me to make some stand-offs when screwing into the wood to prevent the screws from poking out the other side, but at the same time this meant that the screws were not penetrating deep enough to get enough traction to hold down some components.
- ....
- just use thicker wood
- Flexible wiring (220v) I used leftover cables from home-construction, these are unnecessarily thick and have a solid core. This meant that I could not fit two cables in the relay terminals, forcing me to make the hazardous 'wire knot' to split the neutral wire in 10 parallel connections. Furthermore, the stiffness of the solid core cables put a lot of strain on the socket connectors and the relays modules. In this last case, the circuit board was visibly bent due to the force of the cables. Using flexible cables for the 220V wires would have solved a lot, if not all, of these issues.