A modern web application for FRC robotics teams to track, manage, and maintain their robot batteries. This system helps teams ensure they always have charged batteries ready for matches and practice sessions.
- Real-time battery status tracking (Charged, Charging, Needs Charging)
- Battery voltage monitoring
- Simple, intuitive UI for quick status updates
- Automatic data refreshing (every 10 seconds)
- Responsive design for use on various devices in the pit area
- Frontend: Next.js with React
- Backend: Next.js API Routes
- Database: Redis (via Upstash)
- UI Components: Custom components with Tailwind CSS
- Form Management: React Hook Form with Zod validation
- Node.js 16+ and npm/yarn
- Upstash Redis account (or any Redis instance)
- Clone the repository
git clone https://github.com/your-team/frc-battery-manager.git
cd frc-battery-manager- Install dependencies
npm install
# or
yarn install- Create a
.env.localfile with your Redis credentials
UPSTASH_REDIS_REST_URL=your-redis-url
UPSTASH_REDIS_REST_TOKEN=your-redis-token
- Run the development server
npm run dev
# or
yarn dev- Open http://localhost:3000 in your browser
Edit the app/api/batteries/route.ts file to change the number of default batteries:
// Change the number in the Array.from to adjust battery count
const defaultBatteries = Array.from({ length: 10 }, (_, i) => ({
id: i + 1,
status: "needs-charging",
voltage: 0,
}));To add or modify battery statuses, update the batteryStatusSchema in lib/schema.ts:
export const batteryStatusSchema = z.enum([
"charging",
"needs-charging",
"charged",
"in-use", // Added new status here
"damaged", // Added new status here
]);Then update the UI in components/battery-form.tsx to include the new statuses in the radio group.
To track additional information for each battery:
- Update the
batterySchemainlib/schema.ts:
export const batterySchema = z.object({
id: z.number(),
status: batteryStatusSchema,
voltage: z.number().min(0).max(50),
cycleCount: z.number().optional(), // Add new field
lastTestedDate: z.string().optional(), // Add new field
});- Update API handlers and UI components to use the new fields.
The application can be deployed to various platforms:
- Vercel (recommended for Next.js)
- Netlify
- Any platform supporting Node.js applications
Make sure to set the environment variables for your Redis instance on your hosting platform.
This project is licensed under the MIT License - see the LICENSE file for details.
Developed with ❤️ for FRC teams. Feel free to submit issues or pull requests to help improve this tool!
