There are LOTS of options when it comes to programming your Idea7 Robot based on the LOLIN D32 development board. The LOLIN D32 is based on the popular ESP32. All that popularity means that the ESP32 is supported in several Integrated Development Environments (IDEs). That said, I’ll only mention the ones I’ve personally used.
- Mongoose OS (Great for IOT Projects!)
- MicroPython (Great for people who love programming in Python)
- Arduino IDE (Great for beginners or people who are familiar with Arduino)
In this activity, we’ll be using the Arduino IDE and I’ll be using Windows 10 although you can just as easily use Apple OS X or Linux operating systems.
Install and Setup the Arduino IDE
Step 1: Install the Arduino IDE
- Get the Arduino IDE Here: https://www.arduino.cc/en/main/software
Step 2: Install the USB Driver if necessary
- Get the CH340 USB Driver here: https://wiki.wemos.cc/downloads
Step 3: Add ESP 32 support to your Arduino IDE
- In Arduino IDE, go to File>Preferences and enter “https://dl.espressif.com/dl/package_esp32_index.json” into the Additional Board Manager URLs field. Note: You can add multiple URLs, by separating them with commas.
- Go to Tools>Board>Board Manager and search for “ESP32.” Install the latest version.
Now we can add programs like the simple “Blink” example!
Step 1: Open Blink example
- To open, go to File>Examples>01.Basics and select “Blink” to open it.
Step 2: Connect Robot
- Use the provided cable to connect to a USB port on your computer.
- If you have issues connecting, we recommend using a powered USB hub. This helps to resolve connection issues that may be due to an underpowered USB port. Most USB ports should work without an issue, but if you see “Connecting…….__……__…..__…..” and your robot won’t connect, this is probably your issue.
Step 3: Select Serial Port
- Go to Tools>Port and select your active serial port.
Now let’s do something more interesting!
This is great, but with some handy libraries, we can start doing really cool things!
Libraries make it easier to add new capabilities to your robot because they contain lots of helpful programming that is already tested and ready to use. Libraries are frequently used to support special sensors, actuators, screens, speakers, and more.
In the next video, we’ll see how to add libraries to your Arduino IDE. We’ll add support for both our Ultrasonic Distance Sensor and our IR Reflectance Sensor for line following. We’ll use the NewPing library by Tim Eckel and the QTRSensors library by Pololu.
First, we need to add the required libraries.
Step 1: Add Libraries
- Go to Tools>Manage Libraries and search for “qtrsensors” then click “Install” to install the QTRSensors library.
- Repeat for “newping” and click to install the NewPing library.
Now we can try an example program! Let’s follow a line!
Step 1: Download Example (You need the latest version of the QTRSensors library!)
- You can grab our example line following program here: RobotRallyLineFollow_QTRSensors_v4
Step 2: Install Using Arduino IDE
- Follow the examples above if you’re not sure how to do this. 🙂