Power management and working with the brick battery
Battery and power management is very important in robotics. It is important to know whether there is enough power to complete an operation successfully, and it is also important to provide feedback to the user about battery levels. In this lecture you will learn how to read the battery percentage and how to create a notification alert at a predefined battery level. |
|
Requirements
- Lego Mindstorms EV3 Brick
- Ozeki 10 installed: http://www.ozeki.hu/index.php?owpn=6066
- Connect Brick via Bluetooth: http://www.ozeki.hu/index.php?owpn=6065
- Lego connection installed: http://www.ozeki.hu/index.php?owpn=6067
Video tutorial: 'How to use the Lego battery in Ozeki 10'
Start Control Panel!
First make sure you have properly paired the Brick to your Ozeki 10 server machine. You can do this through Bluetooth by following this guide: http://www.ozeki.hu/index.php?owpn=6065. Please log in to Ozeki 10 with your account. You will enjoy how easily you can add and manage connections after selecting the 'Control Panel' from the desktop GUI (Figure 1).
Figure 1 - Opening the Control Panel from the desktop GUI
Choose battery connection from the list!
If you are familiar with the Brick, you probably have already connected it to your Ozeki 10 server. You can easily check if it is on the list (Figure 2). If the Brick and it's components are not in the connection list, you need to follow this short guide: http://www.ozeki.hu/index.php?owpn=6067. Although if it is on the list, please click on 'Battery_1' to open the chat interface of the device.
Figure 2 - Please select 'Battery_1' from the connection list
Send 'subscribe' and 'read' commands!
You will find yourself on the 'Details' page of the Brick's battery device. Here you can chat and configure with the battery. On the bottom of this page you can see a few commands you can test, although let's start with the most important command, which is 'subscribe' (Figure 3), so from now on Ozeki 10 can receive all incoming messages from the battery. Type 'read' and hit enter to get an instant response of the battery power in percentage as you can see it on the figure below.
Figure 3 - Subscribe to the battery and 'read' the condition
Check all low-level communication of the Battery device!
To see all events, you have to open the 'Events' panel from the top toolbar (Figure 4). Look at the panel to see that all events are sorted in chronological order and contain a few extra details like the sender or receipient which is the user you are currently logged in. The event list can be deleted by pressing 'Clear' on the upper right corner. It can also autorefresh itself by using the green switch.
Figure 4 - Look at the 'read' command and response on the Battery's event list
The commands of Lego Mindstorms EV3 Battery
The tables contain a few commands, which you can send through Ozeki 10. Write a command in the chat box and click on the blue 'Send' button, then the sensor will respond for your command. You must pay attention to the spelling, because the device only accepts correct commands.
Command examples | Description |
---|---|
read | it requests the battery charge level in percentage |
Commands table - The message that reads battery power
Basic commands | Description |
---|---|
help | request the command set |
subscribe | subscribe to device messages |
unsubscribe | unsubscribe from device messages |
subscribers | shows the list of subscribers |
Basic commands Table - General commands for all devices
More information
- The touch sensor and sensor messaging
- Capturing infrared signals using the IR sensor
- How to measure light intensity and how to capture color information
- Using motors and rotary encoders
- Distance measurement, the ultrasonic sensor
- Orientation in space, the gyroscope sensor
- Using the LCD display
- Using indicator leds on the Lego Brick
- Power management and working with the brick battery
- Playing sounds on the Lego speaker