Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

abdallah-t/planets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 Solar System Presentation Setup Guide

This guide will help you set up your ESP32 to serve the interactive solar system presentation with LED control functionality.

Hardware Requirements

ESP32 Board

  • ESP32 DevKit V1 (recommended) or similar
  • USB cable for programming

LEDs and Components

  • 8x LEDs (representing the 8 planets)
  • 8x 220-330Ω resistors (current limiting resistors for LEDs)
  • Breadboard or PCB
  • Jumper wires
  • Optional: LED holders or housings

Suggested LED Colors for Planets

  • Mercury (Pin 2): White/Silver LED
  • Venus (Pin 4): Yellow/Orange LED
  • Earth (Pin 5): Blue LED
  • Mars (Pin 18): Red LED
  • Jupiter (Pin 19): Orange/Brown LED
  • Saturn (Pin 21): Yellow LED
  • Uranus (Pin 22): Light Blue/Cyan LED
  • Neptune (Pin 23): Dark Blue LED

Software Requirements

Arduino IDE Setup

  1. Install Arduino IDE (version 1.8.x or 2.x)

  2. Install ESP32 Board Package

    • Open Arduino IDE
    • Go to File → Preferences
    • In "Additional Board Manager URLs" add:
      https://dl.espressif.com/dl/package_esp32_index.json
      
    • Go to Tools → Board → Board Manager
    • Search for "ESP32" and install "ESP32 by Espressif Systems"
  3. Install Required Libraries

    • Go to Tools → Manage Libraries
    • Install the following libraries:
      • WebServer (usually comes with ESP32 package)
      • SPIFFS (usually comes with ESP32 package)
      • WiFi (usually comes with ESP32 package)
  4. Install ESP32 SPIFFS Uploader Plugin

    • Download from: https://github.com/me-no-dev/arduino-esp32fs-plugin
    • Extract to your Arduino IDE tools folder:
      • Windows: C:\Users\{username}\Documents\Arduino\tools\ESP32FS\tool\esp32fs.jar
      • Mac: ~/Documents/Arduino/tools/ESP32FS/tool/esp32fs.jar
      • Linux: ~/Arduino/tools/ESP32FS/tool/esp32fs.jar
    • Restart Arduino IDE

Wiring Diagram

ESP32 Pin    Component           Connection
=========    =========           ==========
3.3V         Breadboard          Positive rail
GND          Breadboard          Negative rail

Pin 2        LED 1 (Mercury)     Cathode via 220Ω resistor to GND
Pin 4        LED 2 (Venus)       Cathode via 220Ω resistor to GND  
Pin 5        LED 3 (Earth)       Cathode via 220Ω resistor to GND
Pin 18       LED 4 (Mars)        Cathode via 220Ω resistor to GND
Pin 19       LED 5 (Jupiter)     Cathode via 220Ω resistor to GND
Pin 21       LED 6 (Saturn)      Cathode via 220Ω resistor to GND
Pin 22       LED 7 (Uranus)      Cathode via 220Ω resistor to GND
Pin 23       LED 8 (Neptune)     Cathode via 220Ω resistor to GND

Step-by-Step Wiring Instructions

  1. Power Rails: Connect ESP32 3.3V to breadboard positive rail, GND to negative rail

  2. For Each LED:

    • Connect LED anode (+, longer leg) to ESP32 GPIO pin
    • Connect LED cathode (-, shorter leg) to one end of 220Ω resistor
    • Connect other end of resistor to breadboard negative rail (GND)
  3. Double Check:

    • Ensure all connections are secure
    • Verify resistor values (220-330Ω)
    • Check LED polarity (longer leg = positive)

Software Setup

Step 1: Configure WiFi Credentials

  1. Open planets_esp32.ino in Arduino IDE
  2. Modify WiFi credentials at the top of the file:
    const char* ssid = "YOUR_WIFI_SSID";        // Replace with your WiFi name
    const char* password = "YOUR_WIFI_PASSWORD"; // Replace with your WiFi password

Step 2: Upload Arduino Sketch

  1. Connect ESP32 to your computer via USB
  2. Select Board:
    • Go to Tools → Board → ESP32 Arduino → "ESP32 Dev Module"
  3. Select Port:
    • Go to Tools → Port → Select your ESP32 port (usually shows as "CP210x" or "Silicon Labs")
  4. Set Upload Speed:
    • Tools → Upload Speed → 921600 (or 115200 if upload fails)
  5. Upload Code:
    • Click Upload button or press Ctrl+U
    • Wait for "Hard resetting via RTS pin..." message

Step 3: Upload Web Files to SPIFFS

  1. Prepare Data Folder:

    • Make sure the data/ folder contains:
      • index.html
      • script.js
      • style.css
      • images/ folder with all planet images
  2. Upload to SPIFFS:

    • With ESP32 still connected
    • Go to Tools → ESP32 Sketch Data Upload
    • Wait for upload to complete (may take several minutes)
    • You should see "SPIFFS Image Uploaded" when done

Testing and Usage

Initial Testing

  1. Open Serial Monitor:

    • Tools → Serial Monitor
    • Set baud rate to 115200
    • Reset ESP32 (press EN button)
  2. Expected Output:

    Connecting to WiFi...
    ....
    WiFi connected!
    IP address: 192.168.1.XXX
    Testing LEDs...
    Testing Mercury LED on pin 2
    Testing Venus LED on pin 4
    ... (all LEDs should light up sequentially)
    LED test complete!
    Web server started
    
  3. LED Test: All 8 LEDs should light up in sequence at startup

Accessing the Presentation

  1. Find ESP32 IP Address: Note the IP from Serial Monitor
  2. Open Web Browser: Go to http://192.168.1.XXX (replace with your ESP32's IP)
  3. Test Functionality:
    • Navigate through slides using arrow buttons
    • LEDs should light up for planet slides (slides 2-9)
    • No LEDs for intro, conclusion, or "how I made this" slides

LED Control Mapping

Slide Planet LED Pin Expected Behavior
1 Intro None All LEDs off
2 Mercury Pin 2 Mercury LED on
3 Venus Pin 4 Venus LED on
4 Earth Pin 5 Earth LED on
5 Mars Pin 18 Mars LED on
6 Jupiter Pin 19 Jupiter LED on
7 Saturn Pin 21 Saturn LED on
8 Uranus Pin 22 Uranus LED on
9 Neptune Pin 23 Neptune LED on
10 Conclusion None All LEDs off
11 How Made None All LEDs off

Troubleshooting

WiFi Connection Issues

  • Problem: ESP32 not connecting to WiFi
  • Solutions:
    • Check WiFi credentials are correct
    • Ensure WiFi network is 2.4GHz (ESP32 doesn't support 5GHz)
    • Try moving closer to router
    • Check for special characters in WiFi password

Upload Issues

  • Problem: Code upload fails
  • Solutions:
    • Hold BOOT button while clicking upload
    • Try different upload speed (115200)
    • Check USB cable (use data cable, not charge-only)
    • Install CP210x or CH340 drivers

LED Issues

  • Problem: LEDs don't light up
  • Solutions:
    • Check LED polarity (longer leg = positive)
    • Verify resistor connections
    • Test with multimeter
    • Check GPIO pin numbers in code

SPIFFS Upload Issues

  • Problem: Web files not uploading
  • Solutions:
    • Ensure ESP32 Sketch Data Upload plugin is installed correctly
    • Close Serial Monitor before uploading
    • Try uploading sketch first, then SPIFFS data
    • Check data folder structure

Web Interface Issues

  • Problem: Website loads but LEDs don't respond
  • Solutions:
    • Check browser console for errors (F12)
    • Verify ESP32 IP address
    • Try different browser
    • Check if JavaScript is enabled

API Endpoints

Your ESP32 also exposes these helpful endpoints:

  • GET /status - Returns current LED status and ESP32 info
  • GET /led/planet?slide=X - Control LEDs by slide number (X = 1-11)
  • GET /led/on?planet=X - Turn on specific planet LED (X = 0-7)
  • GET /led/off - Turn off all LEDs

File Structure

planets/
├── planets_esp32.ino          # Main Arduino sketch
├── data/                      # SPIFFS upload folder
│   ├── index.html            # Web presentation
│   ├── script.js             # JavaScript with ESP32 communication
│   ├── style.css             # Styling
│   └── images/               # Planet images
│       ├── mercury.png
│       ├── venus.png
│       ├── earth.png
│       ├── mars.png
│       ├── jupiter.png
│       ├── saturn.png
│       ├── uranus.png
│       ├── neptune.png
│       └── solar_system_overview.png
├── README.md                 # This file
└── original files/           # Original presentation files
    ├── index.html
    ├── script.js
    └── style.css

Performance Notes

  • Memory Usage: SPIFFS partition uses ~2MB of flash memory
  • Response Time: LED control response is typically <100ms
  • Concurrent Users: ESP32 can handle 5-10 concurrent web users
  • Image Optimization: PNG images are served directly (consider WebP for better compression)

Customization Options

Changing LED Pins

Edit the ledPins[] array in the Arduino sketch:

const int ledPins[8] = {2, 4, 5, 18, 19, 21, 22, 23};

Adding More LEDs

  1. Increase array size
  2. Add more GPIO pins
  3. Update planet count
  4. Modify web interface accordingly

LED Brightness

Add PWM control for dimmable LEDs:

analogWrite(ledPins[planetIndex], brightness); // 0-255

Safety Notes

  • Power: ESP32 GPIO pins output 3.3V max, safe for direct LED connection with resistors
  • Current: Each GPIO can handle up to 40mA, well within LED requirements
  • Heat: LEDs and resistors may get warm during extended use
  • Polarity: Always check LED polarity to avoid damage

Support

If you encounter issues:

  1. Check this troubleshooting section
  2. Verify all connections
  3. Check Serial Monitor for error messages
  4. Ensure all software dependencies are installed

Happy presenting! 🌌🪐

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published