Close

Comfort Drive Modes - creating a smart remote

A project log for Open esk8 Remote - v1

Fully open source remote control for common electric skateboards using the NRF24L01+

Timo BirnscheinTimo Birnschein 08/01/2021 at 04:340 Comments

Since I started this project, I always wanted to implement multiple drive modes. I found it silly that Acton decided - or took the painful compromise enforced by cost and/or a lazy manufacturer of these motor controllers - to use the phone app to switch between drive modes. It's rather unusable and the drive modes don't even work really well. Why not just add a button to the remote that does that or implement the drive modes within the remote in the first place. The latter was the only option for me as I have no control over the bluetooth connection (yet) and didn't want to mess with the board electronics more than absolutely necessary.

I wanted three modes:

Up to this point I had a pin assignment bug in the firmware that would not allow me to use the mode button. That was an easy fix via reassignment. Now that I had a working mode button, I first added a state machine to switch between the modes and then implemented throttle limits and throttle filtering via a simple differential control loop with adjustable gain to smoothen how the board reacts with respect to the throttle input.

After I finished the implementation and preliminary testing with the wheels up in the air, I went out and tested the new drive modes. I love heading out with my crusty laptop in the backpack, stopping, tuning, driving, stopping, tuning, and so on. That’s how I like spending my day :)

Adding a Vehicle Model

However, it wasn’t done with just tuning. The issue I encountered was a rather severe lag between when I let the throttle go to coast and pushing the throttle again to continue to accelerate. The smoother I made the response , the longer the delay would be until the board accelerates from coasting. Logical, since the remote has no idea how fast the board is going. So when I push the throttle again, it slowly ramps up the power request until request and actual board speed finally match again. Then the acceleration starts.

I thought the only way to solve this is to get the skateboard speed into the remote. But as far as I know, with the speed controllers the board uses, there is no way to do that. But what if I implement a crude vehicle model that would simulate the skateboard speed within the remote? It could take acceleration, coasting, and braking into account and base the throttle response in the various drive modes on that speed estimation.

That’s what I ended up doing. For the acceleration case, I added another control loop to accommodate for mass, inertia, and latency of the board response to the throttle input. In other words, the simulated speed follows the desired speed with a bit of a delay. However, it ignores all other outside factors like wind and the rolling resistance of different surfaces.

When coasting, I simply ramp down slowly using an iterator. The value is tuned for a slow linear decay of the speed based on a flat, smooth surface with no wind. It’s a guess and maybe not the best one but it helps a lot!

When braking, I increase the value of the iterator based on the amount of brake input to ramp down the speed faster all the way down to zero.

Now that I had a vehicle speed estimation that was reasonably well tuned, I was able to use this value to turn off the drive mode related throttle smoothing when the estimated speed is lower than the requested speed. It’s not perfect, yet, but reducing the latency from several seconds to less than one second was a pretty big improvement overall!

With a bit of headwind of rolling up a slope the behavior obviously changes and the estimated board speed might be higher than actual causing a bit of a jerky acceleration when going full throttle in one go. This is expected and can only be prevented by using a more conservative vehicle model, more data from the board, or maybe a very fast gps receiver - that consumes a lot of power, though.

For now, I have three modes that all work surprisingly well. The slowest mode is perfect for learning to drive tight turns within a confined space without the fear of twitching the throttle and be thrown off. The cruise mode is about as comfortable as what BackFire is doing on their boards, with the added benefit that I smoothed out the braking behavior even more, making the Acton Blink Qu4tro now more pleasant to drive than even the BackFire Galaxy - and I think that means something! The Galaxy is a very well tuned board that inspires a lot of confidence in the driver! The performance mode is as raw as it gets and provides the least amount of latency, highest speed, and maximum throttle response. Only the board itself is limiting what performance mode can do and I have no control over what's going on internally to the four motor controllers.

Discussions