Saur0o0n / PIDKiln

Kiln PID controller based on Espressif Systems ESP32 chip board with Arduino IDE.
GNU General Public License v2.0
102 stars 38 forks source link

Please consider porting to PlatformIO ( Can provide assistance) #26

Open pyr0ball opened 1 year ago

pyr0ball commented 1 year ago

Given there's a number of library dependencies that are required for this project to work, and it seems versioning is also relevant among those dependencies, I think it's a good idea to start working under a PlatformIO project where dependent libraries can have fully automated installation and management.

I'm happy to help with this if desired! I was about to create my own fork with extra features as well, but wanted to make sure I'm sticking to a platform you, as the original dev, are comfortable with.

Saur0o0n commented 1 year ago

Fell free to commit platformio.ini file - I was working Code it with 3d printer Marlin fw, but somehow had not need to switch. Perhaps now is the chance ;)

pyr0ball commented 1 year ago

Okipokey! I'll carve out some time to do this next week.

I just finished assembling my custom controller PCB, so we'll see how it goes ;) image

Saur0o0n commented 1 year ago

I see MOSFETts - so this is for some low (like lower then kilowatts) power solution?

pyr0ball commented 1 year ago

those two fets are for fan control. I plan on having one cooling the SSR's heatsink, and another for maybe a recirculation fan (as this controller could also be adapted for something like a reflow oven)

I've also added an extra SSR and EMR output for kilns like one of mine that has dual independent coils. All of those outputs are opto-couple isolated.

There's also a header for running a Neopixel (WS281x) LED strip (mainly just for bling, but this could be used for status indicators or all kinds of other things)

The two 10-pin headers are basically just mapped for 3D Printer controller LCD's so any displays that work with that style of connection can theoretically be used. I've chosen to go with the RepRapDiscount Full Graphic Smart controller as they're prolific and cheap and use the same display as the one you're originally using.

Next rev adds 5x GPIO pins for other stuff like a door switch (mentioned by another user in a different issue) or could be used for external physical buttons, a case thermistor input, or even get tied in with a smoke/gas detector for automatic shutoff. I'm also planning on migrating the EMR gate pin to somewhere else so we can take advantage of the I2C bus and maybe get a little extra feature-ability like maybe some current detection IC's. Another thing I would love to add would be support for the SSD1309 displays as a secondary informational output showing things like the the actual heater coil resistance, current power metrics like voltage and wattage etc so that all can be tracked. I believe with that data I could add in a maintenance detection feature or a "remaining health" meter for the coils so the user knows when it's time to get them replaced.

Edit: While doing dependency resolution I finally got around to reading through some of the source and see you've already got it all set up for current monitoring so I'll just go and get that wired up in the next PCB rev! A few resistors and a cap will be enough to set up a CT coupled current sensor. I'd also like to set up a mains voltage meter which would also enable the controller to calculate out the heating element resistance by referencing the current and voltage.

Also noted you've got a second SSR output defined already so that's something I can just flip the switch on and enable already.

pyr0ball commented 1 year ago

@Saur0o0n would it be possible for you to open up a develop branch for me to do my pull requests against?

Saur0o0n commented 1 year ago

Hi, I've created platformio branch (https://github.com/Saur0o0n/PIDKiln/tree/platformio)

djObsidian commented 1 year ago

Wow, that's a great one PCB. I also designed my own, as a replacement for Rex C-100. изображение

Porting this project to PlatformiO is a good idea. But refactoring and splitting code into several files as for arduino IDE would take some time. I ported for myself by simply throwing all code into main.c and declaring all functions in main.h. Not really convinient for writing and editing code but compiles like 10 times faster than in Arduino IDE.

My platformio.ini looks like this. ESP32 in PIO is not still updated to Arduino Core 2.0 so it was a bit tricky to configure.


platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream
board = esp32dev
framework = arduino
platform_packages = framework-arduinoespressif32@https://github.com/espressif/arduino-esp32.git
lib_deps = 
    adafruit/Adafruit MAX31856 library@^1.2.5
    adafruit/Adafruit BusIO@^1.11.1
    Wire
    SPI
    br3ttb/PID @ ^1.2.1
    olikraus/U8g2@^2.33.2
    arcao/Syslog @ ^2.0.0
monitor_speed = 115200
pyr0ball commented 1 year ago

Well that's a heck of a lot of work you've already done! If you are up to doing a PR on that new branch with your current refactor, I can work on the file segregation while I'm adding the other features

djObsidian commented 1 year ago

I made a PR, you can check it out