In this tutorial I'll show you how to build your own wireless reflow oven so you can assemble quality PCB's in your kitchen without having to worry about manually turning the knobs and worrying if your boards are getting too hot! Not only that but we'll be using the built-in Bluetooth Low Energy (BLE) functionality of the ESP32 (because what else would you use in 2018) as well as an add-on module I've built as part of an open-source reflow control ecosystem called "Reflowduino". We'll also be programming everything in the Arduino IDE environment and using what we've learned in a previous tutorial to control the reflow setup with a custom Android app. I've provided all design files, example Arduino sketches, demo app, and project wiki (lots of info!) on my Reflowduino Github page.
If you haven't already, please see this tutorial on using the ESP32's Bluetooth Low Energy feature with Arduino IDE and establishing two-way communication with a custom Android app because it has a lot of pertinent information related to what we'll be covering here. However, if you don't really care about the inner workings of the Bluetooth and app, just keep reading and I'll show you how to get your reflow oven setup working painlessly! My goal for this tutorial is to make it short and sweet while still getting the key messages across!
If you are a beginner in electronics or don't have the proper experience to work with mains voltage, I would suggest that you either don't mess with it, consult a professional, or keep learning until you're proficient enough! I am not liable for any mishaps that may occur due to misuse of the Reflowduino or its associated components or electrical system (including mains power). Take all safety precautions as necessary, such as gloves and certified safety glasses. Moreover, it is not recommended that you use the same appliance to reflow PCB's and also to cook food for consumption, which may result in food poisoning, especially with leaded solder. You are fully responsible for your actions, and perform them at your own risk!
With that, let's get started!
Step 1: Gather Parts
For this tutorial you'll need the following components:
- DOIT ESP32 development board
- Micro USB cable (to upload code and power the ESP32 dev board)
- Reflowduino32 "backpack" module for the ESP32 dev board
- Toaster oven (read comments below for more details)
- K-type thermocouple (included with Reflowduino32)
- Sidekick relay module (comes with a heavy duty C13 power cable)
- 2x male-male Dupont jumper wires (to connect the Reflowduino32 to the relay module)
- Small flat head screwdriver (for tightening the screw terminals)
The main ingredients here are the ESP32 dev board, Reflowduino32, and Sidekick relay module, and of course, the toaster oven itself. I'll briefly explain each item below:
ESP32 Dev Board + Reflowduino32
Currently the Reflowduino32 is designed to plug into the ESP32 dev board so the dev board needs to have the proper header spacing and pinouts in order for this to work. I've designed the Reflowduino32 backpack specifically for the "DOIT" ESP32 dev board since I noticed this was readily available online and seems to be widely used. However, if you do find another ESP32 dev board that has the same pinouts and pin spacing then please let me know because that should work as well!
It should be rather obvious what this does in the grand scheme of things but it might not be so obvious as to which type and model to pick. Personally I tested this cheap Walmart toaster oven which is rated at 1100W and is quite generic. I think anything above 1000W should be adequate for hobbyist use but there are certain considerations. The key things to look for in a toaster is the wattage (>1000W preferably), size (how many boards do you want to fit in it?), the tray configuration (does it have a nice, flat tray you can use to put the PCB's on?) and whether or not it's a convection toaster oven (maybe you'll be cooking larger batches of boards and want a more even temperature distribution throughout the oven?). All these factors really depend on your personal application but for me the cheap, generic Walmart toaster worked just fine. :)
You might ask, what about hot plates? In my opinion I'd steer clear of hot plates because they tend to have high thermal mass. What this means is that they will heat up and keep heating up even well after you turn it off. This makes it really unpredictable for precise temperature control because the temperature can overshoot by large amounts and potentially hurt any vulnerable components on your boards. Basically using a hot plate would defeat the purpose of using a reflow controller in the first place.
In order to control the temperature we need to control the toaster on and off according to the temperature we read from the thermocouple. However, the toaster oven is an AC appliance and is relatively high-power (with 120VAC toasters typically drawing about 8-10A) so we need to make sure we can properly drive it without overloading the relay. Another consideration is the control voltage of the relay. Most hobbyist relays (Arduino-compatible) capable of switching high currents are rated for 5V inputs but in this tutorial we're dealing with an ESP32 which operates on 3.3V. This means the average Joe relay module may not work for us. However, in case you do want to use a different relay module I've designed a feature where you can change the relay control voltage from the default 3.3V to the "VIN" voltage of the ESP32 dev board, which by default is ~5V when powered via USB. However, you could theoretically externally-power it with something higher than 5V, say 9V, and then the relay control voltage will be 9V. That being said, you won't normally need anything above 5V.
This is partly why I created the Sidekick relay module, a high-power solid-state relay capable of switching any legal 120VAC appliance and without any clicking noise (solid-state) like traditional relays! It also has very safe and convenient connectors and for easily connecting the appliance, microcontroller, and mains power (the AC wall outlet) so this is what I'll be using here. The cool part is you don't even have to open up the toaster oven to control it!
Step 2: Hardware Setup
Really, the concept is pretty straightforward: Ultimately our goal is to control the temperature inside the toaster oven. To do this we need to control the toaster oven on and off periodically with the relay module, analogous to PWM but a reallllly slow version of it (each time window is 2s, so it could be on for 1.5s and off for 0.5s). In order to drive the relay we need to give it a proper voltage on the relay control pins (logic HIGH = ON, LOW = OFF). In our case we simply connect the two relay control inputs to the Reflowduino32's relay screw terminal. The reason we're not directly connecting the ESP32 digital pins to the relay is because the relay draws a good bit of current (compared to what the IO pins can handle) and we don't want to overload the ESP32. The Reflowduino32 includes MOSFET low-side switching and can handle over 200mA of current, thus sparing the ESP32's pins from any potential damage.
Basically just follow the "Reflowduino32 + Sidekick Control" wiring diagram above and you should be good to go!
Toaster Oven Knobs
Believe it or not, this is a crucial section in this tutorial! If you don't pay attention here you will be wondering why your toaster isn't turning on even if you followed everything else perfectly. Why? Well, in order for us to control the toaster externally (via its power cord) without opening it up, we have to make the toaster as if it were always on if we were to plug it directly into the wall. Because the toaster is switched by the relay we can control when the toaster is off, but if the toaster is sometimes on or sometimes off when the relay is active then we're setting ourselves up for failure. This is why the first thing we have to do is set the knobs of the toaster. Most toaster ovens will have three knobs: one for the temperature, one for the bake setting, and another for the timer. What you need to do is the following:
- Max out the temperature (we don't want our reflow process to stop mid-way!)
- Set the cooking option to "Bake" or whatever makes all the heating filaments turn on inside!
- Max out the timer or, in the case of my toaster, turn the timer knob to "Stay on" so that it never turns off!
After doing this, plug the toaster's power cord into an outlet and you should hear and see it turn on. Bingo! If in case you fear that you will accidentally misplace the knobs, feel free to hot glue them in place so that they never move!
Now that our toaster is always on when powered, we can switch it on or off with the relay with the peace of mind that it will indeed turn on when the relay is active.
Here are just some notes that may or may not help you when putting everything together:
- The first thing you want to do is plug in the Reflowduino32 backpack into the first six pins of the DOIT ESP32 dev board (so that the screw terminals are on the same side as the micro USB on the dev board). In case you're wondering, the backpack is designed so that you can still insert Dupont wires into the ESP32 dev board adjacent to the Reflowduino32 as shown in the picture above.
- Another thing to take note of is the polarity of the relay inputs. They're both labeled next to the screw terminals but I want to spare you from accidentally swapping them and wondering what's going on when the toaster doesn't turn on!
- You also need to connect the thermocouple in the screw terminal on the Reflowduino32 backpack. At first it might be hard to see which wire is which color (yellow or red) so you might have to use your fingernail and gently peel back the insulation slightly. However, don't do this forcefully to minimize fraying!
- I've read from some people that you might get more accurate results if you thread the thermocouple into a scrap PCB such that the tip is contacting the surface of the PCB. A scrap board of similar size to the boards you're assembling will give the thermocouple comparable thermal mass and therefore make the readings more accurate. This makes sense if you think about cooling down; without the scrap PCB the thermocouple tip will cool down much quicker than the PCB's you're assembling, and the same goes with heating up much quicker.
- There's a power switch on the Sidekick relay module. If this isn't turned on the toaster ain't gonna heat up! However, for now just leave it off before we upload the code to the ESP32 board.
Step 3: ESP32 Arduino IDE Setup
Now that you have all the hardware set up, let's take a look at the software needed to get everything up and running.
Note: These ESP32 Arduino installation instructions below come straight from Step 2 of my previous ESP32 Bluetooth tutorial. This is one of those places where if you haven't already it might be a good idea to check out that tutorial to learn more about the ESP32's Bluetooth capabilities.
This is pretty obvious, but the first thing you need to do is install Arduino IDE. Enough said.
ESP32 Package Installation
The next thing you need to do is install the ESP32 package for Arduino IDE by following the Windows instructions or the Mac instructions. I will say that for Windows when the instructions tell you to open "Git GUI" you have to download and set up "Git" from the link provided and if you have a hard time finding an application called "Git GUI" then all you need to do is search "Git GUI" in the start menu and you will see a little command prompt-ish looking icon (see attached screenshot above). It's also located in "C:\Program Files\Git\cmd\git-gui.exe" by default. From there, follow the instructions and you should be good to go! Note: If you already have the ESP32 package installed in Arduino IDE but you didn't get it after BLE support was added to the package, I'd recommend going to "Documents/hardware/espressif" and deleting the "esp32" folder and re-doing the setup instructions above. I'm saying this because I ran into an issue where even after following the update procedure at the bottom of the instructions the BLE examples weren't appearing in the "Examples" under "Examples for ESP32 Dev Module" in Arduino IDE.
In Arduino IDE the first thing you should do is go to Tools / Board and select the appropriate board. It usually doesn't really matter which one you choose, but some things might be board-specific (typically the GPIO numbering and things like that) so watch out! I chose "ESP32 Dev Module" for my board. Also go ahead and choose the correct COM port after connecting the board to your computer via the USB cable.
In order to check if the ESP32 installation went well, go to File / Examples / ESP32 BLE Arduino and you should see several example sketches, like "BLE_scan", "BLE_notify", etc. This means everything is set up properly in Arduino IDE!
Now that Arduino IDE is all set up, test if it's really working by opening the Blink example under File -> Examples -> 01.Basics -> Blink and change all instances of "LED_BUILTIN" to "2" (the default GPIO number that controls the LED on the DOIT ESP32 dev board). After uploading the sketch you should see the blue LED blinking every second!
Step 4: Reflowduino32 Demo Sketch
Now that you have the ESP32 Arduino package installed, go to the Reflowduino Github repository and download the Reflowduino_ESP32_Demo.ino sketch. (When you try to open it Arduino will ask you if you want to create a containing folder with the same name as the sketch, in which case click "Yes" to open it). This sketch is a comprehensive reflow oven demo that reads the temperature from the thermocouple, periodically sends those readings to a custom Android app (mentioned in the next section), controls the relay (and ultimately the toaster) accordingly based on PID control, and receives commands from the app. All this on the ESP32! Pretty neat huh?
Now in order to compile this sketch you will need the following libraries:
Install these libraries and verify that the Reflowduino32 sketch compiles then upload it to your ESP32 dev board!
Near the top portion of the code there are a bunch of #define lines. These are things you can change according to your needs. For example, you might want the reflow temperature to be lower if you have low-temp solder paste, or higher if you have leaded solder paste. You will notice that I've included some typical values for the reflow profile and the default should work well with low-temp lead-free solder paste. You might also want to tune the PID constants later down the road depending on your physical setup (although this is probably not necessary). For more information on solder paste and reflow profiles please see this Github wiki page.
Step 5: App Setup
After uploading the demo sketch to your ESP32 you will need to install the Reflowduino32 Android app as the last step in getting our setup to work! Simply download and install the .apk file on an Android device with Bluetooth 4.0 or greater and open the app!
If Bluetooth isn't already enabled the app will ask you to turn it on. Make sure your ESP32 dev board is powered up and running the demo sketch. The first thing you have to do is connect to the ESP32 via Bluetooth on the app, then shortly after the button at the top left says "Connected!" you should see temperature readings appear on the screen if you connected the themocouple properly. If you don't, please check the thermocouple and make sure you have a secure connection in the screw terminal.
Now it's time to test the fun stuff! Flip the switch to the "on" position on the Sidekick module and press the "START" button on the app. The toaster oven's light should light up and you should hear the filaments make a faint rattling noise and eventually see them glow as they heat up! You should also see the blue LED on the ESP32 dev board light up to indicate the reflow process is underway.
As the reflow process continues you should see a nice reflow profile being graphed on the app. When the temperature reaches the reflow temperature a good practice is to open up the toaster oven door to let the heat escape so the board can cool down, otherwise the temperature will rise for some additional time. On the classic Reflowduino board there's a buzzer to alert you when to do this, but here you'll just have to judge according to the temperature displayed on the app which isn't hard.
After the board cools down to a certain threshold (40 *C by default but you can change this in the code) the reflow process will be deemed complete and the blue LED will turn off and the app will save the reflow data to a file on your phone so you can import it into Excel. For more info about importing the saved data to Excel please see this Github wiki page.
That's pretty much it!
Step 6: Conclusion
Check out the video above for how everything works together! It's a pretty straightforward setup and works great! I've assembled many boards using the same control method without any problem!
In this tutorial we learned how to build our own reflow oven using a common ESP32 dev board in conjunction with the Reflowduino ecosystem I developed, which includes the Reflowduino32 backpack module as well as the Sidekick relay module for the hardware and example Arduino IDE code for the ESP32 and demo Android app to display the data and communicate with the ESP32. All these combined make it easy and safe to control a toaster oven for a custom reflow oven build and getting it to work doesn't require extensive knowledge!
If you liked this tutorial please:
Thanks and happy tinkering!