Super Car

by 704191 in Circuits > Arduino

97 Views, 1 Favorites, 0 Comments

Super Car

IMG_3538 (1) (1).png

You can control this car, let it run on its own or even have it follow a line, and all of this can be done with the click of a remote.

Supplies

  • 1 Car chasey
  • 1 IR receiver
  • 1 IR remote
  • Distance sensor
  • 2 line trackers
  • 2 DC/Servo motors
  • 1 LED
  • 1 H bridge
  • 1 Slide switch
  • 1 100k resistor
  • 1 2.2k resistor
  • 2 Non-polar capacitors
  • An Arduino
  • A breadboard
  • Many wires
  • Many female/male wires
  • spacers

Setting Up the Components

Wiring-L293D-Motor-Driver-IC-with-DC-Motors-Arduino.png

There are a lot of different sensors on this car so before you start you want to make sure that everything works. You want to code all of the components and test them, tweak them, and fit them to your vision before you put it all on the car. First I would make code for the motors. To do this. you want to attach a breadboard to your car chasey. You then want to set the h bridge up on the breadboard and make sure that there is room for your other components. With the given link you can learn how to code and wire the motors. (https://dronebotworkshop.com/dc-motors-l298n-h-bridge/). Next, I set up the IR receiver. For this, all you need is the IR receiver, some wires, and your IR remote. Using this link you can learn how to set up the IR receiver (https://www.circuitbasics.com/arduino-ir-remote-receiver-tutorial/). Next set up your distance sensor. For this, all you need is your distance sensor and some female/male wires. Long female/male wires are preferred as you don't know exactly where the distance sensor will go so you want the wires to be able to reach. Use this link to help with the code and the wiring (https://www.tutorialspoint.com/arduino/arduino_ultrasonic_sensor.htm#:~:text=The%20HC%2DSR04%20ultrasonic%20sensor,or%201%E2%80%9D%20to%2013%20feet.). Finally, you need to set up your line sensors. For these, you once again only need the two sensors and some female/male wires. Use this link to help with the wire and the code(https://www.electroniclinic.com/ky-033-line-tracking-sensor-arduino-circuit-and-programming/). The sensors have little white nobs on them. If your sensor seems to not be working, adjust the knobs and try again.

Plan Out the Car

IMG_3519.png

The secondt step to making a car is knowing where everything is going to go on the car chase. There are a lot of wires and different components that are going to need to be attached to the chasey so before you start putting everything together you need to know how it's all going to be organized on the chasey. What I did was attach my breadboard to the chasey using tape which works fairly well. I then attached the Arduino to the chasey using spacers that get screwed into the chasey. The bottom of the spacers gets attached to the chasey and the top is where the Arduino goes. The Arduino gets elevated because it makes it easier to organize the wiring between the breadboard and the Arduino. After that's done, attach all of the sensors to your car. The line sensors get attached to the front of the car and they have to be very close to the ground to detect the line. Attach the line sensors to the car using spacers in the same way you attached the Arduino just towards the ground. Finally, the distance sensor is also gets placed at the front of the car. I propped my distance sensor up with tape but all you need to do is make sure that it is facing straight forward, is stable, and that there is space to attach wires to it.

Sync All the Components

Next, you have to code the motor's different commands. Make different void functions for the motors that make the car go forward, back, left, and right. Using these you can then set it up so that if the left line tracker senses the line then the car will go right and if the right sensor senses the line the car will go left. Then code it so that if the distance sensor senses anything less than 4 inches it moves back, turns to the right, then continues.

Set Up the IR Receiver

apijtuy4a__80293.jpg

Next, you set up everything with the IR sensor. Make if statements for each thing you want the car to do. These if statements will be structured like "if IR sensor reads the up arrow then the car will go forward" To do this test the IR sensor and your IR remote to find the different HEX values each button the remote produces. Using the HEX values, give the car different commands.

On Off Switch

Finally, add your slide switch to the breadboard. Make an if statement saying that if the slide switch is on, the rest of the code can run. Also, hook an led up to the switch so that it lights up to show that the car is on.

Finished Product