From the outside the Nanokontrol is just a USB control surface, but inside it hides an AVR microcontroller. It even has the ISP (programming) header broken out, though the pinout differs. With this it seems pretty natural to write a new firmware for it.
I wanted a simple project that demonstrates interfacing the potentiometers, LEDs and buttons. The idea of a CV step sequencer sprang to mind. In order to get nice clean voltage output I decided to add a DAC. The problem with adding to this setup is the general lack of IO pins. The serial pins TX and RX are conspicuously unused, but I chose to leave them free for possible MIDI communication. I don't plan on using USB MIDI, so I freed up IO by removing the USB chip.
PDIUSBD12 USB chip |
Now most of IO PORTD is free to use. I used one external interrupt pin for the trigger input. This makes it fast and easy to step the sequencer in response to an external clock/trigger. This leave plenty of pins for the DAC (MAX528). It gets its own clock and chip select lines, but it shares the data line with the LED shift register since it's clocked separately.
This is what the schematic looks like after the modifications:
Modified Nanokontrol |
MAX528 12V configuration |
Read Buttons:
- Pull PC0-3 low one at a time to enable one column
- Pull PC4 low to enable buffer
- Read PINB for button statuses (low = pressed)
- Repeat steps 1-3 pulling each column low
Read Pots:
- Set PA0-2 to select pot from Mux
- Read Mux on PA4 and PA6
- Read single pots on PA5 and PA7
- Repeat steps 1-3 selecting each set of pots
Write LEDs:
- Set PC7 high to disable LED output
- Write first bit to PD7 (low to turn on)
- Set PA3 high, then low to clock in bit
- Repeat steps 1&2 for all 8 bits
- Set PC5-7 to select column and enable LED output
- Delay to allow LEDs to shine
- Repeat steps 1-6 selecting each column
The code and schematics can be found on my github here. The code is pretty barebones and simple. It just serves to demonstrate interfacing the Nanokontrol hardware. There are some obvious upgrade and features that can be added, so this is just a starting point.
No comments:
Post a Comment