Introduction: Summer Project 2020
For my summer project of 2020, I made two robot cars with the same chassis. One robot car was supposed to use an ultrasonic sensor to detect objects in front of it and then automatically change directions accordingly. The other car was supposed to be able to be controlled by my phone.
Step 1: Get Supplies!
All the supplies needed to make the two cars are listed below:
- Clear acrylic base
- 2 Plastic wheels with rubber tires
- 2 Yellow geared motors (make sure to attach connectors on to them)
- Caster/Trailing wheel
- Mounting Hardware (nuts & bolts)
- Hex Standoffs
- KeyeStudio Arduino Clone (Yellow & Black Board)
- NodeMCU Esp8266 Board
- Mini Breadboard
- 480 point BreadBoard
- Micro USB (for ESP8266)
- USB A to B (for Arduino Board
- 6Volt Battery Pack (Holds 4xAA)
- DF Robot Dual H-Bridge (Black Circuit Board, with Black Heat sink and green connectors)
- L298N (Red Circuit Board with Black heat sink and Blue connectors)
- Jumper Wires
- 2 qty IR Sensors (Small blue circuit boards, 4 pin Connectors)
- 3qty Wheel motion discs (1 is a spare)
- 2qty 9g servos
- UltraSonic sensor (Blue circuit board, 2 large round ‘eyes’)
- On/Off Button
- 1 Hobby Screwdriver (Black Handle, Orange top)
- Double sided tape (for mounting the parts into the chassis. You could also use a glue gun)
Step 2: Assemble the Car Chassis
A manual came with my set, so you can save the picture and follow it if you want. Otherwise you can follow my instructions below to assembling the chassis. You may want to have a second person help you, because it can get really difficult to tighten the screws without someone helping you hold the car still.
First you need to fix the motor onto the chassis by using the plastic fasteners, some screws, and some nuts like in the picture above
Then you attach the wheels to the motors
Now you need to attach the front wheel to the chassis using the hex standoffs, some screws, and nuts
Next you attach the battery container by also using screws. After you do that, the car chassis is finished!
Step 3: Wiring
We’ll be doing the car controlled by the ultrasonic sensor first. You will need your ultrasonic sensor, 6V battery, jumper wires, your L298 board, breadboard, and an Arduino Redboard. I used the schematic above to help me.
Connect both motors to the L298 board using jumper wires
Connect the L298 board to the 9V power source
Connect the L298 board to GND on your red board
Connect the ultrasonic sensor to the empty breadboard and to the analog inputs
Connect the L298 board to the red board
Connect the sensor swivel to the breadboard and red board
Then connect the other battery to the red board with an adapter
Step 4: Code
The code posted will be used to ping the ultrasonic sensor to check anything in front of it. It will then tell the car to change directions depending if there is anything obstructing it’s path. You will also need to download the NewPing library posted below. Then you need to put it in the libraries folder of the Arduino application.
Step 5: Success (or Not)
Now if you do everything correctly, then it should work. As you can see here, I got the sensors to work, but the motors are not working. The code and sensor all seem to be working. However, the car simply will not drive. I checked the wiring and code and it all seemed fine. You may run into these technical problems, and if that is the case, make sure to double check to see if anything is broken or not. The sensor was clearly working as shown in the videos posted below. The motor is definitely not broken either because I used it successfully in the next car. I actually did this car after the next car but I decided to show this one first. I suspect there’s a problem with the L298 board.
Step 6: Wiring the Second Car
Now we are going to build the car that can be controlled by your phone. Luckily, this one did work and I have videos of it driving around. For this car you don’t need as much material as the last one. You only need jumper wires, your L298N board and your battery container. I used an android phone to download the necessary app to control the car.
Connect the motors to the L298 board
Connect the breadboard and L298 board
Make sure to also connect the battery pack to the L298 board
Step 7: Code
Here is the code that you need to download for this car. It is supposed to detect your phone’s IP address so that way you can control the car with your phone. You will also need to download an app on your android phone.
Step 8: Success!
With all the steps down, you should now be able to control the car using your touchscreen