Programming current amplitudes of less than 0.1 mA

According to the documentation, the amplitude of the stimulator has a resolution of 0.1 mA. Does that apply only to the amplitude entered into the profiler GUI or also to the amplitude we specify in the MATLAB code? For instance, if we put an amplitude of 0.05 mA into the profiler, it automatically changes it to 0.1 mA. What happens if we program an amplitude of 0.05 mA using this line of code: nnp.write(1, ‘3212’, 1, [50, 0.5]);? Will it automatically round the amplitude so that the stimulator outputs 0.1 mA? Or will it round to 0 mA, or actually output 0.05 mA?

Here’s the tl;dr

  • Rounding is occurring in both profiler(nnp) and nnp.write(). It so happens that the profiler(nnp) explicitly rounds and displays it while nnp.write() rounds in the background as data is cast to uint8.
    • 0.5 for pa will round to 1; 0.1mA output will be observed.
    • 0.49 for pa will round to 0; 0mA output will be observed.
  • You will not be able to use software changes in MATLAB to stim at 0.05mA.
    • The # of steps in the current amplitude range is limited. Increasing resolution requires using more bits of a digital-to-analog converter (DAC) and rethinking how to handle the data for stimulation parameters in the firmware and software.
  • There is a quick hardware change to scale down all stim amplitude parameters however. Link for example project below.

Rounding in nnp.write() / MATLAB

When using nnp.write(node, indexOD, subIndexOD, writeData, varargin) for the stim parameters as in your case, argument writeData represents the stim parameters [pw, pa]. writeData does not get relayed to the Power Module directly. Instead, nnp.write() casts the writeData to uint8 in order to be transmitted through serial from MATLAB to WirelessLink and through radio from WirelessLink to PowerModule.

In that cast, MATLAB’s rounding rules are followed: “If the number being converted to an integer has a fractional part, MATLAB rounds to the nearest integer. If the fractional part is exactly 0.5, then MATLAB chooses the nearest integer whose absolute value is larger in magnitude.”

The profiler(nnp) GUI accounts for this and rounds values before they are passed to nnp.write() for the sake of being displayed accurately in the live view. So entering [50, 0.5] will round to [50, 1] and you will observe 0.1 mA instead of 0.05mA no matter how you try with NNP-API in MATLAB.

Thank you for pointing out the ambiguity between the two options, and that there’s no feedback to the programmer that rounding is occurring when using nnp.write.

Decimal values will not work to get to stim below 0.1mA. Instead, consider this hardware change below.

DAC Limitations

The current system was designed to have amplitude resolution of 200 steps using 8-bits of a DAC, restricting the system to 0.1mA steps between 0.1mA and 20mA. Widespread changes would be needed in the system for increasing the number of steps using a higher resolution DAC.

Example of reducing stim output through hardware

We posted an example of a hardware change another group has done for this same purpose. :link: Example Projects - Reduce Stimulation Amplitude

A resistor in the stimulation output circuit can be swapped to scale the stimulation output. This is very accessible for the benchtop development kit, and not accessible at all for the enclosed implantable PG4 module. In the future, an implantable module could be assembled as typical but with an altered circuit board with an alternative resistor component. This uses the same 200 steps of resolution but at a smaller scale.