Tuesday, 6 March 2012

My DIY Arduino MIDI controller - 2. The first problems

The first problems:
There's one thing I might find annoying with LDRs: If I want to increase for instance the filter cutoff frequency of a synthesizer by casting a shadow over a LDR with my hand, the frequency would suddenly drop down as I remove my hand, unlike a potentiometer which would remain at its position after tweaking. Although that sounds like a cool thing to be able to go instantly from high to low position (which you can't do with a rotary pot), I thought it would be even better to be able to "freeze" the reading of the LDR by pressing a button. To do that I will therefore need 4 switches, one per LDR, and 4 LEDs to tell if freeze is active for each LDR.

Another problem about LDRs is that they will return different values according to the ambient light, and I want to be able to use my controller under a maximum range of light conditions (daylight from the window, artificial lamp on the desk, or just the light from the computer screen...) Therefore I will have to calibrate it whenever the ambient light changes, which will require another button to toggle the calibration mode on/off. I will also have to tell the user when calibration is on and which LDR is being calibrated. I decided I would just turn the LEDs off when the sensor is in use, turn them on when the sensor is "frozen" and I'll make them blink during calibration. It might be a good thing to add a potentiometer to adjust their brightness so that they don't influence calibration.

The problem I'm facing now is that my Arduino board has only got 13 digital in/outs, and 6 analog inputs. The digital in/out pins can be used to detect the presses of switches, or light LEDs (you can think of them as switches that are either on or off). Pins 1 and 2 will be used for MIDI communication, so we have 11 pins left for LEDs & buttons/switches, each of which require 1 pin. The analog inputs allow us to connect a total of 6 sensors and potentiometers.

A rotary pot, a LDR and a few tact switches
My digital needs so far are:
- 5 switches/buttons for LDR options
- 1 "panic" button that would turn all notes off
- 1 reset button if possible
- 4 LEDs
- 4 (at least) triggering buttons (if I wanted to use velocity I would have to get analog sensors instead)

That's already a total of 15 digital pins and I only have 11 of them left. Same for analog inputs. I've only got 6, to which I want to connect 1 slider pot, 4 LDRs and some rotary pots. Running out of pins on the analog side too! That said, you cannot browse Youtube looking for Arduino videos without noticing many project with 8x8 LED matrices or many pots, motors or whatever, so there definitely is a solution, which is what I'm working on at the moment, see next post!

<< Previous: 1. The Arduino

No comments:

Post a Comment