Skip to content

AnalogInput reporting incorrect values #13

@bparks13

Description

@bparks13

Using the attached workflow below, the AnalogOutput node is sending a range of values from -5 to +5 volts, but the AnalogInput node is reporting values ranging from -3.2 to 1.5 volts.

Image

Connecting the output to an oscilloscope, the actual values being delivered by the device are correct:

Image

@cjsha mentioned it could be related to this issue: #8

Bonsai Workflow
<?xml version="1.0" encoding="utf-8"?>
<WorkflowBuilder Version="2.9.0"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:onix1="clr-namespace:OpenEphys.Onix1;assembly=OpenEphys.Onix1"
                 xmlns:rx="clr-namespace:Bonsai.Reactive;assembly=Bonsai.Core"
                 xmlns:io="clr-namespace:Bonsai.IO;assembly=Bonsai.System"
                 xmlns:dsp="clr-namespace:Bonsai.Dsp;assembly=Bonsai.Dsp"
                 xmlns="https://bonsai-rx.org/2018/workflow">
  <Workflow>
    <Nodes>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="onix1:CreateContext">
          <onix1:Driver>riffa</onix1:Driver>
          <onix1:Index>0</onix1:Index>
        </Combinator>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="onix1:ConfigureBreakoutBoard">
          <onix1:Name>BreakoutBoard</onix1:Name>
          <onix1:Heartbeat>
            <onix1:DeviceName>BreakoutBoard/PersistentHeartbeat</onix1:DeviceName>
            <onix1:DeviceAddress>0</onix1:DeviceAddress>
            <onix1:BeatsPerSecond>100</onix1:BeatsPerSecond>
          </onix1:Heartbeat>
          <onix1:AnalogIO>
            <onix1:DeviceName>BreakoutBoard/AnalogIO</onix1:DeviceName>
            <onix1:DeviceAddress>6</onix1:DeviceAddress>
            <onix1:Enable>true</onix1:Enable>
            <onix1:InputRange0>TenVolts</onix1:InputRange0>
            <onix1:InputRange1>TenVolts</onix1:InputRange1>
            <onix1:InputRange2>TenVolts</onix1:InputRange2>
            <onix1:InputRange3>TenVolts</onix1:InputRange3>
            <onix1:InputRange4>TenVolts</onix1:InputRange4>
            <onix1:InputRange5>TenVolts</onix1:InputRange5>
            <onix1:InputRange6>TenVolts</onix1:InputRange6>
            <onix1:InputRange7>TenVolts</onix1:InputRange7>
            <onix1:InputRange8>TenVolts</onix1:InputRange8>
            <onix1:InputRange9>TenVolts</onix1:InputRange9>
            <onix1:InputRange10>TenVolts</onix1:InputRange10>
            <onix1:InputRange11>TenVolts</onix1:InputRange11>
            <onix1:Direction0>Output</onix1:Direction0>
            <onix1:Direction1>Input</onix1:Direction1>
            <onix1:Direction2>Input</onix1:Direction2>
            <onix1:Direction3>Input</onix1:Direction3>
            <onix1:Direction4>Input</onix1:Direction4>
            <onix1:Direction5>Input</onix1:Direction5>
            <onix1:Direction6>Input</onix1:Direction6>
            <onix1:Direction7>Input</onix1:Direction7>
            <onix1:Direction8>Input</onix1:Direction8>
            <onix1:Direction9>Input</onix1:Direction9>
            <onix1:Direction10>Input</onix1:Direction10>
            <onix1:Direction11>Input</onix1:Direction11>
          </onix1:AnalogIO>
          <onix1:DigitalIO>
            <onix1:DeviceName>BreakoutBoard/DigitalIO</onix1:DeviceName>
            <onix1:DeviceAddress>7</onix1:DeviceAddress>
            <onix1:Enable>true</onix1:Enable>
            <onix1:DeadTime>0</onix1:DeadTime>
            <onix1:SampleRate xsi:nil="true" />
          </onix1:DigitalIO>
          <onix1:ClockOutput>
            <onix1:DeviceName>BreakoutBoard/OutputClock</onix1:DeviceName>
            <onix1:DeviceAddress>5</onix1:DeviceAddress>
            <onix1:ClockGate>true</onix1:ClockGate>
            <onix1:Frequency>1000000</onix1:Frequency>
            <onix1:DutyCycle>50</onix1:DutyCycle>
            <onix1:Delay>0</onix1:Delay>
          </onix1:ClockOutput>
          <onix1:HarpInput>
            <onix1:DeviceName>BreakoutBoard/HarpSyncInput</onix1:DeviceName>
            <onix1:DeviceAddress>12</onix1:DeviceAddress>
            <onix1:Enable>false</onix1:Enable>
            <onix1:Source>Breakout</onix1:Source>
          </onix1:HarpInput>
          <onix1:MemoryMonitor>
            <onix1:DeviceName>BreakoutBoard/MemoryMonitor</onix1:DeviceName>
            <onix1:DeviceAddress>10</onix1:DeviceAddress>
            <onix1:Enable>true</onix1:Enable>
            <onix1:SamplesPerSecond>10</onix1:SamplesPerSecond>
          </onix1:MemoryMonitor>
        </Combinator>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="onix1:StartAcquisition">
          <onix1:ReadSize>2048</onix1:ReadSize>
          <onix1:WriteSize>2048</onix1:WriteSize>
        </Combinator>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="rx:Timestamp" />
      </Expression>
      <Expression xsi:type="Disable">
        <Builder xsi:type="io:CsvWriter">
          <io:FileName>start-time_.csv</io:FileName>
          <io:Append>false</io:Append>
          <io:Overwrite>false</io:Overwrite>
          <io:Suffix>FileCount</io:Suffix>
          <io:IncludeHeader>false</io:IncludeHeader>
          <io:Selector>Timestamp,Value</io:Selector>
        </Builder>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="onix1:AnalogInput">
          <onix1:DeviceName>BreakoutBoard/AnalogIO</onix1:DeviceName>
          <onix1:BufferSize>100</onix1:BufferSize>
          <onix1:DataType>Volts</onix1:DataType>
        </Combinator>
      </Expression>
      <Expression xsi:type="MemberSelector">
        <Selector>Clock</Selector>
      </Expression>
      <Expression xsi:type="Disable">
        <Builder xsi:type="Combinator">
          <Combinator xsi:type="dsp:MatrixWriter">
            <dsp:Path>analog-clock_.raw</dsp:Path>
            <dsp:Suffix>FileCount</dsp:Suffix>
            <dsp:Overwrite>false</dsp:Overwrite>
            <dsp:Layout>ColumnMajor</dsp:Layout>
          </Combinator>
        </Builder>
      </Expression>
      <Expression xsi:type="MemberSelector">
        <Selector>AnalogData</Selector>
      </Expression>
      <Expression xsi:type="Disable">
        <Builder xsi:type="Combinator">
          <Combinator xsi:type="dsp:MatrixWriter">
            <dsp:Path>analog-data_.raw</dsp:Path>
            <dsp:Suffix>FileCount</dsp:Suffix>
            <dsp:Overwrite>false</dsp:Overwrite>
            <dsp:Layout>ColumnMajor</dsp:Layout>
          </Combinator>
        </Builder>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="dsp:Butterworth">
          <dsp:SampleRate>100000</dsp:SampleRate>
          <dsp:Cutoff1>1000</dsp:Cutoff1>
          <dsp:Cutoff2>0</dsp:Cutoff2>
          <dsp:FilterOrder>3</dsp:FilterOrder>
          <dsp:FilterType>LowPass</dsp:FilterType>
        </Combinator>
      </Expression>
      <Expression xsi:type="GroupWorkflow">
        <Name>Ramp Generator</Name>
        <Workflow>
          <Nodes>
            <Expression xsi:type="Combinator">
              <Combinator xsi:type="rx:Timer">
                <rx:DueTime>PT0S</rx:DueTime>
                <rx:Period>PT0.01S</rx:Period>
              </Combinator>
            </Expression>
            <Expression xsi:type="Combinator">
              <Combinator xsi:type="FloatProperty">
                <Value>0.2</Value>
              </Combinator>
            </Expression>
            <Expression xsi:type="rx:Accumulate" />
            <Expression xsi:type="Mod">
              <Operand xsi:type="FloatProperty">
                <Value>10</Value>
              </Operand>
            </Expression>
            <Expression xsi:type="Add">
              <Operand xsi:type="FloatProperty">
                <Value>-5</Value>
              </Operand>
            </Expression>
            <Expression xsi:type="Combinator">
              <Combinator xsi:type="rx:BufferCount">
                <rx:Count>12</rx:Count>
                <rx:Skip>1</rx:Skip>
              </Combinator>
            </Expression>
            <Expression xsi:type="dsp:ConvertToArray">
              <dsp:Depth xsi:nil="true" />
            </Expression>
            <Expression xsi:type="Disable">
              <Builder xsi:type="Combinator">
                <Combinator xsi:type="dsp:FunctionGenerator">
                  <dsp:BufferLength>1</dsp:BufferLength>
                  <dsp:Frequency>1</dsp:Frequency>
                  <dsp:Waveform>Square</dsp:Waveform>
                  <dsp:SampleRate>1000</dsp:SampleRate>
                  <dsp:Depth>F32</dsp:Depth>
                  <dsp:Amplitude>2</dsp:Amplitude>
                  <dsp:Offset>0</dsp:Offset>
                  <dsp:Phase>0</dsp:Phase>
                </Combinator>
              </Builder>
            </Expression>
            <Expression xsi:type="Disable">
              <Builder xsi:type="Combinator">
                <Combinator xsi:type="dsp:SelectChannels">
                  <dsp:Channels>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                    <dsp:int>0</dsp:int>
                  </dsp:Channels>
                </Combinator>
              </Builder>
            </Expression>
            <Expression xsi:type="WorkflowOutput" />
          </Nodes>
          <Edges>
            <Edge From="0" To="1" Label="Source1" />
            <Edge From="1" To="2" Label="Source1" />
            <Edge From="2" To="3" Label="Source1" />
            <Edge From="3" To="4" Label="Source1" />
            <Edge From="4" To="5" Label="Source1" />
            <Edge From="5" To="6" Label="Source1" />
            <Edge From="6" To="9" Label="Source1" />
            <Edge From="7" To="8" Label="Source1" />
            <Edge From="8" To="9" Label="Source2" />
          </Edges>
        </Workflow>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="onix1:AnalogOutput">
          <onix1:DeviceName>BreakoutBoard/AnalogIO</onix1:DeviceName>
          <onix1:DataType>Volts</onix1:DataType>
        </Combinator>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="onix1:DigitalInput">
          <onix1:DeviceName>BreakoutBoard/DigitalIO</onix1:DeviceName>
        </Combinator>
      </Expression>
      <Expression xsi:type="MemberSelector">
        <Selector>DigitalInputs</Selector>
      </Expression>
      <Expression xsi:type="Disable">
        <Builder xsi:type="Combinator">
          <Combinator xsi:type="dsp:MatrixWriter">
            <dsp:Path>digital-pins_.raw</dsp:Path>
            <dsp:Suffix>FileCount</dsp:Suffix>
            <dsp:Overwrite>false</dsp:Overwrite>
            <dsp:Layout>ColumnMajor</dsp:Layout>
          </Combinator>
        </Builder>
      </Expression>
      <Expression xsi:type="HasFlag">
        <Operand xsi:type="WorkflowProperty" TypeArguments="onix1:DigitalPortState">
          <Value>Pin0</Value>
        </Operand>
      </Expression>
      <Expression xsi:type="MemberSelector">
        <Selector>Buttons</Selector>
      </Expression>
      <Expression xsi:type="Disable">
        <Builder xsi:type="Combinator">
          <Combinator xsi:type="dsp:MatrixWriter">
            <dsp:Path>digital-buttons_.raw</dsp:Path>
            <dsp:Suffix>FileCount</dsp:Suffix>
            <dsp:Overwrite>false</dsp:Overwrite>
            <dsp:Layout>ColumnMajor</dsp:Layout>
          </Combinator>
        </Builder>
      </Expression>
      <Expression xsi:type="HasFlag">
        <Operand xsi:type="WorkflowProperty" TypeArguments="onix1:BreakoutButtonState">
          <Value>Triangle X</Value>
        </Operand>
      </Expression>
      <Expression xsi:type="MemberSelector">
        <Selector>Clock</Selector>
      </Expression>
      <Expression xsi:type="Disable">
        <Builder xsi:type="Combinator">
          <Combinator xsi:type="dsp:MatrixWriter">
            <dsp:Path>digital-clock_.raw</dsp:Path>
            <dsp:Suffix>FileCount</dsp:Suffix>
            <dsp:Overwrite>false</dsp:Overwrite>
            <dsp:Layout>ColumnMajor</dsp:Layout>
          </Combinator>
        </Builder>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="rx:Timer">
          <rx:DueTime>PT0S</rx:DueTime>
          <rx:Period>PT0.1S</rx:Period>
        </Combinator>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="IntProperty">
          <Value>1</Value>
        </Combinator>
      </Expression>
      <Expression xsi:type="rx:Accumulate" />
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="onix1:DigitalOutput">
          <onix1:DeviceName>BreakoutBoard/DigitalIO</onix1:DeviceName>
        </Combinator>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="onix1:MemoryMonitorData">
          <onix1:DeviceName>BreakoutBoard/MemoryMonitor</onix1:DeviceName>
        </Combinator>
      </Expression>
      <Expression xsi:type="Disable">
        <Builder xsi:type="io:CsvWriter">
          <io:FileName>memory-use_.csv</io:FileName>
          <io:Append>false</io:Append>
          <io:Overwrite>false</io:Overwrite>
          <io:Suffix>FileCount</io:Suffix>
          <io:IncludeHeader>false</io:IncludeHeader>
          <io:Selector>Clock,BytesUsed,PercentUsed</io:Selector>
        </Builder>
      </Expression>
      <Expression xsi:type="MemberSelector">
        <Selector>PercentUsed</Selector>
      </Expression>
      <Expression xsi:type="Combinator">
        <Combinator xsi:type="onix1:HeartbeatData">
          <onix1:DeviceName>BreakoutBoard/PersistentHeartbeat</onix1:DeviceName>
        </Combinator>
      </Expression>
      <Expression xsi:type="MemberSelector">
        <Selector>Clock</Selector>
      </Expression>
    </Nodes>
    <Edges>
      <Edge From="0" To="1" Label="Source1" />
      <Edge From="1" To="2" Label="Source1" />
      <Edge From="1" To="3" Label="Source1" />
      <Edge From="3" To="4" Label="Source1" />
      <Edge From="5" To="6" Label="Source1" />
      <Edge From="5" To="8" Label="Source1" />
      <Edge From="6" To="7" Label="Source1" />
      <Edge From="8" To="9" Label="Source1" />
      <Edge From="9" To="10" Label="Source1" />
      <Edge From="11" To="12" Label="Source1" />
      <Edge From="13" To="14" Label="Source1" />
      <Edge From="13" To="17" Label="Source1" />
      <Edge From="13" To="20" Label="Source1" />
      <Edge From="14" To="15" Label="Source1" />
      <Edge From="15" To="16" Label="Source1" />
      <Edge From="17" To="18" Label="Source1" />
      <Edge From="18" To="19" Label="Source1" />
      <Edge From="20" To="21" Label="Source1" />
      <Edge From="22" To="23" Label="Source1" />
      <Edge From="23" To="24" Label="Source1" />
      <Edge From="24" To="25" Label="Source1" />
      <Edge From="26" To="27" Label="Source1" />
      <Edge From="27" To="28" Label="Source1" />
      <Edge From="29" To="30" Label="Source1" />
    </Edges>
  </Workflow>
</WorkflowBuilder>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions