Automated Coffee Bean Roaster

Roasting coffee beans at the push of a button

Similar projects worth following
Coffee? Great! Roasting your own beans. Even better. Building your own roaster and automating it all? Best?

For years I’ve toyed with the idea of roasting my own coffee beans, but it’s always fallen into the category of “Not another hobby I need to fall into”. After experiencing repeated bean disappointment while long-term travelling and serendipitously stumbling upon an old Hackaday post, I decided it was finally time. Obviously, the end result needed to be fully automated and both connected to my home automation system as well as able to run independently while travelling. It also needed to be cleaned up into something more akin to a consumer appliance rather than a Frankenstein creation.

Recently I came across this Hackaday article by Elliot Williams linked from a more recent post. I’d considered roasting my own coffee in the past using the air popcorn popper method, but avoided it as I didn’t need yet another hobby/interest to take up my time. But after having done a fair bit of travelling around the US in an RV and striking out every time we bought coffee, the serendipity of reading that article inspired me to take the plunge (and make a bit of a project out of it too).

I more or less followed the original build, subbing components I either could get or already had on hand. I opted for the popper I got, mainly because it seemed to be the most ‘name-brand’ while still being inexpensive. I was also hoping the actual components MIGHT be slightly better and that the particular model more likely to find again if I need to buy another (to hopefully avoid redesigning/printing the enclosure I was going to make). One change from the source post that I made was a safety one: the original just bypassed a thermal fuse on the popper to allow for higher temps, but I went ahead and added a higher-temp thermal fuse instead. A pack of them was inexpensive and it seemed like a wise choice to have as many safety mechanisms (both physical and electronic) as possible, considering the high temps it will be operating at (think the highest setting on your oven). I also decided to not just enclose all the electronic bits, but the roasting chamber as well. The high temperatures it would be getting to and the fact that I planned to let it do it’s thing unsupervised, I really didn’t want it exposed (especially with little-ones around). Because the temperatures are north of the nozzle temperature for most printing materials, I ordered some high-temp thermal blanket material to wrap it with and hopefully keep the PLA I planned to print the enclosure out of from getting soft.

For the brains, I went with an ESP32 and for the code I went with ESPHome to make it play extra-nice with Home Assistant. While I’ve used ESPHome for lots of ‘dumb’ connected devices, this was my first time using it to do automation and control all locally: the only thing I’m using Home Assistant for is to visualize the data and as a way to make small changes to the roast setpoints and tell it to start the actual roast. It just makes sense for this type of project to have all the control done locally and not dependent on a wireless connection, but I also specifically wanted the ability to operate it wherever (say in an RV in the middle of nowhere). At the end of the day, it was quite easy automating it within ESPHome (minus the crazy-particular indentation syntax of YAML), but it took me quite a while to fully realize how to write it (I originally went down the path of using a custom component and writing the automation in C++ before realizing how easy it is to do natively). Part of the reason I chose the ESP32 instead of an 8266 was because I wanted to use the Web Server component of ESPHome, that way I have a simple UI to interact with it when not at home; the documentation warns away from doing so on an 8266. This was extra-important as I was going to be having the ESP render everything locally rather than pulling templates from the web.

As far as physical IO devices, I settled on having 3 lighted buttons that would be used to initiate 3 different roast profiles (with the lights indicating which one is currently running) and a single Neopixel LED that changes color based on the current state of the roast or to alert to any errors. Obviously, I can pull out my phone or laptop to get ALL the data, but at the end of the day I wanted it to be very ‘set it and forget it’ once I found what I liked; the end goal was to pull the roaster out, add some beans, select the roast and walk away until my phone tells me that it’s done. As a starting point, I used the original roasting profile from Elliot’s post but making the code customizable on-the-fly. So while...

Read more »

coffee-roaster (redacted).yaml

My YAML file with any sensitive bits removed

yaml - 15.10 kB - 09/06/2022 at 18:55


Coffee Roaster.brd

Eagle Board File

brd - 144.70 kB - 09/06/2022 at 18:40


Coffee Roaster.sch

Eagle Schematic File

sch - 790.60 kB - 09/06/2022 at 18:40


View all 17 components

  • On The Road

    Ben Brooks10/23/2022 at 23:44 0 comments

    Finally took the roaster on the road and had some unexpected bad results; the ESP-32 kept seeming to randomly reset while in the middle or roasting. I initially thought the adjustable voltage regulator had dropped too low from it riding in the trailer while driving, but this proved to not be the case. Then it dawned on me... "I wonder if it times out when it can't connect to my Home Assistant instance?" Some quick googling and I confirmed that by default, ESPHome has a 15 minute timeout when it can't connect. Adding a single line to my 'code' to set this to zero fixed things and I've been successfully roasting coffee while on the road! Huzzah!

  • Exhaust Vent Upgrade

    Ben Brooks09/15/2022 at 16:14 0 comments

    While the weather where I live (central US) is currently pretty pleasant, it gets quite hot (and of even more import, quite cold) at times. Not really wanting to have to clear snow off of my table outside just to roast some coffee, combined with the fact that I'm not sure that the roaster could hit the proper temps having to heat COLD air, I decided a while ago that I wanted the option of roasting inside. While the extra heat isn't a problem in the winter (and the smell isn't particularly unpleasant), the chaff that comes off the beans makes a bit of a mess even when outside. A quick visit to a hardware store (and the salvaging of an extra soup can) as well as designing and printing up a simple slide to allow me to keep the window mostly closed and voila: I have a simple setup that allows me to roast inside but vent the exhaust air outside.

    As an extra bonus, it was able to achieve my roast temp more quickly/accurately than before (there's normally been a little slowdown in the temp rise as it gets close to the roast temperature). My guess is it's the reduced airflow due to not sitting it on an open table (the air inlets are on the bottom of the roaster) and/or the restriction of the vent hose. Regardless of the exact cause, it gives me more precise control over the roast which is an unintended benefit!

  • It's Alive!

    Ben Brooks09/03/2022 at 14:27 0 comments

    The enclosure finally finished printing yesterday afternoon, and the day before the PCB arrived in the mail! While printing the lids, I was able to install and wire everything up last night too.

    Soldered up the PCB last night while the enclosure finished printing

    While my initial test runs with no beans were less than great (I had to drop the fan speed to 4% to even be able to hit roasting temps), I decided to add some beans anyway this morning and give it a go even at the low fan speed. As expected, it didn't mix the beans very well at such a low speed and I actually ended up burning some before I even got to my 'pre-heat' temperature. I ended up bumping the fan speed to 65% and got much better mixing and went ahead and tried ramping it up to roasting temp; to my surprise, it didn't have any problems hitting it! Obviously having the beans in the chamber slowed the airflow down enough to allow it to hit temp, I just didn't expect it to make such a significant difference. Ended up getting a pretty decent/even first-roast and while waiting a day is 'how it's done' I couldn't resist brewing up a cup this morning. While it's not at the level of my favorite local roaster, it's WAY better than Folger's! I'll be curious how it tastes tomorrow.

  • Enclosure Designed

    Ben Brooks08/29/2022 at 18:31 0 comments

    Finished up my design for the enclosure. It's decent size, and while I'd considered breaking it into a couple of pieces (minus the obvious lids, etc.) it fits neatly on the bed of my CR-10s, so I opted for keeping it in one piece. Normally I tend to print these types of things in an exciting color, like black or gray. With this being both a large print and something that's more akin to a consumer appliance, I decided to buy a roll of filament just for it (Cura says it should take just over half a roll). Opted for a dark green color; once it arrives I'll start printing and hopefully not to long thereafter the PCB will arrive.

    In the meantime, I went ahead and printed the control panel piece. I opted to do so with translucent filament as the PCB will be underneath it: I'll use the integrated LED on the ESP32 to give me the status of the WiFi connection and it's also the part of the internals I wouldn't mind showing off a little. You can also see in the background that I printed a test piece for the fan/heater mount; glad I did this as I ended up tweaking it a little to make sure it fits well in the final print.

  • 'Code' Basically Done

    Ben Brooks08/21/2022 at 15:35 0 comments

    From the beginning, I had decided I was going to use ESPHome to control everything so I could have a pretty front-end and easily log data. Normally when I've done this, I've left the actual control to Home Assistant, but for this project I wanted all of the 'smarts' local. This is both because the automation is more involved and controlling mains power items (like a heater) and I explicitly want to be able to use it away from WiFi.

    I spent a lot more time than I'd care to admit trying to figure out how to write the code locally in ESPHome. I think I just really overthought things as in the end, it ended up being pretty easy (minus the maddening formatting issues of YAML). I got the general outline of a roast profile setup, with buttons and lights to indicate at what stage things are at. I also added some safety features/checks to shut the whole thing down if something unsafe occurs, such as too high of a temperature or the heater being on but not the fan.

    While I continue to wait for the PCBs to arrive, all that is left is to make a case for the whole thing. Shouldn't be complicated, but between the transformer, SSR, PCB and the actual roaster there's a decent bit of stuff I need to find a place for while keeping it compact and safe.

    I also got some high-temp insulation to wrap around the metal bits. Considered just leaving it exposed, but felt like having a bunch of metal and high temps readily accessible is probably a bad idea.

  • PCB Ordered!

    Ben Brooks08/17/2022 at 15:59 0 comments

    After tearing apart a popcorn popper and in general, 'making it work the way I want' with an ESP32, I was able to add my other 'wants' such as some buttons and lights and put together a schematic in Eagle.

    A few hours later and I had a PCB.

    Now I just have to wait for it to arrive in a few weeks. In the meantime, I've got plenty to do: both the 3D printed enclosure to clean everything up needs to get designed and I need to write the actual code for the roasting process. This last part is dead-simple in practice, but since I'm making myself use ESPHome to control the ESP32 I think it will be a little more involved (I've never used ESPHome for anything other than making simple sensors, etc. in Home Assistant). It LOOKS like I can use a 'Generic Custom Component' to essentially just write some code like it's a normal Arduino project, but we'll see if this is actually the case.

View all 6 project logs

Enjoy this project?



bgdas394 wrote 02/11/2023 at 16:45 point

We are the pioneers in making the best bean bags in town. We are delivering in  bean bags dallas and at the same time across the USA. 

  Are you sure? yes | no

Adam Demuri wrote 10/18/2022 at 02:24 point

This is a nice project, thanks for sharing! I'm working on my own roaster right now, and as your is well-built it is nice to see how you made it.

For mine, assuming I can get it working and polished enough, I plan to make a few for friends and family. So, I am paying a lot of attention to reliability and safety. As part of that, I'm using a dual-processor architecture: like you, I'm using an ESP32 for control and profile editing. But, I also have an STM32, which will run the control loop. This is probably overkill- the ESP32 does have a watchdog, and generally when I've had issues with them, they reboot, not hang. Still, it gives me a little more confidence, and I haven't designed a board with this type of architecture before, so I appreciate the learning opportunity.

One of the constraints for my build is that I want it to be quieter. How loud is your design, with your enclosure and insulation?

  Are you sure? yes | no

Ben Brooks wrote 10/23/2022 at 23:40 point

Thanks, I'm glad you've found the post helpful! In regards to safety, thus far I've found the various safeguards I implemented via code have worked well (maybe too well, as I have continued to tweak it, I've tripped them multiple times unintentionally).

As far as noise, it's definitely not 'quiet'. Since the guts are all using an air popcorn popper, if you've ever heard one of those it's similarly loud. Not really a concern for me since it's something that doesn't run super often or long. It also helps some, since I've either used it outdoors or have it vent outside.

Let me know if you have any other questions!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates