Main Content


Measures voltage of battery in EV3 brick

Add-On Required: This feature requires the Simulink Support Package for LEGO MINDSTORMS EV3 Hardware add-on.


Simulink® Support Package for LEGO® MINDSTORMS® EV3 Hardware

  • Battery block


The Battery block measures the voltage of the battery in the LEGO MINDSTORMS EV3 brick, in millivolts. For example, when the six 1.5-volt batteries are fully charged, the output value is approximately 9000 millivolts.

During simulations without hardware, this block emits zeros. See Block Produces Zeros or Does Nothing in Simulation.

Measure Battery Voltage

  1. Open the legoev3lib block library as described in Open Block Library for LEGO MINDSTORMS EV3 Hardware.

  2. Copy the Battery and the Display blocks to a new model and connect these blocks.

  3. Prepare and run the model on the EV3 brick as described in Run Model on EV3 Hardware. Observe the battery voltage, in millivolts, on the LCD display of the EV3 brick.


Sample time

Specify how often the block reads battery values. This value defaults to 0.1. Shorter sample times, such as 0.01, may produce unreliable measurements.

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

Version History

Introduced in R2018a