BernhardSchlegel / BierBot-Bricks

Beer brewing and fermentation control for homebrewers with a nice web UI for 25 bucks.
GNU General Public License v3.0
29 stars 10 forks source link

Support for Sonoff Basic #16

Open ksga opened 2 years ago

ksga commented 2 years ago

Support for ESP8285 based Sonoff Basic would be very simple to achieve. I made a custom build with a minimum of changes, and it works as expected.

Edited platformio.ini changing the env section as such: platform = espressif8266@2.6.2 board = esp8285 framework = arduino lib_deps = paulstoffregen/OneWire@^2.3.5 bblanchon/ArduinoJson@^6.17.2 WiFiManager=https://github.com/tzapu/WiFiManager.git ; commit f5dd402ba2698be17e27d357b1ead5291c3d0eb1 as of 04/12/2021 worked fine, see backup next line ;./dependencies/WiFiManager@f5dd402ba2698be17e27d357b1ead5291c3d0eb1.zip monitor_speed = 115200 board_build.flash_mode = dout board_upload.maximum_size = 786432 board_build.ldscript = eagle.flash.1m128.ld build_flags = -DSIZE_1M -DBUILD_NO_DEBUG -Os -s

and modified OneWire port in main.cpp: OneWire ds(2);

Easy enough for me to edit and build, but would be nice to see in the releases as well for the cheapos ;) (me....)

BernhardSchlegel commented 2 years ago

Hey ksga, thanks for reaching out! Can you provide a PR?

Thanks, Bernhard.

BernhardSchlegel commented 2 years ago

Hey @ksga, I noticed you forked the repo. I'd suggest you create a branch called 'feature/sonoff-basic-support' on your fork. And commit all your changes there! Thanks!

WireTownMan commented 2 years ago

I have also changed the one wire pin in Main.cpp to use pin 2, re-compiled and flashed a sonoff basic R1 with V2.0 hardware. It works without any issues. I suggest that either two versions of the firmware are compiled or the main software is updated to detect the OneWire pin the temperature senor is connected. Detecting the OneWire pin used for temperature would provide compatibility with many ESP8266 devices not just sonoff TH16

BernhardSchlegel commented 2 years ago

That's a great idea! Auto detecting the 1W pin is probably tricky. Maybe PIO has some built-in lookup tables which we can use, maybe as precompiler command?

WireTownMan commented 2 years ago

You don't have to check every pin for one wire, Sonoff only require gpio02 or gpio14.  Socket type wifi switches based on SWA1 hardware all use gpio14.

Checking for a temperature sensor on pins 2 and 14 would allow the firmware to work on a large number of esp8266 based devices.

⁣David KENT​

On 23 Jan 2022, 15:03, at 15:03, Bernhard Schlegel @.***> wrote:

That's a great idea! Auto detecting the 1W pin is probably tricky. Maybe PIO has some built-in lookup tables which we can use, maybe as precompiler command?

-- Reply to this email directly or view it on GitHub: https://github.com/BernhardSchlegel/BierBot-Bricks/issues/16#issuecomment-1019503219 You are receiving this because you commented.

Message ID: @.***>