Recently, I embarked on a project to create a smart battery charging system for my electric mountain bike. After doing some research, I discovered that maintaining the battery charge between 30-80% is ideal for longevity, and only topping it up to 100% before a ride makes the most sense. Here’s how I approached it and what I learned along the way.
The Setup:
I decided to use a Shelly Plus 1PM smart plug with metering capabilities. The goal was to automate the charging process to specific percentages (25%, 50%, 75%, and 100%). I focused on creating a 50% charge flow as the foundation, with adjustments for the others.
How It Works:
- Trigger: I started by setting up a trigger using a start block, which I favorited so I can voice-activate it via my Google speaker in the garage.
- Meter Reading: When the flow begins, it takes an initial reading from the plug’s meter and stores it in a variable for later calculations.
- Charging Status: A Yes/No variable tracks whether the plug is actively charging the battery to prevent unintended shutdowns.
- Power On: The plug is then turned on, initiating the charging process.
- Stopping Condition: The flow monitors the meter and stops charging once the desired 50% (360Wh for my 720Wh battery) has been reached. It then turns off the plug and resets the charging status.
- Feedback: A timeline message notifies me when charging is complete, including the amount charged and the electricity cost, which is calculated using my provider’s current rate.
Challenges and Solutions:
One challenge was ensuring accurate meter readings, especially when the plug is used for other purposes. The Yes/No variable proved essential to prevent false triggers. Additionally, testing different charge levels helped me refine the automation for consistent performance.
Tips for Improvement:
- Consider integrating solar power monitoring to optimize charging during peak sun hours.
- Explore using a more advanced battery management system for real-time data.
- Experiment with different charging thresholds based on your usage patterns.
I’d love to hear how others have approached similar projects or any improvements you might suggest! Let’s share ideas to make our smart homes even smarter. ![]()