├── ESP32CAM_HOG_OPENCV ├── docker │ ├── Dockerfile │ ├── LICENSE │ ├── README.md │ ├── build.sh │ └── run.sh └── src │ ├── .vscode │ └── launch.json │ ├── __pycache__ │ ├── camera.cpython-311.pyc │ ├── detectors.cpython-311.pyc │ └── utils.cpython-311.pyc │ ├── camera.py │ ├── detectors.py │ ├── main.py │ ├── models │ └── models.dat │ ├── requirements │ └── requirements.txt │ └── utils.py ├── ESP32_AM2301 ├── AM2301_ESP32.ino ├── debug.cfg ├── debug_custom.json └── esp32.svd ├── ESP32_AMPLIFIER └── SPEAKER_SD │ ├── SPEAKER_SD.fzz │ ├── SPEAKER_SD.ino │ └── SPEAKER_SD.png ├── ESP32_CAM_PYTHON_STREAM_OPENCV └── ESP32_CAM_PYTHON_STREAM_OPENCV.py ├── ESP32_FIREBASE_SERVICES └── ESP32_FIREBASE_SERVICES.ino ├── ESP32_LAND_METER ├── ESP32_LAND_METER.ino ├── GPS.FCStd ├── GPS.FCStd1 └── index.h ├── ESP32_MQ135 ├── MQ135_ESP32.ino ├── debug.cfg ├── debug_custom.json └── esp32.svd ├── ESP32_WEB_SERVER ├── ESP32 Web Server.fz ├── ESP32 Web Server_bb.png ├── ESP32_WEB_SERVER.ino └── part.esp32_V2_52d2ade585478c3892482f9a77789f59_13.fzp ├── ESP_MOTION_DETECTION └── ESP32_MOTION_DETECTION.py ├── LICENSE └── README.md /ESP32CAM_HOG_OPENCV/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # OS SETTINGS 2 | # Here you can choose the OS and the CUDA version you want to mount 3 | 4 | FROM nvidia/cuda:12.0.1-devel-ubuntu22.04 5 | 6 | 7 | # other examples: 8 | # FROM nvidia/cuda:11.7.1-base-ubuntu22.04 9 | # FROM nvidia/cuda:11.3.1-base-ubuntu20.04 # supports python 3.8 - 3.9 10 | # FROM nvidia/cuda:11.8.0-base-ubuntu18.04 # supports python 3.6 - 3.7 11 | # FROM nvidia/cuda:11.1.1-devel-ubuntu20.04 # supports python 3.8 - 3.9 12 | # FROM nvidia/cuda:11.8.0-devel-ubuntu18.04 # supports python 3.6 - 3.7 13 | 14 | # you can find more versions here: 15 | # https://hub.docker.com/r/nvidia/cuda/ 16 | # https://hub.docker.com/r/nvidia/cuda/tags?page=1&name=base-ubuntu 17 | 18 | 19 | # ----------------------------------------------------------------------------------------------------------------------------------------------------- 20 | # ENVIRONMENT SETTINGS 21 | # In this section we want to specify which softwares we want to pre-install within the docker 22 | 23 | # to be sure we set non interactive bash also here 24 | ENV DEBIAN_FRONTEND=noninteractive 25 | 26 | # configuration for x11 forwarding 27 | LABEL com.nvidia.volues.needed="nvidia-docker" 28 | ENV PATH /usr/local/nvidia/bin:${PATH} 29 | ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64:${LD_LIBRARY_PATH} 30 | RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y -q \ 31 | x11-apps mesa-utils && rm -rf /var/lib/apt/lists/* 32 | 33 | # remove all the packages within Debian base configuration (not wasting time installing things that will not be used) 34 | RUN rm -f /etc/apt/sources.list.d/*.list 35 | 36 | # install Ubuntu Software needed for the development (DEBIAN_FRONTEND="noninteractive" needed to avoid human interaction in the process) 37 | RUN apt-get update && DEBIAN_FRONTEND="noninteractive" && apt-get install -y -q\ 38 | sudo \ 39 | git \ 40 | curl \ 41 | wget \ 42 | bash \ 43 | net-tools \ 44 | inetutils-ping \ 45 | bash-completion \ 46 | build-essential \ 47 | ffmpeg \ 48 | python3.11 \ 49 | python3.11-dev \ 50 | python3-pip \ 51 | python3-tk \ 52 | && rm -rf /var/lib/apt/lists/* 53 | 54 | # set python update alternatives - the highest is the preferred one 55 | RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1 56 | RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2 57 | RUN update-alternatives --config python3 58 | 59 | # remove python2 60 | RUN ln -sf /usr/bin/python3 /usr/bin/python && \ 61 | ln -sf /usr/bin/pip3 /usr/bin/pip 62 | 63 | # ----------------------------------------------------------------------------------------------------------------------------------------------------- 64 | # USER SETTINGS 65 | 66 | # the docker's user will be 'user' and its home will be '/user/home' 67 | ARG USER_NAME=user 68 | ARG USER_HOME=/home/$USER_NAME 69 | 70 | # create a new user within the Docker container 71 | RUN useradd -m -s /bin/bash $USER_NAME \ 72 | && echo "$USER_NAME:Docker!" | chpasswd \ 73 | && mkdir -p /src && chown -R $USER_NAME:$USER_NAME /src \ 74 | && mkdir -p /etc/sudoers.d \ 75 | && usermod -aG video $USER_NAME \ 76 | && usermod -aG dialout $USER_NAME \ 77 | && usermod -aG tty $USER_NAME \ 78 | && echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/$USER_NAME 79 | 80 | RUN exec sg dialout 81 | USER $USER_NAME 82 | WORKDIR $USER_HOME 83 | 84 | # ----------------------------------------------------------------------------------------------------------------------------------------------------- 85 | # FINAL SETUPS 86 | 87 | # upgrade python pip 88 | RUN pip install --upgrade pip 89 | 90 | # install python packages in requirements directory 91 | # project/ 92 | # |-- ai-base-docker/ 93 | # | | |-- build.sh 94 | # | | |-- Dockerfile 95 | # | | |-- run.sh 96 | # |-- src/ 97 | # | | |-- model/ 98 | # | | |-- utils/ 99 | # | | |-- requirements/ 100 | # | | |-- base.txt 101 | # | | |-- devel.txt 102 | 103 | RUN mkdir ./tmp 104 | COPY ./src/requirements/* ./tmp/ 105 | 106 | RUN for file in ./tmp/*; do \ 107 | python3 -m pip install -r $file; \ 108 | done 109 | 110 | # if you need to download .whl packages from a link 111 | # RUN python -m pip download --only-binary :all: --dest . --no-cache PACKAGE-DOWNLOAD-LINK.whl 112 | 113 | # remove all the created/copied/moved file by the docker 114 | RUN rm -rf * 115 | 116 | # when the container is launched it will start a bash session 117 | CMD ["/bin/bash"] 118 | -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/docker/LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/docker/README.md: -------------------------------------------------------------------------------- 1 | # ai-base-docker 2 | This docker aims to support research in being able to run their projects on different machines, and be able to share them in the best way. 3 | 4 | ### Why do I need a Docker? 5 | Currently there are many ways to share the setup of an Artificial Intelligence research project, many only share the requirements file, while others also provide the configuration file for an environment managed by Anaconda. The problem with research projects is that a lot of time is often wasted just doing a project setup: installing Python, installing GPU drivers, installing CUDA, installing Anaconda, resolving errors and conflicts, ... 6 | Docker is not yet the de-facto standard in research, but I think wider adoption could save a lot of people time. 7 | 8 | Docker allows you to create something similar to a virtual machine, where any action carried out within it, such as installing an ubuntu package or a python library, is canceled once docker is closed. To make a change made on Docker permanent, just write it in the Dockerfile. 9 | 10 | in addition to proposing this tool which I think is useful for better managing one's environment, and in any case it is a skill in great demand even within companies (it is worth learning to use it!), I also propose to better organize research projects in this way : 11 | - **`project-directory`**: a folder with the name of your research project. 12 | - **`ai-base-docker`**: import here the *ai-base-docker* as submodule. 13 | - **`src`**: the main directory where you implement the project. 14 | - **`requirements`**: the directory where you specify all the requirements files 15 | - **`base.txt`**: base requirements 16 | - **`devel.txt`**: development requirements 17 | 18 | ## Docker setup 19 | 1. Please follow docker base installation: 20 | https://docs.docker.com/engine/install/ 21 | 22 | 2. Once docker has been installed, install nvidia-docker2 for GPU support (otherwise you can follow [this](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html) procedure (Recommended) ): 23 | ``` 24 | distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && curl -s -L https://nvidia.github.io/libnvidia-container/gpgkey | sudo apt-key add - && curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list 25 | sudo apt-get update 26 | sudo apt-get install -y nvidia-docker2 27 | sudo systemctl restart docker 28 | ``` 29 | 30 | 3. Add required permissions to your user in order to perform actions with docker on containers 31 | ``` 32 | sudo groupadd docker 33 | sudo usermod -aG docker $USER 34 | newgrp docker 35 | ``` 36 | 37 | 4. Import and build docker image: please note that here you are downloading ubuntu, cuda and pytorch, and it may take several minutes 38 | 39 | - Importing ai-base-docker as submodule (to use it as it is) 40 | ``` 41 | git submodule add https://github.com/ProjectoOfficial/ai-base-docker 42 | git fetch 43 | git pull 44 | ``` 45 | - Cloning: recommended when you need to work on a private repository. Delete .git directory within ai-base-docker, in this way you can push your changes without any issue 46 | ``` 47 | git clone https://github.com/ProjectoOfficial/ai-base-docker 48 | ``` 49 | - Forking: recommended if you need it but just for a public project (then you create a new branch per each project you need to work on). Click on [Fork](https://github.com/ProjectoOfficial/ai-base-docker/fork) and then: 50 | ``` 51 | git clone https://github.com/your-github-id/ai-base-docker 52 | cd ai-base-docker 53 | git checkout -b project-branch-name 54 | ``` 55 | 56 | then go to ai-base-docker directory and build the docker 57 | ``` 58 | cd ai-base-docker 59 | ./build.sh 60 | ``` 61 | 62 | 5. run docker image: 63 | ``` 64 | ./run.sh 65 | ``` 66 | - params: 67 | - $1 (data directory): optionally you can specify a supplementary volume (directory) which tipically can be used as data directory (where you store your datasets). You will find it under ```/home/user/data``` 68 | 69 | ## Coding 70 | To be able to program and execute the code inside the docker at the same time (permanent programming, the files will remain even when the docker is closed) I recommend using [VSCode](https://code.visualstudio.com/). 71 | 72 | As extensions to do this I use the following. Go to the VSCode marketplace (CTRL+SHIFT+X) and search for: 73 | - ```ms-azuretools.vscode-docker``` 74 | - ```ms-vscode-remote.remote-containers``` 75 | 76 | once the extensions have been installed and after launching the docker *run* script, in the menu on the left of VSCode you must select the whale icon (docker), and under the "individual containers" item you will find the container you have just launched with a green arrow next to it. By clicking with the right mouse button on it you will find "attach with VSCode", and this will open a new window for programming inside the docker. 77 | 78 | It's not over here, one last step is missing! Go to File>Open Folder -> enter "/home/user" as the path 79 | 80 | 81 | ## Contributions 82 | 83 | If you find errors or have suggestions for improving this project, feel free to open an issue or send a pull request. 84 | 85 | tested with docker version: 24.0.7 -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/docker/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | IMAGE_NAME="ESP32-docker" 4 | IMAGE_TAG="1.0.0" 5 | echo "Started build for $IMAGE_NAME:$IMAGE_TAG" 6 | 7 | # Percorso assoluto del Dockerfile 8 | MAIN_DIR="$(cd "$(dirname "$0")" && pwd)/.." 9 | echo "setting main directory as $PWD" 10 | 11 | # Esegui la build dell'immagine Docker 12 | echo "building: $MAIN_DIR/Dockerfile" 13 | docker build -t "$IMAGE_NAME:$IMAGE_TAG" -f "$MAIN_DIR/docker/Dockerfile" "$MAIN_DIR" 14 | 15 | 16 | # Controlla se la build è stata completata con successo 17 | if [ $? -eq 0 ]; then 18 | echo "Build dell'immagine completata con successo." 19 | else 20 | echo "Si è verificato un errore durante la build dell'immagine." 21 | fi -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/docker/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # exit on error 4 | set -e 5 | 6 | IMAGE_NAME="ESP32-docker" 7 | IMAGE_TAG="1.0.0" 8 | 9 | echo $IMAGE_NAME:$IMAGE_TAG started! 10 | 11 | CONTAINER_NAME="ESP32" 12 | 13 | # x11 forwarding 14 | echo "Setting x11 forwarding" 15 | XSOCK=/tmp/.x11-unix 16 | XAUTH=/tmp/.docker.xauth 17 | xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge - 18 | chmod 755 $XAUTH 19 | 20 | launch_command="docker run " 21 | base_options="--shm-size 2GB -ti --rm " # set container shared memory to 2GB 22 | # start container with interactive mode 23 | # and enable auto-remove of the container 24 | 25 | if command nvcc -v > /dev/null 2>&1 && command nvidia-smi > /dev/null 2>&1; then 26 | base_options+="--gpus all " # eat all gpus 27 | options+="--device=/dev/nvidia-modeset " # nvidia modeset map to support graphic card acceleration 28 | fi 29 | 30 | 31 | echo "preparing docker run options" 32 | options="-v /media:/media " # mount media directory 33 | options+="${MOUNT_SRC_PATH} " # mount project directory 34 | options+="-e http_proxy -e https_proxy " # set environment variables for http and https 35 | options+="-e "DISPLAY" --env "QT_X11_NO_MITSHM=1" " # X11 display and disable memory share in MIT-SHM for Qt applications 36 | options+="-v $XSOCK:$XSOCK -v $XAUTH:$XAUTH " # X11 forward settings 37 | options+="-e XAUTHORITY=$XAUTH " # set XAUTHORITY with host authorization path 38 | options+="--name $CONTAINER_NAME " # update container name 39 | options+="--user $(id -u):$(id -g) " # sync user ID and group ID 40 | options+="--net=host " # add internet connetion 41 | options+="--group-add video " # add container to video group 42 | options+="--device=/dev/dri:/dev/dri " # map host DRI (Direct Rendering Infrastructure) to container 43 | options+="-v $(dirname $PWD)/src:/home/user/src " # mount src path 44 | 45 | CAMERA_MOUNTED=0 46 | UART_MOUNTED=0 47 | while [ "$#" -gt 0 ]; do 48 | case "$1" in 49 | -w) 50 | video_devices=($(ls /dev/video* 2>/dev/null)) 51 | if [ ${#video_devices[@]} -gt 0 ] && [ "$CAMERA_MOUNTED" -eq 0 ]; then 52 | for video_device in "${video_devices[@]}"; do 53 | echo "Setting device: $video_device" 54 | options+="--device ${video_device}:${video_device} " 55 | done 56 | CAMERA_MOUNTED=1 57 | else 58 | echo "Could not find any video input device or camera already mounted" 59 | fi 60 | ;; 61 | -u) 62 | uart_device=$(ls /dev/ttyUSB* 2>/dev/null | head -n 1) 63 | if [ -n "$uart_device" ] && [ "$UART_MOUNTED" -eq 0 ]; then 64 | echo "setting UART device: $uart_device" 65 | options+="--device ${uart_device}:${uart_device} " 66 | UART_MOUNTED=1 67 | else 68 | echo "Could not find any UART device or UART already mounted" 69 | fi 70 | ;; 71 | -d) 72 | shift 73 | if [ -n "$1" ] && [ -d "$1" ]; then 74 | last_dir=$(basename "$1") 75 | echo "mounting data directory: $last_dir" 76 | options+="-v ${1}:/home/user/$last_dir " 77 | else 78 | echo "Invalid or missing directory path after -d option" 79 | exit 1 80 | fi 81 | ;; 82 | *) 83 | echo "Unknown option: $1" 84 | exit 1 85 | ;; 86 | esac 87 | shift 88 | done 89 | 90 | options+="$IMAGE_NAME:$IMAGE_TAG " # set image name and image tag 91 | 92 | 93 | $launch_command $base_options $options 94 | -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/src/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Main", 6 | "type": "python", 7 | "request": "launch", 8 | "program": "main.py", 9 | "console": "integratedTerminal", 10 | "args": [ 11 | // "--get-camera-ip", 12 | "--camera-socket", "http://192.168.137.201" 13 | // "--camera-index", "2", 14 | ] 15 | } 16 | ] 17 | } 18 | -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/src/__pycache__/camera.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/ESP32/cf845d689eaf849d9cd3e2c0179996a4783215cb/ESP32CAM_HOG_OPENCV/src/__pycache__/camera.cpython-311.pyc -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/src/__pycache__/detectors.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/ESP32/cf845d689eaf849d9cd3e2c0179996a4783215cb/ESP32CAM_HOG_OPENCV/src/__pycache__/detectors.cpython-311.pyc -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/src/__pycache__/utils.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/ESP32/cf845d689eaf849d9cd3e2c0179996a4783215cb/ESP32CAM_HOG_OPENCV/src/__pycache__/utils.cpython-311.pyc -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/src/camera.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import argparse 3 | import serial 4 | import serial.tools.list_ports 5 | import requests 6 | import time 7 | 8 | def camera_settings(cap: cv2.VideoCapture) -> cv2.VideoCapture: 9 | cap.set(cv2.CAP_PROP_FRAME_WIDTH, 640) 10 | cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) 11 | cap.set(cv2.CAP_PROP_FPS, 30) 12 | cap.set(cv2.CAP_PROP_AUTO_EXPOSURE, 0.25) 13 | 14 | return cap 15 | 16 | def set_esp32camera(socket: str) -> None: 17 | settings = [ 18 | "/control?var=framesize&val=7", 19 | "/control?var=quality&val=10", 20 | "/control?var=awb&val=1", 21 | "/control?var=awb_gain&val=1", 22 | "/control?var=brightness&val=-1", 23 | "/control?var=aec1&val=1", 24 | "/control?var=aec2&val=1", 25 | "/control?var=saturation&val=2", 26 | "/control?var=dcw&val=0", 27 | ] 28 | 29 | for setting in settings: 30 | response = requests.get(socket + setting) 31 | time.sleep(0.1) 32 | print(response.reason) 33 | 34 | def open_camera(args: argparse.Namespace) -> cv2.VideoCapture: 35 | if args.camera_index is not None: 36 | cap = cv2.VideoCapture(args.camera_index) 37 | elif args.camera_socket is not None: 38 | cap = cv2.VideoCapture(args.camera_socket) 39 | cap.set(cv2.CAP_PROP_BUFFERSIZE, 1) 40 | else: 41 | raise Exception("You must specify either a camera index or a camera ip") 42 | assert cap.isOpened(), "Cannot open camera" 43 | 44 | ret, frame = cap.read() 45 | assert ret and frame.size > 0, "Cannot read camera" 46 | 47 | cap = camera_settings(cap) 48 | return cap 49 | 50 | def close_camera(cap: cv2.VideoCapture) -> None: 51 | assert cap is not None, "Camera is not opened" 52 | cap.release() 53 | cv2.destroyAllWindows() 54 | 55 | def get_camera_ip() -> None: 56 | ports = serial.tools.list_ports.comports() 57 | 58 | if not ports: 59 | print("No UART devices found.") 60 | return 61 | 62 | print("Available UART devices:") 63 | for port, desc, hwid in sorted(ports): 64 | print(f"{port}: {desc} ({hwid})") 65 | 66 | ip = None 67 | port = sorted([port for port in ports if "USB" in port[2]])[0][0] 68 | device = serial.Serial(port, 69 | baudrate=115200, 70 | bytesize=serial.EIGHTBITS, 71 | parity=serial.PARITY_NONE, 72 | stopbits=serial.STOPBITS_ONE, 73 | timeout=1, 74 | xonxoff=False, 75 | rtscts=False 76 | ) 77 | 78 | try: 79 | device.write(b"getIp\n") 80 | ip = device.readline().decode().strip() 81 | print(f"IP received from microcontroller: {ip}") 82 | finally: 83 | device.close() 84 | 85 | assert ip is not None, "could not get camera ip" 86 | return ip -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/src/detectors.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | import imutils 4 | import sklearn 5 | from skimage.feature import hog 6 | from skimage import color 7 | from skimage.transform import pyramid_gaussian 8 | 9 | from utils import non_max_suppression 10 | 11 | def hog_detect(hog, frame:np.ndarray, win_stride: tuple=(4,4), padding: tuple=(8,8), scale: float=1.55, useMeanshiftGrouping: bool=False): 12 | boxes, weights = hog.detectMultiScale(frame, winStride=win_stride, padding=padding, scale=scale, useMeanshiftGrouping=False) 13 | boxes = np.array([[x, y, x + w, y + h] for (x, y, w, h) in boxes]) 14 | boxes, weights = non_max_suppression(boxes, weights, overlapThresh=0.25) 15 | 16 | return zip(boxes, weights) 17 | 18 | def sliding_window(image, window_size, step_size): 19 | for y in range(0, image.shape[0], step_size[1]): 20 | for x in range(0, image.shape[1], step_size[0]): 21 | yield (x, y, image[y: y + window_size[1], x: x + window_size[0]]) 22 | 23 | def svm_detect_hog(frame:np.ndarray, model, overlap_threshold: float=0.4, size: tuple=(64, 128), step_size=(32, 32), downscale: float=1.25): 24 | detections = [] 25 | scale = 0 26 | 27 | for im_scaled in pyramid_gaussian(frame, downscale = downscale): 28 | #The list contains detections at the current scale 29 | if im_scaled.shape[0] < size[1] or im_scaled.shape[1] < size[0]: 30 | break 31 | for (x, y, window) in sliding_window(im_scaled, size, step_size): 32 | if window.shape[0] != size[1] or window.shape[1] != size[0]: 33 | continue 34 | 35 | if len(window.shape) > 2: 36 | window = color.rgb2gray(window) 37 | fd = hog(window, orientations=9, pixels_per_cell=(8,8), visualize=False, cells_per_block=(3,3)) 38 | fd = fd.reshape(1, -1) 39 | pred = model.predict(fd) 40 | 41 | if pred == 1: 42 | 43 | if model.decision_function(fd) > 0.5: 44 | detections.append((int(x * (downscale**scale)), int(y * (downscale**scale)), model.decision_function(fd), 45 | int(size[0] * (downscale**scale)), 46 | int(size[1] * (downscale**scale)))) 47 | scale += 1 48 | 49 | boxes = np.array([[x, y, x + w, y + h] for (x, y, _, w, h) in detections]) 50 | scores = np.array([score[0] for (x, y, score, w, h) in detections]) 51 | boxes, scores = non_max_suppression(boxes, scores, overlapThresh=overlap_threshold) 52 | 53 | return zip(boxes, scores) -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/src/main.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import cv2 3 | import time 4 | import joblib 5 | import numpy as np 6 | 7 | from camera import open_camera, close_camera, set_esp32camera, get_camera_ip 8 | from detectors import hog_detect, svm_detect_hog 9 | from utils import create_gaborfilter, apply_filter 10 | 11 | 12 | def grad_frame(frame: np.ndarray) -> np.ndarray: 13 | gradx = cv2.Sobel(frame, cv2.CV_32F ,1, 0, ksize=3) 14 | grady = cv2.Sobel(frame, cv2.CV_32F ,0, 1, ksize=3) 15 | # compute the magnitude and angle of the gradients 16 | norm, angle = cv2.cartToPolar(gradx, grady, angleInDegrees=True) 17 | return norm, angle 18 | 19 | def process_camera(args: argparse.Namespace) -> None: 20 | cv2.startWindowThread() 21 | 22 | cap = open_camera(args) 23 | 24 | hog = cv2.HOGDescriptor(_winSize=(64,128), _blockSize=(16,16), _blockStride=(8,8), _cellSize=(8,8), _nbins=9) 25 | hog.setSVMDetector(cv2.HOGDescriptor_getDefaultPeopleDetector()) 26 | clahe = cv2.createCLAHE(clipLimit=8.0, tileGridSize=(8,8)) 27 | 28 | model = joblib.load('models/models.dat') 29 | gabor = create_gaborfilter() 30 | while True: 31 | fps_start_time = time.time() 32 | ret, frame = cap.read() 33 | frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 34 | 35 | alpha = 0.2 36 | blur = cv2.bilateralFilter(frame,9,75,75) 37 | frame = cv2.addWeighted(frame, alpha, blur, (1.0 - alpha), 0.0) 38 | frame = apply_filter(frame, gabor) 39 | 40 | 41 | if ret and frame.size > 0: 42 | detections = hog_detect(hog, frame) 43 | # detections = svm_detect_hog(frame, model) 44 | 45 | for (x0, y0, x1, y1), score in detections: 46 | if score > 0.55: 47 | cv2.rectangle(frame, (x0, y0), (x1, y1), (0, 255, 0), 2) 48 | 49 | frame = cv2.putText(frame, f"FPS: {1/(time.time() - fps_start_time):.2f}", (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 0, 255), 2, cv2.LINE_AA) 50 | 51 | norm, angle = grad_frame(frame.copy()) 52 | frame = np.concatenate((frame, norm.astype(np.uint8), angle.astype(np.uint8)), axis=1) 53 | cv2.imshow("Original", frame) 54 | 55 | else: 56 | raise Exception("Unexpected error occured while reading the camera") 57 | 58 | if cv2.waitKey(1) & 0xFF == ord("q"): 59 | break 60 | 61 | close_camera(cap) 62 | 63 | 64 | def main(args: argparse.Namespace): 65 | if args.camera_socket is None and args.camera_index is None: 66 | ip = get_camera_ip() 67 | args.camera_socket = "http://" + ip 68 | set_esp32camera(socket) 69 | args.camera_socket += ":81/stream" 70 | print(f"Camera socket: {args.camera_socket}") 71 | 72 | elif args.camera_socket: 73 | set_esp32camera(args.camera_socket) 74 | args.camera_socket += ":81/stream" 75 | print(f"Camera socket: {args.camera_socket}") 76 | 77 | process_camera(args) 78 | 79 | 80 | if __name__ == "__main__": 81 | parser = argparse.ArgumentParser() 82 | parser.add_argument("--camera-index", type=int, default=None, help="Index of the camera to use") 83 | parser.add_argument("--camera-socket", type=str, default=None, help="socket of the camera to use") 84 | parser.add_argument("--get-camera-ip", action="store_true", help="True if you want to get the camera ip") 85 | 86 | args = parser.parse_args() 87 | 88 | main(args) -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/src/models/models.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/ESP32/cf845d689eaf849d9cd3e2c0179996a4783215cb/ESP32CAM_HOG_OPENCV/src/models/models.dat -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/src/requirements/requirements.txt: -------------------------------------------------------------------------------- 1 | joblib==1.3.2 2 | numpy==1.26.2 3 | opencv-contrib-python==4.9.0.80 4 | pandas==2.1.4 5 | pyserial==3.5 6 | python-dateutil==2.8.2 7 | pytz==2023.3.post1 8 | scikit-learn==1.3.2 9 | scipy==1.11.4 10 | six==1.16.0 11 | threadpoolctl==3.2.0 12 | tzdata==2023.4 13 | requests==2.31.0 14 | -------------------------------------------------------------------------------- /ESP32CAM_HOG_OPENCV/src/utils.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import cv2 3 | 4 | def non_max_suppression(boxes: np.ndarray, weights:np.ndarray, overlapThresh: float = 0.4) -> np.ndarray: 5 | if len(boxes) == 0: 6 | return [], [] 7 | 8 | # Initialize the list of picked indices 9 | pick = [] 10 | 11 | # Grab the coordinates of the bounding boxes 12 | x0 = boxes[:, 0] 13 | y0 = boxes[:, 1] 14 | x1 = boxes[:, 2] 15 | y1 = boxes[:, 3] 16 | 17 | # Compute the area of the bounding boxes 18 | area = (x1 - x0 + 1) * (y1 - y0 + 1) 19 | 20 | # Sort the bounding boxes by their bottom-right y-coordinate 21 | idxs = np.argsort(y1) 22 | 23 | # Keep looping while some indices still remain in the indexes list 24 | while len(idxs) > 0: 25 | # Grab the last index in the indexes list and add the index value to the list of picked indices 26 | last = len(idxs) - 1 27 | i = idxs[last] 28 | pick.append(i) 29 | 30 | # Find the largest (x, y) coordinates for the start of the bounding box and the smallest (x, y) coordinates for the end of the bounding box 31 | xx0 = np.maximum(x0[i], x0[idxs[:last]]) 32 | yy0 = np.maximum(y0[i], y0[idxs[:last]]) 33 | xx1 = np.minimum(x1[i], x1[idxs[:last]]) 34 | yy1 = np.minimum(y1[i], y1[idxs[:last]]) 35 | 36 | # Compute the width and height of the bounding box 37 | w = np.maximum(0, xx1 - xx0 + 1) 38 | h = np.maximum(0, yy1 - yy0 + 1) 39 | 40 | # Compute the ratio of overlap 41 | overlap = (w * h) / area[idxs[:last]] 42 | 43 | # Delete all indexes from the index list that have overlap greater than the specified threshold 44 | idxs = np.delete(idxs, np.concatenate(([last], np.where(overlap > overlapThresh)[0]))) 45 | 46 | # Return only the bounding boxes that were picked 47 | return boxes[pick], weights[pick] 48 | 49 | def create_gaborfilter(): 50 | # This function is designed to produce a set of GaborFilters 51 | # an even distribution of theta values equally distributed amongst pi rad / 180 degree 52 | 53 | filters = [] 54 | num_filters = 16 # Number of filters to create 55 | ksize = 3 # The local area to evaluate 56 | sigma = 5.0 # Larger Values produce more edges 57 | lambd = 10.0 # Wavelength - Higher values produce more edges 58 | gamma = 0.8 # Values closer to 1 produce stronger components 59 | psi = 0.2 # Offset value - lower generates cleaner results 60 | for theta in np.arange(0, np.pi, np.pi / num_filters): # Theta is the orientation for edge detection 61 | kern = cv2.getGaborKernel((ksize, ksize), sigma, theta, lambd, gamma, psi, ktype=cv2.CV_64F) 62 | kern /= 1.0 * kern.sum() # Brightness normalization 63 | filters.append(kern) 64 | return filters 65 | 66 | def apply_filter(img, filters): 67 | # This general function is designed to apply filters to our image 68 | 69 | # First create a numpy array the same size as our input image 70 | newimage = np.zeros_like(img) 71 | 72 | # Starting with a blank image, we loop through the images and apply our Gabor Filter 73 | # On each iteration, we take the highest value (super impose), until we have the max value across all filters 74 | # The final image is returned 75 | depth = -1 # remain depth same as original image 76 | 77 | for kern in filters: # Loop through the kernels in our GaborFilter 78 | image_filter = cv2.filter2D(img, depth, kern) #Apply filter to image 79 | 80 | # Using Numpy.maximum to compare our filter and cumulative image, taking the higher value (max) 81 | np.maximum(newimage, image_filter, newimage) 82 | return newimage -------------------------------------------------------------------------------- /ESP32_AM2301/AM2301_ESP32.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define DHTPIN 14 4 | #define DHTTYPE AM2301 5 | 6 | DHT dht(DHTPIN, DHTTYPE); 7 | 8 | float temp = 0.0; 9 | float hum = 0.0; 10 | 11 | void setup() { 12 | Serial.begin(9600); 13 | dht.begin(); 14 | 15 | } 16 | 17 | void loop() { 18 | hum = dht.readHumidity(); 19 | temp = dht.readTemperature(); 20 | 21 | Serial.print("Temperature: ");Serial.print(temp);Serial.print("°C"); 22 | Serial.print("; Humidity: ");Serial.print(hum);Serial.println("%"); 23 | delay(1000); 24 | } 25 | -------------------------------------------------------------------------------- /ESP32_AM2301/debug.cfg: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-or-later 2 | # 3 | # Example OpenOCD configuration file for ESP32 connected via ESP USB Bridge board 4 | # 5 | # For example, OpenOCD can be started for ESP32 debugging on 6 | # 7 | # openocd -f board/esp32-bridge.cfg 8 | # 9 | 10 | # Source the JTAG interface configuration file 11 | source [find interface/esp_usb_bridge.cfg] 12 | # ESP32 chip id defined in the idf esp_chip_model_t 13 | espusbjtag chip_id 1 14 | # Source the ESP32 configuration file 15 | source [find target/esp32.cfg] 16 | -------------------------------------------------------------------------------- /ESP32_AM2301/debug_custom.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"Arduino on ESP32", 3 | "toolchainPrefix":"xtensa-esp32-elf", 4 | "svdFile":"esp32.svd", 5 | "request":"attach", 6 | "postAttachCommands":[ 7 | "set remote hardware-watchpoint-limit 2", 8 | "monitor reset halt", 9 | "monitor gdb_sync", 10 | "thb setup", 11 | "c" 12 | ], 13 | "overrideRestartCommands":[ 14 | "monitor reset halt", 15 | "monitor gdb_sync", 16 | "thb setup", 17 | "c" 18 | ] 19 | } -------------------------------------------------------------------------------- /ESP32_AMPLIFIER/SPEAKER_SD/SPEAKER_SD.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/ESP32/cf845d689eaf849d9cd3e2c0179996a4783215cb/ESP32_AMPLIFIER/SPEAKER_SD/SPEAKER_SD.fzz -------------------------------------------------------------------------------- /ESP32_AMPLIFIER/SPEAKER_SD/SPEAKER_SD.ino: -------------------------------------------------------------------------------- 1 | /* 2 | * Datasheet: https://np.micro-semiconductor.hk/datasheet/af-HW04505200J0G.pdf 3 | * Copyright (C) Dott. Daniel Rossi 4 | * 5 | */ 6 | 7 | #include "Audio.h" //https://github.com/schreibfaul1/ESP32-audioI2S 8 | #include 9 | #include "SD.h" 10 | #include "FS.h" // File system wrapper 11 | 12 | #define SD_CS 5 13 | #define SPI_MOSI 23 14 | #define SPI_MISO 19 15 | #define SPI_SCK 18 16 | #define I2S_DOUT 25 17 | #define I2S_BCLK 27 18 | #define I2S_LRC 26 19 | 20 | 21 | Audio audio; 22 | 23 | void setup() { 24 | pinMode(SD_CS, OUTPUT); 25 | digitalWrite(SD_CS, HIGH); 26 | SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI); 27 | Serial.begin(115200); 28 | 29 | if (!SD.begin(SD_CS)) { 30 | Serial.println("initialization failed. You should ckeck:"); 31 | Serial.println(" - SD card wiring (MISO, MOSI, SCLK) on your board's datasheet"); 32 | Serial.println(" - CS pin wiring and Pin declared in code"); 33 | Serial.println(" - if SD card has been inserted"); 34 | while (1); 35 | } 36 | 37 | audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT); 38 | audio.setVolume(15); // 0...21 39 | audio.connecttoFS(SD, "musica1.mp3"); 40 | } 41 | 42 | void printDirectory(File dir) { 43 | while (true) { 44 | File entry = dir.openNextFile(); 45 | if (!entry) { 46 | break; 47 | } 48 | 49 | Serial.println(entry.name()); 50 | 51 | if (entry.isDirectory()) { 52 | Serial.println("/"); 53 | printDirectory(entry); 54 | } 55 | entry.close(); 56 | } 57 | } 58 | 59 | void loop() { 60 | audio.loop(); 61 | if (Serial.available()) { 62 | audio.stopSong(); 63 | 64 | Serial.println(""); 65 | String r = Serial.readString(); 66 | r.trim(); 67 | char *buff = (char *) calloc(r.length() + 1, sizeof(char)); 68 | r.toCharArray(buff, r.length() + 1); 69 | 70 | File root = SD.open("/"); 71 | printDirectory(root); 72 | 73 | Serial.print("PLAYING: "); 74 | Serial.print(r); 75 | Serial.println(""); 76 | Serial.println(""); 77 | audio.connecttoFS(SD, buff); 78 | log_i("free heap=%i", ESP.getFreeHeap()); 79 | } 80 | } 81 | 82 | // PRINT ON SERIAL MONITOR ABOUT MUSIC TRACK 83 | void audio_info(const char *info) { 84 | Serial.print("info "); Serial.println(info); 85 | } 86 | void audio_id3data(const char *info) { //id3 metadata 87 | Serial.print("id3data "); Serial.println(info); 88 | } 89 | void audio_eof_mp3(const char *info) { //end of file 90 | Serial.print("eof_mp3 "); Serial.println(info); 91 | } 92 | void audio_showstation(const char *info) { 93 | Serial.print("station "); Serial.println(info); 94 | } 95 | void audio_showstreaminfo(const char *info) { 96 | Serial.print("streaminfo "); Serial.println(info); 97 | } 98 | void audio_showstreamtitle(const char *info) { 99 | Serial.print("streamtitle "); Serial.println(info); 100 | } 101 | void audio_bitrate(const char *info) { 102 | Serial.print("bitrate "); Serial.println(info); 103 | } 104 | void audio_commercial(const char *info) { //duration in sec 105 | Serial.print("commercial "); Serial.println(info); 106 | } 107 | void audio_icyurl(const char *info) { //homepage 108 | Serial.print("icyurl "); Serial.println(info); 109 | } 110 | void audio_lasthost(const char *info) { //stream URL played 111 | Serial.print("lasthost "); Serial.println(info); 112 | } 113 | void audio_eof_speech(const char *info) { 114 | Serial.print("eof_speech "); Serial.println(info); 115 | } 116 | -------------------------------------------------------------------------------- /ESP32_AMPLIFIER/SPEAKER_SD/SPEAKER_SD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/ESP32/cf845d689eaf849d9cd3e2c0179996a4783215cb/ESP32_AMPLIFIER/SPEAKER_SD/SPEAKER_SD.png -------------------------------------------------------------------------------- /ESP32_CAM_PYTHON_STREAM_OPENCV/ESP32_CAM_PYTHON_STREAM_OPENCV.py: -------------------------------------------------------------------------------- 1 | import cv2 2 | import numpy as np 3 | 4 | import requests 5 | 6 | ''' 7 | INFO SECTION 8 | - if you want to monitor raw parameters of ESP32CAM, open the browser and go to http://192.168.x.x/status 9 | - command can be sent through an HTTP get composed in the following way http://192.168.x.x/control?var=VARIABLE_NAME&val=VALUE (check varname and value in status) 10 | ''' 11 | 12 | # ESP32 URL 13 | URL = "insert here the Esp-cam URL, eg. http://192.168.1.1" 14 | AWB = True 15 | 16 | # Face recognition and opencv setup 17 | cap = cv2.VideoCapture(URL + ":81/stream") 18 | face_classifier = cv2.CascadeClassifier('haarcascade_frontalface_alt.xml') # insert the full path to haarcascade file if you encounter any problem 19 | 20 | def set_resolution(url: str, index: int=1, verbose: bool=False): 21 | try: 22 | if verbose: 23 | resolutions = "10: UXGA(1600x1200)\n9: SXGA(1280x1024)\n8: XGA(1024x768)\n7: SVGA(800x600)\n6: VGA(640x480)\n5: CIF(400x296)\n4: QVGA(320x240)\n3: HQVGA(240x176)\n0: QQVGA(160x120)" 24 | print("available resolutions\n{}".format(resolutions)) 25 | 26 | if index in [10, 9, 8, 7, 6, 5, 4, 3, 0]: 27 | requests.get(url + "/control?var=framesize&val={}".format(index)) 28 | else: 29 | print("Wrong index") 30 | except: 31 | print("SET_RESOLUTION: something went wrong") 32 | 33 | def set_quality(url: str, value: int=1, verbose: bool=False): 34 | try: 35 | if value >= 10 and value <=63: 36 | requests.get(url + "/control?var=quality&val={}".format(value)) 37 | except: 38 | print("SET_QUALITY: something went wrong") 39 | 40 | def set_awb(url: str, awb: int=1): 41 | try: 42 | awb = not awb 43 | requests.get(url + "/control?var=awb&val={}".format(1 if awb else 0)) 44 | except: 45 | print("SET_QUALITY: something went wrong") 46 | return awb 47 | 48 | if __name__ == '__main__': 49 | set_resolution(URL, index=8) 50 | 51 | while True: 52 | if cap.isOpened(): 53 | ret, frame = cap.read() 54 | 55 | if ret: 56 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 57 | gray = cv2.equalizeHist(gray) 58 | 59 | faces = face_classifier.detectMultiScale(gray) 60 | for (x, y, w, h) in faces: 61 | center = (x + w//2, y + h//2) 62 | frame = cv2.rectangle(frame, (x, y), (x + w, y + h), (255, 255, 0), 4) 63 | 64 | cv2.imshow("frame", frame) 65 | 66 | key = cv2.waitKey(1) 67 | 68 | if key == ord('r'): 69 | idx = int(input("Select resolution index: ")) 70 | set_resolution(URL, index=idx, verbose=True) 71 | 72 | elif key == ord('q'): 73 | val = int(input("Set quality (10 - 63): ")) 74 | set_quality(URL, value=val) 75 | 76 | elif key == ord('a'): 77 | AWB = set_awb(URL, AWB) 78 | 79 | elif key == 27: 80 | break 81 | 82 | cv2.destroyAllWindows() 83 | cap.release() -------------------------------------------------------------------------------- /ESP32_FIREBASE_SERVICES/ESP32_FIREBASE_SERVICES.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #define FIREBASE_HOST "" 5 | #define FIREBASE_AUTH "" 6 | 7 | #define WIFI_SSID "" 8 | #define WIFI_PASSWORD "" 9 | 10 | FirebaseData fData; 11 | FirebaseJson json; 12 | 13 | size_t updateTime = 0; 14 | 15 | void setup() { 16 | Serial.begin(115200); 17 | 18 | WiFi.begin(WIFI_SSID, WIFI_PASSWORD); 19 | size_t start_time = millis(); 20 | while (WiFi.status() != WL_CONNECTED) 21 | if (millis() - start_time > 500) { 22 | Serial.print("."); 23 | start_time = millis(); 24 | } 25 | 26 | Serial.println("Connessione"); 27 | Serial.println(); 28 | Serial.print("WiFi Connesso, indirizzo IP:"); 29 | Serial.println(WiFi.localIP()); 30 | Serial.println(); 31 | 32 | Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); 33 | Firebase.reconnectWiFi(true); 34 | Firebase.setReadTimeout(fData, 1000 * 60); 35 | Firebase.setwriteSizeLimit(fData, "tiny"); 36 | 37 | Serial.println(); 38 | Serial.println("-------------------------------------"); 39 | Serial.println("Fatto! WiFi connesso!"); 40 | updateTime = millis(); 41 | } 42 | 43 | void loop() { 44 | if (millis() - updateTime > 500) { 45 | int val1 = random(300); 46 | int val2 = random(300); 47 | Serial.print("Valore 1:"); 48 | Serial.print(val1); 49 | Serial.print(" - Valore 2:"); 50 | Serial.println(val2); 51 | json.set("/data1", val1); 52 | json.set("/data2", val2); 53 | Firebase.updateNode(fData, "/valore", json); 54 | updateTime = millis(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /ESP32_LAND_METER/ESP32_LAND_METER.ino: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "index.h" 7 | 8 | #define SWITCH 23 9 | #define MODE_MAX 7 10 | #define READ_DELAY 200 11 | #define UPDATE_DELAY 1 12 | #define DISPLAY_DELAY 50 13 | 14 | TinyGPSPlus gps; 15 | 16 | LiquidCrystal lcd(13, 12, 14, 27, 26, 25); 17 | 18 | short MODE = 0; 19 | unsigned long time_delay; 20 | unsigned long disp_time; 21 | 22 | double MOVE_X = 0.0; 23 | double MOVE_Y = 0.0; 24 | 25 | String X = "44.6283916"; 26 | String Y = "10.9497243"; 27 | String Z = "20z"; 28 | 29 | String ALT = "0.0m"; 30 | 31 | // WEB SERVER 32 | #define WIFI_MAX_WAIT 5000 33 | 34 | const char* ssid = ""; 35 | const char* password = ""; 36 | 37 | AsyncWebServer server(80); 38 | 39 | void notFound(AsyncWebServerRequest *request) { 40 | request->send(404, "text/plain", "Not found"); 41 | } 42 | 43 | void runserver() { 44 | server.on("/", HTTP_GET, [](AsyncWebServerRequest * request) { 45 | request->send_P(200, "text/html", home0_html); 46 | }); 47 | 48 | server.on("/getPos", HTTP_GET, [](AsyncWebServerRequest * request) { 49 | String pos = String("https://www.google.com/maps/d/u/0/embed?mid=1OWjIiXc7clGxGdbrHvjNOdY9ZLo&ll=" + X + "%2C" + Y + "&z=" + Z); 50 | request->send_P(200, "text/plane", pos.c_str()); 51 | }); 52 | 53 | server.on("/getLat", HTTP_GET, [](AsyncWebServerRequest * request) { 54 | request->send_P(200, "text/plane", X.c_str()); 55 | }); 56 | 57 | server.on("/getLon", HTTP_GET, [](AsyncWebServerRequest * request) { 58 | request->send_P(200, "text/plane", Y.c_str()); 59 | }); 60 | 61 | server.on("/getAlt", HTTP_GET, [](AsyncWebServerRequest * request) { 62 | request->send_P(200, "text/plane", ALT.c_str()); 63 | }); 64 | } 65 | 66 | /*GLOBAL VARIABLES */ 67 | unsigned long satellites = 0; 68 | double latitude = 0.0; 69 | double longitude = 0.0; 70 | double altitude = 0.0; 71 | double speed = 0.0; 72 | double course = 0.0; 73 | double hdop = 0.0; 74 | 75 | unsigned long satellites_age = 0; 76 | unsigned long location_age = 0; 77 | unsigned long course_age = 0; 78 | unsigned long altitude_age = 0; 79 | unsigned long hdop_age = 0; 80 | 81 | void setup() { 82 | Serial.begin(115200); 83 | Serial2.begin(9600, SERIAL_8N1, 16, 17, false); 84 | lcd.begin(16, 2); 85 | 86 | pinMode(SWITCH, INPUT); 87 | 88 | lcd.noAutoscroll(); 89 | lcd.noBlink(); 90 | lcd.noCursor(); 91 | 92 | lcd.clear(); 93 | delay(UPDATE_DELAY); 94 | lcd.home(); 95 | lcd.print("Land Meter"); 96 | lcd.setCursor(0, 1); 97 | lcd.print("By Dani"); 98 | delay(1500); 99 | 100 | WiFi.mode(WIFI_STA); 101 | Serial.print("Connecting to "); 102 | Serial.println(ssid); 103 | lcd.clear(); 104 | lcd.print("Connecting to"); 105 | lcd.setCursor(0, 1); 106 | lcd.print(ssid); 107 | 108 | WiFi.begin(ssid, password); 109 | unsigned long connect_time = millis(); 110 | while ((WiFi.status() != WL_CONNECTED) && (millis() - connect_time < WIFI_MAX_WAIT)) { 111 | delay(500); 112 | Serial.print("."); 113 | } 114 | 115 | lcd.clear(); 116 | if (WiFi.status() == WL_CONNECTED) { 117 | lcd.print("Connected:"); 118 | lcd.setCursor(0, 1); 119 | lcd.print(WiFi.localIP()); 120 | delay(1500); 121 | runserver(); 122 | server.onNotFound(notFound); 123 | server.begin(); 124 | } 125 | else { 126 | lcd.print("no connection"); 127 | delay(1500); 128 | } 129 | 130 | lcd.clear(); 131 | delay(UPDATE_DELAY); 132 | 133 | time_delay = millis(); 134 | disp_time = millis(); 135 | Serial.println("Started!"); 136 | } 137 | 138 | void lcd_print(const String str1, const String str2) { 139 | lcd.home(); 140 | lcd.print(str1); 141 | delay(UPDATE_DELAY); 142 | lcd.setCursor(0, 1); 143 | lcd.print(str2); 144 | delay(UPDATE_DELAY); 145 | } 146 | 147 | void loop() { 148 | while (Serial2.available()) { 149 | Serial.println("Data"); 150 | gps.encode(Serial2.read()); 151 | } 152 | 153 | if (millis() - disp_time > DISPLAY_DELAY) { 154 | 155 | // UPDATE GPS VALS 156 | if (gps.satellites.isUpdated()) { // SATELLITES 157 | satellites_age = gps.satellites.age(); 158 | satellites = gps.satellites.value(); 159 | } 160 | 161 | if (gps.location.isUpdated()) { // LOCATION 162 | latitude = gps.location.lat(); 163 | longitude = gps.location.lng(); 164 | location_age = gps.location.age(); 165 | 166 | X = String(latitude + MOVE_X, 8); 167 | Y = String(longitude + MOVE_Y, 8); 168 | } 169 | 170 | if (gps.altitude.isUpdated()) { // ALTITUDE 171 | altitude_age = gps.altitude.age(); 172 | altitude = gps.altitude.meters(); 173 | ALT = String(altitude, 2) + "m"; 174 | } 175 | 176 | if (gps.speed.isUpdated()) // SPEED 177 | speed = gps.speed.mps(); 178 | 179 | 180 | if (gps.course.isUpdated()) { // COURSE 181 | course = gps.course.deg(); 182 | course_age = gps.course.age(); 183 | } 184 | 185 | if (gps.hdop.isUpdated()) { // HDOP 186 | hdop_age = gps.hdop.age(); 187 | hdop = gps.hdop.hdop(); 188 | } 189 | 190 | // BUTTON CONTROL 191 | if (MODE == 0) 192 | lcd_print((String)"SATs [" + satellites_age + "ms] ", (String)satellites); 193 | 194 | else if (MODE == 1) { 195 | lcd.home(); 196 | lcd.print(String(latitude + MOVE_X, 7)); 197 | delay(UPDATE_DELAY); 198 | lcd.setCursor(0, 1); 199 | lcd.print(String(longitude + MOVE_Y, 7)); 200 | delay(UPDATE_DELAY); 201 | } 202 | 203 | else if (MODE == 2) { 204 | lcd.home(); 205 | lcd.print((String)"LAT [" + location_age + "ms] "); 206 | delay(UPDATE_DELAY); 207 | lcd.setCursor(0, 1); 208 | lcd.print(String(latitude + MOVE_X, 7)); 209 | delay(UPDATE_DELAY); 210 | } 211 | 212 | else if (MODE == 3) { 213 | lcd.home(); 214 | lcd.print((String)"LON [" + location_age + "ms] "); 215 | delay(UPDATE_DELAY); 216 | lcd.setCursor(0, 1); 217 | lcd.print(String(longitude + MOVE_Y, 7)); 218 | delay(UPDATE_DELAY); 219 | } 220 | 221 | else if (MODE == 4) { 222 | lcd.home(); 223 | lcd.print((String)"SPEED [" + location_age + "ms] "); 224 | delay(UPDATE_DELAY); 225 | lcd.setCursor(0, 1); 226 | lcd.print(String(speed, 2) + "m/s"); 227 | delay(UPDATE_DELAY); 228 | } 229 | 230 | else if (MODE == 5) { 231 | lcd_print((String)"COURSE [" + course_age + "ms] ", String(course, 4)); 232 | } 233 | 234 | else if (MODE == 6) { 235 | lcd_print((String)"ALT [" + altitude_age + "ms] ", String(altitude, 2) + "m"); 236 | } 237 | 238 | else if (MODE == 7) { 239 | lcd_print((String)"HDOP [" + hdop_age + "ms] ", String(hdop, 4)); 240 | } 241 | 242 | else if (gps.charsProcessed() < 10) 243 | Serial.println("WARNING: No GPS data. Check wiring."); 244 | disp_time = millis(); 245 | } 246 | 247 | if (millis() - time_delay > READ_DELAY) { 248 | if (digitalRead(SWITCH)) { 249 | if (MODE < MODE_MAX) 250 | ++MODE; 251 | else 252 | MODE = 0; 253 | lcd.clear(); 254 | lcd.noCursor(); 255 | 256 | time_delay = millis(); 257 | delay(UPDATE_DELAY); 258 | } 259 | } 260 | } 261 | -------------------------------------------------------------------------------- /ESP32_LAND_METER/GPS.FCStd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/ESP32/cf845d689eaf849d9cd3e2c0179996a4783215cb/ESP32_LAND_METER/GPS.FCStd -------------------------------------------------------------------------------- /ESP32_LAND_METER/GPS.FCStd1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/ESP32/cf845d689eaf849d9cd3e2c0179996a4783215cb/ESP32_LAND_METER/GPS.FCStd1 -------------------------------------------------------------------------------- /ESP32_LAND_METER/index.h: -------------------------------------------------------------------------------- 1 | #ifndef INDEX_H_ 2 | #define INDEX_H_ 3 | 4 | const char home0_html[] PROGMEM = R"rawliteral( 5 | 6 | 7 | 8 | 9 | 10 | Land Meter by Dani 11 | 12 | 13 | 15 | 16 | 17 |

Land Meter

18 |

By Dani

19 | 20 |
21 |

LAT: 22 |

LON: 23 |

ALT: 24 | 25 |

26 | 28 |
29 |
30 | 31 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | )rawliteral"; 90 | 91 | #endif // INDEX_H_ 92 | -------------------------------------------------------------------------------- /ESP32_MQ135/MQ135_ESP32.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define MQ135PIN 34 4 | #define R0_PRECISION 100 5 | #define RatioMQ135CleanAir 3.6//RS / R0 = 3.6 ppm 6 | 7 | //Declare Sensor 8 | MQUnifiedsensor MQ135("ESP32", 5, 12, MQ135PIN, "MQ-135"); 9 | 10 | void setup() { 11 | Serial.begin(9600); 12 | MQ135.setRegressionMethod(1); //_PPM = a*ratio^b 13 | MQ135.init(); 14 | 15 | /* 16 | //If the RL value is different from 10K please assign your RL value with the following method: 17 | MQ135.setRL(10); 18 | */ 19 | 20 | /***************************** MQ CAlibration ********************************************/ 21 | // Explanation: 22 | // In this routine the sensor will measure the resistance of the sensor supposedly before being pre-heated 23 | // and on clean air (Calibration conditions), setting up R0 value. 24 | // We recomend executing this routine only on setup in laboratory conditions. 25 | // This routine does not need to be executed on each restart, you can load your R0 value from eeprom. 26 | 27 | Serial.print("Calibrating please wait ..."); 28 | float calcR0 = 0; 29 | for (int i = 1; i <= R0_PRECISION; i ++) 30 | { 31 | MQ135.update(); // Update data, read the voltage from the analog pin 32 | calcR0 += MQ135.calibrate(RatioMQ135CleanAir); 33 | Serial.print("."); 34 | } 35 | MQ135.setR0(calcR0 / R0_PRECISION); 36 | Serial.println(" done!"); 37 | 38 | if (isinf(calcR0)) { 39 | Serial.println("Warning: Conection issue, R0 is infinite (Open circuit detected) please check your wiring and supply"); 40 | while (1); 41 | } 42 | if (calcR0 == 0) { 43 | Serial.println("Warning: Conection issue found, R0 is zero (Analog pin shorts to ground) please check your wiring and supply"); 44 | while (1); 45 | } 46 | 47 | /***************************** MQ CAlibration ********************************************/ 48 | Serial.println("** Values from MQ-135 ****"); 49 | Serial.println("| CO | Alcohol | CO2 | Toluen | NH4 | Aceton |"); 50 | } 51 | 52 | void loop() { 53 | MQ135.update(); // Update data, read the voltage from the analog pin 54 | 55 | MQ135.setA(605.18); MQ135.setB(-3.937); // Configure the equation to calculate CO concentration value 56 | float CO = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup 57 | 58 | MQ135.setA(77.255); MQ135.setB(-3.18); //Configure the equation to calculate Alcohol concentration value 59 | float Alcohol = MQ135.readSensor(); // SSensor will read PPM concentration using the model, a and b values set previously or from the setup 60 | 61 | MQ135.setA(110.47); MQ135.setB(-2.862); // Configure the equation to calculate CO2 concentration value 62 | float CO2 = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup 63 | 64 | MQ135.setA(44.947); MQ135.setB(-3.445); // Configure the equation to calculate Toluen concentration value 65 | float Toluen = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup 66 | 67 | MQ135.setA(102.2 ); MQ135.setB(-2.473); // Configure the equation to calculate NH4 concentration value 68 | float NH4 = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup 69 | 70 | MQ135.setA(34.668); MQ135.setB(-3.369); // Configure the equation to calculate Aceton concentration value 71 | float Aceton = MQ135.readSensor(); // Sensor will read PPM concentration using the model, a and b values set previously or from the setup 72 | Serial.print("| "); Serial.print(CO); 73 | Serial.print(" | "); Serial.print(Alcohol); 74 | 75 | Serial.print(" | "); Serial.print(CO2 + 400); // 400ppm offset due to current pollution 76 | Serial.print(" | "); Serial.print(Toluen); 77 | Serial.print(" | "); Serial.print(NH4); 78 | Serial.print(" | "); Serial.print(Aceton); 79 | Serial.println(" |"); 80 | 81 | /* 82 | Exponential regression: 83 | GAS | a | b 84 | CO | 605.18 | -3.937 85 | Alcohol | 77.255 | -3.18 86 | CO2 | 110.47 | -2.862 87 | Toluen | 44.947 | -3.445 88 | NH4 | 102.2 | -2.473 89 | Aceton | 34.668 | -3.369 90 | */ 91 | 92 | delay(500); //Sampling frequency 93 | } 94 | -------------------------------------------------------------------------------- /ESP32_MQ135/debug.cfg: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: GPL-2.0-or-later 2 | # 3 | # Example OpenOCD configuration file for ESP32 connected via ESP USB Bridge board 4 | # 5 | # For example, OpenOCD can be started for ESP32 debugging on 6 | # 7 | # openocd -f board/esp32-bridge.cfg 8 | # 9 | 10 | # Source the JTAG interface configuration file 11 | source [find interface/esp_usb_bridge.cfg] 12 | # ESP32 chip id defined in the idf esp_chip_model_t 13 | espusbjtag chip_id 1 14 | # Source the ESP32 configuration file 15 | source [find target/esp32.cfg] 16 | -------------------------------------------------------------------------------- /ESP32_MQ135/debug_custom.json: -------------------------------------------------------------------------------- 1 | { 2 | "name":"Arduino on ESP32", 3 | "toolchainPrefix":"xtensa-esp32-elf", 4 | "svdFile":"esp32.svd", 5 | "request":"attach", 6 | "postAttachCommands":[ 7 | "set remote hardware-watchpoint-limit 2", 8 | "monitor reset halt", 9 | "monitor gdb_sync", 10 | "thb setup", 11 | "c" 12 | ], 13 | "overrideRestartCommands":[ 14 | "monitor reset halt", 15 | "monitor gdb_sync", 16 | "thb setup", 17 | "c" 18 | ] 19 | } -------------------------------------------------------------------------------- /ESP32_WEB_SERVER/ESP32 Web Server_bb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ProjectoOfficial/ESP32/cf845d689eaf849d9cd3e2c0179996a4783215cb/ESP32_WEB_SERVER/ESP32 Web Server_bb.png -------------------------------------------------------------------------------- /ESP32_WEB_SERVER/ESP32_WEB_SERVER.ino: -------------------------------------------------------------------------------- 1 | /* 2 | ESP32 WEB SERVER 3 | 4 | This sketch provides an example of creating a Web Server with ESP32 devices. 5 | It allow to control a pair of led through two respective buttons on a web page. 6 | An LM35 make it possible to monitor the temperature, which is showed too on the web page. 7 | 8 | As a style source for HTML, Bootstrap is used. 9 | 10 | The circuit: 11 | - LED1: GPIO26 12 | - LED2: GPIO27 13 | - LM35: GPIO33 14 | 15 | Created 27/08/2021 16 | By Dott. Daniel Rossi 17 | Copyright: ESP32 WEB SERVER © 2021 - GPLv3 18 | 19 | YOUTUBE: Https://youtube.com/c/ProjectoOfficial 20 | COLLABORATION E-MAIL: miniprojectsofficial@gmail.com 21 | */ 22 | 23 | #include 24 | 25 | #define LED1 26 26 | #define LED2 27 27 | #define LM35 33 28 | #define CONNECT_TIME 10000 29 | #define TIMEOUTTIME 5000 30 | 31 | const char* ssid = ""; 32 | const char* password = ""; 33 | WiFiServer server(80); 34 | 35 | String header; 36 | String LED1State = "off"; 37 | String LED2State = "off"; 38 | 39 | size_t currentTime = millis(); 40 | size_t previousTime = 0; 41 | 42 | void setup() { 43 | Serial.begin(115200); 44 | pinMode(LED1, OUTPUT); 45 | pinMode(LED2, OUTPUT); 46 | pinMode(LM35, INPUT); 47 | digitalWrite(LED1, LOW); 48 | digitalWrite(LED2, LOW); 49 | 50 | Serial.print("Attempting to connect to "); 51 | Serial.println(ssid); 52 | WiFi.begin(ssid, password); 53 | 54 | size_t start_time = millis(); 55 | size_t dot_time = millis(); 56 | while ((WiFi.status() != WL_CONNECTED) && (start_time + CONNECT_TIME) > millis()) { 57 | if (dot_time + 250 < millis()) { 58 | Serial.print("."); 59 | dot_time = millis(); 60 | } 61 | } 62 | if (WiFi.status() != WL_CONNECTED){ 63 | Serial.println("Connection failed"); 64 | while (1); 65 | } 66 | Serial.println(""); 67 | Serial.println("WiFi connected."); 68 | Serial.println("ESP32 IP address: "); 69 | Serial.println(WiFi.localIP()); 70 | server.begin(); 71 | } 72 | 73 | void loop() { 74 | WiFiClient client = server.available(); 75 | if (client) { 76 | currentTime = millis(); 77 | previousTime = currentTime; 78 | Serial.println("New Client."); 79 | String currentLine = ""; 80 | 81 | while (client.connected() && currentTime - previousTime <= TIMEOUTTIME) { 82 | currentTime = millis(); 83 | if (client.available()) { 84 | char c = client.read(); 85 | Serial.write(c); 86 | header += c; 87 | 88 | if (c == '\n') { 89 | if (currentLine.length() == 0) { 90 | client.println("HTTP/1.1 200 OK"); 91 | client.println("Content-type:text/html"); 92 | client.println("Connection: close"); 93 | client.println(); 94 | 95 | if (header.indexOf("GET /LED1/on") >= 0) { 96 | Serial.println("LED 1 on"); 97 | LED1State = "on"; 98 | digitalWrite(LED1, HIGH); 99 | } else if (header.indexOf("GET /LED1/off") >= 0) { 100 | Serial.println("LED1 off"); 101 | LED1State = "off"; 102 | digitalWrite(LED1, LOW); 103 | } else if (header.indexOf("GET /LED2/on") >= 0) { 104 | Serial.println("LED2 on"); 105 | LED2State = "on"; 106 | digitalWrite(LED2, HIGH); 107 | } else if (header.indexOf("GET /LED2/off") >= 0) { 108 | Serial.println("LED2 off"); 109 | LED2State = "off"; 110 | digitalWrite(LED2, LOW); 111 | } 112 | client.println(""); 113 | client.println(""); 114 | client.println(""); 115 | client.println(""); 116 | client.println(""); 117 | client.println(""); 118 | client.println(""); 119 | 120 | client.println(""); 121 | client.println(""); 122 | client.println(""); 123 | 124 | client.println(""); 131 | 132 | client.println(""); 133 | client.println("

ESP32 Web Server

"); 134 | client.println("
"); 135 | 136 | client.println("

GPIO 26 - State " + LED1State + "

"); 137 | if (LED1State == "off") { 138 | client.println("

ON

"); 139 | } else { 140 | client.println("

OFF

"); 141 | } 142 | client.println("
"); 143 | 144 | client.println("

LED2 - State " + LED2State + "

"); 145 | if (LED2State == "off") { 146 | client.println("

ON

"); 147 | } else { 148 | client.println("

OFF

"); 149 | } 150 | client.println("
"); 151 | 152 | double temp = analogRead(LM35) / 9.31; 153 | String celsius = String(temp ); 154 | client.println("

LM35 - Temperature

"); 155 | if ( temp < 21) 156 | client.println("

" + celsius + "°C

"); 157 | else if ( temp > 24) 158 | client.println("

" + celsius + "°C

"); 159 | else 160 | client.println("

" + celsius + "°C

"); 161 | 162 | client.println("
"); 163 | client.println(""); 183 | 184 | 185 | client.println(""); 186 | client.println(); 187 | break; 188 | } else { 189 | currentLine = ""; 190 | } 191 | } else if (c != '\r') { 192 | currentLine += c; 193 | } 194 | } 195 | } 196 | header = ""; 197 | client.stop(); 198 | Serial.println("Client disconnected."); 199 | Serial.println(""); 200 | } 201 | delay(1); 202 | } 203 | -------------------------------------------------------------------------------- /ESP32_WEB_SERVER/part.esp32_V2_52d2ade585478c3892482f9a77789f59_13.fzp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 4 5 | Mon Jan 29 2018 6 | 7 | Ayarafun.com 8 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 9 | <html><head><meta name="qrichtext" content="1" /><style type="text/css"> 10 | p, li { white-space: pre-wrap; } 11 | </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> 12 | <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:8pt;"><br /></p></body></html> 13 | ESP 32 DEVKIT DOIT 14 | 15 | ESP32 16 | 17 | 18 | ESP32 19 | variant 3 20 | ESP8266 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | TX0 50 | 51 | 52 |

53 | 54 | 55 |

56 | 57 | 58 |

59 | 60 | 61 | 62 | 63 | D23 64 | 65 | 66 |

67 | 68 | 69 |

70 | 71 | 72 |

73 | 74 | 75 | 76 | 77 | CLK 78 | 79 | 80 |

81 | 82 | 83 |

84 | 85 | 86 |

87 | 88 | 89 | 90 | 91 | VIN 92 | 93 | 94 |

95 | 96 | 97 |

98 | 99 | 100 |

101 | 102 | 103 | 104 | 105 | SD1 106 | 107 | 108 |

109 | 110 | 111 |

112 | 113 | 114 |

115 | 116 | 117 | 118 | 119 | RX2 120 | 121 | 122 |

123 | 124 | 125 |

126 | 127 | 128 |

129 | 130 | 131 | 132 | 133 | D4 134 | 135 | 136 |

137 | 138 | 139 |

140 | 141 | 142 |

143 | 144 | 145 | 146 | 147 | D2 148 | 149 | 150 |

151 | 152 | 153 |

154 | 155 | 156 |

157 | 158 | 159 | 160 | 161 | D15 162 | 163 | 164 |

165 | 166 | 167 |

168 | 169 | 170 |

171 | 172 | 173 | 174 | 175 | D0 176 | 177 | 178 |

179 | 180 | 181 |

182 | 183 | 184 |

185 | 186 | 187 | 188 | 189 | D22 190 | 191 | 192 |

193 | 194 | 195 |

196 | 197 | 198 |

199 | 200 | 201 | 202 | 203 | D18 204 | 205 | 206 |

207 | 208 | 209 |

210 | 211 | 212 |

213 | 214 | 215 | 216 | 217 | D5 218 | 219 | 220 |

221 | 222 | 223 |

224 | 225 | 226 |

227 | 228 | 229 | 230 | 231 | TX2 232 | 233 | 234 |

235 | 236 | 237 |

238 | 239 | 240 |

241 | 242 | 243 | 244 | 245 | D21 246 | 247 | 248 |

249 | 250 | 251 |

252 | 253 | 254 |

255 | 256 | 257 | 258 | 259 | D19 260 | 261 | 262 |

263 | 264 | 265 |

266 | 267 | 268 |

269 | 270 | 271 | 272 | 273 | 3V3 274 | 275 | 276 |

277 | 278 | 279 |

280 | 281 | 282 |

283 | 284 | 285 | 286 | 287 | GND 288 | 289 | 290 |

291 | 292 | 293 |

294 | 295 | 296 |

297 | 298 | 299 | 300 | 301 | SD0 302 | 303 | 304 |

305 | 306 | 307 |

308 | 309 | 310 |

311 | 312 | 313 | 314 | 315 | RX0 316 | 317 | 318 |

319 | 320 | 321 |

322 | 323 | 324 |

325 | 326 | 327 | 328 | 329 | CMD 330 | 331 | 332 |

333 | 334 | 335 |

336 | 337 | 338 |

339 | 340 | 341 | 342 | 343 | SD3 344 | 345 | 346 |

347 | 348 | 349 |

350 | 351 | 352 |

353 | 354 | 355 | 356 | 357 | SD2 358 | 359 | 360 |

361 | 362 | 363 |

364 | 365 | 366 |

367 | 368 | 369 | 370 | 371 | D13 372 | 373 | 374 |

375 | 376 | 377 |

378 | 379 | 380 |

381 | 382 | 383 | 384 | 385 | D12 386 | 387 | 388 |

389 | 390 | 391 |

392 | 393 | 394 |

395 | 396 | 397 | 398 | 399 | D14 400 | 401 | 402 |

403 | 404 | 405 |

406 | 407 | 408 |

409 | 410 | 411 | 412 | 413 | D27 414 | 415 | 416 |

417 | 418 | 419 |

420 | 421 | 422 |

423 | 424 | 425 | 426 | 427 | D26 428 | 429 | 430 |

431 | 432 | 433 |

434 | 435 | 436 |

437 | 438 | 439 | 440 | 441 | D25 442 | 443 | 444 |

445 | 446 | 447 |

448 | 449 | 450 |

451 | 452 | 453 | 454 | 455 | D33 456 | 457 | 458 |

459 | 460 | 461 |

462 | 463 | 464 |

465 | 466 | 467 | 468 | 469 | D32 470 | 471 | 472 |

473 | 474 | 475 |

476 | 477 | 478 |

479 | 480 | 481 | 482 | 483 | D35 484 | 485 | 486 |

487 | 488 | 489 |

490 | 491 | 492 |

493 | 494 | 495 | 496 | 497 | D34 498 | 499 | 500 |

501 | 502 | 503 |

504 | 505 | 506 |

507 | 508 | 509 | 510 | 511 | VN 512 | 513 | 514 |

515 | 516 | 517 |

518 | 519 | 520 |

521 | 522 | 523 | 524 | 525 | VP 526 | 527 | 528 |

529 | 530 | 531 |

532 | 533 | 534 |

535 | 536 | 537 | 538 | 539 | EN 540 | 541 | 542 |

543 | 544 | 545 |

546 | 547 | 548 |

549 | 550 | 551 | 552 | 553 | 554 | 555 | 556 | 557 | 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | -------------------------------------------------------------------------------- /ESP_MOTION_DETECTION/ESP32_MOTION_DETECTION.py: -------------------------------------------------------------------------------- 1 | # (C) Dott. Daniel Rossi 09/10/2022 - ProjectoOfficial 2 | # how to flash the firmware: https://www.hackster.io/onedeadmatch/esp32-cam-python-stream-opencv-example-1cc205 3 | 4 | 5 | import cv2 6 | import numpy as np 7 | from datetime import datetime 8 | 9 | import requests 10 | import time 11 | import os 12 | 13 | # ESP32 URL 14 | URL = "" #update with your URL 15 | 16 | cap = cv2.VideoCapture(URL + ":81/stream") 17 | requests.get(URL + "/control?var=framesize&val=10") # 10: UXGA(1600x1200) 18 | 19 | SAVE_MOTION_FRAME = True 20 | current = os.path.dirname(os.path.realpath(__file__)) 21 | 22 | if __name__ == '__main__': 23 | 24 | prev_frame = None 25 | 26 | if cap.isOpened(): 27 | ret, prev_frame = cap.read() 28 | prev_frame = cv2.cvtColor(prev_frame, cv2.COLOR_BGR2GRAY) 29 | prev_frame = cv2.medianBlur(prev_frame, 5) 30 | 31 | kernel = np.ones((5, 5)) 32 | start_time = time.perf_counter() 33 | while True: 34 | if cap.isOpened(): 35 | ret, frame = cap.read() 36 | 37 | original = frame.copy() 38 | gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) 39 | gray = cv2.medianBlur(gray, 5) 40 | 41 | if ret and prev_frame is not None: 42 | difference = cv2.absdiff(prev_frame, gray) 43 | thresh = cv2.threshold(difference, thresh=80, maxval=255, type=cv2.THRESH_BINARY)[1] 44 | thresh = cv2.dilate(thresh, kernel, 2) 45 | #cv2.imshow("frame", thresh) 46 | 47 | contours, _ = cv2.findContours(thresh, mode=cv2.RETR_EXTERNAL, method=cv2.CHAIN_APPROX_SIMPLE) 48 | 49 | motion = False 50 | for contour in contours: 51 | if cv2.contourArea(contour) < 100: 52 | continue 53 | (x, y, w, h) = cv2.boundingRect(contour) 54 | cv2.rectangle(frame, (x, y), (x + w, y + h), color=(0, 255, 255), thickness=2) 55 | motion = True 56 | 57 | cv2.imshow("frame", frame) 58 | 59 | if SAVE_MOTION_FRAME and (time.perf_counter() - start_time) >= 2: 60 | if motion: 61 | filename = os.path.join(current, "{}.jpg".format(datetime.now().strftime("%d_%m_%Y__%H_%M_%S"))) 62 | cv2.imwrite(filename, original) 63 | start_time = time.perf_counter() 64 | 65 | prev_frame = gray.copy() 66 | 67 | key = cv2.waitKey(1) 68 | if key == 27: # ESC 69 | break 70 | 71 | cv2.destroyAllWindows() 72 | cap.release() 73 | 74 | 75 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ESP32 Projects Repository 2 | 3 | Welcome to the ESP32 Projects repository, your source for a variety of projects developed for ESP32 microcontrollers. Explore the world of ESP32 and its applications in IoT, home automation, and more. 4 | 5 | ## Table of Contents 6 | - [Project Descriptions](#project-descriptions) 7 | - [Projects Included](#projects-included) 8 | - [Getting Started](#getting-started) 9 | - [Contributing](#contributing) 10 | 11 | ## Project Descriptions 12 | 13 | ### [AM2301 and MQ135 on ESP32](https://github.com/ProjectoOfficial/ESP32/tree/main/ESP32_AM2301) 14 | This project showcases how to interface AM2301 (DHT22) and MQ135 sensors with ESP32 microcontrollers. Monitor temperature, humidity, and air quality with ease. 15 | 16 | ### [ESP32 Amplifier and Speaker with SD Card](https://github.com/ProjectoOfficial/ESP32/tree/main/ESP32_AMPLIFIER/SPEAKER_SD) 17 | Create an audio amplifier system with an ESP32. Play audio files from an SD card and explore audio applications using the ESP32. 18 | 19 | ### [ESP32 CAM Python Stream with OpenCV](https://github.com/ProjectoOfficial/ESP32/tree/main/ESP32_CAM_PYTHON_STREAM_OPENCV) 20 | Learn how to create a Python script for streaming video from an ESP32 CAM module using OpenCV. Explore real-time video processing. 21 | 22 | ### [ESP32 Firebase Services](https://github.com/ProjectoOfficial/ESP32/tree/main/ESP32_FIREBASE_SERVICES) 23 | Enhance your IoT projects with Firebase integration. Use ESP32 to send and receive data from Firebase, enabling cloud-based control. 24 | 25 | ### [ESP32 Land Meter](https://github.com/ProjectoOfficial/ESP32/tree/main/ESP32_LAND_METER) 26 | A project for measuring and monitoring land parameters. Use ESP32 to collect data and present it for analysis and decision-making. 27 | 28 | ### [ESP32 MQ135](https://github.com/ProjectoOfficial/ESP32/tree/main/ESP32_MQ135) 29 | A variation of the AM2301 and MQ135 project, this version focuses on MQ135 sensor integration with ESP32 for air quality monitoring. 30 | 31 | ### [ESP32 Web Server](https://github.com/ProjectoOfficial/ESP32/tree/main/ESP32_WEB_SERVER) 32 | Create your own web server with ESP32. It allows to directly control a pair of digital GPIO through two buttons inserted on the web page. An LM35 allows to monitor the ambient temperature, which is showed on the web page too. The web server uses Bootstrap framework for rendering the graphics, giving to it an amazing look! More instruction can be found inside .ino file. 33 | 34 | ### [ESP Motion Detection](https://github.com/ProjectoOfficial/ESP32/tree/main/ESP_MOTION_DETECTION) 35 | Build a motion detection system using ESP32. Monitor and respond to motion events in your environment. 36 | 37 | ### [ESP Histogram of Oriented Gradients](https://github.com/ProjectoOfficial/ESP32/tree/main/ESP32CAM_HOG_OPENCV) 38 | A project which exploits ESP32-CAM stream to be captured with OpenCV in Python in order to detect people within the scene. It is built within docker, please refere to this guide [ai-base-docker](https://github.com/ProjectoOfficial/ai-base-docker). As for the firmware you have to upload on ESP32, please install ESP32 boards on arduino adding this link (https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json), then select AI-Base-Thinker, go to "Examples" > "ESP32" > "Camera" and use "WebServerCamera.ino". In the Firmware, select the MACRO with AI-Thinker name, add your WiFi SSID and Password and retrieve ESP32 IP address. 39 | 40 | ## Getting Started 41 | 42 | Each project includes detailed documentation and code within its respective folder. Click the project links above to access code examples, setup instructions, and additional resources. 43 | 44 | ## Contributing 45 | 46 | We welcome contributions from the community! If you have ideas, improvements, or new projects to add, please open an issue or submit a pull request. Let's build and grow the ESP32 community together. 47 | 48 | Happy hacking and exploring! 49 | 50 | --------------------------------------------------------------------------------