-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdraussenfuchs.de_tx_minimal.ino
More file actions
94 lines (66 loc) · 3.23 KB
/
Copy pathdraussenfuchs.de_tx_minimal.ino
File metadata and controls
94 lines (66 loc) · 3.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
Very basic 70cm-ISM fox-transmitter based on ESP32 and generic transmitter module.
See draussenfuchs.de for details.
--
The MIT License (MIT)
Copyright (c) 2025 Harm, DK4HAA, draussenfuchs.de
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
--
INSTALL
Install ESP32 via boards manager (if not done before)
1. Open Arduino IDE
2. Open Tools > Board > Boards Manager
3. Search for "esp32"
4. Install "esp32" by Espressif Systems
Select Board
1. Select Tools > Board > esp32 > Nologo ESP32C3 Super Mini
2. Use default settings for this board
Compile and install as usual. :)
IMPORTANT NOTE
This code uses deep sleep. Once flashed, your ESP32 will go
to deep sleep most of the time and will not be available as a serial
device during deep sleep.
You have to hold down the "boot" button and press the "RST" button
to go back into bootloader mode to re-flash/update the board.
*/
#define FREQ_HZ 880 // Tone frequency of the fox. For reference: c-major-scale: 440 494 523 587 659 698 784 880 988 1047
#define TIME_TO_TX 200 // Time ESP32 will transmit (in ms)
#define TIME_TO_SLEEP 1800 // Time ESP32 will go to sleep (in ms)
#define DATA_PIN 3 // Pin of the ESP32 connected to the data pin of the transmitter module
#define TX_ARTIFICIAL_VCC_PIN 4 // Pin of the ESP32 providing power to the transmitter module due to unused enable pin
#define uS_TO_MS_FACTOR 1000 // Conversion factor for micro seconds to ms
void setup() {
// set pin modes
pinMode(TX_ARTIFICIAL_VCC_PIN, OUTPUT);
pinMode(DATA_PIN, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
// set wakeup timer
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_MS_FACTOR);
// start TX
digitalWrite(TX_ARTIFICIAL_VCC_PIN, HIGH); // enable transmitter module
digitalWrite(LED_BUILTIN, LOW); // enable built-in LED
tone(DATA_PIN, FREQ_HZ); // output tone to transmitter
delay(TIME_TO_TX); // wait...
// stop TX
noTone(DATA_PIN); // stop tone
digitalWrite(LED_BUILTIN, HIGH); // disable LED
digitalWrite(TX_ARTIFICIAL_VCC_PIN, LOW); // disable transmitter module
esp_deep_sleep_start(); // go to deep sleep
}
void loop() {
// never executed because of deep sleep
}