Problems uploading code to esp32+cam

oldtecken
Posts: 9
Joined: Tue Jun 04, 2019 7:26 pm

Problems uploading code to esp32+cam

Postby oldtecken » Wed Jun 05, 2019 12:29 pm

Hello All,
This is my first post here and I am new to the esp32 board. I have bought a esp32+cam board. It is an ai thinker marked with esp32-s. The camera that comes with this board is an ov2640. I have installed arduino ide 1.8.9. Both the linux 32bit and windows 32 bit versions. Windows version is on XP (only version I have). I also have the raspbian stretch version on a rasp pi3b+ but cannot use this as the extra stuff required for the esp32 does not exist in arm format. I have downloaded the extra stuff needed for the esp32 using https://dl.espressif.com/dl/package_esp32_index.json
for both the linux and windows 32 bit versions. I also have an ftdi232 board. However, I have had no success in uploading anything to the esp32 board. The win driver for ftdi232 on XP is dated 2012. I have tried updating via windows but told no later driver but have seen later drivers for windows on web so this might be an issue. However, for most of my attempts I've used linux. I have tried using the instruction on the following sites But always get compiling errors.

1) https://randomnerdtutorials.com/install ... tructions/

2)https://robotzero.one/esp32-cam-arduino-ide/

I have tried to upload both "wifi scan" and "camera web server". The error outputs are shown bellow.

1. WiFi Scan

Arduino: 1.8.9 (Linux), Board: "AI Thinker ESP32-CAM"

Code: Select all

Traceback (most recent call last):
  File "/root/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py", line 37, in <module>
    import serial
ImportError: No module named serial
Multiple libraries were found for "WiFi.h"
 Used: /root/.arduino15/packages/esp32/hardware/esp32/1.0.2/libraries/WiFi
 Not used: /root/Applications/arduino-1.8.9/libraries/WiFi
exit status 1
Error compiling for board AI Thinker ESP32-CAM.
2. Camera Web Server

Arduino: 1.8.9 (Linux), Board: "AI Thinker ESP32-CAM"

Code: Select all

Build options changed, rebuilding all
Traceback (most recent call last):
  File "/root/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py", line 37, in <module>
    import serial
ImportError: No module named serial
Multiple libraries were found for "WiFi.h"
 Used: /root/.arduino15/packages/esp32/hardware/esp32/1.0.2/libraries/WiFi
 Not used: /root/Applications/arduino-1.8.9/libraries/WiFi
exit status 1
Error compiling for board AI Thinker ESP32-CAM.
I have carefully checked the connections. I have tried both 3.3V and 5V. I have tried powering the esp32 board from a separate 3.3V supply. I have IO0 pulled to gnd and have also tried disabling the camera. I have connected tx to rx and vice versa and also rx to rx and tx to tx and it was no surprise when this did not work but it was worth a try. I believe the ftdi232 board is working as I see lights flashing when plugged in, I can see it with lsusb in terminal and I can get board inf for it i.e. pid6001 and vid0403. A hunt around the web shows these values as quite common. The esp board appears to be powered as if I press the rst button the led lights.

I have also tried the method outlined in this video using an arduino uno (this board I know to be working) to upload to the esp32. This also failed.

https://www.youtube.com/watch?v=a_PxAT8M-58

The error output is shown bellow.

3) (error third method) Camera Web Server
Arduino: 1.8.9 (Linux), Board: "ESP32 Wrover Module, Huge APP (3MB No OTA), QIO, 40MHz, 921600, None"

Code: Select all

Traceback (most recent call last):
  File "/root/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py", line 37, in <module>
    import serial
ImportError: No module named serial
exit status 1
Error compiling for board ESP32 Wrover Module.
The instructions for this one seems to have eliminate the "Multiple libraries were found for WiFi.h" issue but I still get the compiling error. This is leading me to think that this is a code error rather than a hardware error

Below is the code at the beginning of camera web server for method 3) after changes suggested.

Code: Select all

#include "esp_camera.h"
#include <WiFi.h>
#include "soc/soc.h"
#include "soc/rtc_cntl_reg.h"

//
// WARNING!!! Make sure that you have either selected ESP32 Wrover Module,
//            or another board which has PSRAM enabled
//

// 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

#include "camera_pins.h"
I assume this is correct based on the outline given in the youtube video but I am not sure.

Below is the code around line 37 in /root/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py

Code: Select all

    import serial
except ImportError:
    print("Pyserial is not installed for %s. Check the README for installation instructions." % (sys.executable))
    raise

# check 'serial' is 'pyserial' and not 'serial' https://github.com/espressif/esptool/issues/269
try:
    if "serialization" in serial.__doc__ and "deserialization" in serial.__doc__:
        raise ImportError("""
I am not sure what the above means.

I hope I have given enough information to allow somebody more expert than me to get an idea of what I am doing wrong and help me to get "Camera Web Server" uploaded to the board and working.

Regards,

Ken.

portasynthinca3
Posts: 8
Joined: Sat May 11, 2019 10:11 pm

Re: Problems uploading code to esp32+cam

Postby portasynthinca3 » Wed Jun 05, 2019 4:00 pm

Hi.
Seems like this is not a hardware problem. The esptool software, which uploads the firmware to the chip, runs on a Python programming language and requires a serial port library. Seems like this library isn't installed, but it should be installed by default! Can you try to re-install the Arduino ESP32 core?

oldtecken
Posts: 9
Joined: Tue Jun 04, 2019 7:26 pm

Re: Problems uploading code to esp32+cam

Postby oldtecken » Wed Jun 05, 2019 5:13 pm

Hi,
Thanks for your reply. I'll try reinstalling then uploading the code and I'll report back.

Regards,

Ken.

oldtecken
Posts: 9
Joined: Tue Jun 04, 2019 7:26 pm

Re: Problems uploading code to esp32+cam

Postby oldtecken » Thu Jun 06, 2019 6:20 pm

@ESP Spirte,
Thanks for your PM and the explanation therein. I'm still not authorised to reply via the PM hence this post. I have now overcome the problem I outlined on that post so it's now not needed. Thanks for letting me know what had happened as I wondered where it had gone.

Regards,

Ken.

oldtecken
Posts: 9
Joined: Tue Jun 04, 2019 7:26 pm

Re: Problems uploading code to esp32+cam

Postby oldtecken » Thu Jun 06, 2019 6:37 pm

@portasynthinca3,
After a bit of a problem I had in trying to workout how to remove esp32 v1.0.2 then reinstall it I found it to be quite easy. I see there's a v 1.0.1 and a v 1.0.0. I though I might try these if v 1.0.2 does not work again. I have not tried to upload again but I think I'll go back to using the ftdi232 as that seems to be what most people that have successfully uploaded seem to be using. I'll try uploading again tomorrow and will report on how it goes.

Regards,

Ken.

oldtecken
Posts: 9
Joined: Tue Jun 04, 2019 7:26 pm

Re: Problems uploading code to esp32+cam

Postby oldtecken » Fri Jun 07, 2019 2:53 pm

Hi,
I have tried again to upload code to the esp32 using method (3) as outlined in my original post. As before it failed with the same error. See below.

Code: Select all

Traceback (most recent call last):
  File "/root/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py", line 37, in <module>
    import serial
ImportError: No module named serial
exit status 1
Error compiling for board ESP32 Wrover Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Changed /root/.arduino15/preferences.txt from build.verbose=false to build.verbose=true to see if it provided more info.

I tried again but as this seems to be a compilation error I selected "Verify/compile" from the drop down menu. I got the same error. Asking for a verbose output does not seem to have worked. See below.

Code: Select all

Arduino: 1.8.9 (Linux), Board: "ESP32 Wrover Module, Huge APP (3MB No OTA), QIO, 40MHz, 921600, None"

Traceback (most recent call last):
  File "/root/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py", line 37, in <module>
    import serial
ImportError: No module named serial
exit status 1
Error compiling for board ESP32 Wrover Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
I have tried "Upload using programmer" before but it looked as if you had to select one though this is not mentioned on any method I have found. I presume programmer means the ftdi232 board. I do no know the name of this board. I decided to try this again anyway and it also failed. See below.

Code: Select all

Arduino: 1.8.9 (Linux), Board: "ESP32 Wrover Module, Huge APP (3MB No OTA), QIO, 40MHz, 921600, None"

Traceback (most recent call last):
  File "/root/.arduino15/packages/esp32/tools/esptool_py/2.6.1/esptool.py", line 37, in <module>
    import serial
ImportError: No module named serial
exit status 1
Error compiling for board ESP32 Wrover Module.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
It does not seem to matter what I try I get the same output. I decided to look for the "module named serial" in the ESP stuff.
This is what I have in "hardware".
/root/.arduino15/packages/esp32/hardware/esp32/1.0.2
a) Directories cores, libraries, tools and variants.
b) Files boards.txt, platform.txt and programmers.txt

/root/.arduino15/packages/esp32/hardware/esp32/1.0.2/tools Contains
a) Directories pattitions and sdk
b) Files espota.exe, espota.py, esptool.py, gen_esp32part.exe and gen_esp32part.py

I guess the .exe are windows files and .py python.

This is what I have in "tools"

/root/.arduino15/packages/esp32/tools/esptool_py/2.6.1
Files esptool.py

/root/.arduino15/packages/esp32/tools/mkspiffs/0.2.3
Files mkspiffs

/root/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-80-g6c4433a-5.2.0
Directories bin, include, lib, libexc, share, xtensa-esp32-elf.

Can I ask if this looks like what I should have in these file and do they look to be the most up to date stable versions? If more info is required to answer the above then please ask and I will do my best to provide it? I cannot find a "module named serial". Can anybody point me as to where I should find it?
I am beginning to wonder if trying to upload code to this version of the esp32 using arduino ide with esp32 additions works for anybody in spite of what it says on the sites I have linked to. If anybody has done this successfully can you tell me how you did it.

Regards,

Ken.

portasynthinca3
Posts: 8
Joined: Sat May 11, 2019 10:11 pm

Re: Problems uploading code to esp32+cam

Postby portasynthinca3 » Fri Jun 07, 2019 3:51 pm

Hi,
Have you tried to completely delete the ESP32 core for Arduino and install the latest version?

oldtecken
Posts: 9
Joined: Tue Jun 04, 2019 7:26 pm

Re: Problems uploading code to esp32+cam

Postby oldtecken » Fri Jun 07, 2019 5:53 pm

Hi,
Have you tried to completely delete the ESP32 core for Arduino
Yes I did it through arduino ide by going to Tools>Board>Board Manager>ESP32 by Espressif v 1.0.2. I clicked "Remove" and rebooted. However, when you asked the question it stuck me that I had not checked to see if anything was left before I reinstalled. I have just uninstalled it again. I have now /root/.arduino left however, on checking the parts that relate to esp32 I found whats shown below.

/root/.arduino15/packages/esp32/tools is empty
/root/.arduino15/packages/esp32/hardware/esp32 is empty

So it looks as if the esp32 stuff does get removed using the above method.
and install the latest version
I believe that ESP32 v 1.0.2 is the latest version. It does not update to a higher version when I select updates. There are two earlier versions though. Do you know of a later version than v 1.0.2?

Regards,

Ken.

portasynthinca3
Posts: 8
Joined: Sat May 11, 2019 10:11 pm

Re: Problems uploading code to esp32+cam

Postby portasynthinca3 » Fri Jun 07, 2019 7:34 pm

Hi,
Do you know of a later version than v 1.0.2?
As I know, v1.0.2 is the latest version.
If just re-installing the ESP32 Arduino core didn't work, can you please try this?
First of all, download Python version 2.7 using this (https://www.python.org/download/releases/2.7/) link, if it's not installed already. Please ensure that Python is installed into the

Code: Select all

C:/Python27/
directory. Secondly, run a command prompt as an administrator. Type the following commands in this sequence:

Code: Select all

cd "C:/Python27/Scripts"
pip install pyserial
This sequence of commands, or rather the second one, installs a module (library) named "pyserial" via built-in "pip" module manager. This is the exact module your setup is missing.
I think it will solve the issue.

oldtecken
Posts: 9
Joined: Tue Jun 04, 2019 7:26 pm

Re: Problems uploading code to esp32+cam

Postby oldtecken » Sat Jun 08, 2019 3:55 pm

@ portasynthinca3,
C:/Python27/, C:/Python27/Scripts
As the above looked to be for windows I had to adapt it a bit for linux. I was fairly sure that my machine was running python 2.7 but I checked anyway.

Code: Select all

root@live:~# python --version
Python 2.7.16
However, I didn't have pip so I installed it.

Code: Select all

sudo apt-get install pip
Then from your last post I ran.

Code: Select all

pip install pyserial
All of this went OK. I decided to upload a smaller sketch and tried WiFi Scan. I chose Sketch>Upload and this time it did though it did take longer than I thought it would to compile. I clicked on the Tools>Serial Monitor, disconnected IO0 from gnd and clicked reset and it worked. Encouraged by this I decided to install CameraWebServer. I did the same as above and the code was compiled and uploaded. However, when I went to the serial monitor and clicked reset all I saw was five random characters. Clicking reset again gave a different set of characters. I then remembered that I had not disabled the camera. I read that the board and camera needs more current than the usb can provide. I unplugged the usb plug on the ftdi232 board. I removed the vcc lead from the ftdi232 board and the esp32. I connected a 3V battery (two AA cells) to 3.3V and gnd on the esp32 board, checked the ftdi232 was set to 3.3V and reconnected to the usb and repeated the process. This time I got the expected output to the serial monitor. However, when I clicked reset and entered the url from the serial monitor in my browser it said that it could not be reached. The url was http://192.168.0.211. This url looks alright to me. Is it OK? This is where things went wrong. I disconnected the esp32 board by removing the positive connection to the battery. I then removed the ftdi232 board from the usb and the esp32. I then connected the positive from the battery to 3.3V on the esp32 board and clicked reset. At this point a message appeared. I can't remember the exact words but it was something along the lines that a "burnout situation had been detected". After this I could get nothing to work nor could I re-flash the board. I don't believe that I damaged the board. I have been particularly careful. The leads have shrouded pins and so even when disconnected can't short to other pins. I gave up at this point. This morning I thought before I made this post I would try and get the exact wording of the "burnout" thing but when I tried the esp32 board was working again. I have uploaded WiFi Scan again which is working. I this "burnout" thing common? Are the boards made to stop working then reset themselves. I am a bit worried by this and as yet have not felt brave enough to try and upload CameraWebServer again.

Regards,

Ken.

Who is online

Users browsing this forum: No registered users and 55 guests