MacFe72
Published © GPL3+

Transporter (Karnaugh Map)

This is a line follower car able to transport small objects thanks to a loading platform.

IntermediateFull instructions provided1,390
Transporter (Karnaugh Map)

Things used in this project

Hardware components

ELEGOO UNO R3 Board ATmega328P ATMEGA16U2 with USB Cable
ELEGOO UNO R3 Board ATmega328P ATMEGA16U2 with USB Cable
×1
SparkFun RedBot Sensor - Line Follower
SparkFun RedBot Sensor - Line Follower
×3
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
L298N motor driver - H bridge
×1
DC motors & Wheels
×1
Arduino sensor shield V5.0 - Expansion board
×1
Connector Adapter, DC Power - 2.1mm
Connector Adapter, DC Power - 2.1mm
×1
Battery holder
×1
Batteries (18650 3,7V 4200mAh li-ion) & Charger
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Various bolts (like screws, nuts, spacers)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Arduino reference
Fritzing
Draw.io

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
Drill / Driver, Cordless
Drill / Driver, Cordless
Screwdrivers

Story

Read more

Custom parts and enclosures

Loading platform

This part allows you to transport goods and materials.
Check it and eventually modify quotas before printing.

Higher frame

It is the higher part of the car's structure

Lower frame

It is the lower part of the car's structure.

Schematics

Connections scheme (.jpg file)

This is the electrical diagram, we used it to correctly wire the project.
Follow it.

Connections scheme (.pdf file)

This is the electrical diagram, we used it to correctly wire the project.
Follow it.

Connections scheme (.fzz file)

This is the electrical diagram, we used it to correctly wire the project.
Follow it.

Code

Transporter code

C/C++
This is the completed listing, loaded on the Elegoo board.
#include <NewPing.h>
#include <Servo.h>
int in1 = 9;
int in2 = 8;
int in3 = 7;
int in4 = 6;
int EnD = 11;
int EnS = 5;
int LS = 12;
int CS = 4;
int RS = 2;
int velNor = 70;
int velRot = 110;
int period1 = 50;
int period2 = 120;
int pos1 = 120;
int pos2 = 60;
#define TRIGGER_PIN A5
#define ECHO_PIN A4
#define MAX_DISTANCE 200
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE);
Servo SMA;

void setup() {
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);
  pinMode(in4, OUTPUT);
  pinMode(EnD, OUTPUT);
  pinMode(EnS, OUTPUT);
  pinMode(LS, INPUT);
  pinMode(CS, INPUT);
  pinMode(RS, INPUT);
  SMA.attach(3);
  SMA.write(pos1);
}

void loop() {
  while (sonar.ping_cm() < 20) {
    SMA.write(pos1);
    delay(period2);
    SMA.write(pos2);
    delay(period2);
    digitalWrite(EnD, LOW);
    digitalWrite(EnS, LOW);
    delay(period1);
  }
  SMA.write(pos1);
  delay(period2);
  SMA.write(pos2);
  delay(period2);
  if (digitalRead(LS) == LOW && digitalRead(CS) == HIGH && digitalRead(RS) == LOW) {
    analogWrite(EnD, velNor);
    analogWrite(EnS, velNor);
    delay(period1);
  }
  else if (digitalRead(RS) == HIGH && digitalRead(LS) == LOW || digitalRead(RS) == LOW && digitalRead(LS) == HIGH) {
    analogWrite(EnD, velRot);
    analogWrite(EnS, velRot);
    delay(period1);
  }
  digitalWrite(in1, digitalRead(LS) && digitalRead(RS));
  digitalWrite(in2, digitalRead(RS) && (digitalRead(LS) || digitalRead(CS)));
  digitalWrite(in3, digitalRead(LS) && (digitalRead(RS) || digitalRead(CS)));
  digitalWrite(in4, digitalRead(LS) && digitalRead(RS));
  delay(period1);
}

Credits

MacFe72
0 projects • 0 followers

Comments