Documentation Center

  • Trials
  • Product Updates



Measure voltage of battery in NXT brick


Simulink Support Package for LEGO MINDSTORMS NXT Hardware


This block measures the voltage of the battery located in the NXT brick, and outputs the value in millivolts. For example, when the six 1.5 volt batteries are fully charged, the output value is approximately 9000.

If you run a simulation of a model that contains this block without the target hardware, this block outputs zeroes. See Block Produces Zeros or Does Nothing in Simulation.

Measure Battery Voltage

Measure the voltage of the batteries in the NXT brick.

Open the legonxtlib block library and copy the blocks shown to a new model.

Connect the Battery block to the LCD block, as shown.

Prepare and run the model on the NXT brick.

Observe the battery voltage, shown in millivolts, on the LCD display.

Dialog Box

Sample time

Specify how often the block reads battery values.

Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.

See Also

| | | | | |

External Web Sites

Was this topic helpful?