Skip to content

State of Charge #2

@dimembermatt

Description

@dimembermatt

The new PCB design includes a state of charge circuit (a voltage divider feeding into an ADC).
image

We need to write the accompanying code to incorporate State of Charge functionality for our robot.

  • write a simple state of charge driver to measure the battery capacity.
    • the ADC pin that measures the voltage of the battery is IO4 (5th from the top right, USB facing up and top).
    • we have a voltage divider ratio of 1:2. We have a 5V input into the VReg, which means our effective measurement range is 0 to 2.5 V (approximately) and bounds of [0, 3.3V].
    • the ADC input has 12 bits of precision, so 4096 levels. For 0 - 3.3v, that's about an 8th of a mV resolution.
  • Implement functionality to send robot state of charge to the server.
    • we want to add to the robot config for a Dancebot the state of charge. We should be able to read the struct or class for the Dancebot, and update that SoC every time period (something we need to determine - I'm leaning towards every 2 minutes).
    • we'll represent the SoC as an integer value from 0 - 100, representing percent.
    • in our networking code, we need to send this back to the server in our GET request.
  • finally, we need to modify the HTML to show current state of charge as well.
    • given the existing and planned assets for the Dancebot for the webserverui, we will determine four different battery states that correspond to each image (happy, drowsy, snoring, dead). We will need to determine this. An example of such may be 61-100%, 41 - 60%, 21 - 40%, 0 - 20%.
    • the web UI code will need to update the assets to reflect this.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions