CONTENTS 1 Assemble Video 2 Play Mode Quick Guide ..........Avoid(E) .
Page 5
Sounds like a dream for NASA engineers, right? Not anymore. Welcome to the world of the GalaxyRVR, a Mars Rover kit from SunFounder, designed to bring interplanetary explo- ration right into your living room. Built upon the same universal rocker-bogie system employed by NASA’s real Mars rovers, GalaxyRVR is capable of traversing all kinds of terrains –...
Page 6
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 The GalaxyRVR isn’t just a toy, but a gateway to Mars, an educational tool, and a catalyst for limitless imagination. Start your cosmic journey today with GalaxyRVR, and let your world become an extension of Mars.
GalaxyRVR. For the assembly of the GalaxyRVR, we provide printed assembly instructions in the kit. Here is the PDF version of it: If you are having difficulty understanding the printed assembly instructions, you can instead follow our step-by-step assembly video.
Equipped with factory-preloaded code, you can jump straight into the action after assembling your GalaxyRVR. Use the user-friendly SunFounder Controller app to explore its myriad of functions including first- person driving, switching between obstacle avoidance and follow modes, and even voice control.
1. Let’s start the GalaxyRVR. • If it’s your first time using the GalaxyRVR or if the battery cable has been unplugged, the GalaxyRVR Shield will engage its over-discharge protection mechanism. To deactivate this protection, plug in the Type-C cable for approximately 5 seconds.
Page 11
4. Set up a controller. • To create a controller on SunFounder Controller, tap the + icon. • Preset controllers are available for some products, here we choose GalaxyRVR. Give it a name, or simply tap Confirm. 2.1. Quick Guide...
Page 12
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • Once inside, the app will automatically search for the GalaxyRVR. After a moment, you will see a prompt saying “Connected Successfully”. Note: – If not connected, please confirm that your Wi-Fi is connected to GalaxyRVR.
Page 13
• Throttle Widgets on K and Q: The throttle widget in the K area controls the Rover’s left motors, while the one in the Q area controls the right motors. Coordinating both widgets allows the GalaxyRVR to move in any direction.
Avoid(E) Once in follow mode, the GalaxyRVR will move towards an object in front of it or turn left or right to follow the object’s movement. 2.4 STT(J) STT stands for Speech to Text.
Page 15
Note: The STT (Speech to Text) function requires an internet connection and Google services on Android devices. However, this doesn’t work with the pre-set AP (Access Point) mode on the GalaxyRVR. In AP mode, the GalaxyRVR creates a local Wi-Fi network that your mobile device can connect to, but it does not provide internet access.
Page 16
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Chapter 2. Play Mode...
GalaxyRVR to life. By the end of the course, you’ll not only have assembled your very own Mars rover, but you’ll also possess the knowledge to troubleshoot, modify, and further experiment with your rover.
Page 18
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 3.1.3 Steps Step 1: What are Mars Rovers? Before we dive into Mars rovers, let’s first acquaint ourselves with Mars itself. As we can see from the images and models, the surface of Mars is marked with craters, mountains, valleys, and dust storms, painting a picture of a landscape that is both fascinating and challenging.
Page 19
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 We’ll delve deeper into actual Mars rover designs and their functions in the following steps, so keep your creative ideas in mind as we progress. Step 2: Exploring the History of Mars Rovers Next, we’ll embark on a journey through time by watching a documentary that details the history of Mars rovers.
Page 20
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • Spirit (2004–2010) and Opportunity (2004–2018) Spirit and Opportunity are twin rovers of NASA’s Mars Exploration Rover (MER) mission. Spirit, also known as MER-A, operated on Mars from 2004 to 2010. On the other hand, Opportunity, or MER-B, had a remarkably long run from 2004 to 2018. Together, they greatly expanded our understanding of the Martian surface and geological history.
Page 21
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • Perseverance (2021–present): Perseverance, also known as Percy, is the most recent rover to arrive on Mars. It’s designed to explore the Jezero crater as part of NASA’s Mars 2020 mission. Along with its scientific instruments, Perseverance also carries Ingenuity, a small experimental Mars helicopter, marking another first in Martian exploration.
Page 22
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 For our next activity, let’s put our knowledge and creativity to work by designing our very own Mars rover. Consider the key characteristics of the rovers we’ve studied so far, but also think about the unique attributes you would want to incorporate in your design.
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • Drawing paper • Pencils and erasers • Colored pencils, crayons, or markers Drawing Instructions: 1. Start with the body of the rover. What shape will it be? How large? 2. Consider the wheels. How many will your rover have? What size and shape will they be? 3.
Page 24
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 3.2.1 Learning Objectives • Understand the design principle of the Rocker-Bogie suspension system and its advantages. • Learn how to design and make a basic model of the Rocker-Bogie suspension system. • Apply basic principles of physics to explain how the Rocker-Bogie suspension system overcomes complex ter- rains.
Page 25
• GalaxyRVR Kit • Basic tools like screwdriver and wrench • Follow the steps provided in the assembly instructions of the GalaxyRVR Kit to construct the suspension system of the Rover. Please note that patience and precision are essential here, make sure you correctly place every piece and secure it tightly.
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 3.3 Lesson 3: Entering the World of Arduino and Coding In our previous lesson, we successfully built the Rocker-Bogie Suspension System. However, to make it functional, we need to provide it with power, a control board, and programming to dictate its movements.
Page 27
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • Microcontroller: A microcontroller is like the brain of the Arduino. It’s a tiny computer that can run simple software. Although it’s not as powerful as the computer you’re using now, it’s perfect for simple tasks like understanding messages from sensors or lighting up an LED (a small light).
Page 28
Inside your kit, you’ll find a blue board, seemingly a tiny city filled with small metallic towers and pathways. But don’t let it intimidate you! This is the SunFounder R3 development board, a kind of Arduino board that can be used to program and control a vast array of electronic devices and projects.
Page 29
• Reset Button: If you press it, it’s like telling the board to forget what it was just doing and start its program over from the beginning. With these basics, you’ll be all set to begin your programming adventures with the SunFounder R3 board! Step 3: Install Arduino IDE Now that we understand what Arduino and the Arduino board are, it’s time to start putting that knowledge to use.
Page 30
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 2. You’ll be shown the License Agreement. Take a moment to read through this, and if you agree to the terms, click “I Agree”. 3. Next, you’ll be asked to choose installation options. Leave these as they are and click “Next”.
Page 31
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 4. Choose where you want to install the software. It’s generally best to install it on a different drive than the one your system uses. 5. Click “Install” to start the installation. Once it’s done, click “Finish”.
Page 32
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 For macOS users: Double-click the downloaded file (which will be called something like arduino_ide_xxxx.dmg). Follow the on-screen instructions to drag the Arduino IDE app into the Applications folder. After a few seconds, the Arduino IDE will be successfully installed.
Page 33
Let’s break it down: 1. Plug it in: Connect your SunFounder R3 Board to your computer using a USB cable. This is how we’re going to give our board power and send our program (also called a “sketch”) to it. You might feel like you’re just plugging in a computer gadget, but believe me, you’re connecting to a world of possibilities!
Page 34
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 3. Understand the sketch: Look at the code in this new window. It tells Arduino to turn on the built-in LED (which is on pin 13) for one second, then turn it off for one second, and then repeat. It’s like sending Morse code, but with light! 4.
Page 35
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Time to uncover some cool secrets about Arduino programming! • Code Magic: setup() and loop() An Arduino sketch, or a piece of code, is like a two-act play: – setup(): This is Act 1, the opening scene. It only happens once, when your Arduino board first wakes up.
By the end of this course, you’ll have a solid understanding of motor operation and hands-on experience in motor control. Let’s dive in! Note: If you are learning this course after fully assembling the GalaxyRVR, you need to move this switch to the right before uploading the code. Chapter 3. Course Mode...
Page 37
• Understand the basic principles of motors and the characteristics of the TT motor. • Learn how to control the direction and speed of the TT motor. • Understand how the GalaxyRVR Shield controls six motors. 3.4.2 Course Materials • SunFounder R3 Board •...
Page 38
The type of motor we’re focusing on in our GalaxyRVR is a specific kind called a TT Gear Motor. This is essentially a regular motor combined with a series of gears, all encased within a plastic shell.
Page 39
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 As the motor spins, the gears translate this spin to the wheels of our rover. The use of gears provides a crucial benefit - it increases torque, enabling the motor to move larger, heavier loads.
Page 40
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 If you guessed that the motor would not spin, you are correct! But why is that so? The answer lies in the current output of the Arduino board. The signal pins on a typical Arduino board can output only about 20mA of current, which is insufficient to drive a motor.
Page 41
Step 3: How the Motor is controlled by the Motor Driver Our GalaxyRVR Shield, included in the kit, serves as the control center for our Mars Rover. It is the hub where we connect all our sensors, motors, and power supply. It consists of several components that allow us to control and power our Rover effectively.
Page 42
Let’s learn how these two drive chips control the six motors through hands-on experience: • 1. Connecting the Circuit 1. Plug the GalaxyRVR Shield into the R3 board, connect a motor, and finally plug in the battery to provide power to the expansion board.
Page 43
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 character in our story speaks (OUTPUT) or listens (INPUT). – digitalWrite(): This function can set a pin HIGH (on) or LOW (off), much like switching a magic light on and off. 2. Once you’ve selected the correct board(Arduino Uno) and port, click on the Upload button. It’s like putting a letter in a mailbox - you’re sending your instructions off to Arduino!
Page 44
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 (continued from previous page) pinMode(in4, OUTPUT); void loop() { digitalWrite(in3, LOW); digitalWrite(in4, HIGH); Here, we define two variables to represent pins 4 and 5. By using variables, we can easily manage and adjust our pin assignments throughout our code.
Page 45
Now that you should have a better understanding of how the motor driver chip controls the motors through the GalaxyRVR Shield and how we can use Arduino code to manipulate the motor’s movements. Isn’t it fascinating how a few lines of code can dictate the behavior of a physical object like our motor? Consider the following questions as you move forward: •...
Page 46
Note that although the SunFounder R3 board has some pins with built-in PWM functionality, we can’t use them for our motor because they’re already serving other functions. Thus, we’re connecting the driver chips to pins 2, 3, 4, and 5, and using the Arduino’s SoftPWM library to enable PWM on these pins.
Page 47
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 (continued from previous page) SoftPWMSet(in1, 0); SoftPWMSet(in2, 255); • In the code above, we first add SoftPWM.h to the top of the code, enabling us to use the functions in the SoftPWM library directly.
Page 48
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • Initialization: This step is executed first and only once when we enter the loop for the first time. It allows us to declare and initialize any loop control variables. • Condition: This is the next step after initialization. If it’s true, the body of the loop is executed.
Page 49
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 So, after running the above code, you will see the motor speed gradually increasing. It stops for a second, and then starts again from 0 and gradually increases. In this step, we have learned about Pulse Width Modulation (PWM), a technique for controlling the speed of our motor.
Rover across imagined Martian landscapes. It’s a Martian adventure in our classroom. Let’s get started! Note: If you are learning this course after fully assembling the GalaxyRVR, you need to move this switch to the right before uploading the code.
Page 51
3.5.3 Steps Step 1: Assembling the Rover Components In this step, we will assemble the battery, R3 board, GalaxyRVR Shield, motors, and wheels onto the pre-assembled rocker-bogie system. This will bring the GalaxyRVR to a runnable state. Congratulations! We’ve successfully built our very own rover, and it’s ready to start exploring. Let’s get moving! Step 2: Set the Rover in Motion Now it’s time to breathe life into our creation and send it off on its maiden voyage.
Page 52
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 (continued from previous page) SoftPWMSet(in2, 0); // Stop // Set the right motors rotate clockwise SoftPWMSet(in3, 0); // Stop SoftPWMSet(in4, 255); // Full speed In this code, we’re speaking to our rover, telling it exactly what to do. With the SoftPWMSet() function, we’re acting like the car’s accelerator and brakes, controlling the speed and direction of each motor.
Page 53
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 speed will make the rover turn towards the left. • The second way is by making both left and right motors rotate in the same direction (clockwise in this case), which will make the rover spin to the left on its axis.
Get ready to gear up our rover with some Martian obstacle-dodging intelligence! Let’s get rolling! Note: If you are learning this course after fully assembling the GalaxyRVR, you need to move this switch to the right before uploading the code.
Page 55
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 3.6.1 Learning Objectives • Understand the working principle and application of the infrared obstacle avoidance module. • Learn to use Arduino to control the infrared obstacle avoidance module. • Practice designing and building an automatic obstacle avoidance system based on infrared obstacle avoidance.
Page 56
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Meet the Infrared Obstacle Avoidance Module - our rover’s smart sidekick. This little device is a pack of wonders. Let’s take a tour: Here are the pin definitions: • GND: This is like the module’s anchor, connecting it to the ground or common point in the circuit.
Page 57
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 abilities. However, the color of objects does impact its sensing. Darker objects, especially black ones, are detected at a shorter range. Against a white wall, the sensor is most efficient, sensing within the 2-30cm range.
Page 58
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 2. Next, we’ll need to communicate with our Rover using the universal language of Arduino code. First things first, let’s give a unique name to each eye of the Rover. Let’s call them IR_RIGHT and IR_LEFT, this way we won’t mix them up.
Page 59
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 4. Before you start receiving the Rover’s messages, make sure your secret communication line is tuned at the same speed (9600 baud) as your Rover. And there you have it - live updates from your Mars Rover!
Page 60
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 5. To put our system to the test, wave a “space rock” (your hand) in front of one of the sensors. You’ll see the value flip to 0, and the corresponding LED on the module lights up. That’s the Rover saying, “Look out, space rock on my right!”...
Page 61
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 lights up. Then, keep moving the obstacle back and forth to check if the indicator light comes on at the desired distance. If the light doesn’t turn on at the correct distance or if it remains on without going out, you’ll need to adjust the other potentiometer.
Page 62
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Let’s whisper this plan to our Rover in its language(Arduino code): In this code, we are using if...else statement in the loop() function. The if...else statement is used to execute a block of code among two alternatives. However, when we need to choose among more than two alternatives, we use the if...else if...else statement.
Join us as we take a step further into this exciting STEAM journey, making our Mars Rover even more adept at exploring the uncharted territories! Note: If you are learning this course after fully assembling the GalaxyRVR, you need to move this switch to the right before uploading the code.
Page 64
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 3.7.2 Materials Needed • Ultrasonic Module • Basic tools and accessories (e.g. screwdriver, screws, wires etc.) • Mars Rover Model (Equipped with rocker-bogie system, main boards, motors, obstacle avoidance module) • USB Cable •...
Page 65
Here are the key steps that our superhero sensor will follow: • We have connected both the TRIG and ECHO pins to pin 10 on the GalaxyRVR Shield. This allows us to control both signal transmission and reception of the ultrasonic module using a single Arduino pin.
Page 66
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 // Define the pin for the ultrasonic module #define ULTRASONIC_PIN 10 • Preparation: To start, we establish serial communication at a 9600 baud rate so we can see the superhero’s measurements in our Serial Monitor.
Page 67
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 float distance duration 0.034 • Report the Findings: Our superhero sensor then reveals the result of its mission, printing the distance to the Serial Monitor for us to see. // Print the distance to the serial monitor Serial.print("The distance is:...
Page 68
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • In the loop() function, we call readSensorData() and stores its returned value in the distance variable. float distance readSensorData(); • Depending on this distance, the Rover will move forward, move backward, or stop.
Page 69
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Below is the complete code. You can upload this code to the R3 board and see if it achieves the desired effect. You can also modify the detection distance based on the actual environment to make this obstacle avoidance system more perfect.
Imagine having a mini robotic pet following you around! Exciting, isn’t it? So let’s get started. Note: If you are learning this course after fully assembling the GalaxyRVR, you need to move this switch to the right before uploading the code.
Page 71
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 3.8.1 Course Objectives • Learn how to combine obstacle avoidance modules with an ultrasonic module for improved navigation. • Understand the principles and functionalities behind an advanced obstacle avoidance system. • Learn how to implement an intelligent following system in the Mars Rover.
Page 72
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Now let’s turn this flowchart into actual code to bring our Rover to life. Note that the handleForwardMovement() function is where we’ve integrated the behavior of the ultrasonic sensor. We read the distance data from the sensor and based on this data, we decide the movement of the Rover.
Page 73
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • If the ultrasonic sensor detects an object within 5-30 cm, our Rover should move towards it. • If the left IR sensor detects an object, our Rover should take a left turn.
Rover’s movements. By the end, our Mars Rover will be more than a machine. It’ll be a luminous, color-changing entity, leading the way in the vast Martian landscape! Note: If you are learning this course after fully assembling the GalaxyRVR, you need to move this switch to the right before uploading the code.
Page 75
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 3.9.1 Objective • Understand the working principles and applications of RGB LED strips. • Learn how to use Arduino programming to control the color and brightness of RGB LED strips. • Practice installing and using RGB LED strips on the Mars Rover model as indicators.
Page 76
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • +5V: This is the common “positive” end or the “anode” of the three tiny light bulbs (LEDs) inside our strip. It needs to connect to DC 5V, a kind of electric juice that powers our tiny bulbs! •...
Page 77
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 And the coolest part? With our command, all the LEDs on this strip can change their colors at once! It’s like having our own light orchestra at the tip of our fingers! So let’s get ready to play some light music! In our next step, we’ll learn how to control these LEDs to display the colors we want.
Page 78
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 void setup() { // Initialize software-based PWM on all pins SoftPWMBegin(); void loop() { // Set the color to red by turning the red LED on and the others off SoftPWMSet(redPin, 255); // 255 is the maximum brightness SoftPWMSet(greenPin, 0);...
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Now that we’ve mastered the art of color-setting, in the next step, we’ll integrate these dazzling displays with the movements of the Mars Rover. Exciting times ahead! Step 4: Move the Rover with Color Indication Now, we’ll add color indications to the movements of the Mars Rover.
Page 80
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Just as our neck muscles move our head so our eyes can get a better view, the servo will move the tilt mechanism so the Rover’s camera can better survey the Martian landscape.
Page 81
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Servo motors are special type of motors that don’t just spin around and around like a wheel. Instead, they can move to a specific position and hold that position. Imagine if you’re playing a game of Simon says, and Simon says, “Raise your arm to a 90-degree angle!”...
Page 82
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 In the next step, we will go on a fascinating journey inside a servo motor to understand how it works. Excited? Let’s Step 2: How does a Servo Work? So how does a servo work its magic? Let’s go on an exciting journey inside a servo! If we were to peek inside a servo, we would see a few parts.
Page 83
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 (continued from previous page) Servo myServo; // create a servo object void setup() { myServo.attach(6); // attaches the servo on pin 6 void loop() { myServo.write(90); // tell servo to go to 90 degrees In this code, myServo is our Servo object, attach(6) tells the Arduino that our servo is connected to pin 6, and write(90) tells the servo to move to 90 degrees.
Page 84
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 get stuck and even damage itself! We don’t want that to happen, do we? So, let’s understand its movement limitations with a little experiment. We use a for loop to rotate the servo from 0 to 180 degrees while keeping a note of the angle in the Serial Monitor.
Page 85
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 On my Rover, the tilt mechanism could go up to around 140° before it hit the body of the Rover and couldn’t go any further. So, explorers, always remember to respect the limits of your rover to keep it safe and functioning! Step 6: Sharing and Reflection Well done, explorers! Today, you’ve not only built a tilt mechanism for your Rover but also understood how to control...
Martian landscape from the Rover’s perspective! The excitement continues as we also introduce the SunFounder Controller app. This application allows us to get a live feed of the Rover’s view as it navigates around, and we can control the tilt mechanism directly from our smartphones or tablets.
Page 87
• Understand how to establish a WiFi connection with the ESP32 CAM. • Learn how to see exactly what the Rover sees, in real time. • Learn how to use the SunFounder Controller app to create a virtual remote and control the Mars Rover. 3.11.2 Materials needed •...
Page 88
• AP Mode: In this mode, the Rover creates a hotspot (named as GalaxyRVR in our code). This allows any device like a mobile phone, tablet, or laptop to connect to this network. This is espe- cially useful when you want to control the Rover remotely under any circumstances.
Page 89
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 // AP Mode #define WIFI_MODE WIFI_MODE_AP #define SSID “GalaxyRVR” #de- fine PASSWORD “12345678” • STA Mode: In this mode, the Rover connects to your home WiFi network. Remember that your controlling device (like a mobile phone or tablet) should also be connected to the same WiFi network.
Page 90
• Open the Serial Monitor and set the baud rate to 115200. If no information appears, press the Reset button on the GalaxyRVR shield to run the code again. You should see an IP address in the serial monitor output.
Page 91
Ever wished you could view the Mars Rover’s visual feed right on your smartphone while also being able to control its tilt mechanism? Now you can! With the help of the SunFounder Controller app, you’ll be able to do exactly that.
Page 92
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • Choose the Blank preset, select either Dual or Single Stick according to your preference. Give your new controller a name and click Confirm. • You are now inside the controller. Click the + icon in the D section, then select Slider from the popup menu.
Page 93
#define SSID "GalaxyRVR" #define PASSWORD "12345678" • Next, we add an onReceive() function to receive values from the SunFounder Controller and print these values in the Serial Monitor. We use the getSlider() function to get the value of the slider widget. I added a slider widget in Region D, but if you added it in a different region, you need to change REGION_D to your region.
Page 94
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • After the code is successfully uploaded, move the switch to the left to start the ESP32 CAM. • When you see the following information in the Serial Monitor, you can move on to the next step.
Page 95
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 GalaxyRVR. By doing this, both your mobile device and the Rover will be on the same network, enabling smooth communication between the applications on your mobile device and the Rover. • Find GalaxyRVR on the list of available networks on your mobile device (tablet or smartphone), enter the password 12345678, and connect to it.
Page 96
• Now, return to the controller you created earlier (in my case, it’s named “camera”). Use the button to link the SunFounder Controller to the Rover and establish a line of communication. After a brief wait, GalaxyRVR(IP) (the name you assigned in the code with #define NAME "GalaxyRVR") will appear.
Page 97
Now you’ve successfully learned to implement the SunFounder Controller and how to use the slider widget to control servo movements. This process will allow you to interact with your GalaxyRVR in a more intuitive and direct way. Step 4: Reflection and Summary Using the SunFounder Controller to operate your Mars Rover may seem a bit complicated at first.
3.12 Lesson 12: Driving the Rover with the App In our last adventure, we mastered the art of using the SunFounder Controller to not only explore the world through the rover’s eyes but also to adjust its gaze by controlling the tilt mechanism. It was like giving our Mars rover a sense of sight! Now, imagine if you could steer this Martian explorer as well, directing its path at your whim.
Page 99
Step 1: Dive Deeper into the SunFounder Controller In our previous lesson, we got our first taste of the SunFounder Controller, its basic operations and uses. But surely, you’re left with some burning questions, right? Time to quench that curiosity and delve deeper into this tech marvel.
Page 100
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 • Deciphering the Shapes For instance, tap on a long rectangular area. Like opening a treasure chest, you’ll unveil several widgets. Remember the Slider from our previous class? Swiping it left or right controlled the Mars rover’s camera tilt.
Page 101
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Throttle widget. And yes, there’s more! At this point, don’t fret about each widget’s function or usage. Familiarize yourself with what widgets each shape houses. • Harnessing the Widgets Through the content above, we know that there are many different widgets. So what can these widgets be used for? We categorize these widgets into two types: control widgets and show widgets.
Page 102
Step 2: Control the Mars Rover with Dual Throttles Now that we’ve delved into the ins and outs of the SunFounder Controller widgets, let’s elevate our game by incorpo- rating two Throttle widgets to commandeer the movement of the Mars Rover.
Page 103
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 (continued from previous page) SoftPWMSet(in4, map(power_R, 0, 100, 0, 255)); else SoftPWMSet(in3, map(power_R, 0, -100, 0, 255)); SoftPWMSet(in4, 0); Sure, let’s break down the carSetMotors() function. This function accepts two arguments, power_L and power_R, which are likely the power settings for the left and right motors respectively. The values of these arguments are presumably from -100 to 100, where negative values indicate reverse motion, 0 indicates stop, and positive values indicate forward motion.
Page 104
Step 3: Visualizing Sensor Readings In our journey with the SunFounder Controller, we have been actively interacting with our Mars rover through con- trol widgets, including sliders for adjusting the tilt and throttles for dictating the rover’s movement. But what about harnessing the power of display widgets to paint a vivid picture of our rover’s surroundings?
Page 105
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 2. Next, let’s delve into the code. Start by bringing over the IR avoidance modules and ultrasonic module code snippets from our previous lessons. // Define the pin for the ultrasonic module #define ULTRASONIC_PIN 10...
Page 106
Here is the complete code: Once the code has been successfully uploaded, get your SunFounder Controller up and running. You’ll be greeted with the real-time values of the avoidance modules and the distance detected by the ultrasonic sensor, painting a clear picture of the rover’s immediate environment.
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 How about adding some Switch widgets to your SunFounder Controller? With these switches activated, the Mars rover could switch between avoidance and follow modes. Or, why not use the switches to control the light strip – switching...
Page 108
• Solar panel and bottom plate • Arduino IDE • Computer • Tablet or smartphone with SunFounder Controller app installed 3.13.3 Course Steps Step1: Introduction to the Mars Rover’s Energy System Just as our bodies need a constant supply of energy to function, our Mars Rover needs a way to store and generate power for its exploration missions.
Page 109
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 But what happens when the energy in the batteries runs out? How does it replenish its energy stores? This is where the solar panels come into play. Much like trees absorb sunlight for photosynthesis to create food, our Mars Rover uses solar panels to harness energy from the Sun, converting it into electricity that is stored in the batteries for use.
Page 110
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 However, harnessing solar energy on Mars is not as easy as it sounds. Dust storms can reduce the amount of sunlight reaching the panels, and the weaker Martian sunlight (compared to Earth’s) means that the panels generate less power than they would here at home.
Page 111
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 #define BATTERY_PIN A3 • This function calculates the battery’s voltage. It first reads the analog value from BATTERY_PIN, then converts it into voltage. Because the Arduino’s analog-to-digital converter (ADC) operates on a scale of 0-1023, we divide the raw reading by 1023.
Page 112
Instead, we can send the battery level to an app, allowing us to easily monitor how much playtime is left while we’re having fun! From previous lessons, we’ve learned that when we want to shown data on the SunFounder Controller or control the Mars Rover using widgets, we need to add these widgets first.
Page 113
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 By completing this step, we’ve mastered the Mars Rover’s energy system and gained the ability to monitor its power levels in real-time. Now that we have learned how to harness the sun’s power to operate the Mars Rover effectively, we can start planning...
If you get a “Compilation error: SoftPWM.h: No such file or directory” prompt, it means you don’t have the SoftPWM library installed. Please install the two required libraries SoftPWM and SunFounder AI Camera as shown. 4.2 Q2: avrdude: stk500_getsync() attempt 10 of 10: not in sync:...
Page 116
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 After the code is successfully uploaded, if you need to use the ESP32 CAM, then you need to move the switch to the left to start the ESP32 CAM. Chapter 4. FAQ...
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 4.3 Q3: How can I use the STT mode on my Android device? The STT mode requires the Android mobile device to be connected to the Internet and to install the Google service component.
Page 118
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 4. Open the controller previously created in SunFounder Controller and connect it to GalaxyRVR through the button. 5. Tap and hold the STT(J) widget after clicking the button. A prompt will appear indicating that it is listening.
SunFounder GalaxyRVR Kit for Arduino, Release 1.0 Say the following command to move the car. • stop: All movements of the rover can be stopped. • forward: Let the rover move forward. • backward: Let the rover move backward. • left: Let the rover turn left.
Page 120
Copyright Notice All contents including but not limited to texts, images, and code in this manual are owned by the SunFounder Company. You should only use it for personal study,investigation, enjoyment, or other non-commercial or nonprofit purposes, under therelated regulations and copyrights laws, without infringing the legal rights of the author and relevant right holders.
Need help?
Do you have a question about the GalaxyRVR and is the answer not in the manual?
Questions and answers
Not able to see GalaxyRVR WiFi on my phone. Please advice