Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sensor System
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institut für Informatik
QE Research Group
FORTE
Sensor System
Commits
2bbe7b7a
Commit
2bbe7b7a
authored
2 years ago
by
marieschroeder
Browse files
Options
Downloads
Patches
Plain Diff
Implementing Deepsleep + counter (as long as we have no timestep for naming picture files)
parent
e8c36f04
No related branches found
No related tags found
3 merge requests
!39
Merge Develop into Main
,
!19
development into master
,
!17
Inital Host, initial Client
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
client/ESPcam/src/main.cpp
+78
-14
78 additions, 14 deletions
client/ESPcam/src/main.cpp
client/libs/sht85/Sht85.hpp
+2
-2
2 additions, 2 deletions
client/libs/sht85/Sht85.hpp
with
80 additions
and
16 deletions
client/ESPcam/src/main.cpp
+
78
−
14
View file @
2bbe7b7a
...
@@ -61,6 +61,14 @@ over-the-air updates for the camera at one point.
...
@@ -61,6 +61,14 @@ over-the-air updates for the camera at one point.
// LED control
// LED control
#define LEDpin 4
#define LEDpin 4
// Deep Sleep Settings
#define uS_TO_S_FACTOR 1000000
/* Conversion factor for micro seconds to seconds */
#define TIME_TO_SLEEP 10
/* Time ESP32 will go to sleep (in seconds) */
// Counting files on sd card for saving in the name of each image
int
fileCountOnSD
=
0
;
// for counting files
// string for saving the time
// string for saving the time
char
time_string
[
20
];
char
time_string
[
20
];
...
@@ -237,21 +245,55 @@ void takeNewPhoto(String path)
...
@@ -237,21 +245,55 @@ void takeNewPhoto(String path)
esp_camera_fb_return
(
fb
);
esp_camera_fb_return
(
fb
);
}
}
void
readRTC
()
// Count files on SD card to give a meaningful count
{
void
listDir
(
fs
::
FS
&
fs
,
const
char
*
dirname
,
uint8_t
levels
){
// This is used for a picture timestamp (name of the image)
Serial
.
printf
(
"Listing directory: %s
\n
"
,
dirname
);
rtc
.
begin
();
DateTime
now
=
rtc
.
now
();
File
root
=
fs
.
open
(
dirname
);
sprintf
(
time_string
,
"%04d-%02d-%02dT%02d-%02d-%02d"
,
now
.
year
(),
now
.
month
(),
now
.
day
(),
now
.
hour
(),
now
.
minute
(),
if
(
!
root
){
now
.
second
());
Serial
.
println
(
"Failed to open directory"
);
Serial
.
println
(
time_string
);
return
;
}
if
(
!
root
.
isDirectory
()){
Serial
.
println
(
"Not a directory"
);
return
;
}
File
file
=
root
.
openNextFile
();
while
(
file
){
fileCountOnSD
+=
1
;
//Serial.print(" FILE: ");
//Serial.print(file.name());
//Serial.print(" SIZE: ");
//Serial.println(file.size());
file
=
root
.
openNextFile
();
}
Serial
.
println
(
"File Count on SD: "
);
Serial
.
println
(
fileCountOnSD
);
}
}
void
readRTC
()
{
// This is used for a picture timestamp (name of the image)
if
(
!
rtc
.
begin
())
{
Serial
.
println
(
"Couldnt find RTC!"
);
}
else
{
Serial
.
println
(
"Setting the time"
);
}
DateTime
now
=
rtc
.
now
();
sprintf
(
time_string
,
"%04d-%02d-%02dT%02d-%02d-%02d"
,
now
.
year
(),
now
.
month
(),
now
.
day
(),
now
.
hour
(),
now
.
minute
(),
now
.
second
());
Serial
.
println
(
time_string
);
}
Sht85
sht85Sensor
;
Sht85
sht85Sensor
;
void
setup
()
void
setup
()
{
{
// control of the LED pin
// control of the LED pin
pinMode
(
LEDpin
,
OUTPUT
);
pinMode
(
LEDpin
,
OUTPUT
);
// Disable brownout detector
// Disable brownout detector
WRITE_PERI_REG
(
RTC_CNTL_BROWN_OUT_REG
,
0
);
WRITE_PERI_REG
(
RTC_CNTL_BROWN_OUT_REG
,
0
);
...
@@ -259,19 +301,24 @@ void setup()
...
@@ -259,19 +301,24 @@ void setup()
// Start Serial
// Start Serial
Serial
.
begin
(
115200
);
Serial
.
begin
(
115200
);
Serial
.
println
(
"Wake Up!"
);
delay
(
1000
);
// Initialize the camera
// Initialize the camera
Serial
.
print
(
"Initializing the camera module..."
);
Serial
.
print
(
"Initializing the camera module..."
);
camera_configESPCamera
();
camera_configESPCamera
();
Serial
.
println
(
"Camera OK!"
);
Serial
.
println
(
"Camera OK!"
);
espnow_setup
();
espnow_setup
();
sht85Sensor
.
setup
();
sht85Sensor
.
setup
();
}
void
loop
()
// before in loop
{
// initiate I2C, read SHT+RTC, end I2C
// initiate I2C, read SHT+RTC, end I2C
readRTC
();
readRTC
();
try
{
try
{
// out_data_drs26 data= dr26.readData();
// out_data_drs26 data= dr26.readData();
// Serial.printf("data circumfrence");
// Serial.printf("data circumfrence");
...
@@ -299,8 +346,12 @@ void loop()
...
@@ -299,8 +346,12 @@ void loop()
Serial
.
print
(
"Initializing the MicroSD card module... "
);
Serial
.
print
(
"Initializing the MicroSD card module... "
);
initMicroSDCard
();
initMicroSDCard
();
// Count files on SD card
listDir
(
SD_MMC
,
"/"
,
0
);
// Path where new image will be saved in MicroSD card
// Path where new image will be saved in MicroSD card
String
path
=
"/"
+
String
(
time_string
)
+
".jpg"
;
String
path
=
"/
Picture_
"
+
String
(
fileCountOnSD
)
+
".jpg"
;
Serial
.
printf
(
"Picture file name: %s
\n
"
,
path
.
c_str
());
Serial
.
printf
(
"Picture file name: %s
\n
"
,
path
.
c_str
());
// Take and save a picture
// Take and save a picture
...
@@ -311,4 +362,17 @@ void loop()
...
@@ -311,4 +362,17 @@ void loop()
// Delay for specified period
// Delay for specified period
delay
(
1000
);
delay
(
1000
);
// Deep sleep
esp_sleep_enable_timer_wakeup
(
TIME_TO_SLEEP
*
uS_TO_S_FACTOR
);
Serial
.
println
(
"Setup ESP32 to sleep for "
+
String
(
TIME_TO_SLEEP
)
+
" Seconds"
);
Serial
.
println
(
"Going to sleep now"
);
delay
(
1000
);
Serial
.
flush
();
gpio_hold_en
((
gpio_num_t
)
LEDpin
);
esp_deep_sleep_start
();
}
void
loop
()
{
}
}
This diff is collapsed.
Click to expand it.
client/libs/sht85/Sht85.hpp
+
2
−
2
View file @
2bbe7b7a
...
@@ -19,8 +19,8 @@
...
@@ -19,8 +19,8 @@
// Pin definitions for I2C (SHT85, RTC)
// Pin definitions for I2C (SHT85, RTC)
// This is different from the pins on the ESP32-C3-DevKit boards!
// This is different from the pins on the ESP32-C3-DevKit boards!
#define SDA 1
2
#define SDA 1
3
#define SCL 1
3
#define SCL 1
2
struct
out_data_sht85
{
struct
out_data_sht85
{
float
temperature
=
0.0
;
float
temperature
=
0.0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment