DigiKey-eMag-EdgeAI-Vol 18

2.5 V (still considered logic HIGH for 3.3V pins). IMPORTANT: the SAMD51 GPIO pins are NOT 5V tolerant! Make sure you use a divider, diode, etc. to drop the voltage if you’re trying to sense something from 5V logic.

nodes. In the photo below, the black wire goes to ground, the green wire goes to the high side of the limiting resistor for the ‘toasting’ LED (i.e. 5V during ‘toasting’ and 0V otherwise), and the yellow wire goes to the ‘cancel’ button node opposite GND. Attach all of the sensors and fan to the mounting plate. You’ll want to position the fan to steadily blow air over the sensors. Use the I2C hub to connect all of the sensors together, and use the long Grove cable to connect the hub to the Wio Terminal. You’ll also want long wires to run from the Wio Terminal to the ammonia sensor (as it is an analog sensor, not I2C). You need the MOSFET in open- drain configuration to successfully control the ‘cancel’ button. The Wio Terminal might support open- drain GPIO, but I was too lazy to dig through the SAMD51 datasheet to figure out how to do this in code. The voltage divider is needed to convert the 5V ‘toasting’ node to

Data collection The model I created worked in my environment. It may or may not work for you, which means you’ll likely need to collect data in your environment. Head to github. com/ShawnHymel/perfect-toast- machine to view all of the code for this project. Upload toast-odor- data-collection to the Wio Terminal. Read the comments in the code to determine which libraries you need to install prior to running the code. Make sure the Wio Terminal is plugged into a computer for the data collection process. I recommend waiting 15-30 minutes to let the gas sensors warm up. Use Python (v3+) to run serial-data- collect-csv.py to have it listen for serial data from the Wio Terminal. This will log each toasting instance to a CSV file on your computer. See this readme to learn how to use serial-data-collect-csv.py. Start the toasting process with a piece of bread. Press button C (on the top of the Wio Terminal) to tag the data in one of three states: background (not toasting), toasting,

How to build an AI-powered toaster We can treat the toasting process

Screw/bolt everything to the aluminum plate (or some other mounting device).

Written by Shawn Hymel. License: Attribution Arduino

Mechanical build Construct a cage or arm that suspends the collection of sensors above the toaster. The microcontroller (Wio Terminal) should not be placed with the sensors to avoid letting it get too hot.

■ Grove SPG VOC and eCO2 gas sensor ■ Grove BME680 temperature, pressure, and humidity sensor ■ Grove I2C Hub (6 port) ■ Grove cable (100 cm) ■ Ammonia gas sensor ■ Pololu Carrier for MQ Gas Sensors ■ Fan (40 mm, 5V) ■ 2x 10kΩ resistors ■ N-channel MOSFET ■ Mounting plate (e.g. a small piece of aluminum) ■ Various wire, screws, nuts, standoffs

Hardware connections First, we need to hack the toaster. Open the toaster and find the circuit board that controls the toasting process. Use a multimeter to identify the following 3 nodes: ■ Ground (GND) ■ Node that becomes 3.3 or 5 V during the toasting process (for example, an LED that turns on when you press the lever down) ■ Node that connects to GND when the ‘cancel’ button is pressed

like a predictive maintenance problem: how do we stop the toasting before the bread in question becomes irrevocably damaged (i.e. burnt)? We’ll use a variety of gas sensors and machine learning to accomplish this task.

Required hardware

You will need the following components: ■ Wio Terminal ■ Grove Multichannel Gas Sensor v2

Tack-solder 3 wires to each of these

we get technical

18

19

Powered by