ESP32CAM send captured images to Googledrive


ESP32CAM send captured images to Google drive


App script code :



function doPost(e) {
var myFoldername = e.parameter.myFoldername;
var myFile = e.parameter.myFile;
var myFilename = e.parameter.myFilename;
//var myFilename = Utilities.formatDate(new Date(), "GMT", "yyyyMMddHHmmss")+"-"+e.parameter.myFilename;
var myToken = e.parameter.myToken;
var contentType = myFile.substring(myFile.indexOf(":")+1, myFile.indexOf(";"));
var data = myFile.substring(myFile.indexOf(",")+1);
data = Utilities.base64Decode(data);
var blob = Utilities.newBlob(data, contentType, myFilename);
// Save a captured image to Google Drive.
var folder, folders = DriveApp.getFoldersByName(myFoldername);
if (folders.hasNext()) {
folder = folders.next();
} else {
folder = DriveApp.createFolder(myFoldername);
}
var file = folder.createFile(blob);
file.setDescription("Uploaded by " + myFilename);
var imageID = file.getUrl().substring(file.getUrl().indexOf("/d/")+3,file.getUrl().indexOf("view")-1);
var imageUrl = "https://drive.google.com/uc?authuser=0&id="+imageID;

NOTE : For other code contact : pigirl.02@gmail.com

Arduino set up:
Set up
1.ESP32cam board is interfaced with OV2640 camera with GPIO pins


2. Connect the EP32cam board with FTDI programmer since it is not a UmSB port for TTL serial transmission of USB signals.


3. GPIO 1,3 are serial pins and these pins to upload code to board GPIO 1,3 are the serial pins and  ID0 is connected to GND ESP32 will be in flashing mode


4. Installation


There is an add on which allows you to program ESP32 with Arduino IDE and programming languages.
  • Arduino IDE go to FILE > Preferences      
  • Additional board manager in URL 
  • Install ESP32 BY Espressif Systems
    • Board                    :   Esp32 Worever module(Windows) / DOIT ESP32                 DEVKIT V1(mac) 
    • Upload Speed       :  115200
    • Flash Frequency   :  40MHz
    • Flash Mode           :  QIO 
    • Partition Scheme  :  Huge App ( 3mba no OTA)
    • Programmer         :  AVR ISP


            5. Upload the code.


            6.Press the on board reset button for ESP32 in flashing mode to be set. 


            7.After Uploading  the code disconnect ID0 from GND  


            8. Open the serial Monitor  at a baud rate of 115200. The ESP32 IP address should be 
             printed on a serial monitor.   
        
NOTE:  

  • Supply should be atleast 5V 2Amps or else that would cause ripple in image
  • Connection ID0 to GND
  • Select the COM port (if you don't see the COM port you need to install drivers)





My Instagram

Made with by Pi-girl | Copyright © 2020 Pi-girl