One-stop solution for e-bike motor controller configuration
QT, Python, GitHub Actions Continuous Development Integration
Our client FTEX is a Montreal-based company that builds advanced power management solutions and an operating system for e-bikes. Their focus is on making efficient and intelligent motor controllers and communications modules that they sell to e-bike brands, who ultimately embed them in their frame designs. These micro computers dictate the behavior of the e-bike—telling the motor to go forwards/backwards, operate the front and rear lights, adjust speed and voltage, react to the battery, and more. Lots of coding and math is involved in programming, even for simple things like adjusting headlight brightness.
Previously, programming FTEX’s IoT motor controllers was a complicated and time-consuming task. Each one had to be manually set up by a hardware engineer with 200+ entries. If even one value was forgotten (such as omitting a zero), the behavior of the bike would be thrown off. And so, we were tasked with developing a desktop application that would semi-automate the configuration of the brand’s controllers so that their customers could do it themselves (no technical know-how required).
Here’s how we did it.
Previously, FTEX and their customers had to ship controllers back and forth for testing and further programming until the behaviour was just right. FTEX wanted to do away with this time-sapping practice by shipping out controllers in bulk with the companion desktop app we would develop called "FTEX Configurator." FTEX’s customers would require an additional device to make the desktop app talk to the controller called a CAN analyzer. This device "sniffs” the Controller Area Network (CAN) bus (aka the physical communication medium used to transmit messages between different nodes in the network). The CAN protocol is often used in embedded systems for its low cost, light weight, and robustness. There are many devices that fit the bill, but we built the app to work with an analyzer from SeeedStudio, because it’s readily available for online purchase at an accessible price point. The challenge we faced with this was that the CAN Analyzer has minimal documentation to speak of, and no real working implementation examples other than basic functionality using their proprietary windows application. We had to learn how to use it based purely on trial and error, and encountered some quality control issues with the hardware. With the help of FTEX’s engineers, we addressed these issues and found a way to make the hardware usable for everyone in a plug-and-play fashion on multiple operating systems (OSX, Linux, and Windows). Something else to mention about this project is that it gave us a chance to use a new-to-us technology: QT for Python. This is a framework (used heavily in the automotive industry) that relies on a single code base—meaning that the resulting product can run on Mac, Linux, iOS, or Android. QT for Python isn’t used much in our industry of building web apps, software houses, etc., so there were many learning opportunities.
The task at hand
Light electric vehicles such as e-bikes are a relatively new field for us, but our senior full-stack developer on the project, Jonathan, loves working in research and development and getting his hands dirty with new technology, so he was excited to take on this project. We followed our signature development process to create FTEX Configurator, spending the most time in the quality assurance phase. There was a lot of back and forth required with FTEX’s engineers to fine-tune the software to get the expected behaviour. We would make a few little tweaks, test it on our end, then send the software to an engineer at FTEX and ask for feedback. Depending on the complexity of the feedback, this could happen up to a few times a day. We used an AGILE approach, and tried to be very responsive. One of the big jobs on FTEX’s side was that their engineer had to fill out a spreadsheet of all of the possible “addresses'' used by an e-bike. Addresses are numbers that represent a setting for a capability of the controller—e.g. wheel speed, motor voltage, or whether lights should blink or not. We then applied a basic configuration with min/max settings that would fall within a reasonable and safe range. In terms of deployment of the project, we used GitHub Actions to provide Continuous Development, which allowed us to roll out a new version of the desktop app every day. This meant FTEX didn’t have to wait on our developers as new releases were made available for all platforms in only one click.
The end result
We were successful in automating a very manual process that originally involved complex coding and mathematics. The finished desktop app has a streamlined and accessible UI, enabling the average person to use it without any programming knowledge thanks to a flow that shows users how to set up their controllers and customize them for their needs. At the moment, there are roughly 50 settings that can be adjusted by the end user via FTEX Configurator. This number will grow because we designed the app so that FTEX can easily update the CAN address mapping to reflect firmware capabilities on the controller. The project work took us two sprints, adding up to a little over a month of development work and testing. The FTEX Configurator tool is now being used internally at FTEX, and by their clients. FTEX is very happy with the finished software, as it represents a massive time-saver for them. Shipping their hardware back and forth to and from their customers is a thing of the past, and they no longer have to set the values manually for each controller. It’s now as simple as their customer plugging in the device, clicking “apply configuration,” watching as the necessary default settings are applied to the motor controller automatically, and refining from there. Upper and lower limits can be saved as a configuration file, which can then be applied to multiple e-bikes in a row.
The first version of the FTEX Configurator app was the proof of concept and we’re looking forward to working on the second version, which will support even more light electric vehicles, such as scooters. We’re pleased with how precise and professional the software looks and feels, even though it was our first time using the technology involved. It’s very gratifying for us as developers to build something that goes beyond the virtual space. Yes, building Python applications is something we do on a regular basis, but setting up controllers that work with physical vehicles that get people from point A to Point B is something else. There’s nothing quite like seeing the actual output of the software we write!
Project detailsFTEX Configurator 2022-2023 Desktop app
- GitHub Actions Continuous Development Integration