Optimizing IoT Battery Swap Stations in Indonesia with Seamless Over-the-Air (OTA) Updates
Imagine waking up in Jakarta, where your electric motorcycle has silently optimized its performance overnight. Without lifting a finger, its software has boosted battery life, enhanced efficiency, and fortified security—all while you slept. As you prepare for your commute, your ride is already tuned for peak performance, showcasing the transformative power of Over-the-Air (OTA) updates.
In our country, Indonesia, where urban congestion and sustainability challenges intersect, innovations in electric vehicle (EV) technology are not just important—they’re essential. Electrum is at the forefront of this transformation. We’re not only delivering electric motorcycles to the streets of Jakarta but building a connected ecosystem that evolves with every ride. With our network of battery swap stations, riders eliminate the need to wait for charging. They simply swap a depleted battery for a fully charged one and continue their journey seamlessly.
Making this vision a reality goes beyond hardware. It demands a sophisticated software infrastructure to ensure smooth, reliable operations across the ecosystem.
Hi, Back again with me, I’m Andi Pangeran, Principal Software Engineer at Electrum.id.
Previously, we shared how we built our data stack using ClickHouse to power scalable electric mobility systems (read more here). We also detailed the development of our IoT protocol, which ensures a secure and scalable battery-swapping network (check it out here).
In this article, we’ll dive into:
- The critical role of OTA updates in maintaining and enhancing our EV ecosystem.
- The challenges of managing updates across a large and diverse network.
- Our cloud-based orchestration approach, ensuring reliable and efficient OTA delivery.
Why OTA Updates Are Essential for Our EV Motorcycles
In the fast-evolving world of electric vehicles, software is becoming the true driver of innovation. While hardware like batteries and motors is critical, the real power lies in the software that brings everything together. To keep our EV ecosystem at peak performance, maintaining, updating, and constantly improving this software is as vital as refining the hardware itself.
That’s where Over-the-Air (OTA) updates come in. More than just fixing bugs, OTA updates allow us to deliver performance boosts, strengthen security, and introduce new features without requiring any action from riders. This capability is especially essential in our battery-swapping model, where motorcycles, batteries, and swap stations all rely on synchronized software to function as a seamless network.
Here’s why OTA updates are mission-critical for our ecosystem:
- Performance Optimization
Maintaining peak motorcycle performance is largely a matter of software—optimizing power distribution, enhancing battery management, and fine-tuning performance settings. OTA updates empower us to push these enhancements in real-time, ensuring that every motorcycle is running at its best without delay. This not only improves ride efficiency but also reduces the need for physical maintenance, allowing our entire fleet to operate with minimal interruptions. - User Experience
Ultimately, it’s all about the rider’s experience. OTA updates let us enhance dashboard features, improve ride quality, and add new conveniences—all seamlessly and without requiring riders to visit a service center. By keeping updates invisible yet impactful, we focus on what matters most: a smoother, smarter ride that adapts to riders’ needs over time. - Security
Every connected vehicle introduces cybersecurity risks. With our motorcycles and swap stations online, vulnerabilities could be exploited if not managed proactively. OTA updates enable us to quickly patch security flaws, keeping riders safe and building trust in our network.
OTA in Action — A Deep Dive into the Workflow
To make seamless OTA updates possible, we’ve developed a highly orchestrated process that unites our engineering team, cloud infrastructure, and every connected device in our EV network.
To achieve this, our process spans the following stages:
Step 1: Developing and Testing Firmware
Our engineering team begins by Developing, rigorously testing, and validating each update. This goes beyond just writing code—each update is crafted to be stable, secure, and deployment-ready. Once confirmed, the update package is uploaded to our IoT platform with essential metadata and security protocols, such as digital signatures, to verify its authenticity and integrity.
Step 2: Managing Every Device
Our IoT platform maintains constant communication with each battery and battery swap station in the network. Devices routinely “check in” to report their current status and software version, providing us with real-time insight into each device’s health and readiness for an update. This continuous monitoring ensures that every device is prepared and that we can proactively address any issues before initiating an update.
Step 3: Executing Command Flow
When an update is ready to roll out, the IoT platform initiates a remote command sequence for each device. This sequence is carefully coordinated, first alerting the device of the OTA update, then tracking progress as the device reports each stage of the update. Finally, the platform verifies the installed version to confirm that the update completed successfully. This systematic approach ensures consistency and minimizes any disruptions across the network.
Managing State and Device Updates: Single-Device Workflow
In the previous section, we provided an overview of how OTA updates work across the entire network. Now, let’s take a closer look at how our system manages OTA updates at the single-device level.
The workflow is divided into two main processes:
- The orchestration at the IoT platform.
- The execution within the device itself.
The orchestration at the IoT platform
At the platform level, a structured workflow coordinates the entire OTA process, efficiently handling each stage for every connected device:
- Update Notification: The IoT platform notifies the device of an available update, including metadata like version details and retrieval location.
- Command Execution: Once initiated, the platform tracks the download, application, and verification steps, receiving real-time updates from the device to ensure progress and promptly address any issues.
- Deployment Status: After completion, the platform logs the update’s outcome—whether successful or not—for continuous monitoring and analytics.
The workflow engine (powered by Temporal.io) supports reliability and state-tracking throughout, enhancing fault tolerance and smooth coordination.
Internal Workflow at the Device
On the device side, the OTA process follows the Device Artifact Update (DAU) standard, with four key stages:
- Download
The device retrieves the update from the IoT platform, with built-in resilience to handle network interruptions, ensuring data integrity even in challenging conditions. - Apply
Once downloaded, the device stages the update, often storing it in an inactive partition (for systems with dual-bank architecture) so the current version remains operational until verification. - Update Verification
After applying the update, the device reboots and verifies the installation. It confirms the new version and runs a self-test to ensure the deployment was successful. If issues arise, the device reverts to the previous stable version to maintain functionality. - Wait for Idle
The device ensures it is idle (e.g., not actively in use) before starting the update, preventing any disruptions.
By coordinating workflows at both the IoT platform and device levels, we ensure every device receives consistent, efficient updates, enhancing the stability and performance of our EV ecosystem.
Rolling Out OTA Updates Across Thousands of Devices: Multi-Device Workflow
After managing OTA updates at the single-device level, the next challenge is scaling this process to thousands of devices. Leveraging a powerful workflow engine (powered by Temporal.io), we’ve developed a multi-device workflow that orchestrates updates efficiently while maintaining control and stability across the network.
How This Multi-Device Workflow Operates
- Identifying and Preparing Devices for Update
The platform begins by identifying all online devices that require the update. Each device’s metadata—such as tags, manufacturer, and location—is gathered to ensure the rollout considers any relevant device-specific factors. - Grouping Devices for a Gradual Rollout
Devices are then divided into predefined groups for a staggered rollout. This process starts by selecting an initial set of “alpha” devices within specific categories for early-stage testing. Subsequent groups are organized in staggered increments (e.g., 5%, 10%, 20%) to allow for gradual scaling. - Orchestrating Group Workflows
The platform creates an overarching orchestrator workflow that sets up child workflows, referred to as group workflows, for each device group. Each device group workflow is assigned a set of devices but remains inactive until triggered by the orchestrator, enabling controlled initiation. - Executing Sequential Rollout
Starting with the alpha group, the platform deploys the update. Once the alpha group completes successfully, the orchestrator initiates updates for progressively larger groups—moving sequentially from 5% to 10%, 20%, and so forth. Each activated group initiates a device-level workflow, which manages the update for each assigned device. - Continuous Monitoring and Real-Time Tracking
Throughout the rollout, the platform continuously tracks each device’s status and progress. Devices report back at each stage, allowing the platform to log results, identify and resolve any issues promptly, and, if necessary, halt the rollout.
Stop-Rollout Option for Enhanced Safety
To maintain network stability and prevent potential widespread issues, the platform includes an operator-controlled stop-rollout feature. This capability allows operators to halt the update process immediately if anomalies are detected during any stage, ensuring that issues can be addressed before progressing further.
This multi-device workflow provides a scalable, reliable solution for OTA updates across our EV ecosystem, ensuring that all devices remain up-to-date, secure, and optimized without overwhelming network resources.
Auto-OTA: Ensuring All Devices Stay Up-to-Date
Having discussed single-device workflows and large-scale rollouts in previous sections, one critical scenario remains: what happens if a device is offline during the rollout process? Devices might go offline to conserve energy, or they could be newly deployed units hitting the road for the first time.
Ensuring that such devices receive the latest updates is essential for maintaining fleet consistency, and this is where our Auto-OTA system comes into play—
Auto-OTA is a component designed to ensure that all devices, regardless of their connection status during the rollout, stay synchronized with the latest firmware.
How Does Auto-OTA Work?
- Event Triggering via IoT Platform
Whenever a new or returning device comes online, the IoT platform detects this through a login event. This event is immediately published to our messaging broker (Kafka), creating a stream of device activity data. - Event Processing by Auto-Worker
Acting as a consumer of the messaging broker, filters these login events to identify devices running outdated firmware. It checks each device’s firmware version against the latest version available. If a mismatch is found, the device is flagged for an update. - Batching and Workflow Creation
The auto-worker batches flagged devices and creates a new group workflow for them. This workflow orchestrates the update process in a manner similar to the standard rollout process described earlier, ensuring a structured and efficient update sequence.
Where Are We?
Today, we’ve reached a significant milestone with over 3,000 electric bikes on the road and more than 250 battery-swapping stations in operation across Jakarta. Each bike covers an average of 220 kilometers daily—a testament to the scale and efficiency of our system.
This progress didn’t come without challenges. It’s the result of continuous learning, adapting to real-world demands, and refining our approach. Crucially, the Over-the-Air (OTA) update mechanism has played a key role in keeping our network running smoothly, allowing us to stay ahead of technical needs while delivering a seamless and reliable experience for our riders.
Key Takeaways from Building OTA for EV Motorcycles
Developing an OTA system for our EV motorcycles taught us valuable lessons that continue to shape our approach to connected mobility. Here are the key insights that drive our OTA strategy:
- Gradual Rollouts Reduce Risks and Ensure Stability By rolling out updates incrementally, we can manage risk effectively. Deploying updates in stages allows us to detect and address issues early, ensuring system stability and safeguarding the rider experience.
- Flexible System Design Adapts to Diverse Hardware Our OTA system is designed with flexibility in mind, accommodating different battery models and battery swap stations. This adaptability means seamless compatibility across various hardware configurations, ensuring efficient updates with minimal disruptions.
- Consistent Updates Reduce Maintenance Needs and Improve User Experience Keeping every battery and swap station up to date with the latest software reduces compatibility issues and prevents unexpected errors. This synchronization not only minimizes maintenance demands but also ensures a smooth experience for riders, allowing them to focus on the journey rather than troubleshooting.
- Real-Time Monitoring Keeps Our Fleet Reliable Real-time monitoring and feedback are crucial for maintaining control over updates. With constant oversight at every stage, we can proactively address potential issues, minimizing downtime and keeping the entire fleet running smoothly.
Conclusion: OTA as the Backbone of Connected Mobility
Over-the-Air (OTA) updates are the foundation of our connected EV ecosystem, enabling us to manage, enhance, and secure our fleet seamlessly. In a rapidly evolving mobility landscape, OTA technology ensures our network stays synchronized, adaptable, and ready for the road.
As urban transportation transforms, OTA updates drive this progress, offering the flexibility and reliability needed to meet new challenges. By delivering continuous improvements, we create a smarter, safer, and more seamless electric mobility experience.
Looking ahead, OTA will remain vital to advancing connected mobility and sustainable transportation. At Electrum, we are not just keeping up with innovation—we’re leading it, redefining electric vehicles to make urban commuting more efficient and exciting for everyone.
Thank you for joining us on this journey. We’re excited to see where the road ahead will take us, and we look forward to sharing what’s next in Electrum’s story.