Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions docs/12.HarddwareSONOFF.md

This file was deleted.

23 changes: 23 additions & 0 deletions docs/12.HardwareSONOFF.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
BrewPiLess can run on [SONOFF Basic](https://www.itead.cc/wiki/Sonoff) and [SONOFF TH10/16](https://www.itead.cc/wiki/Sonoff_TH_10/16). You will need to solder the header pins for the first flashing and install temperature sensors. However, because of the small 1M byte flash memory, you will either sacrifice
* OTA web update for log storage, or
* 500k log storage for OTA update
* LCD is not available.

SONOFF dual is not supported, because the Relays are controlled by Serial instead of GPIO.Instead, SONOFF Dual **R2** should work by specify correct PINs.

Please note that some older SONOFFs, maybe before 2018, use ESP8266 while new ones use ESP8285. Right configuration must be used.

### ESP32 SonOff devices (Sonoff TH Origin and Sonoff TH Elite)

For Sonoff TH Elite the built-in lcd display can be removed and a OLED LCD screen can be connected in it's place.. Use electrical tape to make sure that the LCD pcb is not touching the main pcb. The front glass is a thin plastic be gentle with it.

#### Conntecting sensor
The sensor that has the RJ9 connector comes with a controller in the wire that needs to be removed
Option 1: Remove the controller and reconntect the wires (not tested).
Option 2: Use `Sonoff AL010 2.5mm Audio Jack to RJ9 Adapter` with the old sensor using the audio jack conntector.

##### Connecting OLED LCD (optional)
* Connect SDA to WR solder pad
* Connect SCL to CS solder pad
* Use hotglue over soldered contacts so that you don't ripoff the solder pads accidentally.
* Connect 3v and Gnd to corresponding solderpads
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
* [Hardware Setup](10.HardwareGeneral.md)
* [Example#1](11.HardwareExample1.md)
* [SONOFF](12.HarddwareSONOFF.md)
* [SONOFF](12.HardwareSONOFF.md)
* [Thorrax’s Board](https://github.com/thorrak/brewpi-esp8266)
* [ESP32](13.ESP32Pins.md)
* [ESP32 Build](14.ESP32BuildInstructions.md)
Expand Down
22 changes: 21 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,27 @@ lib_extra_dirs = ${common_env_data.esp32_lib}
board_build.partitions = ./partition2.csv

build_flags =
-DOLED_LCD=true
-DOLED_LCD=true

monitor_speed = 115200
lib_deps = ${common_env_data.lib_deps_external_esp32}

[env:esp32-sonoff] # for newgen sonoff devices like sonoff elite and origin
platform = ${common_env_data.esp32_framework}
board = esp32dev
framework = arduino
board_build.mcu = esp32
lib_extra_dirs = ${common_env_data.esp32_lib}

board_build.partitions = ./partition2.csv

build_flags =
-DOLED_LCD=true
-DSerialDebug=false
-DEnableHumidityControlSupport=false
-DEanbleParasiteTempControl=false
-DEnableBME280Support=false
-DSONOFF_NEWGEN=true

monitor_speed = 115200
lib_deps = ${common_env_data.lib_deps_external_esp32}
Expand Down
7 changes: 6 additions & 1 deletion src/BrewPiLess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1702,7 +1702,12 @@ void handleReset()

void brewpi_setup()
{

if (SONOFF_NEWGEN) {
pinMode(sensorPowerPin, OUTPUT); // Power for sonoff temp sensor
digitalWrite(sensorPowerPin, HIGH);
pinMode(powerIndicatorPin, OUTPUT);
digitalWrite(powerIndicatorPin, LOW); // Red power led
}
#if defined(ESP8266)
// We need to initialize the EEPROM on ESP8266
EEPROM.begin(MAX_EEPROM_SIZE_LIMIT);
Expand Down
27 changes: 27 additions & 0 deletions src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@

#endif

#ifndef SONOFF_NEWGEN
#define SONOFF_NEWGEN false
#endif

#if ESP32
#define FS_EEPROM true
#endif
Expand Down Expand Up @@ -344,6 +348,21 @@
// pins
#ifdef ESP32

#if SONOFF_NEWGEN

#define PIN_SCL 17 // TM1621 CS
#define PIN_SDA 18 // TM1621 WR


#define oneWirePin 25

#define actuatorPin1 21 // This is relay 1
#define actuatorPin2 23 // TM1621 RD
#define actuatorPin3 5 // TM1621 DAT
#define actuatorPin4 24
#define actuatorPin5 26
#else // SONOFF_NEWGEN ends

#define PIN_SDA 21
#define PIN_SCL 22

Expand All @@ -356,6 +375,8 @@
#define actuatorPin4 27
#define actuatorPin5 26

#endif

#if MORE_PINS_CONFIGURATION

#define actuatorPin6 18
Expand All @@ -368,14 +389,20 @@
#else
#define BuzzPin 18
#endif

// 34,35,66,39 input only
#define rotaryAPin 32
#define rotaryBPin 33
#if SONOFF_NEWGEN
#define rotarySwitchPin 35
#else
#define rotarySwitchPin 25
#endif

// Only ADC1 (pin 32~39) is allowed
#define PressureAdcPin 36


#else // #ifdef ESP32
#define NODEMCU_PIN_A0 17 // Analog

Expand Down
15 changes: 15 additions & 0 deletions src/Pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,21 @@
#define fridgeSensorPin 11
#endif
#endif

#if SONOFF_NEWGEN
#ifndef powerIndicatorPin
#define powerIndicatorPin 16
#endif
#ifndef relayIndicatorPin
#define relayIndicatorPin 13
#endif
#ifndef wifiIndicatorPin
#define wifiIndicatorPin 15
#endif
#ifndef sensorPowerPin
#define sensorPowerPin 27
#endif
#endif
// Pay attention when changing the pins for the rotary encoder.
// They should be connected to external interrupt INT0, INT1 and INT3

Expand Down
10 changes: 10 additions & 0 deletions src/TempControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "EepromManager.h"
#include "TempSensorDisconnected.h"
#include "RotaryEncoder.h"
#include "Config.h"

TempControl tempControl;

Expand Down Expand Up @@ -77,6 +78,9 @@ uint16_t TempControl::waitTime;
#endif

void TempControl::init(void){
if (SONOFF_NEWGEN) {
pinMode(relayIndicatorPin, OUTPUT);
}
state=IDLE;
cs.mode = MODE_OFF;

Expand Down Expand Up @@ -398,6 +402,12 @@ void TempControl::updateOutputs(void) {
heater->setActive(!cc.lightAsHeater && heating);
light->setActive(isDoorOpen() || (cc.lightAsHeater && heating) || cameraLightState.isActive());
fan->setActive(heating || cooling);
if (SONOFF_NEWGEN && (heating || cooling)) {
digitalWrite(relayIndicatorPin, LOW);
}
else {
digitalWrite(relayIndicatorPin, HIGH);
}
}


Expand Down
11 changes: 10 additions & 1 deletion src/WiFiSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <nvs.h>
#include <nvs_flash.h>
#include <ESPmDNS.h>
#include "Pins.h"
#endif

//needed for library
Expand Down Expand Up @@ -83,7 +84,9 @@ bool WiFiSetupClass::isApMode(){
void WiFiSetupClass::begin(WiFiMode mode, char const *ssid,const char *passwd,char const* targetSSID,const char *targetPass)
{
wifi_info("begin:");

if(SONOFF_NEWGEN) {
pinMode(wifiIndicatorPin, OUTPUT); // Blue Wifi led
}
if(targetSSID && targetSSID[0]){
if(_targetSSID) free((void*)_targetSSID);
_targetSSID=strdup(targetSSID);
Expand Down Expand Up @@ -192,6 +195,9 @@ String WiFiSetupClass::status(void){

bool WiFiSetupClass::stayConnected(void)
{
if(SONOFF_NEWGEN) {
digitalWrite(wifiIndicatorPin, HIGH);
}
if(WiFi.getMode() == WIFI_AP || WiFi.getMode() == WIFI_AP_STA){
dnsServer->processNextRequest();
// if(_mode == WIFI_AP) return true;
Expand Down Expand Up @@ -342,6 +348,9 @@ bool WiFiSetupClass::stayConnected(void)
} // WiFi.status() != WL_CONNECTED
else // connected
{
if(SONOFF_NEWGEN) {
digitalWrite(wifiIndicatorPin, LOW);
}
if(_mode == WIFI_AP){
DBG_PRINTF("Connected in AP_mode\n");
}else{
Expand Down