1. Go to https://git.uclalemur.com/arnhold/espmeshnetworking/-/tree/master/MeshCode
2. In that repository, follow the instructions to install the ArnholdMesh.zip and Painless_Mesh.zip libraries.
3. If you are planning on doing demo using the LED panel, please also install Adafruit Neopixel library through the Library Manager in your Arduino IDE
4. If you are using the Adafruit Motor shield, **do not** install the default library through the library manager. Instead, in your Arduino IDE, go to Sketch > Include Library > Add .ZIP Library
5. Download or Clone the Adafruit_Motor_Shield_V2_Library.zip from this repository and use that for Step 4. The reason we are using an alternate library from the default one is because the motor library and the mesh library uses the same name for one of their macros. This changes the macro's name in the motor library to ensure that this doesn't happen.
6. Download the PID library, which is needed for the motion control. (https://playground.arduino.cc/Code/PIDLibrary/)
**Connecting the ESP32 Feather with OpenMV**
1. If you are planning on using the I2C communication protocol, you need to connect the following from Feather to OpenMV:
* GND pin - GND pin
* SCL/22 pin - P4 pin
* SDA/23 pin - P5 pin
Note: Failure to properly setup the I2C protocol might cause the code to not work properly
Note: Pullup resistors are needed for the SDA and SCL lines
**Connecting the ESP32 Feather with the Motor Shield**
1. The Feather and the shield should be stackable. Make sure you have soldered the pins properly.
2. The shield runs on a separate power source. Make sure that you have a 3.7V Lipo Battery if you are planning to use the shield.
3. If the battery is properly connected, a green LED should light up. This LED also approximately indicate how much power the battery has left as it will get dimmer with lower voltage.
4. Connect the vertical motor to M1, right motor to M2, and left motor to M4.
5. The motor itself can be connected differently if you are using a different vehicle. If so, changes might be needed for the motor controller code section.
**Other Components Needed**
1. Adafruit Neopixel LED Panel (https://www.adafruit.com/product/2945)
2. Adafruit Radio FeatherWing (https://www.adafruit.com/product/3230)
Note: The components listed above are optional. They are also stackable with the ESP32. Therefore, no extra wiring is needed
**Physically Setting Up the Blimp**
1.
**Running the Code**
1. Create a folder name feather_main_personaldemo in your directory of choice.
2. Copy everthing in the Main Code repository into the feather_main_personaldemo folder except for OpenMV_main.py, the motor library, and the other ino file that is *not* feather_main_personaldemo.
3. Open feather_main_personaldemo.ino and upload the sketch into your ESP32 Feather
4. Upload the OpenMV_main.py into your OpenMV camera
5. By default, it should start detecting and responding to green blob.
**Varying the Parameters**
1. Color Detection Threshold (C)
* By default, the blimp will start trying to detect the biggest green blob. However, there are 2 ways we can change the threshold so that the program will look for other colored blobs.
* The first way is to provide a single-digit color code. The code along with the command character:
- "C1": generic green blob
- "C2": generic blue blob
- "C5": generic red blob
* If the generic colors are not enough, you can also prescribe a specific thresholds for the robot to use. The format will be something like:
- "C(Lmin) (Lmax) (Amin) (Amax) (Bmin) (Bmax)", without the brackets
- "C30 100 12 -19 0 -120"
2. PID Constants (T)
* You can also vary the PID constant for the horizontal motion. By default, these are the constants:
- Kpx = 1
- Kix = 0.05
- Kdx = 0.25
* In order to change the constant which are double datatype, the generic form of the message should be:
- "TP0.1 I0.2 D0.3"
* For this command, you can also just change one or 2 parameters by doing the command like:
- "TP0.5"
- "TI0.9 D1.5"
3. Pause the Blimp (P)
* If you want to stop the mesh from moving, a quick way is to use the pause feature:
- "P1": pause the blimp program
- "P0": resume the blimp program
4. Change the Base Speed (S)
* The base speed is used to move towards the tracked object. If it is 0, it the blimp will not actively move towards the object if it is detected by the camera. The command format is:
- "S0"
- "S250"
**Using the Camera.cpp Class Separately**
1. Install OpenMV Arduino RPC Library into your Arduino IDE.
2. At the top of your main code, include the following lines to create the i2c interface that the OpenMV will communicate with the feather:
#include "Camera.h"
openmv::rpc_scratch_buffer<256> scratch_buffer; // All RPC objects share this buffer.
openmv::rpc_i2c_master interface(0x12, 100000); //to make this more robust, consider making address and rate as constructor argument
3. You need to pass the interface's address when you are constructing the camera:
Camera cam(&interface);
4. Now, you should be able to use all the function in the Camera.h file.
5. If you want to make a new function in the OpenMV and create an interfacing function corresponding to it on Arduino, please refer the RPC library for further clarification. https://github.com/openmv/openmv-arduino-rpc