For sensing the trainer speed, I have a choice between using the elapsed time between two events, or counting the frequency of events within a specific time period. For now, I’ve opted for this latter approach.
In order to keep things responsive, I need this time period to be quite short, therefore I also need quite a fast pulse train in order to get a reasonable count in this period. To achieve this, I’ve switched from the hall effect sensor to an optical solution, which can easily generate many more events per revolution.
I’m using a Hamamatsu 5587 photo-reflector in conjunction with a laser printed optical encoder pattern on the flywheel. This is quite an old sensor (possibly even discontinued), but gets good write-ups from the robotics community. For ease of mounting, I’ve soldered everything on one side of some protoboard, and stuck it to the trainer with double sided tape. This provides a nice stable mount, and ideally positions the sensor a couple of mm from the flywheel.
The encoder pattern was created using a postscript generator script, converted to PDF, and then laser printed on standard office paper. This was then stuck onto the inner face of the flywheel using a spray mount adhesive.
I’m using 16 black & 16 white segments, and capturing both rising and falling edges to give me 32 events per revolution. I’m currently sampling speed at 4hz (to match the ANT+ transmission rate) and have tested up to ~70pkh, which equates to ~1,000 events per sample.