Yesterday was March 14th, Pi Day. So I decided to do something with My Raspberry Pi 3B. But what to do? I remembered that last year, I decided to make a RC car with screen to show love to my girl friend, but finally we spent the money in a high-end restaurant where we really had a good time. We enjoined Japanese grilled Eel course, Sushi, Sashimi, Beaf rice, and so on. Well, so the plan of making RC car was abandoned because of my limited budget. Not I have enough time and money to do it, and it’s a good way to celebrate Pi Day.
I already have a Raspberry Pi and a power bank. So I only need these things listed blow.
- L298n Driver
- 4 DC motors
- Bottom plate
- Plastic Tire Wheel
- DuPont line
- 4X AA Battery Holder Case Slot #not must
To make a multi-functional car, you can also buy any modules you want if you like, like Breadboard, Ultrasonic Wave Detector Ranging Module, Line tracking Sensor, and so on.
Installing the bottom plate and wheel
Just follow this document from the seller. But remember to connect wire to the motors first, and use the same color on the same side of motor. I didn’t connect motor cable before installing motors, so I had a hard time connecting it.
Connect the motors to the board
First we should know about how L289N works.You can see this essay.
Parallel connect two motors which are on the same side. And then connect them to the L298N driver.
Then we connect the drive to the raspi. I used 2 4 6 to provide power for L289N and morors, and used 11 12 15 16 to control L289N.
- GPIO 2 –> +12V #do not do this like me if you have bettarty. This may do harm to raspi.
- GPIO 4 –> +5V
- GPIO 6 –> GND
- GPIO 11 –> IN1
- GPIO 12 –> IN2
- GPIO 15 –> IN3
- GPIO 16 –> IN4
Just follow this article I wrote before. Remember to connect wifi and enable ssh.
I do not kown how to program, so I have seen many other’s source code. This is the most suitable code for me. Connect raspi via ssh, and then:
git clone https://github.com/wujiwh/piCar
apt install python-pip
pip install flask
Finally, you can open your browser, go to http://Raspi’sIP:2000, and remote control your car.