A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/ArminJo/Arduino-RobotCar below:

ArminJo/Arduino-RobotCar: Enables autonomous driving of a 2 or 4 wheel car with an Arduino and a Adafruit Motor Shield V2. To avoid obstacles a HC-SR04 Ultrasonic sensor mounted on a SG90 Servo continuously scans the area. Manual control is by a GUI implemented with a Bluetooth HC-05 Module and the BlueDisplay library.

If you find this program useful, please give it a star.

🌎 Google Translate


Just overwrite the function doUserCollisionAvoiding() to test your own skill. You may also overwrite the function fillAndShowForwardDistancesInfo(), if you use your own scanning method.

Other examples of PWMMotorControl like SmartCarFollower will also run on this robot car.



Automatic control page with detected wall at right

Ultrasonic distance measurement has a problem with walls. You can only detect a wall if the angle of the wall relative to sensor axis is approximately between 70 and 110 degree. For other angels the reflected ultrasonic beam cannot reach the receiver which leads to unrealistic great distances.
The implemented wall detection function doWallDetection() takes samples every 18 degrees and if it gets 2 adjacent short distances below DISTANCE_MAX_FOR_WALL_DETECTION_CM, it assumes a wall determined by these 2 samples. The (invalid) values 18 degrees right and left of these samples are then extrapolated by computeNeigbourValue().


Compile options / macros for this software

To customize the software to different car configurations, there are some compile options / macros available.
Modify them by enabling / disabling them, or change the values if applicable.

Compile options for the used PWMMotorControl library like USE_ENCODER_MOTOR_CONTROL are described here.

Name Default value Description CAR_HAS_VIN_VOLTAGE_DIVIDER undefined VIN/11 at A2, e.g. 1 MΩ to VIN, 100 kΩ to ground. Required to show and monitor (for undervoltage) VIN voltage. VIN_VOLTAGE_CORRECTION undefined or 0.8 for Uno Voltage to be subtracted from VIN voltage for voltage monitoring. E.g. if there is a series diode between Li-ion and VIN as on the Uno boards, set it to 0.8. CAR_HAS_US_DISTANCE_SENSOR disabled A HC-SR04 ultrasonic distance sensor is mounted (default for most China smart cars). US_SENSOR_SUPPORTS_1_PIN_MODE disabled Use modified HC-SR04 modules or HY-SRF05 ones.
Modify HC-SR04 by connecting 10 kΩ between echo and trigger and then use only trigger pin. CAR_HAS_IR_DISTANCE_SENSOR disabled Use Sharp GP2Y0A21YK / 1080 IR distance sensor. CAR_HAS_TOF_DISTANCE_SENSOR disabled Use VL53L1X TimeOfFlight distance sensor. CAR_HAS_DISTANCE_SERVO disabled Distance sensor is mounted on a pan servo (default for most China smart cars). DISTANCE_SERVO_IS_MOUNTED_HEAD_DOWN disabled Distance.h CAR_HAS_PAN_SERVO disabled Enables the pan slider for the PanServo at the PAN_SERVO_PIN pin. CAR_HAS_TILT_SERVO disabled Enables the tilt slider for the TiltServo at the TILT_SERVO_PIN pin. CAR_HAS_CAMERA disabled Enables the Camera button for the CAMERA_SUPPLY_CONTROL_PIN pin. CAR_HAS_LASER disabled Enables the Laser button for the LASER_OUT_PIN / LED_BUILTIN pin. ENABLE_RTTTL_FOR_CAR undefined Plays melody after initial timeout has reached. Enables the Melody button, which plays a random melody. MONITOR_VIN_VOLTAGE disabled Shows VIN voltage and monitors it for undervoltage. VIN/11 at A2, 1 MΩ to VIN, 100 kΩ to ground. ENABLE_EEPROM_STORAGE disabled Activates the buttons to store compensation values. Normally they are stored after calibration. Changing include (*.h) files with Arduino IDE

First, use Sketch > Show Sketch Folder (Ctrl+K).
If you have not yet saved the example as your own sketch, then you are instantly in the right library folder.
Otherwise you have to navigate to the parallel libraries folder and select the library you want to access.
In both cases the library source and include files are located in the libraries src directory.
The modification must be renewed for each new library version!

Modifying compile options / macros with PlatformIO

If you are using PlatformIO, you can define the macros in the platformio.ini file with build_flags = -D MACRO_NAME or build_flags = -D MACRO_NAME=macroValue.

Modifying compile options / macros with Sloeber IDE

If you are using Sloeber as your IDE, you can easily define global symbols with Properties > Arduino > CompileOptions.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4