Skip to content

Latest commit

 

History

History
128 lines (84 loc) · 5.31 KB

software_setup.md

File metadata and controls

128 lines (84 loc) · 5.31 KB

Software setup

Install Pycharm

From https://www.jetbrains.com/pycharm/

I am using Pycharm to develop the python program as well as the Arduino program. To associate C/C++ syntax highlighting with .ino files, follow Sawyer McLane's tutoral.

Clone the project

Clone the project from the github repository. To do it from within Pycharm, see Pycharm documentation.

Install the required packages

After cloning the project, PyCharm may automatically propose you to install the required packages. Or you can execute this command in the project directory:

pip install -r requirements.txt

Setup the Arduino IDE

If you are editing your Arduino project in another IDE like Pycharm, then check "Use an external editor" in the Arduino IDE preferences.

Install the Arduino libraries

This project uses the following libraries:

Library Function Where to find it
Servo Servo motor Installed by default with the Arduino IDE
HC-SR04 Ultrasonic telemeter Regular Osoyoo robot
WifiEsp-master Wifi Shield Regular Osoyoo robot (Lesson 5 : WiFiEsp-master.zip)
Arduino_JSON JSON Arduino IDE Library manager
MPU6050 Inertial Measurement Unit Included in our project repository
HLC5883L Compass Included in our project repository
MMC5883 Compass Included in our project repository
Adafruit_TCS34725 Color sensor Arduino IDE Library manager

Follow the Osoyoo introduction lessons to install the libraries needed by the regular Osoyoo Robot:

Information about these libraries

MPU6050

I adapted the MPU6050 library by Korneliusz Jarzebski and included it in this project. I had to add a timeout to avoid freezing the main loop if the MPU6050 is not responding. This seems to happen because of the noise caused by the motors. In file MPU6050.cpp, I added this line after Wire.begin() in line 38 (documentation here):

Wire.setWireTimeout( 25000, true);

Also, I had to edit the MPU6050.cpp to prevent it from aborting the initialization process when the address is not 0x68:

image

Figure 2: Comment the return false; in line 56

After looking at a few alternatives, I chose this library because it was also provided with my Arduino kit by Elegoo. It is provided in the arduino-kits-support-files. The file Mega_2560_The_Most_Complete_Starter_Kit contains the whole pedagogical material, including the electronic wiring diagram.

Arduino_JSON

Install Arduino_JSON by Arduino from the library manager: image Don't mistake it with the library ArduinoJSON by Benoit Blanchon.

HMC5883L

This library handles the compass chip HMC5883L implemented in some of the GY-86 imu cards, This project includes a version adapted from Jarzebski's library.

image Figure 3: The IMU card with the compass chip labeled L883/2131.

If your compass chip begins with L883, include the following lines in robot_define.h for your robot:

#define ROBOT_HAS_MPU6050  true
#define ROBOT_COMPASS_TYPE 1

MMC5883L

This library handles the compass chip Duinotech MMC5883L implemented in some imu cards. I followed the article by David Such that lists the different compass chips. I adapted this library from his repo.

image Figure 4: The IMU card with the compass chip labeled 5883/601X.

If your compass chip begins with 5883, include the following lines in robot_define.h for your robot:

#define ROBOT_HAS_MPU6050  true
#define ROBOT_COMPASS_TYPE 2

Local parameters

Wifi

In the autocat_enacter\src\wifi folder, next to the WifiCat.cpp and WifiCat.h files, create the file arduino_secrets.h.

This file is registered in .gitignore so it won't be pushed to GitHub. Your wifi password won't be shared to the world.

To let the robot connect to your own wifi as a station (STA), arduino_secrets.h must contain:

#define SECRET_WIFI_TYPE "STA"
#define SECRET_SSID "<your wifi SSID>"
#define SECRET_PASS "<your password>"

Alternatively, to let the robot provide its own wifi petitcat as an access point (AP), arduino_secrets.h must contain:

#define SECRET_WIFI_TYPE "AP"

The robot's IP address will show in the serial terminal:

image