Sezione disponibile solo in inglese

Self-driving car

The intent of this project is to build a self-driving car

The Covid-19 pandemic has changed a lot our habits. This situation has forced us to stay more time at home. I'm not used to spend time watching TV or worse doing nothing at all, thus I've thought to start a new project.

When I decided to build a self-driving car I didn't even know where to start, I didn't know how exactly it had to be built or how it could drive by itself.
The first thing I did was to look for other projects to take some inspiration from them to decide whether it was something within my reach or not.

Once decided that I could realize this project, I started to make some simulations at the PC related to computer vision to test how the car could recognize the lane.

Because I'm sure that this project will take quite a while to be accomplished, I've decided to track it as a blog topic, writing something new anytime I will do a significant step further or I will have something that could be of interest to say.

19 May 2021

Having four motors and no steering wheels, to make the car turn it is necessary to have a different speed between the left and right motors. I've written the code to turn left and right, but testing the functionality I've faced a problem: the right motors were running while the left ones were not.

My first thought was about some disconnected wires, but all of them were connected. I reverted the code to have the car moving straight and it did work. Trying again the code to turn, three motors were running and one was not. This new behavior led me to the correct guess, I was setting the gap between the duty cycle for the left and the right motors too high.

Some of my tries:

  • Duty cycle for right and left motors 110, all run
  • Right 130 and left 110, the motors run at a different speed
  • Right 160 and left 110, right motors run, left motors don't
  • Right 200 and left 150, the motors run at a different speed
  • Right 200 and left 140, right motors run, left motors don't
This also tells that the acceptable gap depends on the duty cycle, for higher values it is possible to use a wider gap.

Currently, the front motors are connected to one DRV8833, and the rear to the other. This configuration decided for space convenience must be changed, I have to connect the right motors to one DRV8833 and the left ones to the other. In this second configuration, the problem will not arise because, at any given moment, the duty cycle for both the channel of each driver will be the same and I will be able to use any speed on each side of the car.

12 May 2021
13 Apr 2021
04 Apr 2021
22 Mar 2021
13 Mar 2021