Compare commits
8 Commits
serialdebu
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df98815fc8 | ||
|
|
34ebe62aaa | ||
|
|
152c83114f | ||
|
|
679db9a5f3 | ||
|
|
3d2c67157b | ||
|
|
53ce038f45 | ||
|
|
22ce569fcb | ||
|
|
7f51df11e1 |
28
LICENSE
Normal file
28
LICENSE
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
BSD 3-Clause License
|
||||||
|
|
||||||
|
Copyright (c) 2025, Splatink
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of the copyright holder nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
A digital clock and thermomter/hydrometer written in Arduino for the Raspberry Pi Pico using an SH1106 OLED dispaly and a BME280 environment sensor
|
A digital NTP clock and thermomter/hydrometer written in Arduino for the Raspberry Pi Pico using an SH1106 OLED dispaly and a BME280 environment sensor
|
||||||
|
|
||||||
Pin definitions and display drivers (as long as the display is 128x64) can easily be changed in the code
|
Pin definitions and display drivers (as long as the display is 128x64) can easily be changed in the code
|
||||||
|
|
||||||
@@ -8,4 +8,8 @@ The battery level is read by the battery going into a simple 10k resistor voltag
|
|||||||
|
|
||||||
The OLED display and BME280 share the same I2C lines into the Pico
|
The OLED display and BME280 share the same I2C lines into the Pico
|
||||||
|
|
||||||
Pin definitions and display drivers (as long as the display is 128x64) can easily be changed in the code
|
Pin definitions and display drivers (as long as the display is 128x64) can easily be changed in the code
|
||||||
|
|
||||||
|
28/09/25 WARNING: This code has bugs and holes. It is the first piece of software ever written by me, and since then, I've (unfotunetly) given up programming.
|
||||||
|
I am not responsible for anything that happens if you use this neither do I care.
|
||||||
|
If you want to run this, do so at your own risk and on an isolated IOT network.
|
||||||
|
|||||||
16
src/main.cpp
16
src/main.cpp
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
|
U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE);
|
||||||
|
|
||||||
const char* ssid = "Limbo";
|
const char* ssid = "teo";
|
||||||
const char* password = "95H2O862U235@#";
|
const char* password = "teo";
|
||||||
|
|
||||||
bool lpmode, debugmode;
|
bool lpmode, debugmode;
|
||||||
|
|
||||||
@@ -25,9 +25,11 @@ WiFiUDP ntpUDP;
|
|||||||
NTPClient timeClient(ntpUDP, "gr.pool.ntp.org", 0, 1296000000);
|
NTPClient timeClient(ntpUDP, "gr.pool.ntp.org", 0, 1296000000);
|
||||||
Adafruit_BME280 bme;
|
Adafruit_BME280 bme;
|
||||||
|
|
||||||
void serialDebugInfo(float batteryVoltage, float batteryPrecentage, int wifiRSSI, int wifiStatus, const char* day, bool brightness, float temperature, float humidity, float pressure, bool disconnected)
|
void serialDebugInfo(float firmwareVersion, float batteryVoltage, float batteryPrecentage, int wifiRSSI, int wifiStatus, const char* day, bool brightness, float temperature, float humidity, float pressure, bool disconnected)
|
||||||
{
|
{
|
||||||
Serial1.print("Battery Voltage: ");
|
Serial1.print("Firmware Version: ");
|
||||||
|
Serial1.println(firmwareVersion, 1);
|
||||||
|
Serial1.print("Battery Voltage: ");
|
||||||
Serial1.println(batteryVoltage, 1);
|
Serial1.println(batteryVoltage, 1);
|
||||||
Serial1.print("Battery Precentage: ");
|
Serial1.print("Battery Precentage: ");
|
||||||
Serial1.println(batteryPrecentage, 0);
|
Serial1.println(batteryPrecentage, 0);
|
||||||
@@ -375,7 +377,7 @@ void setup()
|
|||||||
{
|
{
|
||||||
Serial1.setTX(0);
|
Serial1.setTX(0);
|
||||||
Serial1.setRX(1);
|
Serial1.setRX(1);
|
||||||
Serial1.begin(9600);
|
Serial1.begin(115200);
|
||||||
debugmode = true;
|
debugmode = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -383,7 +385,7 @@ void setup()
|
|||||||
void loop()
|
void loop()
|
||||||
{
|
{
|
||||||
static bool disconnected = false;
|
static bool disconnected = false;
|
||||||
static int counter = 0;
|
static int counter = 29;
|
||||||
timeClient.update();
|
timeClient.update();
|
||||||
|
|
||||||
const char* day = getDay(timeClient.getDay());
|
const char* day = getDay(timeClient.getDay());
|
||||||
@@ -401,7 +403,7 @@ void loop()
|
|||||||
if (debugmode == true && counter >= 30)
|
if (debugmode == true && counter >= 30)
|
||||||
{
|
{
|
||||||
float pressure = bme.readPressure();
|
float pressure = bme.readPressure();
|
||||||
serialDebugInfo(batteryVoltage, batteryPrecentage, wifiRSSI, wifiStatus, day, brightness, temperature, humidity, pressure, disconnected);
|
serialDebugInfo(2.2 ,batteryVoltage, batteryPrecentage, wifiRSSI, wifiStatus, day, brightness, temperature, humidity, pressure, disconnected);
|
||||||
counter = 0;
|
counter = 0;
|
||||||
}
|
}
|
||||||
counter++;
|
counter++;
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
**CHANGELOG:**
|
**CHANGELOG:**
|
||||||
|
|
||||||
|
2.2:
|
||||||
|
* Changed baudrate to standard 115200 baud
|
||||||
|
* Added a firmware version printout to serial
|
||||||
|
|
||||||
2.1:
|
2.1:
|
||||||
* Added a serial debugging mode. This mode is activated if the BUTTON is held at bootup. Serial debugging info (variables) are output on GPIO0(TX) at 9600 baud every 30 seconds.
|
* Added a serial debugging mode. This mode is activated if the BUTTON is held at bootup. Serial debugging info (variables) are output on GPIO0(TX) at 9600 baud every 30 seconds.
|
||||||
* All functions are now called seperately and their return values placed in variables to be given to displayClocl() and serialDebugInfo()
|
* All functions are now called seperately and their return values placed in variables to be given to displayClocl() and serialDebugInfo()
|
||||||
@@ -59,4 +63,4 @@
|
|||||||
|
|
||||||
1.0:
|
1.0:
|
||||||
* Updated battery precentage calculator math to original (measurement - min) / (max - min) * 100
|
* Updated battery precentage calculator math to original (measurement - min) / (max - min) * 100
|
||||||
* Created this updates.md file
|
* Created this updates.md file
|
||||||
|
|||||||
Reference in New Issue
Block a user