Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modification ideas: ESP8266; rotary encoder #1

Closed
maximweb opened this issue Oct 4, 2024 · 13 comments
Closed

Modification ideas: ESP8266; rotary encoder #1

maximweb opened this issue Oct 4, 2024 · 13 comments

Comments

@maximweb
Copy link

maximweb commented Oct 4, 2024

Hi there,

I am currently in the process of upgrading my MK4(soon to be S) with MMU3 and the (un)original heated drybox. When scouting for possible modifications, I saw your very interesting mod.

I have some ideas for further modifications, which I hope are worth sharing.

Switch from Arduino to ESP8266

Your images indicate that you are using Shelly products to log the temperatures, and it somewhat looked like Home Assistant. Hence, I was thinking about replacing the Arduino with a wifi-capable ESP8266/NodeMCU. This could then push all the sensor data to a self-hosted MQTT server enabling logging and live review of the heater's performance without the need of additional Shelly hardware. (I've some working not-yet-published code for ESP8266 and MQTT, which I could contribute.)

Replace some buttons with a rotary encoder

Another tweak I can think of, vastly improving flexibility, is to replace some of the buttons with a rotary encoder. This gives significant more flexibility and allows to built an entire menu structure. In addition to setting the target temperature, this would also allow to adjust multiple settings, currently hardcoded.

I would love to get your take on my suggestions. It might take some weeks until I have all the default parts for the enclosure ready, but I am willing to contribute some code, as I have helpful bits and pieces already lying around on my harddrive somewhere.

@maximweb maximweb changed the title Modification ideas: ESP8266; encoder; DS18B20 temperature sensors Modification ideas: ESP8266; rotary encoder Oct 4, 2024
@WernerKr
Copy link
Owner

WernerKr commented Oct 4, 2024

I was thinking about replacing the Arduino with a wifi-capable ESP8266/NodeMCU

I had this idea too and have even bought an Arduino Nano ESP32 with Headers [ABX00083] – ESP32-S3, USB-C, WLAN, Bluetooth, HID support, MicroPython compatible
But I haven't done anything with it yet.

Shelly products to log the temperatures, and it somewhat looked like Home Assistant.

Yes. The Selly plus 1 with Add-on plus is a device in Home Assistant und here I can log the temperatures of (un)original heated drybox.
Why Selly?
Is an independent device outside the dry box, i.e. not exposed to high temperatures,
the DS18B20 sensor can measure temperatures of up to 125°C and can switch off the voltage
from the heating element in the event of overheating without an additional device.
It is important that the fans continue to run.
The Shelly is only intended for additional security.
Is currently available for recording temperatures, as I have not found any other way to record such high temperatures and transmit them for evaluation

I have tried to use the DS18B20 sensors directly now as well.
They are not recognized, but they work because they are recognized by the Shelly.
I haven't yet found out the reason for this.

Replace some buttons with a rotary encoder

I think this is a prerequisite for further expansion.

I think your suggestions are excellent

@maximweb
Copy link
Author

maximweb commented Oct 4, 2024

I was thinking about replacing the Arduino with a wifi-capable ESP8266/NodeMCU

I had this idea too and have even bought an Arduino Nano ESP32 with Headers [ABX00083] – ESP32-S3, USB-C, WLAN, Bluetooth, HID support, MicroPython compatible But I haven't done anything with it yet.

I just looked it up, didn't realize that there is an Arduino ESP. Must have missed that, thanks. I have a bunch of different versions of ESP8266 board, though. My last attempt to MicroPython was some years ago, and I had trouble getting it work reliably. But I never revisited it since. For such possibly dangerous applications, I would always opt for Arduino (C/C++) code.

Shelly products to log the temperatures, and it somewhat looked like Home Assistant.

Yes. The Selly plus 1 with Add-on plus is a device in Home Assistant und here I can log the temperatures of (un)original heated drybox. Why Selly? Is an independent device outside the dry box, i.e. not exposed to high temperatures, the DS18B20 sensor can measure temperatures of up to 125°C and can switch off the voltage from the heating element in the event of overheating without an additional device. It is important that the fans continue to run. The Shelly is only intended for additional security. Is currently available for recording temperatures, as I have not found any other way to record such high temperatures and transmit them for evaluation

Thank you for the info, I had not really thought about the electronics overheating. Maybe I opt for moving all electronics to the outside of the box. Maybe next to the PSU.

I have tried to use the DS18B20 sensors directly now as well. They are not recognized, but they work because they are recognized by the Shelly. I haven't yet found out the reason for this.

DS18B20 can be tricky. They easily damage when connecting them in the wrong way. In addition, they are very picky regarding the value of the pullup resistor on the data line. Some reference code from one of my projects.

@maximweb
Copy link
Author

maximweb commented Oct 8, 2024

I hope it's ok that I hijack this issue to report my latest findings and progress.

I've read your notes regarding the temperature distribution being poor without additional external fans.

Hence, I had a look at the duct I believe you are using.

I think the design of the duct has two flaws, which when fixed, might make the additional fans unnecessary. The original design divides the entire cross section in three even sections. The outer ones direct the hot air sideways and the central one downwards. The flaw I see in this is that the cross section of the duct includes the black plastic frame of the heater, while the air from the fans solely flows through the metal parts.

This results in most of the hot air flowing in the central section and hence downward, whereas only a small portion of air is taking the outer section directed towards the sides.

duct original flaw

Therefore, I am in the process of redesigning the duct with the following changes:

  • significantly decrease the width of the central section, directing more air towards the sides
  • widening the entire base of the duct, placing the side outlets further apart.

Here a sneak peek:

duct redesign sneak peek

So far, I have only printed in PETG as design test. Running the fans without heating, I can confirm that most of the air is exiting the duct sideways. As of yet, I never printed with Nylon and still waiting for my order to arrive. I hope i get this printed without warping.

PS: I also ordered an Arduino Nano ESP32. Some more printing of basic frame parts to do, before I can start coding.

@WernerKr
Copy link
Owner

WernerKr commented Oct 8, 2024 via email

@BugsBunny1403
Copy link

I'm going to follow with interest the progress of this idea to use an ESP 32, it would indeed allow to have the management of the basic functions plus an efficient log on MQTT.

@maximweb
Copy link
Author

maximweb commented Jan 1, 2025

@BugsBunny1403 Working on it, but nothing published, yet. The additional temperature sensors gave me trouble so I pushed it aside for a while. But two days ago I finally fixed this.

Just a sneak peak what already works on my breadboard:

  • use of Arduino Nano ESP32
  • moved to VSCode and PlatformIO for development
  • SSD1306 128x64 display
  • DHT2? temperature and humidity sensor
  • 3x DS18B20 temperature sensors (one for duct, two for drybox front)
  • rotary button encoder with differentiation between short press, long press, double press (replaces two buttons)
  • WiFi connection

Missing:

  • push button wiring
  • heater & fan wiring
  • controller code
  • menu code
  • MQTT code for Home Assistant

@WernerKr Sorry to highjack your project. Wasn't sure if you were actively working on a switch to ESP32. If you are interested in collaborating, I am willing to clean up my code and publish it even before its finished.

@WernerKr
Copy link
Owner

WernerKr commented Jan 2, 2025

Sorry to highjack your project.

No Problem!

I tried to query DS18B20 temperature sensors with the "normal" Nano, but was unsuccessful.
After that, I didn't have time to worry about why.

I have already seen MQTT with Home Assistant:
For example, use HomeAssistantEntities and MQTTRemote

Why "moved to VSCode and PlatformIO for development" ?

and publish it even before its finished

I would be very interested in that

@maximweb
Copy link
Author

maximweb commented Jan 2, 2025

Sorry to highjack your project.

No Problem!

I appreciate it 🥇

I tried to query DS18B20 temperature sensors with the "normal" Nano, but was unsuccessful. After that, I didn't have time to worry about why.

I've used them before, but struggle time and time again.

I have already seen MQTT with Home Assistant: For example, use HomeAssistantEntities and MQTTRemote

Did this before with an ESP8266. So I hope this will be an easy task.

Why "moved to VSCode and PlatformIO for development" ?

I don't like the Arduino IDE and I am used to VSCode. It is my first attempt with PlatformIO and it seems to work quite trouble-free.

and publish it even before its finished

I would be very interested in that

I've published my current state, but it is far from complete: https://github.com/maximweb/drybox-esp32

At the moment I am still working on various individual parts. Still some way to go before putting everything together.

@WernerKr
Copy link
Owner

WernerKr commented Jan 6, 2025

My Testversion for Home Assistant and MQTT support is now ready - are Arduino IDE files!
see drybox_Home_Assistant_MQTT - Hardware Arduino Nano ESP32-S3

@WernerKr
Copy link
Owner

WernerKr commented Jan 7, 2025 via email

@maximweb
Copy link
Author

maximweb commented Jan 7, 2025

What was/is the solution to the problems with the DS18B20 sensors?

The standard things:

  • I use the OneWire and DallasTemperature libraries
  • The data line needs a 4.7kOhm pullup resistor (for long cables in the tenth or hundred meters: use less)
  • DS18B20 is allergic (damages easily) when GND and VCC pins are swapped, so take extra care to check

Nano ESP32 specific

  • There is something called pin-remap for the Nano ESP32. It seems the OneWire library required for DallasTemperature does not (yet)support this. This meant i had to use the GPIO pin number for it to work.
    • I am still not entirely sure how the remapping works, but OneWire always needs a GPIO pin number.
    • This can lead to conflicts when pin remapping is disabled: Never use Dx names for pins and pure numbers combined.
  • I had to set pinMode(<your pin>, OUTPUT) explicitly for the data pin, despite it being used as combined input and output. This is probably related to the remapping issue.

@WernerKr
Copy link
Owner

WernerKr commented Jan 8, 2025 via email

@WernerKr
Copy link
Owner

Since the switch to the Arduino Nano ESP32 is now complete and the data also arrives at Home Assistant both without additional DS18B20 and with this temperature sensor, I now close here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants