I had already decided that I wanted the LDRs to be arranged on a large board. As discussed in the previous post, I arranged them in groups of 4, in order to minimise light spillage between LDRs and creating confusing XY values.
I arranged the LDRs on a piece of black foam board as discussed and connected them in groups of 4 (see image). Since my setup involved connecting the resistors to the ground rail, I was able to connect all LDRs to the same 5v rail as shown below.
Each LDR group then had a voltage divider attached to the other side, with one
section going through a 220Ω resistor to ground, and the other connected to a multiplexer, eventually reaching the Arduino to be sent to Max for processing. I also added a stand, first to house the hardware, but mostly as I wanted it to stand unsupported.
During the building process, I had a range of issues with hardware. I had originally intended to connect all leads to the multiplexers through a perf-board, but due to poor soldering, some connections were touching which caused strange values to arise in Max. In the end, I resolved to to using a breadboard to finalise my connections. This also provided a better means of adjustment in the event of faulty connections. All in all, I needed 3 multiplexers to accommodate all the LDRs.
With the hardware set up, I then set up Arduino. The code I had previously used for 1 multiplexer threw up some issues when using 3, so with some help from Miguel, I ended up using SarcDuino code, along with the same truth table used in previous codes.
As can be seen from the code, the Bluetooth code has been commented out. Unfortunately, I couldn’t use the code I had used previously with my HC-06 module. Since time was a factor, I resolved to use keyboard keys as a substitute to buttons within the app, and fix the Bluetooth problems at a later date.
In this version of the code, rather than defining the XY values of each LDR in Arduino, it has been done in Max, as can be seen from the images below.
Aside from this part of the code being different, the rest of the patch controlling audio is the same as the prototype example discussed previously. An image of the final instrument is shown below:
At a later date, I intend to firstly fix the Bluetooth connectivity, and possibly add to and upgrade the hardware itself to include a larger surface of LDRs for playing.