#ftp server sd card

1 messages · Page 1 of 1 (latest)

wide bay
#

This is my first post, for some time I wanted to access the card reader of my esp32s3box3 I arrived with the participation of Serrette we set up an access to the sd card reader with a crl_power of the box3 and a web page that works with webserver of esphome to access the file of the sd card but we are confronted with the limitation of webserver it loads the whole file in memory then sends it, present 2 times in the memory esp on for sending and the other on the receiving side. so I had the idea of ​​creating an ftp_server which works very well it sends the raw data but with a limitation of 5 mb per file we can delete create folders etc either by fillezilla or the windows explorer, but I would have liked esphome to be able to read the ftp maybe one day, it works with esp-idf for arduino I have not tested it,To access the web page you need the IP address of your ESP and the URL_prefix that you have chosen, for example http://xxxxxxxxxxxx/files, For the FTP server, you will need the IP address of your ESP and the root_path: "/" that you created in your SD card, for example FTP://ESP IP address/

#
esp32:
  board: esp32-s3-devkitc-1
  flash_size: 16MB
  framework:
    type: esp-idf
    version: recommended
    sdkconfig_options:
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
      CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
      CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
      CONFIG_FATFS_LFN_HEAP: "y"

"important"  ESP-IDF Framework
By default long file name are not enabled, to change this behaviour CONFIG_FATFS_LFN_STACK or CONFIG_FATFS_LFN_HEAP should be set in the framework configuration. See the Espressif documentation for more detail.


 sd_mmc_card:
  id: sd_card
  clk_pin: GPIO11
  cmd_pin: GPIO14
  data0_pin: GPIO9
  data1_pin: GPIO13
  data2_pin: GPIO42
  data3_pin: GPIO12
  mode_1bit: true
  power_ctrl_pin: GPIO43
  
  
box3web:
  id: box3_web
  url_prefix: files                    
  root_path: "/"                 
  enable_download: true                 
  enable_upload: false 

ftp_server:
  username: ""  # Choisissez votre nom d'utilisateur
  password: ""  # Choisissez un mot de passe sécurisé
  root_path: "/"  # Chemin vers votre carte SD
  port: 21 
  
external_components:

  - source:
      type: git
      url: https://github.com/youkorr/test
      ref: main
    components: [sd_mmc_card, ftp_server, box3web]
    refresh: 0s   
wide bay
wide bay
#

just copy the web page link of your audio or image,but for now reading is limited to 70kb of the basic web_server of esphome

rocky meadow
#

Nice job

wide bay
#

Hi everyone, I used to have a small problem with esphome's web_server, which was storing the file in memory before sending it, thus saturating the box's memory. [Reboot] It only took very small files, less than 20kb. So I developed an external_components esphome ftp_http. It allows you to transform FTP into HTTP. You had to specify the IP address of your FTP server, username, and password, either the one I had previously uploaded, which works very well, or another one, and a remote_paths file, which you had to upload to indicate a path, either in the root of the SD card, for example: "sounds_timer_finished.flac" or a folder you created on your SD card, "sounds/sounds_timer_finished.flac" in esphome's yaml file, and then you can upload it to
files:

  • id: sounds_timer_finished
    File: http:// ip_server:port 8000/sounds/timer_finished.flac

I made sure that all extensions are supported: jpg, png, mp3, flac, mp4, pdf, yaml, text, wav, etc. The download speed varies from 700 kb/s to 1000 kb/s, the same for uploads, but for MP3 playback, we are limited to the memory of the media player box, which uses resources, i.e., 3 MB for playing an audio file on the box. For other formats like png, jpg, etc., the limit is 10 MB. I'm at the maximum that the box can provide. The ESP-IDF chunking is introduced, and it plays its role well. This project largely replaces the box3web web part that I had installed before, which limited streaming and downloads.

#
esp32:
  board: esp32-s3-devkitc-1
  flash_size: 16MB
  framework:
    type: esp-idf
    version: recommended
    sdkconfig_options:
      CONFIG_ESP32S3_DEFAULT_CPU_FREQ_240: "y"
      CONFIG_ESP32S3_DATA_CACHE_64KB: "y"
      CONFIG_ESP32S3_DATA_CACHE_LINE_64B: "y"
      CONFIG_FATFS_LFN_HEAP: "y"
      CONFIG_ESP_TASK_WDT_TIMEOUT_S: "20"
      CONFIG_SPIRAM_RODATA: "y"
      CONFIG_LWIP_MAX_SOCKETS: "16"
      CONFIG_LWIP_SO_RCVBUF: "y"
      task_stack_size: "16384"





ftp_http_proxy:
  id: my_ftp_proxy
  server: xxx.xxx.x.x  #adress ip server
  username: ""
  password: ""
  remote_paths:
    - "4k/pexels.jpg" # 108 Ko
    - "jpg/capture.jpg" # 118 Ko
    - "jpg/Zephyrus.jpg"  #1,60 Mo
  local_port: 8000    
  

  - source:
      type: git
      url: https://github.com/youkorr/esphome_ftp_http
      ref: main
    components: [ftp_http_proxy]
    refresh: 0s