What is a Onewheel and why would you build a one?

If you build it yourself it is a learning process and custom.

Before we start to build we need to source the parts..

Parts

Hub Motor 🛞

I’m going for a 10x5.5 6 Hub motor with a power of 1000W.

VESC 🎮

In the beginning I wanted to build everything myself. Make the control engineering myself. This would be very hard and there are not the right components on the market. Because of a kind stranger I met on reddit I understood that it is easier to just buy a cheap VESC.

Software

Trying out the Apps can be a bit confusion. There are apps that are predefined like balance. I really like the easy PID controllability the app Balance.

My settings

Hardware

In order to control the board there is already nice hardware and firmware written to control the engine. Makerbase VESC MINI 6,7, Flipsky 75100 or something similar.

Battery 🔋

Bluetooth 🛜

2 1m aluminum 2cmX2cm15.98
The frame is built with two aluminum rods.
The body is 3d printed and made from tpu.

Building the frame

Needed minimum hardware for the onewheel to be buildable.

alualu For the materials of the frame/housing I went the cheap route. I found black plywood in the industrial trash. I bought 2 aluminum rods with the size of 20mm x 20mm x 1m each for a total of 16€.

Testing the components

Before we can do any testing the motor has to be fixed in position. hub motor I use two aluminum rods that I later will use as a frame as a testing bench. Before that I made a testing bench made out of wood that stood on the table without any anchoring. Spinning the motor unexpectedly caused the contraption to fall over and damage the cable a bit.

Test bench

I recommend building a good test bench before testing.

Building the frame

frame

Configuring the IMU

The IMU gets connected to the VESC. We need to set up an alogrithm for the filtering of the IMU. In order to calculate the angle (pitch and roll) of the IMU we need to use the Gyro and the accelerometer.

Complementary Filter

The integral of the Gyroscope is the current angle.

This is only true if the gyro dose not have any drift. The real angle will differ to the calculated angle over time.

The angle can also be calculated with the accelerometer.

AHRS Madgwick

The Madgwick filter is based on sensor fusion techniques using a gradient descent optimization approach to estimate the orientation quaternion. Let’s break down the math behind it:

  1. Data Representation:

    Angular Rates (Gyroscopes): denoted by ω. Specific Force (Accelerometers): denoted by a. Magnetic Field Strength (Magnetometers): denoted by m. Quaternion Representation of Orientation: denoted by q=[q0,q1,q2,q3], where q0​ is the scalar part and [q1,q2,q3][q1​,q2​,q3​] is the vector part.

  2. Prediction Step:

    Predict the orientation quaternion using the gyroscope data and integrate it over time:

qpredicted=qprevious+12Δt⋅(Ω⋅qprevious)

Where:

Ω is the 3D angular velocity vector represented as a quaternion (0, ωx​, ωy​, ωz​).
Δt is the time interval between sensor measurements.

3. Correction Step:

Calculate the error between the predicted orientation and the measured orientation obtained from accelerometer and magnetometer data.
Define a cost function based on this error.

4. Gradient Descent Optimization:

Minimize the cost function by iteratively updating the orientation quaternion using gradient descent:

qupdated=qpredicted−β⋅∇f(qpredicted)

Where:

β is the step size (learning rate) for gradient descent.
∇f(qpredicted) is the gradient of the cost function with respect to the orientation quaternion qpredictedqpredicted​.

5. Normalization:

After each update, normalize the quaternion to ensure it remains a unit quaternion:

qnormalized=qupdated∥qupdated∥ 6. Output:

The final orientation quaternion after normalization represents the estimated orientation of the IMU.

Construction

We need to build a sturdy frame from the aluminum. The wood must be cut accordingly. Everything gets screwed together with M3 screws. done

Testing and riding

I began with choosing some value for P (0.1). This was very low. I ended up going higher and higher to P=2 and D=20. With this setup I made the journey to Pfungstadt to Adaptive Balancing Power through the forest. With my bike besides me it is rather easy to ride, as long as the road is not too bumpy. On the way back I took some time to properly learn it without the help of my bike that I was desperately crutching at times. After some practice I’m able to ride and take turns that are wider than 2m.

I need to increase the parameters, as it was not safe to lower the tip of my board so low in uneven tarrain. I also play with the thought on adding some Integral gain but also keeping P and D so I would still be able to decelerate quick but have the advantage that for longer rides I would be level. For now I wait to get pressure dependent resistors in order to shut off the board in case I dismount the board.

This video was taken with the following parameters:

  • P=4
  • D=10 On 2024-04-25 I tested the additional Integral parameter. I felt like the nose was too close to the ground and it should lift slowly when keeping the speed.
  • I=0.01 Now it’s not working at all. The nose won’t drop and even rises. The speedup and final crash feels inevitable. I’ll stick to a PD controller for now.

At Adaptive Balancing Power I learnt How to thread a hole. I applied it and mounted the Imu and the esc on an aluminum plate with M3 screws.

mount

Update on 2024-04-25 I also installed a pressure sensor partially. The pressure sensor is wedged under the footpad. These sensors are just cheap force/pressure film sensors that can be bought for 1€. Because I did not define with how much torque I screw in the screws to mount the footplate to the alu frame, I got varying result. I connected the sensor with a 1k resistor in series to 3V3 and ground. I can measure the voltage between the resistor and the sensor. Depending on the voltage you can trigger a fault to stop the baord. Using a dead man’s switch with 1 second allows repositioning of the food and is immune to faulty readings (maybe I put it down to 0.5s).

On 2024-04-26 I had the idea to mount the sensor on top. Additionally I mounted another sensor in parallel to the already existing ones. I ended up with wooden sticks to increase the sensitive area to the width of the board. sensors on the top you can that I also attached some foam to the sensor to propagate the pressure. This is still very crude looking. I might 3d print something to help detect the foot better.

On the way to work on that day the board behaved the same as the day before, even though I removed the I part. It is very weird but I’ve changed I to 0 and I still get the same behavior. It’s wierde there is no I in the program but it really feels weird. I can drive slow on flat surfaces and even make turns with a diameter of 2m. Going over rough terrain is the catalyst. Maybe the software to read the Imu is not proper and has to be validated in vibration (in the hand held testing it seems fine).

I bent the the mounting device for the axle and will have to construct a new one.