User Tools

Site Tools


amc:ss2023:group-y:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
amc:ss2023:group-y:start [2023/07/24 10:23] – [While the code is not sufficiently developed, it only modifies the file name, some more improvement on the code has to be done.] hoi-fung.samamc:ss2023:group-y:start [2023/07/24 14:49] (current) – [2.1.3 Adafruit Universal USB / DC / Solar Lithium Ion/Polymer charger - bq24074] hoi-fung.sam
Line 4: Line 4:
 =====1.Introduction ===== =====1.Introduction =====
 ====Aim of the project:==== ====Aim of the project:====
-In this project, we are going to make a house for chickens in order for scientists to study their living habits. The basic idea of this chickens’ house is to first, capture motion of the chicken by PIR motion sensor. Second,  the PIR sensor transmits a signal to the camera and then the camera takes a photo of the chicken. In the end, the camera that is connected to Wifi will send the photo to the user via email. The energy supply of this project comes from a solar panel, which means the project is totally environment friendly. +In this project, we are going to make a house for chickens in order for scientists to study their living habits. The basic idea of this chickens’ house is to first, capture motion of the chicken by PIR motion sensor. Second,  the PIR sensor transmits a signal to the camera and then the camera takes a photo of the chicken. In the end, the camera that is connected to WiFi will send the photo to the user via email. The energy supply of this project comes from a solar panel, which means the project is totally environment friendly. 
  
 =====2.Methods and Materials===== =====2.Methods and Materials=====
 ====2.1 Materials:==== ====2.1 Materials:====
-  - breadboard +  - Breadboard 
-  - female jumper wires +  - Jumper wires
-  - male to female jumper wires+
   - HC-SR501 PIR Sensor   - HC-SR501 PIR Sensor
   - ESP32-camera   - ESP32-camera
-  - FTDI programmer+  - UartSBee V5 (FTDI programmer)
   - solar panel   - solar panel
   - battery   - battery
Line 47: Line 46:
 The ESP32-CAM is a popular development board designed for applications requiring a camera module. It includes multiple data pins, a combined Wi-Fi and camera module, and a microSD card slot for easy storage. In this project we mainly use the Wi-Fi function and following pins: Power Pins (5V, 3.3V and GND), general purpose input/output pins (GPIO12), serial pins (U0R, U0T) and GPIO0.\\ The ESP32-CAM is a popular development board designed for applications requiring a camera module. It includes multiple data pins, a combined Wi-Fi and camera module, and a microSD card slot for easy storage. In this project we mainly use the Wi-Fi function and following pins: Power Pins (5V, 3.3V and GND), general purpose input/output pins (GPIO12), serial pins (U0R, U0T) and GPIO0.\\
 ====2.1.3 Adafruit Universal USB / DC / Solar Lithium Ion/Polymer charger - bq24074==== ====2.1.3 Adafruit Universal USB / DC / Solar Lithium Ion/Polymer charger - bq24074====
 +The micro lipo charger is designed to charge Lithium Polymer or Lithium Ion (LiPoly/LiIon) batteries via a USB Type-C connection, DC or Solar power. This charger charges the batteries by plugging into a USB port and a 3.7V/4.2V LiPoly/LiIon to JST plug.\\
 +The Micro-Lipo charger is charged in three stages. Firstly, pretreatment charging, then constant current fast charging, and finally constant voltage trickle charging. The charger has a 0.1-inch connector, D+ and D- data lines, 100mA charging current, which can be adjusted to 500mA by soldering off the jumper.
 +
 ====2.2 Method:==== ====2.2 Method:====
 ====2.2.1 Wire connection to upload the code==== ====2.2.1 Wire connection to upload the code====
Line 83: Line 85:
  
 ====2.2.4 Wire connection in operation==== ====2.2.4 Wire connection in operation====
 +**ESP32CAM - Breadboard**\\
 +5V - positive rail of the breadboard\\
 +GND - negative rail of the breadboard\\
 +
 +**ESP32CAM - PIR**\\
 +GPIO12 - OUT\\
 +
 +**PIR - Breadboard**\\
 +VCC - positive rail of the breadboard\\
 +GND - negative rail of the breadboard\\
 +
 +**Lithium Ion/Polymer charger - Breadboard**\\
 +LiPo - positive rail of the breadboard\\
 +GND - negative rail of the breadboard\\
 +{{:amc:ss2023:group-y:wire_connection_operation.jpg?350|}}
 =====3.Code===== =====3.Code=====
 References for this project are from:\\ References for this project are from:\\
Line 121: Line 138:
    the Sender's Gmail account must activate 2-Step Verification then get "App Passwords". The method is in the video. Watch carefully.    the Sender's Gmail account must activate 2-Step Verification then get "App Passwords". The method is in the video. Watch carefully.
  */  */
-#define emailSenderAccount      "amc491561@gmail.com@gmail.com"+#define emailSenderAccount      "amc491561@gmail.com"
 #define emailSenderAppPassword  "vsvnciqerihrhurx" #define emailSenderAppPassword  "vsvnciqerihrhurx"
 #define smtpServer              "smtp.gmail.com" #define smtpServer              "smtp.gmail.com"
Line 448: Line 465:
 ===Import the libraires=== ===Import the libraires===
 A library is a collection of pre-written code and functions that provide additional functionality to the Arduino sketches.\\ A library is a collection of pre-written code and functions that provide additional functionality to the Arduino sketches.\\
-**ESP32_MailClient.h** allows ESP32 to send emails with attachments via [[https://randomnerdtutorials.com/esp32-send-email-smtp-server-arduino-ide/|SMTP]] servers (Simple Mail Transfer Protocol)\\+**ESP32_MailClient.h** allows ESP32 to send emails with attachments via [[https://randomnerdtutorials.com/esp32-send-email-smtp-server-arduino-ide/|SMTP]] servers (Simple Mail Transfer Protocol), here is the procedure to install the [[https://randomnerdtutorials.com/esp32-cam-send-photos-email/|ESP-Mail-Client library]] in Arduino.\\
 **WiFi.h** allows ESP32 to connect to the local WiFi network which is useful for projects needed to connect Arduiono to the internet to send and receive data.\\ **WiFi.h** allows ESP32 to connect to the local WiFi network which is useful for projects needed to connect Arduiono to the internet to send and receive data.\\
-**<SPIFFS.h>** is used to access and manage the SPIFFS(SPI Flash File System)on ESP32 board. SPIFFS is a lightweight file system that uses the flash memory of the board to store and retrieve files.\\+**<SPIFFS.h>** is used to access and manage the SPIFFS(SPI Flash File System) on ESP32 board. SPIFFS is a lightweight file system that uses the flash memory of the board to store and retrieve files.\\
 **FS.h** allows to read, write, and manage files on different types of storage, such as SPIFFS, SD cards, and internal EEPROM.\\ **FS.h** allows to read, write, and manage files on different types of storage, such as SPIFFS, SD cards, and internal EEPROM.\\
 <code C++> <code C++>
Line 462: Line 479:
 </code> </code>
  
-===Define email=== 
 Define the email account and password that the ESP32-CAM would login as well as the recipient's email\\ Define the email provider SMTP setting, the [[https://randomnerdtutorials.com/esp32-send-email-smtp-server-arduino-ide/|SMTP settings for different email providers]] are different.\\ Define the email account and password that the ESP32-CAM would login as well as the recipient's email\\ Define the email provider SMTP setting, the [[https://randomnerdtutorials.com/esp32-send-email-smtp-server-arduino-ide/|SMTP settings for different email providers]] are different.\\
 <code C++> <code C++>
Line 739: Line 755:
 ===While the code is not sufficiently developed, it only modifies the file name, some more improvement on the code has to be done.=== ===While the code is not sufficiently developed, it only modifies the file name, some more improvement on the code has to be done.===
 ====4.2 Deep Sleep Mode==== ====4.2 Deep Sleep Mode====
 +We put our ESP32-Cam in [[https://randomnerdtutorials.com/esp32-deep-sleep-arduino-ide-wake-up-sources/|Deep Sleep]] mode in order to reduce the power consumption. So that the battery will last longer. In deep sleep mode, CPU and WIFi activities are cut off, but the Ultra Low Power(ULP) co-processor is still powered on. Some of the ESP32 pins can be used by the ULP co-processor during deep sleep.\\ 
 +The original concept of this project is using GPIO12 as an external wake up pin, which when the pir sensor detects motion, it sends a digital output signal high (logical 1) to the wake up pin to trigger esp32-cam to  wake up.\\ While finally we found that it is not suitable to do it in this project. The reason is that when the ESP32 is in deep sleep mode, it effectively "shuts down" the processor, and the code execution stops. It does not maintain the previous state or continue running the code where it left off. Instead, it will restart the entire program from the beginning and start execution from the ’setup()’ function again, as if you pressed the reset button. This means it counts down to stabilize, connect to WiFi, mount SPIFFS, initialize the camera and take photos every time when it detects motion. Which will not take photos efficiently.\\ While without using the deep sleep mode, it counts down to stabilize, connect to WiFi, mount SPIFFS and initialize the camera once, and take photos whenever it detects motion. 
  
 +=====5.Reference===== 
 +[[https://cdn-learn.adafruit.com/downloads/pdf/adafruit-bq24074-universal-usb-dc-solar-charger-breakout.pdf|Adafruit Universal USB / DC / Solar 
 +Lithium Ion/Polymer charger - bq24074]]\\ 
 +[[https://wiki.seeedstudio.com/UartSBee_v5/|UartSBee V5]]\\ 
 +[[https://randomnerdtutorials.com/esp32-cam-send-photos-email/|ESP32-CAM: Take and Send Photos via Email using an SMTP Server]]\\ 
 +[[https://randomnerdtutorials.com/esp32-deep-sleep-arduino-ide-wake-up-sources/|ESP32 Deep Sleep with Arduino IDE and Wake Up Sources]]\\ 
 +[[https://lastminuteengineers.com/pir-sensor-arduino-tutorial/#sensitivity-adjustment|How HC-SR501 PIR Sensor Works & Interface It With Arduino]]\\ 
 +[[https://www.arrow.com/en/research-and-events/articles/understanding-active-and-passive-infrared-sensors|The Right Tool for the Job: Active and Passive Infrared Sensors]]\\ 
 +[[https://learn.adafruit.com/pir-passive-infrared-proximity-motion-sensor/how-pirs-work|How PIRs Work]]
amc/ss2023/group-y/start.1690187010.txt.gz · Last modified: 2023/07/24 10:23 by hoi-fung.sam