MIDIbox Hardware Platform, AINSER64 Module

MBHP_AINSER64 is the successor of the MBHP_AIN module and only supported by MIOS32!

MBHP_AINSER8 is a reduced version without 1-to-8 multiplexers and on-board VR.

It is based on the 8-channel ADC MCP3208 from Microchip and 8 4051 multiplexers so that up to 64 analog inputs are available. They can be used to scan pots and/or faders with 12bit resolution between 0 and 5V.

The accuracy and especially the signal/noise ratio is much better compared to the internal ADCs of STM32 or LPC17 for insignificantly higher costs (+ 3 EUR).

Another advantage is the improved scalability. While with the previous MBHP_AIN module the maximum number of scannable inputs was limited by the number of on-chip ADC channels, the new approach allows to access multiple MBHP_AINSER64 and MBHP_AINSER8 modules from the same microcontroller.

The ADC is accessed via SPI (e.g. J19 of the MBHP_CORE_LPC17 or MBHP_CORE_STM32F4 module). An additional 74HC595 is accessed via SPI as well to control the 4051 multiplexers and the "link status" LED which is helpful for troubleshooting the module connections.

Multiple MBHP_AINSER64 (or MBHP_AINSER8) modules are connected to J19 in parallel, and accessed by strobing dedicated chip select lines. J19 provides two chip selects (called "RC1" and "RC2"), if more modules should be scanned, common IO pins could be used for the same purpose (e.g. available at J5). To programmers: alternatively, AINSER64 modules could be chained, or a 3-to-8 MUX could be used for accessing 8 modules via 3 IO pins of the microcontroller.

Accuracy: if directly powered from the MBHP_CORE_LPC17 module, values are jittering by ca. +/-1..2 LSBs (for comparison: the on-chip ADCs of STM32 and LPC17 are jittering by at least +/- 16). Accordingly, the effective resolution which can be used for MIDI controller purposes is 10 bit. Such a high resolution is especially useful for PitchBender and NRPN messages.

The jitter is around +/- 1 LSB if the module is externally powered via J1, on the other hand this option is only interesting for applications where a slightly higher resolution does really matter, or if multiple MBHP_AINSER64 modules are used with low resistance pots (1k) so that the power can't be supplied by an USB (hub) anymore.

Usually powering the module via USB (provided at J19 by the core module) is sufficient. It's recommended to use a "selfpowered" USB Hub like this one from Reichelt. It also decouples the power from the (noisy) PC supply, and allows to run the MIDIbox without a PC connection.

Download

PCB data, can be viewed, modified and converted with Eagle Light. The .pdf based schematic has been created with xcircuit. There are no special eagle schematics available, since components have been netlisted in the .brd file directly!
Module Schematic Layout Data Quick-view
MBHP_AINSER64_V1 mbhp_ainser64.pdf mbhp_ainser64_v1.brd mbhp_ainser64_v1.png
Additional informations
File Size Description
mbhp_ainser64_orderlist.txt 1k Reichelt orderlist
mbhp_ainser64_interconnections.pdf 18k Interconnection diagram between MBHP_CORE_LPC17 and two MBHP_AINSER64 modules

Available Ports

Following interfaces are provided by the AINSER64 module:

Name No. of pins Description
J1 2 Optional connection to a powersupply unit (PSU). A 7V-10V transformer, or a wall adapter could be used. At least 500 mA is recommended if 1k pots are used, and 50 mA if 10k pots are used.
Jumper J5 has to select the "Ext." routing if the analog domain should be powered by the external source.
Note that the prefered solution is to power the module via J2 (resp. via the USB supply of the MBHP_CORE_LPC17 or MBHP_CORE_STM32F4 module). The external supply option is only provided for the case that the USB based power source is too weak to supply the module.
J2 10 Serial input which is usually connected to J19 of the MBHP_CORE_LPC17 module.
J3 10 Serial output which could be used to chain multiple MBHP_AINSER* modules.
Please note: the standard AINSER driver for MIOS32 doesn't support this method! Instead it expects that multiple modules are connected to J19 in parallel, and that they are using dedicated chip select lines (selected via jumper J4)!
J4 3 A jumper has to be connected to this port to select the first or second chip select line of J2 for accessing the ADC.
J5 3 A jumper has to be connected to this port to select the voltage source for the analog domain (ADC, 4051 multiplexers and pots). With "dig." power will be supplied via the serial port J2, with "ext." power can be supplied via J1
J6..J13 10 8 * 8 analog inputs and 5V (=Vd) / Ground (=Vs) connections.
Please note: all unused analog inputs have to be clamped to ground (Vss), otherwise your MIDIbox will send out a lot of random MIDI events!

Soldering Guide

It's always a good idea to start with the smallest components to simplify mounting, So: start with the sockets!
Thereafter solder following components:
  • R1 = 10 Ohm
  • R2, R3, R4 = 470 Ohm
  • C4, C6, C7 = 100 nF
  • C5 = 10 uF (check the polarity!)
  • Yellow "Analog Supply" LED (polarity! Long leg is + (Anode))
  • Red "Digital Supply" LED (polarity! Long leg is + (Anode))
  • Green "Link" LED (polarity! Long leg is + (Anode))
Now mount the 2x5 DIL Headers, 3-pin SIL headers for chip select and analog supply, and put the ICs into the sockets.
Important: the jumpers have to be stuffed to get the module working!
Usually J4 selects Chip Select line 1, and J5 selects the "Dig." option for analog supply.
If the "Ext." supply option is desired (normaly not), solder the additional caps, voltage regulator and the rectifier.
Before testing the module, it's very important that all unusued analog inputs are clamped to ground!.
This could be done with "dummy plugs" as shown in this picture. It connects the A0..A7 pins with Vs (Ground). Vd is open (never connected it to Vs, because it will cause a short circuit!)
Alternatively the 4051 of an unusued ADC channel could be removed, and a cable between Pin #3 and #8 could connect all 8 multiplexed channels to ground.
The cable could also be soldered at the bottom of the board if you don't plan to use the appr. inputs.
Finally connect your finished AINSER64 module to J19 of the core module with a ribbon cable.
This can be done during runtime ("hot plug&play"), a reboot isn't required.

Testing

After J2 of the AINSER64 module has been connected to J19 of the core module, the red "digital supply" LED should turn on. If it stays off, check the voltage between the Vs and Vd pin of J2 with a multimeter, it should be ca. 5V. Yes: check that the LED has been soldered with the right polarity (the long leg is anode and should be soldered with the pin which is marked with +).

The yellow "analog supply" LED is turned on as well independent from J5 jumper selection. It will turn off if there is a short circuit in the analog voltage domain (e.g. caused by a badly connected pot).

If the green "link" LED is permanently on or off, it signals, that the application which is running on the core module doesn't access the module. The LED should slowly flash (cheap PWM modulated) with an application which supports the AINSER64 module.

So, the next step is to upload an application for testing the analog inputs. MIDIO128 is well suitable for this, as it supports two AINSER64 modules and sends CC events for each analog pin by default without further configuration! The application can be downloaded from this page. Upload it to the core module with MIOS Studio as usual.

The green "link" LED should flash now, and CC events should be visible in the MIDI IN monitor of MIOS Studio whenever a pot/fader connected to an analog input is moved.

Sidenote (for the case this isn't obvious to you): the outer pins of a pot have to be connected to +5V (Vd) and Ground (Vs) - this voltage is available at each J6..J13 port. The middle pin of the pot has to be connected to one of the A0/A1/...A7 pins of J6..J13.

Please keep also in mind that all unusued analog inputs have to be clamped to ground, otherwise the application will flood the MIDI monitor with random CC values!

At the MIOS32 Download Page you will also find a diagnosis application which measures the jitter for each analog input. It allows to check the quality of the power supply that you are using. After the upload of "ainser_jitter_mon" the MIOS Terminal will periodically output the minimum and maximum value which has been converted in between 1 second (1000 samples) + the difference (-> the jitter):

The monitor displays the 8 conversion results of a given 4051 multiplexer.
Most important terminal commands:

  • check_module: type "check_module 1" to check the first module, or "check_module 2" to check the second module
  • check_mux: type "check_mux 1" ... "check_mux 8" to select the 4051 multiplexer:
    1=J6, 2=J7, 3=J8, 4=J9, 5=J10, 6=J11, 7=J12, 8=J13
  • help: to display all available commands


Last update: 2023-11-04

Copyright © 1998-2023, Thorsten Klose. All rights reserved.