Introduction: Space Rover

Hi guys do you know what is space rover ?.

A rover (or sometimes planetary rover) is a planetary surface exploration device designed to move across the solid surface on a planet or other planetary mass celestial bodies. ... They are essential tools in space exploration.

today we making a space rover. It has many features...I am make it through raspberry pi but . Now I am describing how do this with node mcu and arduino ..let's go to project

Supplies

  • node mcu
  • arduino uno
  • gas sensor
  • ultra sonic sensor
  • servo motor
  • battery 2.2A
  • jumbing wire
  • l298n driver module
  • i2c display
  • wifi camera
  • pir sensor
  • water sensor
  • leds
  • bo motor andd wheel
  • gps neo 6m(if you want only)
  • solar panal

Step 1: Node Mcu

here the node mcu used for controlling rover movement. code is here, click here to download

here you can download its apk file click here

Step 2: Ultra Sonic Sensor

Distance Measurement using Arduino Ultrasonic Sensor is a very easy project to measure shorter distance precisely. Before getting started you must know about Ultrasonic Sensor HC SR-04, which is a low-cost sensor. The ultrasonic sensor is consists of Transmitter and Receiver modules. Transmitter part ejects the pulse out and the receiver part receives the pulse. If an obstacle is placed before the sensor, the transmitted pulse ejected strike the obstacle and reflected back. The reflected pulse is received by the receiver part. The time between transmission and reception is calculated. This data is processed to calculate distance

it is used in rover for measuring distance from one place to aonther

* Download the i2c LCD library(impotrant)

Working of Ultrasonic Sensor


The high-level signal is sent to 10 microseconds using Trigger.The module sends 40 KHz signals automatically and then detects whether the pulse is received or not through Echo.If the signal is received, then it is through the high level. The time of high duration is the time gap between sending and receiving the signal is calculated

.

#include

#include

LiquidCrystal_I2C lcd(0x27, 16,2);

const int trigPin = 3;

const int echoPin = 2;

long duration;

int distanceCm, distanceInch;

void setup() {

lcd.init();

lcd.begin(16, 2); // Initializes the interface to the LCD display

lcd.backlight();

pinMode(trigPin, OUTPUT);

pinMode(echoPin, INPUT);

Serial.begin(9600);

}

void loop() {

digitalWrite(trigPin, LOW);

delayMicroseconds(2);

digitalWrite(trigPin, HIGH);

delayMicroseconds(10);

digitalWrite(trigPin, LOW);

duration = pulseIn(echoPin, HIGH);

distanceCm = duration * 0.0340 / 2;

distanceInch = duration * 0.01330 / 2;

lcd.setCursor(0, 0);

lcd.print("Distance: ");

Serial.println(distanceCm);

lcd.print(distanceCm);

lcd.print(" cm");

lcd.setCursor(0, 1);

lcd.print(" ");

lcd.print(distanceInch);

lcd.print(" inch");

delay(1000);

}

you can use servo for rotation

Step 3: Pir Sensor

it is used for detect life in planets.pir sensor detect human animal etc presense.....

its working:-

Passive Infra Red sensors can detect movement of objects that radiate IR light (like human bodies). Therefore, using these sensors to detect human movement or occupancy in security systems is very common. Initial setup and calibration of these sensors takes about 10 to 60 seconds.
The HC-SR501’s infrared imaging sensor is an efficient, inexpensive and adjustable module for detecting motion in the environment. The small size and physical design of this module allow you to easily use it in your project. The output of PIR motion detection sensor can be connected directly to one of the Arduino (or any microcontroller) digital pins. If any motion is detected by the sensor, this pin value will be set to “1”. The two potentiometers on the board allow you to adjust the sensitivity and delay time after detecting a movement.

PIR modules have a passive infrared sensor that detects the occupancy and movement from the infrared radiated from human body. You can use this module in security systems, smart lighting systems, automation, etc. There are different PIR modules available in the market, but all of them are basically the same. They all have at least a Vcc pin, GND pin, and digital output. In some of these modules, there is a ball like a lens on the sensor that improves the viewing angle.

you can work a pir sensor with 2 ways one is programed and other method is testing.i give both option here

first mehthod is testing .it major advantage is we can use without micro controllers........

Diagram for pir sensor with arduino uno

code

You must add the library and then upload the code. If it is the first time you run an Arduino board, Just follow these steps:
Go to www.arduino.cc/en/Main/Software and download the software of your OS. Install the IDE software as instructed.

  • Run the Arduino IDE and clear the text editor and copy the following code in the text editor.

  • Choose the board in tools and boards, then select your Arduino Board.Connect the Arduino to your PC and set the COM port in tools and port.
  • Press the Upload (Arrow sign) button.You are all set!

nt ledPin = 13; // LED

int pirPin = 2; // PIR Out pin

int pirStat = 0; // PIR status

void setup()

{

pinMode(ledPin, OUTPUT);

pinMode(pirPin, INPUT);

Serial.begin(9600);

} void loop(){

pirStat = digitalRead(pirPin);

if (pirStat == HIGH)

{

digitalWrite(ledPin, HIGH); // turn LED ON

Serial.println("Hey I got you!!!");

}

else

{ digitalWrite(ledPin, LOW);

// turn LED OFF if we have no motion

} }

Step 4: Water Sensor

water sensor is used for checking ,if the planet have water or not.

this will give output such as if there is water, it gives true and show its level.

diagram

code

int red=2;

int green=3;

int blue=4;

void setup ()

{

pinMode (red,OUTPUT);

pinMode (green,OUTPUT);

pinMode (blue,OUTPUT);

Serial.begin (9600);

} void loop()

{ // read the input on analog pin 0:

int value = analogRead(A0);

if (value > 500)

{

Serial.println("Very heavy Rain");

digitalWrite (red,HIGH);

digitalWrite(green,LOW);

digitalWrite(blue,LOW);

}

else if ((value > 300) && (value <= 500))

{

Serial.println("AVERAGE Rain");

digitalWrite (green,HIGH);

digitalWrite (red,LOW); }

else

{ Serial.println("Dry Weather"); d

igitalWrite (blue,HIGH);

digitalWrite (red,LOW);

digitalWrite (green,LOW);

delay(100);

} }

Step 5: Esp32 Cemera

i am using normal p2p type camera but if you want to use esp32 camera you use this code.

The ESP32-CAM doesn’t come with a USB connector, so you need an FTDI programmer to upload code through the U0R and U0T pins (serial pins).


Features Here is a list with the ESP32-CAM features:

The smallest 802.11b/g/n Wi-Fi BT SoC module ,Low power 32-bit CPU,can also serve the application processor Up to 160MHz clock speed, summary computing power up to 600 DMIPS Built-in 520 KB SRAM, external 4MPSRAM Supports UART/SPI/I2C/PWM/ADC/DAC Support OV2640 and OV7670 cameras, built-in flash lamp Support image WiFI upload Support TF card Supports multiple sleep modes Embedded Lwip and FreeRTOS Supports STA/AP/STA+AP operation mode Support Smart Config/AirKiss technology Support for serial port local and remote firmware upgrades (FOTA)



pinout diagram

There are three GND pins and two pins for power: either 3.3V or 5V.

GPIO 1 and GPIO 3 are the serial pins. You need these pins to upload code to your board. Additionally, GPIO 0 also plays an important role, since it determines whether the ESP32 is in flashing mode or not. When GPIO 0 is connected to GND, the ESP32 is in flashing mode.


The following pins are internally connected to the microSD card reader:
GPIO 14: CLK

GPIO 15: CMD

GPIO 2: Data 0

GPIO 4: Data 1 (also connected to the on-board LED)

GPIO 12: Data 2

GPIO 13: Data 3

Video Streaming Server

Follow the next steps to build a video streaming web server with the ESP32-CAM that you can access on your local network.

Important: Make sure you have your Arduino IDE updated as well as the latest version of the ESP32 add-on.

* Install the ESP32 add-on

In this example, we use Arduino IDE to program the ESP32-CAM board. So, you need to have Arduino IDE installed as well as the ESP32 add-on. Follow one of the next tutorials to install the ESP32 add-on, if you haven’t already:

Installing the ESP32 Board in Arduino IDE (Windows instructions)

Installing the ESP32 Board in Arduino IDE (Mac and Linux instructions)2.

*CameraWebServer Example Code

In your Arduino IDE, go to File > Examples > ESP32 > Camera and open the CameraWebServer example.

The following code should load.


Before uploading the code, you need to insert your network credentials in the following variables:

const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";

Then, make sure you select the right camera module. In this case, we’re using the AI-THINKER Model.

So, comment all the other models and uncomment this one:

// Select camera model

//#define CAMERA_MODEL_WROVER_KIT

//#define CAMERA_MODEL_ESP_EYE

//#define CAMERA_MODEL_M5STACK_PSRAM

//#define CAMERA_MODEL_M5STACK_WIDE

#define CAMERA_MODEL_AI_THINKER

If none of these correspond to the camera you’re using, you need to add the pin assignment for your specific board in the camera_pins.h tab.

Now, the code is ready to be uploaded to your ESP32.

.ESP32-CAM Upload Code Connect the ESP32-CAM board to your computer using an FTDI programmer. Follow the next schematic diagram: Many FTDI programmers have a jumper that allows you to select 3.3V or 5V. Make sure the jumper is in the right place to select 5V. Important: GPIO 0 needs to be connected to GND so that you’re able to upload code. To upload the code, follow the next steps: 1) Go to Tools > Board and select AI-Thinker ESP32-CAM. 2) Go to Tools > Port and select the COM port the ESP32 is connected to. 3) Then, click the upload button to upload the code. 4) When you start to see these dots on the debugging window as shown below, press the ESP32-CAM on-board RST button. after a few seconds, the code should be successfully uploaded to your board. Getting the IP address After uploading the code, disconnect GPIO 0 from GND. Open the Serial Monitor at a baud rate of 115200. Press the ESP32-CAM on-board Reset button. The ESP32 IP address should be printed in the Serial Monitor type this ip address and you can see camera is working

Step 6: Solar Panel

Connect this solar panel to battery .because in planet the main sources of energy is solar panels

Step 7: Gas Sensor

Here i am using only one gas sensor, you can use many gas sensor to detect the gases in atmoshpere.

While it’s able to read other gases, the MQ-6 is most sensitive to LPG based on the graph. The breakout board simplifies things for us because it converts resistance changes into voltage.
MQ-6 Gas Leak Detector If you want to detect only the presence of LPG in the air, you only need to connect the AO pin to any analog pin of the Arduino UNO. Then you must determine the threshold value by placing the MQ-6 near a safe LPG source (like an unignited gas stove) and record the reading.

code

float sensorValue;

float sensorVolts;

float val =1.4

void setup()

{ Serial.begin(9600); // sets the serial port to 9600

delay(20000); // allow the MQ-6 to warm up

}

void loop()

{

for(int i = 0; i < 100; i++)

{

sensorValue = sensorValue + analogRead(0);

}

sensorValue = sensorValue / 100; // get average reading

sensorVolts = sensorValue/1024*5.0; //convert to voltage

Serial.println(sensorVolts); // prints the value read

delay(100); // wait 100ms for next reading

if(sensorVolts>val)

{

digitalWrite(9,HIGH);

}

else

{

digitalWrite(9,LOW);

}

here the led on if the sensor value is greater than 1.4.... so if led is on it can is through cam .so we can detect gas presense there.