In contrast to my original BicycleCompanion project, this time I made progress much faster.
The main difference is that in this case I decided to go back to the original approach of using Arduino famework. On the original project I actually switched to using NuttX which was a bit overkill for a project like this (at least, initially).
Another good thing is that I started using PlatformIO. Since I really hated the Arduino IDE but liked the existing libraries this was the perfect choice. I even can use QtCreator as the IDE. I used some existing libraries to base this: Adafruit SSD1306, Button, MenuSystem and Metro. This has made everything much simpler.
So far I have the main screens in place (some of which are stubs) which can be browsed with two of the four buttons. These screens are: current speed, traveled distance, moving time, current time, battery level and temperature. Each of this screens will have alternative views which can be browsed with the two remaining buttons. For example, different ways of looking at the speed, distance and so on, or browsing maximum, average stats of each. This is not yet made but will be.
The part which required more work is the configuration. While I used the great MenuSystem library, having this being nicely rendered on the SSD1306 required a bit of thinking. In the end it looked quite nice (with that Sci-Fi 80s look I love).
The functionality so far is:
- Speed in KM/h from reading Hall sensor (using interrupts), which also accumulates traveled distance
- Current time and date display from RTC
- Temperature screen stub (this will be finalized using the reading of the actual DS18B20 sensor)
- Battery charge: reads supply voltage and converts it to a charge percentage (assuming single LiPo cell)
- Configuration menu allowing to change different settings:
- Wheel perimeter
- Exit config menu if motion is detected
- Time & date setting (not yet finished)
- Powersaving (screen sleep time)
- Display settings (inverted mode for higher contrast, dimmed mode for less battery use
Since I decided not to include battery charging circuit for simplicity for now, I realized it would be imperative to use permanent storage for settings. Since the STM32F103 does not have internal EEPROM (ouch), I need to include an external EEPROM chip for that. Luckily they are cheap and easy to use.
At the moment I've done all this on a Teensy 3.1 since I had it available for the original project. The next step is thus run the code on a Blue Pill board for testing. Also, I will add the temperature sensor and EEPROM chip.
After that I will probably start testing battery life and look into using Sleep modes to reduce battery usage to minimum (with such a device, most of the time it does not need to do much).
Finally, I plan to design a PCB and sent it for fabrication and try to solder everything myself (will see how it goes with all SMD components). I still have to decide whether to include a USB port for programming or use the SWD interface.
Here you can see some picture of how the user interface looks so far (will probably look better in the future):
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.