DIY lane keep assist
Lane keep assist system based on openpilot
How it Works
The brain of the system is a NEO from comma.ai. It's an open source driving agent capable of both lane keep assist and adaptive cruise control, but I only used it for LKA. Check out project's source code, which is a fork of now out-of-date v0.2.9 release of openpilot. I added rotary encoder to measure steering wheel angle, and control the motor driver (one pin for direction and one for PWM speed). Extra inputs/outputs to the microcontroller are put into a standalone connector:
Rotary encoder input pins are PB15 (configures as an external interrupt 15) and PB14. Motor driver's direction pin is connected to PC6. PC7 is configured similar to fan speed controller: it outputs PWM with variable duty cycle:
I should've learned how to use EagleCad and have ordered a modified board. As a one-time thing, I just soldered wires directly to the microcontroller. It's an easy way to burn the STM32, by introducing an accidental short between pins. Don't do what I did, just find someone to modify and print proper PCB boards for you instead. You might want to add 10k resistors inline to all GPIO inputs/outputs (instead of having them outside of the board), and put a hardware debouncer for the rotary encoder on the board as well. Note that the diagram for the debouncer says 5v, which is misleading. I actually burned one of the boards by putting 5v to rotary encoder's input pins, exceeding 3.3v limit. Power rotary encoder by 3.3v power line instead.
Copyright © 2017 Vasily Tarasov.