Summer Project 2020

by Justin Gao in Circuits > Arduino

255 Views, 1 Favorites, 0 Comments

Summer Project 2020

F683ED04-1B22-4649-A4C5-1A64831E8B47.jpeg

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.

Get Supplies!

8CA0ABD7-4A34-4D4B-A346-781B48F4A053.jpeg

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)

Assemble the Car Chassis

64093704-7484-47C9-8D71-2285D8300FAB.jpeg
BFF077CC-E24F-45BF-AE69-9BC4A873C975.jpeg
E2F13181-F5F8-4ACC-893C-1F3CB5D6788D.jpeg
855501A6-0B0A-4B03-B722-F6287500F897.jpeg
4AC7BE27-23DB-4086-8A08-70C980C4D561.jpeg
3A9AD74D-07B9-4788-8750-B9F616D22C51.jpeg
9E806526-EBD4-4D57-8821-2591735F0765.jpeg
F22CA58A-5C7F-4CB0-887B-B4B2F60A15F8.jpeg
AB513B65-B577-4190-A05E-81CC8BC7A8F9.jpeg
9DAFA8EF-F923-475E-8B02-FF4BD32224B4.jpeg
06A1D343-9DF5-4672-99F6-E9ED67174B1F.jpeg

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!

Wiring

957AB066-3ED3-4FA5-ACB2-2EBC1A6C48FC.jpeg
5D1D1D0A-0C77-4A89-9C9C-EC4241A7C685.jpeg
A0C4EB6E-B340-425E-929D-79E788095B04.jpeg
CE3F00FE-E6EA-4866-AA68-D43DD4FCD059.jpeg

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

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.

https://bitbucket.org/teckel12/arduino-new-ping/downloads/

Success (or Not)

8/30/2020 Test 1-1
8/30/2020 Test 1-2

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.

Wiring the Second Car

2690A348-2C75-48FC-818E-DEDB8098506B.jpeg
C450484E-8171-4588-877C-E70AB4C930C3.jpeg

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

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.

Downloads

Success!

8/22/2020 Test 2-1
8/22/2020 Test 2-2

With all the steps down, you should now be able to control the car using your touchscreen