4525

A bit of ANNEX32-BASIC-script-code to control an ESP32 based pan/tilt servo CAM. No ARDUINO-Code, no compiling … just run the interpreter on the ESP32-device and develop, change, customize your BASIC-script with your browser in the web interface of the device.

A bit of ANNEX32-BASIC-script-code to control an ESP32 based pan/tilt servo CAM.
No ARDUINO-Code, no compiling … just run the interpreter on the ESP32-device and develop, change, customize your BASIC-script with your browser in the web interface of the device.


Much more Photos at  my blog site


My intention for the hardware and software was: „Keep it simple“.
So I stacked two SG90-servos to carry a „M5CAMERA001 model B“
I used the ANNEX32 BASIC-interpreter in its version 1.43 for ESP32 cameras (M5Stack CAM model B and the native ESP32-CAM)
My web interface was derived from the ANNEX32 developer’s sample code and some useful hints in the fabulous online-help of ANNEX32.
Horizontal and vertical position are manualy set by sliders that are integrated in the live-picture. An auto pan can slowly turn the cam.
All possible resolutions can be selected.
Some pictures can be stored in the internal flash ( or better on a large SD-card if inserted in an ESP32-CAM). Please remember the small PSRAM of the devices. I had no problem storing up to 5 photos with 1024×768. The script will refuse to store if too less space is left for the next photo, and an additional „delete“ button will allow to delete the old pics.

The simple schematic shows how to wire the M5Camera001 Type B or the ESP32-CAM with the two SG90 servos.

M5CAM has two free pins at the grove-port (io13 and io4) for the servos.

With ESP32-CAM I had to use io12 and the RX-Pin io3 for the second servo

The servos are stacked and glued together with double sideded tape. The camera needs four flexible wires to connect the servos and get the 5V supply voltage via a Vero-board on top of the servo stack. A flexible two wire supply line is turned around the grounding shaft of the lower pan servo.

Attached you will find my current ANNEX-code for the described functions:
If you do use only a horizontal PAN servo, or even no servo … the code is prepared to simply set some
variables to (de)activate the servo functions and the sliders.
If running on an ESPCAM the onboard white flash LED can be switched ON/OFF by an additional button.
If the camera or the mount is turned or mounted over the top: Look at the variables to invert/mirror the movements or the picture.

<<<<<<<<<<<< For the BASIC _ SCRIPT  look at "cam_9v1.txt"  >>>>>>>>>>>>>>>>>>>>>

EDIT:
I added a version of the BASIC-script that supports on demand-Photos and alerting via a Telegram_Bot.  (>>> CAM10_3.txt ) This version requires ANNEX 1.435 or newer.
As the CAM requires a fast hardware, it helps a lot  to speed up the device by flashing it in QIO-mode.(, to be found under  "advanced" in the ANNEX-TOOLKIT)