This project did not start as a toaster eventually it become one.
The idea come when my kitchencomputer (an old Windows CE PDA) which was used to display my cooking recipes died. First I was thinking on creating an E-ink based low energy display which would be fixed on my fridge with magnets and would run off from batteries for a very long time but then I got an old 2.1 surround system to the kitchen for listening music as well so I was thinking maybe it should be a computer which could do both as well and then another old project come to my mind:
The original NetBSD toaster. This project by itself is a geek joke, for those who don’t know:
“It has long been regarded that the UNIX-like OS NetBSD is portable to every type of machine except perhaps your kitchen toaster.”
So then let’s create a toaster which is running NetBSD and:
- The temperature and toasting time is completely fine adjustable by the user
- While it is not toasting it displays weather data from 2 weather stations on a stylish dashboard
- When it is toasting it displays the remaining time and temperature on both a graph and in digits
- When it is not toasting it can also be used as an alarm clock and listening music, even playing movies on it
- Displays cooking recipes or can be used for regular browsing
Step 1: Toaster Operation and Choosing the Hardware
Here, unlike at my previous coffee hack, I don’t believe I made a great choice for toaster so I will give a brief introduction of toaster’s inner working, choosing criteria and experience on my own and let the reader choose his/her own toaster for this hack.
One of my main criteria towards the toaster was to be able to make 4 slices of bread simultaneously and be automatic so after couple of hours of skimming through the German Ebay, I have decided next to the
Severin AT 2509 (1400W) toaster.
This is a wide spread brand in Germany, it cost around 40-50 EUR at the time of writing as brand new.
Key features what the manufacturer advertises:
● Heat-insulated stainless steel housing
● integrated roll roasting attachment
● 2 long slot roasting shafts for up to 4 bread slices
● Roasting time electronics with temperature sensor
● adjustable tanning degree
● Defrost level with indicator light
● Warm-up stage without additional tanning with control light
● separate release button with indicator light
● Bread slicer centering for the even browning of both loaf sides
● automatic shutdown when a bread disc is jammed
● Crumb tray
● Cable rewind
Although the manufacturer did not claim that the temperature is adjustable, they make 2 misleading points:
● Warm-up stage without additional tanning with control light
● Roasting time electronics with temperature sensor
To cite these claims let’s see how the machine operates:
1, In normal state the 230V main is completely disconnected, no part of the toaster is powered.
2, When the user pulls down the lever (which also pulls down the breads), it connects the heating element on both sides.
Now what they did here is a cheap but also clever design. There is no transformer inside the toaster so you might wonder how does it getting its low (10V AC ~) voltage then. There is a separate coil coupled with one of the heating element on the left side of the toaster acting kind of like a step-down transformer creating 10V AC .
Then it uses a single diode rectifier to create 10V DC which is powering the toaster’s main control board.
3, What I first thought – that it is a solenoid + transformer together - turned out to be a single solenoid right under the lever which is now powered by the control circuit and responsible for one thing only (to keep that lever pulled down).
As soon as this solenoid releases the bread it’s all over, the toaster is basically cutting its own electricity off thereby finishing the toasting process.
So you could then rightfully ask what are those fancy buttons and claims on the datasheet that it can defrost, preheat, warmup and whatever… I would say it is pure marketing BS. They could put a time adjuster and 1 single button on it because at the end of the day this circuit is nothing more than a timer. Since this circuit is feeding from the same power source as the heating element and it cannot control the only thing which matters in this machine (the heater) therefore I didn’t even bother further modding this circuit, just tossed it where it belongs, to the trash can.
Now that the military-grade control circuit is out of the way let’s take FULL CONTROL over the toaster.
Step 2: Hardware List
This is again not full bom, does not include all basics like wires and screws:
- 1x AT 2509 (1400W) toaster or whatever other toaster you choose
- 1x Arduino Pro Micro
- 1x 5-inch Resistive Touch Screen LCD Display HDMI for Raspberry Pi XPT2046 BE
- 1x Raspberry PI 2 or Raspberry PI 3
- 1x SanDisk 16GB 32GB 64GB Ultra Micro SD SDHC Card 80MB/s UHS-I Class10 w Adapter (for the PI)
- 2x SIP-1A05 Reed Switch Relay
- 1x 1PCS MAX6675 Module + K Type Thermocouple Temperature Sensor for Arduino (recommended to buy spares)
- 1x Output 24V-380V 25A SSR-25 DA Solid State Relay PID Temperature Controller
- 1x Mini DC-DC Buck Converter Step Down Module Power Supply For aeromodelling (buy more of these for replacements).
- 2x Rotary Encoder Module Brick Sensor Development Board For Arduino (Rotary + Middle Switch, recommended to buy more of these for replacements)
- 2x WS2812B 5050 RGB LED Ring 24Bit RGB LED
- 1x 1mm A5 transparent Perspex acrylic sheet Plastic Plexiglass Cut 148x210mm Lot
- 1x12V 2A DC adapter (1A should also be enough for the Pi+Screen+Ardu but it’s better going for sure in case you will connect additional devices through USB they will drain extra current)
- 1x PCS HC-SR501 IR Pyroelectric Infrared IR PIR Motion Sensor Detector Module
- 2x Jumper Wire 5 Pin Female to Female Dupont Cable 20cm for Arduino( for the rotaries, it worth to buy more of these)
- 2x Aluminium Alloy Volume Knob 38x22mm for 6mm Potentiometer Shaft Silver
- 1x 230V relay
- Bunch of Single Row Female 2.54mm + Male Breakable Header Connectors for the connections
- Optional for Xbee mod: 1X10P 10pin 2mm Female Single Row Straight Pin Header Strip XBee Socket
- Optional for Xbee mod: 1 Xbee
- Optional for Xbee mod: 1x Jumper Wire 4 Pin Female to Female Dupont Cable 20cm for Arduino (between Xbee <> Raspi)
For power supply you must use a 12V instead of 5V because the solenoid will not hold on that low voltage level, do not forget to add a flyback diode on the solenoid.
If you decide to use other components, eg.: different buck module for voltage stepdown from 12V->5V you have to redesign the board, it was made for that one specific small square buck converter.
Step 3: Modding the Case: Back Is the Front
After removing the main control circuit there was still a big ugly hole looking out at the place of the switches so I have decided I will just use that side as the back and fixed up the junction box housing the SSR (Solid State Relay -> for heating control) + 230V AC relay (for power detection) + the 12V adapter powering the whole circuit.
This toaster model was kind of difficult to disassemble and reassemble. I found no other way to remove the case but cutting in with a dremmel right under the main pull down lever to be able to liftup the casing after the unscrewing and removing the levers (fortunately since there is an outer plastic coating in place on that part this will be unnoticeable).
I have inserted the detector end of the MAX6675 thermocouple at the bottom of the toaster on the opposite edge to the main lever (where it would be in conflict with the lever mechanism).
The inside case is fine aluminium you don’t even need to drill it, a small hole can be easily widened with a screwdriver then putting in the sensor, the tricky part was to counterscrew it from the inner side. I have to come up with a clever solution to do so, shown in the pictures.
Taking apart the main internal toaster casing with the heating element is only for people with strong nerves and highly not recommended. There is nothing else you need to do in there anyway.
The MAX6675’s wires was just long enough to be easily feed through the bottom of the machine to the hole where the cables were lead out.
Bringing all the necessary cables from one and to the other was one of the most challenging modding task. I did not have to drill another hole on the (now back) side because the cables could just use the hole from the switches. Then the cables needed to be fixed up to the wall of the case, taken down to the bottom through a very narrow space where they get joined together with couple of extra wires from the high voltage control board, namely:
- 1 wire from the heating element -> Goes to SSR
- 1 wire from the 230V (preferably hot brown point) -> Goes to SSR
- 2 wires from the 230V with switch closed state -> Goes to Start Relay
- 2 wires from the 230V main in -> Goes to 12V adapter at the back
- Shielded wires from the thermo-sensor
And that is all you need to control the toaster.
Due to the industrial soldering I have decided to simply cut the wire between the heating element and one end of the main (coming after the switch) and with terminal strips I connected it to the SSR.
A relay operating from 230V (the mains voltage) will be required. This is the start relay which will let the Arduino know that the user have pulled down the lever aka started the toasting process. Don’t forget that the control circuit is no longer in place anymore, the solenoid is not getting power what would hold the lever down and the heater is disconnected as well (controlled through the SSR). All of this will be the Arduino’s task from this point on.
The 12V DC adapter is wired directly to the main (I have added an extra ON/OFF switch at the back). This will provide constant power for the circuit. The toaster on standby mode is only consuming : 5.5 W with the screen ON and 5.4W with it's off.
Step 4: Front Arcyclic Board
I am not an expert in working with this material, I got the advice to cut the holes on it with high rpm dremmel under running water but I didn’t want to over-perfect it so what I did was just to drill in the regular holes, completely give up with dremmeling out the part between the Raspi and the screen, instead I drilled holes only at the spacers of the screen and at the connector of the Raspi then I filed out the remaining substance to a square for the connector to fit through.
You can see that the plexi board has tiny cracks around some drillings, so you know what to avoid if you aiming for perfect design.
Nevertheless because of the heat, there is no way that you could put anything inside the case of the toaster, all the electronic must be mounted up in a safe distance from the heater.
I did not make any proper design drawings for the 148x210mmPlexiglass sheet, just tried to adjust everything to be symmetric and in line so I apologize that I cannot provide any scheme for this part you have to do it on your own. However I have 1 advice:
Before gluing up the LED rings, turn them on with an Arduino and light up and mark with pen the FIRST and LAST led on the back so you don’t end up with mounting them slightly rotated like I did (however this is correctable from software).
There are 6 spacers designed to hold the whole front panel in place, however at the end because the short length of the rotaries the 2 bottom ones are not feed through the panel.
I have used regular PC motherboard spacers between the rotaries and the plexi panel, also added 2-2 more behind the rotary to give some additional stability when the buttons are pushed in.
Step 5: Toaster Control Circuit
This was one of those projects which actually maxed out ALL Arduino pins :) the RX and TX were reserved for future communication module extension.
The main circuit board provides power for everything through a buck converter (Arduino, Raspi, Screen, SSR, Relays). Here I would note that this voltage regulator is not exactly state of the art, it cannot go over 12V DC incoming voltage too much. If you decide to use exactly the same type make sure that your adapter is providing a stable 12V open circuit voltage (not like a WRT54G adapter, with that you will see the magic smoke escaping in seconds).
I made the board modular as possible, using sockets where I could. Beyond the 2 reed relays everything else can be easily replaced.
Both of these excellent reed relays come with built in flyback diodes and consume no more than 7mA so they can be directly connected to any Arduino pins (I will keep recommending these in my future projects as well). The function of the relays:
One is for turning on the solenoid at the beginning of the toasting process (to keep that lever pulled down).
One is for automatically turn on and off the screen in case of motion is detected.
I figured that running that HDMI screen 24/7 would not provide a long lifespan (especially what I am using is just a cheap counterfeit, not the original WaveShare: https://www.waveshare.com/wiki/5inch_HDMI_LCD).
And also can your PC turn on the screen when you enter the room? I don’t think so, the BSD toaster can!
The screen is basically on a 10 minutes hold timer which gets automatically bumped up any time there is motion again. So let’s say it turned on and there is motion again 9 minutes later, that means that it will stay on for an additional 10 minutes. Turning on and off is not healthy for any circuit except the SSR.
Which brings us to the 3rd and last control element for controlling the heater. These little devices were specifically made for turning on and off a lot to keep the temperature under control. What I choose will run just fine directly from an Arduino output pin.
In the original design there would have been another relay on the board for turning on a 2.1 speaker set before the Raspberry pi plays the alarm tone at the morning (also it’s very easy to add a song when toasting finishes) but since this is IoT why bother? It just asks another raspi on my network to do that for me with a standard 433Mhz RCSwitch.
As usually there were some smaller errors with the 0.4 version of the board, what can be seen on the pictures. Namely 2 more 5V connectors and a connector for input relay on Arduino pin 10 was left out.
I have corrected these in version 0.5 and I also made a non-Xbee version.
Since this is a 2 layer board just by downloading these layouts and DIY would be difficult, you would need to print the 2 sides precisely, etch the board and find a way to connect the sides so I will link in later on the Easyeda shared project. It is recommended to order it directly from them.
Step 6: Xbee Mod
The Xbee is only here to control the coffee maker directly through it because it’s relatively close to it in distance and there are no obstacles between the two.
It has absolutely nothing to do with the toaster or the toaster code.
About the Xbee mod: this is completely optional, that is why I include the schematics for this board with and without the Xbee. The Xbee is directly soldered into the Raspberry PI’s RX/TX hardware UART port (ttyAMA0) which is although taken out to the screen’s connectors, the screen is not using it (it uses SPI interface to communicate the touch coordinates between the PI and itself).
I dedicated a separate serial port on the PI for the Xbee communication instead of passing the messages through the Raspberry -> Arduino -> 5v3v converter -> Xbee -> other devices. This way it is also not an issue that the toasting process is blocking the whole MCU.
Step 7: Toaster Control Code
The code is fairly simple which is due to the fact that there is basically a one way communication between the Arduio -> Raspberry PI.
This device unlike the coffee maker cannot be controlled from a phone or computer just manually with some fancy controls.
The only function of the PI here is data logging and displaying nice graphs. It is not vial for the toaster’s operation, it can be completely turned off or even removed from this project, the Arduino does all the work.
At the beginning the code resets the led rings, starts the various hold timers and in each loop it is looking from input from the 2 rotary switches. This input can mean a rotation to clockwise or anti-clockwise or push of any of the 2 switches (which in idle mode just sends a basic command IRONFORGE_OFF_ALARM to the computer then sets back to normal IRONFORGE_OFF state).
Inside the rotary_read_temp() and rotary_read_time() will the global_temp and global_time variables be changed. This is the ONLY place in the code where these values can be changed and they will store their values between toasting events.
Inside both of these functions the rotary_memory() called once change in the positions is detected. This is for the purpose of loading back the led statuses on the rings because after the toasting process they will be reseted back to black, not to waste power and lengthen their lifespans.
The LED lights are also turned off periodically in every 10 minutes in case there was no recent rotary event.
The conjunction of these 2 functions will result the following:
1, Assuming idle state
2, Any of the rotaries moved (if they were adjusted before, these value(s) will be restored from memory and displayed on the leds)
3, If the toasting process does not start and there is no more adjustment events the lights will black out again
I also moved them on separate hold timer from the screen because the computer will be used a lot to display weather data but I don't want the rotary LEDs to be restored all the time because I don't want to make a million toasts a day.
The main toasting process (Arduino Side):
This will be initiated when the system gets triggered from the input start (230V) relay (and both the time and temp are different from zero). The program flow is the following on the Arduino side:
1, Turn on Solenoid for holding down the lever
2, Turn on SSR for heating up
3, Depending on the time start a toasting loop which counts down. In each loop send the following data to the computer:
-TEMPERATURE (originally floating point value but being sent as 2 CSV strings)
-TIME remains (in seconds, this will be converted back to mm:ss format on the other end)
4, In each loop depending on the set temperature turn on or off the SSR to control the toasting process
5, At the end of the toasting loop the IRONFORGE_OFF command will be sent to the computer
6, Turn off SSR and release the solenoid
7, Play LED game for showoff (here you can also add play music or whatever other action you would like)
8, Blackout leds
As I said it earlier the main toasting loop is completely blocking the MCU, no other tasks can be done during this time. It will also ignore rotary inputs in this time period.
The main toasting process (Raspberry PI Side):
The raspberry pi runs the head C control program with an unprivileged user which is responsible for all the interactions on the desktop.
I decided to use Conky for all the graph displays because I using it since a decade and it seemed like the easiest to use for the job however it have some catches:
-Graph granularity cannot be changed, the graph is too fine grain, even after the maximum toasting time (5 minutes) it only gets to half of the bar
-Conky like to crash, especially when you keep killing and reloading it
For the second reason I decided to spawn all conkies through separate supervisord processes to watchguard it.
The basic idle lua uses 2 separate conkies (1 for the weather data and another for the clock).
Once the toasting starts:
1, Arduino signals the raspberry pi C program through serial with IRONFORGE_ON
2, The control C program stops the 2 conky threads and loads in the 3rd conky lua for the toasting
3, The control C program writes out both the temperature and time values to separate text files located on ramdisk (not to do unnecessary RW operations on the SDcard), what the conkies are reading in and displaying automatically. The program is responsible for creating the remaining time to MM:SS format as well.
4, At the end of the toasting the C program stops the current toasting thread and restarts the 2 conkies going back to the weather and time display again
5, For alarm detection the C program can directly stop the process of playing music from cron when in idle state any of the rotaries are pushed in
Step 8: All Your Toasts Are Belong to Us: NetBSD Vs Raspbian
Although the toaster was made to mainly run NetBSD and the screen display, sound, Arduino are all working with it there is no touch screen support. I would appreciate help from anyone who is interested to write a driver for this.
The touch chip of the LCD is XPT2046. The screen is using SPI to send the cursor input coordinates back to the Raspberry.
- 19 TP_SI SPI data input of Touch Panel
- 21 TP_SO SPI data output of Touch Panel
- 22 TP_IRQ Touch Panel interrupt, low level while the TouchPanel detects touching
- 23 TP_SCK SPI clock of Touch Panel
- 26 TP_CS Touch Panel chip selection, low active
At the time of this writing I am not aware of any Raspberry PI compatible (shield) touch screen which have working NetBSD driver for the touch pad.
Step 9: Closure and ToDo List
As always any help, contribution, fixes in the code are welcome.
This was a recently completed hack so I will update the project with the missing code pieces later on (Raspberry pi C control code, Conky luas etc). Also I planning to create auto-resizable 8GB/16GB sdcard images which contain everything. Due to the fact that the Raspberry PI is standard hardware anyone who decides to build the project could just download the images, write them out to an sdcard and the toaster would be functioning after boot up just like mine. Setting up networking is only needed for the correct time (NTP) and the temperature display.
One remaining step will be to measure the temperatures inside with a FLIR and add the adjustments to the readout of the MAX thermo sensor because I believe it is warming up too slowly for the small max 5 minutes toasting period.
Also planning to add auto-scaling the time period depending on the set temperature to be able to extend this 5 minutes maximum time window if the temperature is lowered.