Looking for an ESP32 based an Artisan-like sketch

Discuss roast levels and profiles for espresso, equipment for roasting coffee.

#1: Post by TheProgen »

I've seen a few TC4 emulator sketches floating around the internet but they either don't have the code which allows Artisan to send commands to control heater (also means no PID capability) or doesn't allow tabbing between Background and Manual.

It'll be nice to have manual control sometimes because I have a pot for heater control which I find easier than moving an on-screen slider or buttons.


#2: Post by randytsuch »

You can see what I did:
https://sites.google.com/view/coffee4ra ... ster/esp32

Except I've moved to a SCTO roaster, not using a air popper anymore.

With the SCTO, I'm using Artisan to manually set power levels. With the popper, I was using the Artisan PID function to set power levels.

I have a few push buttons, one sets manual control. But I never use manual control. For me, using the slider or buttons in Artisan works fine.
For the type of control you're describing, I'd add a switch that would let you control heat with your pot or with the ESP32.

BTW, all of the noise problems I describe went away when I moved to the SCTO. I'm sure they were from the popper fan.
I do have a problem where bluetooth drops sometimes, and temps go blank for a sec. But it doesn't impact the roast, and I have a LCD connected to the ESP32 I can look at for temps too.

And yeah, its hard to find ESP32 code that can receive Artisan commands, but it turns out to be pretty simple.


TheProgen (original poster)

#3: Post by TheProgen (original poster) »

Ahhhh, you're active here. I messaged you in Homeroasters about this very thing. I asked how difficult would it be to transplant the analog potentiometer and ability to receive serial commands code from aArtisan over to another sketch.


#4: Post by randytsuch »

My push button switches work well, using interrupts to handle buttons is key to getting good response.
Or you could put in a toggle switch to go between auto and manual. Now that I think about it might be better, lol. I had the push buttons sitting there so I used them.

Hook up a pot to an adc input, read the voltage from the pot and scale the pot voltage to control your power output. That's how I would implement the pot.
I control my heat power using a PWM output. On the artisan side, I use a 1-100 heat power scale, and then I rescale that to set the PWM output, works fine.
This bit of code does that
//set PWM for heater
PWMDutyCycle = map(dutyCycle, 0, 100, 1, MaxDutyCycle);
ledcWrite(HeatChannel, PWMDutyCycle);

I receive the serial commands over bluetooth. But you could receive over a serial port if you use a wired connection.
Find the routine called "void handleSerialCommand()"

That's where all the Artisan interfacing code is. If you use a serial port, change all instances of SerialBT to Serial, and it should work.
You also need to setup Artisan to send the heater commands as OT1. That is somewhat arbitrary, both sides just need to match.

If you were able to get an ESP32 to control a roaster and read temps, I don't think it will be hard to add this stuff into your project.

TheProgen (original poster)

#5: Post by TheProgen (original poster) »

The funny thing is I'm using an ESP32 with MAX6675s to send temperature readings to the laptop via Bluetooth and then an Arduino Uno loaded with aArtisan connected via USB is acting as a standalone controlling the SSR via ICC with the help of a ZCD board.

The reason I ended up like this is because haven't been able able to find a sketch with temperature, analog pot and ability to receive serial commands other than aArtisan and I'm totally dumb with coding which is very far from my recent jobs in veterinary surgery and gym personal training.

As for the switching, that's easy enough in Artisan. Just press P to toggle between Manual, Background and Ramp / Soak.


#6: Post by randytsuch »

Based on last post, to get this far you've copied other projects and your copies have worked.

So you really want something to copy here, but you can't find it.

At first glance, sorry, but I think you might be screwed.

Its not really that difficult to do what you want if you can do a little coding and some simple circuit design. But I doubt you're going to find exactly what you want, so it will take some customization to get what you want.

TheProgen (original poster)

#7: Post by TheProgen (original poster) »

Randy, are you still active here? I've been using my ESP32 and Arduino combo as mentioned in an earlier post for the past month but now the bug has bitten again and my shielded cables and Dupont pins have arrived so I decided to try copying your code and pasting it into the one that's on the ESP32.

I tried messaging you in private but kept getting this message about too much spam coming from Malaysia so I can't message anyone.

Hope it wasn't you reporting me for bugging you. :lol: :lol: :lol:


#8: Post by randytsuch »

I just returned from vacation, still around.

No idea why you can't send me a PM?

I assume you copied the last version I have of the code on gitlab.

Its obviously written for the hardware I used, and how I connected that hardware.

I expect if you don't have an LCD and buttons, the code won't care. I find the LCD nice to have.

Its also written for a TC4 type thermocouple interface board. I had one around from long time ago.