Skip to content

Commit

Permalink
Add ESP8266 and ESP32 support
Browse files Browse the repository at this point in the history
  • Loading branch information
Erriez committed Aug 13, 2022
1 parent 9fd2a85 commit ddb1b5b
Show file tree
Hide file tree
Showing 17 changed files with 853 additions and 70 deletions.
31 changes: 19 additions & 12 deletions .auto-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,29 @@ function autobuild()
{
# Set environment variables
BOARDS_AVR="--board uno --board pro16MHzatmega328 --board pro8MHzatmega328"
BOARDS_ESP8266="--board d1_mini --board nodemcuv2"
BOARDS_ESP32="--board lolin_d32"

echo "Installing library dependencies"
# Install library dependency LowPower.h for example DHT22LowPower.ino
platformio lib --global install "Low-Power"
platformio lib --global install https://github.com/arduino-libraries/SD
platformio lib --global install "OneWire"
platformio lib --global install "DallasTemperature"
platformio lib --global install "adafruit/Adafruit GFX Library"
platformio lib --global install "adafruit/Adafruit SSD1306"
platformio lib --global install "adafruit/Adafruit BusIO"
# Install library dependency LowPower.h for AVR examples
pio pkg install --global --library "Low-Power"
pio pkg install --global --library https://github.com/arduino-libraries/SD
pio pkg install --global --library "OneWire"
pio pkg install --global --library "DallasTemperature"
pio pkg install --global --library "adafruit/Adafruit GFX Library"
pio pkg install --global --library "adafruit/Adafruit SSD1306"
pio pkg install --global --library "adafruit/Adafruit BusIO"

echo "Building examples..."
platformio ci --lib="." ${BOARDS_AVR} examples/ErriezOregonTHN128Receive/ErriezOregonTHN128Receive.ino
platformio ci --lib="." ${BOARDS_AVR} examples/ErriezOregonTHN128ReceiveSSD1306/ErriezOregonTHN128ReceiveSSD1306.ino
platformio ci --lib="." ${BOARDS_AVR} examples/ErriezOregonTHN128Transmit/ErriezOregonTHN128Transmit.ino
platformio ci --lib="." ${BOARDS_AVR} examples/ErriezOregonTHN128TransmitDS1820/ErriezOregonTHN128TransmitDS1820.ino
platformio ci --lib="." ${BOARDS_AVR} examples/AVR/ErriezOregonTHN128Receive/ErriezOregonTHN128Receive.ino
platformio ci --lib="." ${BOARDS_AVR} examples/AVR/ErriezOregonTHN128ReceiveSSD1306/ErriezOregonTHN128ReceiveSSD1306.ino
platformio ci --lib="." ${BOARDS_AVR} examples/AVR/ErriezOregonTHN128Transmit/ErriezOregonTHN128Transmit.ino
platformio ci --lib="." ${BOARDS_AVR} examples/AVR/ErriezOregonTHN128TransmitDS1820/ErriezOregonTHN128TransmitDS1820.ino

platformio ci --lib="." ${BOARDS_ESP8266} ${BOARDS_ESP32} examples/ESP/ErriezOregonTHN128Receive/ErriezOregonTHN128Receive.ino
platformio ci --lib="." ${BOARDS_ESP8266} ${BOARDS_ESP32} examples/ESP/ErriezOregonTHN128ReceiveSSD1306/ErriezOregonTHN128ReceiveSSD1306.ino
platformio ci --lib="." ${BOARDS_ESP8266} ${BOARDS_ESP32} examples/ESP/ErriezOregonTHN128Transmit/ErriezOregonTHN128Transmit.ino
platformio ci --lib="." ${BOARDS_ESP8266} ${BOARDS_ESP32} examples/ESP/ErriezOregonTHN128TransmitDS1820/ErriezOregonTHN128TransmitDS1820.ino
}

function generate_doxygen()
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Erriez Oregon THN128 433MHz temperature sensor library
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 1.0.0
PROJECT_NUMBER = 1.0.1

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
Binary file modified ErriezOregonTHN128.pdf
Binary file not shown.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,33 @@ This microcontroller is available on Arduino UNO and `Pro Mini 3.3V 8MHz` boards
* Genuine DS18B20 temperature sensor.
* STX802 low-power 433MHz transmitter.

**Receiver on on the right breadboard:**
**Receiver on the right breadboard:**

* SRX882 low-power 433MHz receiver.
* SSD1306 I2C 128x64 OLED display.
* Pro-Mini 3V3 8MHz.

### Hardware notes

* For low-power transmitters, a `Pro Mini 3V3 8MHz` bare board with ATMega328 microcontroller is highly recommended. The board has no serial interface chip which reduces continuous power consumption. An external FTDI232 - USB serial interface should be connected for serial console / programming. (See red PCB on the picture)
Supported hardware:
* AVR designed for low-power
* ESP8266
* ESP32

* For low-power transmitters, a `Pro Mini 3V3 8MHz` bare board with ATMega328 microcontroller is highly recommended. The
board has no serial interface chip which reduces continuous power consumption. An external FTDI232 - USB serial
interface should be connected for serial console / programming. (See red PCB on the picture)
The SMD power LED should be desoldered from the Pro Mini to reduce continuous power consumption.
* A transmitter with (protected) 1500mA 18650 battery can operate for at least 6 months with `LowPower.h` functionality implemented. (By sending the temperature every 30 seconds)
* Changing the BOD (Brown Out Detection) fuse to 1.8V allows operation between 1.8 and 4.2V 18650 battery. (Explanation beyond the scope of this project)
* A transmitter with (protected) 1500mA 18650 battery can operate for at least 6 months with `LowPower.h` functionality
implemented. (By sending the temperature every 30 seconds)
* Changing the BOD (Brown Out Detection) fuse to 1.8V allows operation between 1.8 and 4.2V 18650 battery. (Explanation
beyond the scope of this project)
* 1 to 3 temperature transmitters are supported, similar to the original Oregon THN128 temperature transmitters.
* Check [list of counterfeit DS18B20 chips](https://github.com/cpetrich/counterfeit_DS18B20) , because this makes a huge difference in accuracy and read errors at 3.3V. Many DS18B20 chips from Aliexpress are counterfeit and won't work reliable at voltages below 3.3V.
* [NiceRF Wireless Technology Co., Ltd.](https://nl.aliexpress.com/store/934254) sells high quality 433MHz transmit (STX802) and receiver modules (STX882) with a good range.
* Check [list of counterfeit DS18B20 chips](https://github.com/cpetrich/counterfeit_DS18B20) , because this makes a huge
difference in accuracy and read errors at 3.3V. Many DS18B20 chips from Aliexpress are counterfeit and won't work
reliable at voltages below 3.3V.
* [NiceRF Wireless Technology Co., Ltd.](https://nl.aliexpress.com/store/934254) sells high quality 433MHz transmit
(STX802) and receiver modules (STX882) with a good range.
* A 18650 battery (with protection circuit) should be connected directly to the VCC pin (not VIN).
* The voltage regulator can be desoldered from the pro-micro board when not used for more power reduction.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,20 @@
*/

#include <Arduino.h>
#include <LowPower.h> // https://github.com/LowPowerLab/LowPower
#include <ErriezOregonTHN128Receive.h>
#include <ErriezOregonTHN128Receive.h> // https://github.com/Erriez/ErriezOregonTHN128

// Connect RF receive to Arduino pin 2 (INT0) or pin 3 (INT1)
#define RF_RX_PIN 2
#if defined(ARDUINO_ARCH_AVR)
#include <LowPower.h> // https://github.com/LowPowerLab/LowPower
#define RF_RX_PIN 2 // Connect RF receive pin to Arduino pin 2 (INT0) or pin 3 (INT1)
#else
#error "May work, but not tested on this target"
#endif


void printReceivedData(OregonTHN128Data_t *data)
{
bool negativeTemperature = false;
static uint32_t rxCount = 0;
static unsigned long rxCount = 0;
int16_t tempAbs;
char msg[80];

Expand All @@ -48,7 +51,7 @@ void printReceivedData(OregonTHN128Data_t *data)
rxCount++,
data->rollingAddress, data->channel,
(negativeTemperature ? "-" : ""), (tempAbs / 10), (tempAbs % 10), data->lowBattery,
data->rawData);
(unsigned long)data->rawData);
Serial.println(msg);
}

Expand Down
Loading

0 comments on commit ddb1b5b

Please sign in to comment.