If the bike otherwise runs well, you can use a regular bike speedometer. It's $7.99 and far more accurate.
https://www.ebay.com/itm/Waterproof-...wAAOSw8b1Z8ZVE
The above is what I use on inexpensive bike conversions which don't have speedometers and I am doing that right now on a ebike where the speed sensor got corroded by road salt.
Speedometers all work the same. They count how many times the wheel rotates in a given time, then they apply the conversion for the size of the wheel and calculate a speed. Sometimes, a separate wheel sensor is used. Other times, the same sensors that position the motor are used.