In our physical computing class, our team was tasked to design a device that would aid a specific CMU campus client - Cody. Cody is the educational technologist, a designer, and mentor for the Ideate Program at CMU. One of his primary jobs on campus is handling the 3D print machines which is the area we decided to focus on.
The device allows users to weigh and label filament spools. A switch lets users move between two settings: preset mode and selection mode. In preset mode, users assign a filament type to one of four buttons and save the weight of its empty spool. In selection mode, users choose one of their saved filament types and weigh the spool. The device subtracts the saved empty-spool weight to determine how much filament remains. Once the measurement is complete, users can press a button to print a sticker showing the filament type, its weight, and the date and time. The sticker can then be applied to the filament spool.
The final product: Spool&Stick
Video tutoial of our device in action, and how it works!
On Monday night, Cody gets Spool&Stick ready for the week. He flips the switch to preset mode, sets an empty plastic reel on the platform, and presses button 1 so the device remembers that reel's weight. He does the same with an empty wooden reel on button 2 and a cardboard one on button 3. Then he flips back to selection mode and goes through the spools in his drawer that got used that day. For each one, he presses the button for its reel type, sets it on the platform, and the screen shows only the filament weight. He presses print, and a sticker comes out with the weight, date, and time; he sticks it right on the spool.
Tuesday morning, Cody opens an email from Sarah. She needs five parts printed in three different filaments within the next three days. Instead of guessing, he opens the drawer and reads the stickers. There’s plenty for four of her parts, but the third filament is too short to finish the fifth one. Rather than start a print that would run out halfway and waste everything, he emails her back and suggests a filament he has more of. Sarah’s fine with it, and by that afternoon all five parts are done. Before putting the spools away, Cody weighs them again so the stickers stay accurate.
For our first meeting with Cody, we dove into what exactly his job entails as in what machines he interacts with, where he usually is, and what problems arise in those spaces. The space we chose to focus on was his lab where he monitors a variety of machines and tools primarily 3D printers and laser cutters. With the help of student workers, he manages bulk 3D prints on array printers and bamboo printers. This leads to a host of issues such as print failing, filament getting tangled, and inventory failing. Cody then allowed us to walk around in his space and see what machines and tools he interacts with. Through this we isolated two problems that we wanted to target which were respooling unwinded filament spools and weighing filament spools.
We thought that the interview process went very well. We were able to gain a deeper understanding of what Cody does through the conversation we had and physically observing his space. We thought that what was strong in our interview was that it was more of a conversation rather than an interview. Having the back and fourth between Cody with our initial questions and then in the physical space allowed us to cover many possible areas for design and better understand the problems he presented to us.
If we were to conduct the interview again we would like to have explore more spaces such as his office space to potentially find more opportunities for us to design for. Other than that, we felt that our interview process went very well.
Our major takeaway from the interviews was efficiency. No matter what type of problem Cody described, all of it was rooted in the idea that he alone can only do so much so he wanted something that cut down the time for each of his tasks. One thing he said was he can't add time, so he just wants to simplify the processes he goes through. Since time and efficiency is such an important component reliability was also something he prioritized. If we were to design something that breaks down or needs constant maintenance, it would only add more for Cody to do so this was something we were prioritizing throughout our process.
After discussion and ideation we decided to move forward with the filament scale as we thought it was the most plausible idea.
Images from observing Cody's workspace
Initial ideation: Scale
Initial ideation: Spool winder
We decided to move forward with the idea of a scale that weighs filament foro Cody. He mentioned that oftentimes there is only a small amount of filament left of spools and he has no way to definitievely tell how much is on there. This leads him to wasting filament since he chooses to just not use the roll entirely because if it were to run out mid print, he would have to replace it and that is an inconvincen for him. He also wanted something that could indicate easily how much each spool had espeically when he went through his cabinet of filament.
Moving forward, we narrowed down 3 questions and designed prototypes in order to answer them.
Through this prototype, we wanted to understand where Cody would prefer to use this device whether it was on top of a table, off of the side, or mounted on a wall. He is constantly moving around in his space and we didn't want it to be in the way. We played around with overall height and width and the placement of where Cody would receive his sticker.
Efficiency is key and even minor details such as location and orientations of the buttons and screens can play a role in how quick the process is for Cody. Using these prototypes, we wanted to gauge what felt most intuitive and natural for him. For the first prototype we experimented with the scale being behind the buttons and the buttons facing upwards. The second model explores the scale being to the left of the printer with the buttons along the side.
This discovery was not just to identify what would give us the most accurate measurement but what orientation felt most natural for Cody when he held the filament to weigh it. The first one was inspired by a barbell where he would slide it onto a rod that weighs the filament. The second is where he could weigh it on the flat face along the side while the third experiments with weighing it vertically with the round edge facing down.
Slid onto a bar
Flat side down
Round edge down
During the prototyping process, Cody expressed a preference for a tabletop design rather than a wall-mounted one, as he was concerned about the device potentially falling. He also liked being able to look down and see the buttons, and envisioned placing the device on a rolling side table so he could move it around as needed. In terms of composition, he preferred having the buttons visible but potentially positioned to the side of the scale rather than directly in front. Although he did not have a strong preference for how the filament was weighed, he mentioned that positioning it with the rounded edge facing down made him feel more actively engaged in the weighing process. In contrast, weighing it on its side made it feel like it was simply sitting there, making it easier to forget about. He also felt that the barbell concept would be inefficient and appreciated the compactness of one of the models.
We tried to incorporate as many of Cody's preferences as possible into our final design. However, we faced some constraints, particularly the size of the Zebra printer we were given to work with, which made it difficult to achieve the compactness he appreciated in some of our prototypes. Additionally, due to our intended wiring configuration and the already bulky form of the device, we decided to position the buttons along the side rather than on an upward-facing surface. This meant we could not fully incorporate his preference for looking down at the buttons. We also moved away from the barbell concept based on his feedback about its inefficiency. Overall, the biggest surprise was how much the physical orientation of the filament could influence the user's perception of the weighing process, even though both orientations served the same functional purpose.
Our early ideation sketches from right after the interview with Cody: a station that weighs a spool and prints a sticker showing how much filament is left.
The prototype we liked most: a cardboard spool holder with an early version of our sticker on the spool.
A bug in our code made the printer spit out 15 stickers from one button press. You can also see how big the Zebra printer is, which is why we had to design the whole thing around it.
Milo's technical drawings and measurements, where we locked in the final size of the enclosure and where every part would go.
Sydney with the laser-cut plywood panels, cut from the file she modeled off my drawings.
The late night of putting it all together. Tools hold each side down so the glue dries evenly, and in the back you can see the fabric-covered wood platform that works as the scale, with its wiring running underneath.
Building the product
After the prototype crit, the thing that shaped our whole build was the Zebra label printer. It’s huge, way bigger than anything else in the device, and honestly not very nice to look at. Cody told us he didn’t want to stare at it every day and wanted it covered up unless he needed to refill the stickers. So instead of designing a box and squeezing the printer in, we started with the printer and built around it: a 6mm laser-cut wood enclosure with a removable lid so Cody can still access the sticker roll.
Milo measured every part and made technical drawings of the enclosure, then sent them to Sydney, who modeled it and turned it into a laser-cut file. Meanwhile, Mandi got the printer talking to the Arduino. That’s where our weirdest bug came from: pressing the printer button once caused the printer to spit out 15 stickers in a row. The Arduino was reading a single press as a bunch of presses, so we added code to ignore the tiny flicker a button makes when you push it.
Putting it together was a late night. We glued the panels and held each side down with whatever tools we had on the table so the glue would dry evenly. The scale sits under a wooden platform covered in fabric, with the wiring tucked underneath so nothing shows. For the finishing touch, Sydney laser-cut red acrylic stripes, since Cody had told us in the interview he wanted it red with a bit of a cyberpunk look.
For the most part, we stuck to our Gantt chart. Mandi had the printer working and the code done on time. The one place we fell behind was laser cutting. We’d planned to cut between Wednesday and Friday, but we were still finishing the CAD model we were going to cut, so it slipped to Sunday afternoon, the day before the final crit.
The laser cutting itself also got messy. The lab’s staffing was confusing, and it was hard to tell when someone would actually be there, so we made a last-minute reservation at the architecture school’s laser cutting studio instead. We had almost everything cut by Sunday night. Sydney woke up early the next morning and recut one piece that came out about half an inch too long.
Schematics
Overall, I think the project went very well, and we were especially happy with our client’s reaction. One piece of advice we received more commonly was to make the buttons easier to distinguish. One person commented, “I think maybe the buttons to tare the scale could be labeled a bit more clearly, or positioned at the front of the enclosure for easier access.” We agree the buttons were difficult to read, especially from farther away, and that using differently colored labels could have made them easier to identify. We also received questions about the load cell's accuracy. One person asked, “I wonder what the tolerance of your measurement is (+/- 50g?) and if that's good enough for most uses.” This made us think more critically about how reliable our measurements are. Given more time, we would explore a more accurate scale or improve our calibration process, perhaps by controlling where the spool sits or allowing for more precise adjustments in the code. Another recurring piece of feedback concerned the size of the Zebra printer. The general consensus seems to be, “I think it is very big and slightly clunky, but given the size of the printer, I don't think this was avoidable!” We agree that designing around such a large object made the device harder to move. A 3D-printed enclosure with a more organic shape might have helped us use space more efficiently, especially around the printer’s rounded edges. Also, adding wheels or handles could have improved its portability.
We received mixed feedback about the appearance. Some people wanted the device to feel “more refined,” while others stated they liked how it was “compact” and “elegant.” Our client particularly liked its simple appearance and felt that it was not too visually busy. They also explained that this was important to them as they didn’t want students in the 3D printing lab to be tempted to touch or play with the device unnecessarily. We agreed with this direction, although some details, such as the corners, joints, and areas where the electronics are stored, could have been finished more cleanly had we had more time.
Working with a client was different from designing for ourselves or completing a standard assignment in many ways. There was an added responsibility to make the device as efficient and useful as possible, as well as a greater need for communication. We could not simply make assumptions about small design decisions. We regularly checked with our client about where the device would be placed, how the spool should be weighed, and where buttons should go. We were also surprised by how much their daily routine influenced the design. For example, since our client was not always in the 3D printing lab, the device needed to be simple enough for student monitors to use as well. Next time around, we would spend more time observing the client’s routine firsthand and take more initial measurements and photographs of the surrounding space.
Ultimately, we are very happy with the project. It works well, and our client is satisfied. Additionally, successfully finding a way to integrate such a large and clunky printer into a functional device was a rewarding feeling. If we had more time, we would improve the user experience so that the buttons and switches were more intuitive without instructions. We would also test the device with students who had never used it before, rather than relying only on our client’s feedback. Additional features, such as storage for filament materials, could also make it more useful to our client, given the number of items floating around the 3D printing space. Most importantly, we would continue refining the weighing process, since accurate measurements are central to the device’s purpose.
Each unit runs on an Arduino Pro Micro with an nRF24L01+ radio module. The radios run on 3.3 V, with a 10 µF capacitor across each module's power pins to keep them stable. The desk unit reads its button on pin 2 and drives its LEDs from pin 6 through a 330 ohm resistor. The door unit drives its LEDs from pin 6 through a 330 ohm resistor, with a 1000 µF capacitor across its 5 V supply.
[Placeholder: block diagram, exported as PNG.]
[Placeholder: electrical schematic, exported as PNG.]
/*
60-223 PROJECT 2 — CAMPUS CLIENT PROJECT
FILAMENT SCAKE AND STICKER PRINTER
Users use a switch to toggle between two settings: preset-mode or selection mode. Preset mode lets
users assign types of spools to 4 different buttons, saving the weight of that type of spool. Selection mode
prompts users to select a material, via the previously made presets, and weigh the filament. By selecting
a preset first, the weight of the spool can be subtracted so that only the weight of the filament is
recorded. After it is, a button prompts a Zebra sticker printer to print a sticker with
the date, time, filament type, and of course filament weight.
Arduino pin | role | description
----------------------------------------
D2 Input Print button
D3 Input Wooden holder selection / preset button
D4 Input Plastic holder selection / preset button
D5 Input Metal holder selection / preset button
D6 Input Fourth holder selection / preset button
D7 Input Rocker switch — selection mode / preset mode
D8 Input HX711 load cell amplifier — DT/DOUT
D9 Output HX711 load cell amplifier — SCK/CLK
D10 RX MAX3232 receiver output (printer TX → Arduino)
D11 TX MAX3232 transmitter input (Arduino → printer RX)
D13 Output Status LED
A4 I2C SDA DS3231 RTC + I2C LCD
A5 I2C SCL DS3231 RTC + I2C LCD
5V Power HX711, RTC, and LCD power
GND Ground Shared ground for buttons, sensors, LCD, RTC, and MAX3232
by Mandi Lu (mandilu@andrew.cmu.edu), Sydney Lee (sydneyle@andrew.cmu.edu), and Milo Fuchs (mfuchs@andrew.cmu.edu)
November 2026
*/
/*
Asked ChatGPT-6 Instant on Oct 29 2026:
How do I connect the zebra sticker printer to an arduino? I have an Arduino Uno R3 and the GK420d ports are a USB and 9-pin serial.
Give me the wiring and setup instructions.
*/
/*
Asked ChatGPT-6 Instant on Oct 30 2026:
I am making a device using a Arduino Uno R3.
Basically, ppl use a switch to choose between preset-mode or selection mode. Preset mode prompts
users assign types of spools to 4 buttons (one for each material of the spool) and then it saves the weight of that type of spool.
Selection mode asks them to select one of those materials, then weigh the filament with a load cell. So they select
a preset first and the weight of the spool is subtracted from that weight so that only the weight of the filament is
recorded. After that, they use a button to make a Zebra sticker printer to print a sticker with
the date, time, filament type, and of course filament weight. So it will also require an RTC. And all this info will be displayed on a screen.
I want to finish this within 5 days. Please tell me 1) any considerations for this design I may have missed, 2) a recommended workflow with dated bullet pointed
tasks which parts to code and when in an efficient order, and 3) Parts you recomend I use
*/
/*
Asked ChatGPT-6 Instant on Oct 30 2026:
I am using the following parts: zebra printer GK420, RTC, 1 metal pushbutton for printing,
4 metal pushbuttons for presets, (the five metal pushbuttons are this model: https://www.amazon.com/dp/B08R9P9DFC),
rocker switch for two settings, (this kind https://www.amazon.com/gp/product/B01N2U8PK0)
and 1 LCD screen (this kind: https://ioref.org/parts/lcd-displays/). I also have an LCD i2c and an hx711 weight sensor. Which libraries do you recommend I import.
Please provide a "sparknotes-style" summary of what to use for each library.
*/
/*
Asked ChatGPT-6 Instant on Oct 30 2026:
Explain the logic and structure of how to code for a "failsafe" that stops it from printing without a preset. Or if they select a preset that has not yet been made.
*/
//Import all libraries
#include <SoftwareSerial.h>
#include <Wire.h>
#include <RTClib.h>
#include <HX711.h>
#include <LiquidCrystal_I2C.h>
#include <EEPROM.h>
RTC_DS3231 rtc;
HX711 scale;
//LCD I2C address
//Asked ChatGPT-6 Instant on Oct 30 2026:
//My I2C LCD is lighting up but it is not displaying any text. Could you give me test code to make sure the Arduino can "see" the screen?
LiquidCrystal_I2C lcd(0x27, 16, 2);
// Zebra printer
SoftwareSerial zebra(10, 11);
//Make pin assignments!
// Buttons
const byte buttonPins[5] = {2, 3, 4, 5, 6};
const byte modeSwitchPin = 7;
// HX711
//Asked ChatGPT-6 Instant on Oct 30 2026:
//This is my first time using a load cell and HX711. Please give me a tutorial/introduction to this device and tell me useful code I'd need to set it up and run it
const byte HX711_DOUT = 8;
const byte HX711_SCK = 9;
// LED
const byte ledPin = 13;
// Calibrate the weight
//!!This number may vary slightly depending on set up!!
const float CALIBRATION_FACTOR = 527;
//Different holder types - replace with different names depending on your filament holders' materiality
//Asked ChatGPT-6 Instant on Oct 30 2026:
//I want the user to be able to save the empty weight of the 4 different spool holders. What's the simplest way to associate each button with a different saved weight?
const char* holderNames[4] = {
"WOODEN",
"PLASTIC",
"HOLDER 3",
"HOLDER 4"
};
// EEPROM Storage
/*
Asked ChatGPT-6 Instant on Oct 30 2026:
I need the Arduino to remember the presets after power is turned off. Is that possible? If so, how?
*/
const uint16_t EEPROM_MAGIC = 0xBEEF;
struct HolderSettings {
uint16_t magic;
float weights[4];
byte valid[4];
};
HolderSettings holderSettings;
// Currently selected holder
// -1 means no holder selected
int selectedHolder = -1;
// Last holder preset in preset mode
int lastPresetHolder = -1;
//Button Debouncing
/*
Asked ChatGPT-6 Instant on Oct 31 2026:
Sometimes one button press registers twice. How can I prevent this without using delay() throughout my main loop?
*/
struct ButtonState {
byte pin;
bool stableState;
bool lastReading;
unsigned long lastChange;
};
ButtonState buttons[5];
const unsigned long debounceDelay = 35;
// Other Variables
bool scaleReady = false;
bool lastMode = false;
unsigned long lastDisplayUpdate = 0;
const float MAX_HOLDER_WEIGHT = 5000.0;
// Set Up
void setup() {
Serial.begin(9600);
zebra.begin(9600);
// LED
pinMode(ledPin, OUTPUT);
// Mode switch
pinMode(modeSwitchPin, INPUT_PULLUP);
// Initialize all five buttons (4 for materials and 1 for printing)
for (int i = 0; i < 5; i++) {
pinMode(buttonPins[i], INPUT_PULLUP);
buttons[i].pin = buttonPins[i];
buttons[i].stableState =
digitalRead(buttonPins[i]);
buttons[i].lastReading =
buttons[i].stableState;
buttons[i].lastChange = millis();
}
// Initialize I2C
Wire.begin();
// LCD
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("FILAMENT SCALE");
lcd.setCursor(0, 1);
lcd.print("Starting...");
// RTC
/*
Asked ChatGPT-6 Instant on Oct 30 2026:
How do I set up the RTC? Any additional parts needed? Is it possible to have te Zebra printer read and print the time and date?
*/
if (!rtc.begin()) {
lcd.clear();
lcd.print("RTC NOT FOUND!");
Serial.println("RTC not found!");
while (1);
}
//Asked ChatGPT-6 Instant on Nov 2nd 2026:
//Could you give me the line of code that resets the RTC's time to right now? It's off again.
// Reset RTC if it loses power
if (rtc.lostPower()) {
rtc.adjust(
DateTime(F(__DATE__), F(__TIME__))
);
}
// Load saved holder weights
loadHolderSettings();
// Initialize HX711
scale.begin(HX711_DOUT, HX711_SCK);
scale.set_scale(CALIBRATION_FACTOR);
lcd.clear();
lcd.print("Initializing");
lcd.setCursor(0, 1);
lcd.print("Weight sensor...");
// Make sure the scale is connected
if (scale.wait_ready_timeout(2000)) {
// This assumes the weighing platform is EMPTY when the Arduino starts
scale.tare(10);
scaleReady = true;
Serial.println("HX711 ready!");
} else {
scaleReady = false;
Serial.println("HX711 not found!");
}
delay(1000);
//Asked ChatGPT-6 Instant on Nov 1st 2026:
//How can I detect when a rocker switch changes position without repeatedly triggering the same thing in my loop?
lcd.clear();
Serial.println("System ready!");
}
// MAIN LOOP!
void loop() {
// Read switch
bool presetMode =
digitalRead(modeSwitchPin) == LOW;
// Detect mode changes
if (presetMode != lastMode) {
lastMode = presetMode;
lcd.clear();
Serial.println(
presetMode ?
"PRESETTING MODE" :
"MATERIAL SELECTION MODE"
);
}
// Check four holder buttons
for (int i = 0; i < 4; i++) {
if (buttonPressed(i + 1)) {
if (presetMode) {
// Presetting mode: Save the current empty holder weight
saveHolderWeight(i);
} else {
// Selection mode: Select holder type
selectedHolder = i;
Serial.print("Selected holder: ");
Serial.println(holderNames[i]);
}
}
}
// Check separate print button
if (buttonPressed(0)) {
if (presetMode) {
showMessage(
"PRESET MODE",
"Printing disabled"
);
} else {
printSticker();
}
}
// Update LCD
if (millis() - lastDisplayUpdate >= 500) {
lastDisplayUpdate = millis();
updateDisplay(presetMode);
}
}
// Detecting pressed button
bool buttonPressed(byte index) {
bool reading =
digitalRead(buttons[index].pin);
if (reading != buttons[index].lastReading) {
buttons[index].lastChange = millis();
buttons[index].lastReading = reading;
}
if (millis() - buttons[index].lastChange
> debounceDelay) {
if (reading != buttons[index].stableState) {
buttons[index].stableState = reading;
// INPUT_PULLUP:
// LOW means button pressed
if (buttons[index].stableState == LOW) {
return true;
}
}
}
return false;
}
// EEPROM Function
//Asked ChatGPT-6 Instant on Nov 1st 2026:
//How many times can I write to Arduino EEPROM? Is there a way to avoid unnecessarily rewriting the saved holder weights?
void loadHolderSettings() {
EEPROM.get(0, holderSettings);
// Check whether EEPROM contains previously saved holder settings
bool validData =
holderSettings.magic == EEPROM_MAGIC;
if (validData) {
for (int i = 0; i < 4; i++) {
if (holderSettings.valid[i] > 1) {
validData = false;
}
}
}
// If no valid data exists, initialize it
if (!validData) {
holderSettings.magic = EEPROM_MAGIC;
for (int i = 0; i < 4; i++) {
holderSettings.weights[i] = 0.0;
holderSettings.valid[i] = 0;
}
EEPROM.put(0, holderSettings);
}
}
// Pre-setting Mode
void saveHolderWeight(int holderIndex) {
if (!scaleReady || !scale.is_ready()) {
showMessage(
"SCALE ERROR",
"Check HX711"
);
return;
}
// Measure the empty holder
float measuredWeight =
scale.get_units(10);
// Basic error protection
if (measuredWeight <= 0 ||
measuredWeight > MAX_HOLDER_WEIGHT) {
showMessage(
"INVALID WEIGHT",
"Check calibration"
);
return;
}
// Save holder weight
holderSettings.weights[holderIndex] =
measuredWeight;
holderSettings.valid[holderIndex] = 1;
// Save permanently to EEPROM
EEPROM.put(0, holderSettings);
lastPresetHolder = holderIndex;
Serial.print("Saved ");
Serial.print(holderNames[holderIndex]);
Serial.print(" holder weight: ");
Serial.print(measuredWeight, 1);
Serial.println(" g");
char line2[17];
//Asked ChatGPT-6 Instant on Oct 31st 2026:
//So I'm trying to set a preset, but the LCD is reading "Weight: ? g" How do I orient the HX711 to get a weight? As in which side faces which way?
//My LCD sometimes leaves leftover characters when I display shorter messages after longer ones
//How can I clear the remaining characters? (I don't want to display the whole screen)
char weightText[10];
dtostrf(measuredWeight, 5, 1, weightText);
snprintf(
line2,
sizeof(line2),
"%s g saved",
weightText
);
showMessage(
holderNames[holderIndex],
line2
);
}
// LCD DISPLAY
void printLCDLine(byte row, const char* message) {
lcd.setCursor(0, row);
lcd.print(message);
// Clear remaining characters
int length = strlen(message);
for (int i = length; i < 16; i++) {
lcd.print(" ");
}
}
void updateDisplay(bool presetMode) {
if (!scaleReady || !scale.is_ready()) {
printLCDLine(0, "SCALE NOT READY");
printLCDLine(1, "Check HX711");
return;
}
float grossWeight =
scale.get_units(3);
char line1[17];
char line2[17];
if (presetMode) {
// Preset Mode
snprintf(
line1,
sizeof(line1),
"PRESET: %s",
lastPresetHolder >= 0 ?
holderNames[lastPresetHolder] :
"READY"
);
char weightText[10];
dtostrf(grossWeight, 5, 1, weightText);
snprintf(
line2,
sizeof(line2),
"Weight:%s g",
weightText
);
} else {
// Selection Mode
if (selectedHolder < 0) {
snprintf(
line1,
sizeof(line1),
"SELECT HOLDER"
);
snprintf(
line2,
sizeof(line2),
"Gross: %.1f g",
grossWeight
);
} else {
snprintf(
line1,
sizeof(line1),
"SELECT: %s",
holderNames[selectedHolder]
);
if (holderSettings.valid[selectedHolder]) {
float filamentWeight =
grossWeight -
holderSettings.weights[selectedHolder];
//Asked ChatGPT-6 Instant on Oct 31st 2026:
//So now I can save a preset, but then when I flick the switch off preset mode to selection mode,
//it still says "Net: ? g" instead of a number. How do I fix this?
char weightText[10];
dtostrf(filamentWeight, 5, 1, weightText);
snprintf(
line2,
sizeof(line2),
"Net:%s g",
weightText
);
} else {
snprintf(
line2,
sizeof(line2),
"PRESET NEEDED"
);
}
}
}
printLCDLine(0, line1);
printLCDLine(1, line2);
}
//Print the sticker
void printSticker() {
// Check selected holder
if (selectedHolder < 0) {
showMessage(
"NO HOLDER",
"Select a holder"
);
return;
}
// Check saved holder weight
if (!holderSettings.valid[selectedHolder]) {
showMessage(
"NO PRESET",
"Set holder first"
);
return;
}
// Check weight sensor
if (!scaleReady || !scale.is_ready()) {
showMessage(
"SCALE ERROR",
"Check HX711"
);
return;
}
digitalWrite(ledPin, HIGH);
// Read gross weight
float grossWeight =
scale.get_units(10);
// Subtract holder weight so only the filament weight is measured
float filamentWeight =
grossWeight -
holderSettings.weights[selectedHolder];
// Prevent it from printing negative weights
//Asked ChatGPT-6 Instant on Oct 31st 2026:
//How do I format the date and time into separate character arrays so they can be sent to the Zebra printer as part of a ZPL label?
if (filamentWeight < 0) {
digitalWrite(ledPin, LOW);
showMessage(
"INVALID WEIGHT",
"Check spool"
);
return;
}
// Get date and time
DateTime now = rtc.now();
char dateBuffer[11];
char timeBuffer[9];
snprintf(
dateBuffer,
sizeof(dateBuffer),
"%02d/%02d/%04d",
now.month(),
now.day(),
now.year()
);
snprintf(
timeBuffer,
sizeof(timeBuffer),
"%02d:%02d:%02d",
now.hour(),
now.minute(),
now.second()
);
char weightBuffer[16];
dtostrf(
filamentWeight,
0,
1,
weightBuffer
);
// Send this label to the Zebra printer
//Asked ChatGPT-6 Instant on Oct 30 2026:
//This is my first time using the Zebra printer. Please give me a tutorial on how it works and useful lines to include in my code.
// Start a new ZPL label
//Asked ChatGPT-6 Instant on Nov 2nd 2026:
//What do the ZPL commands ^XA, ^FO, ^FD, and ^FS mean? How do I position text on a 2 x 1 inch label?
zebra.println("^XA");
// label width
zebra.println("^PW406");
//label length
zebra.println("^LL203");
// Print the title "FILAMENT INFO" near the top of the label
zebra.println(
"^FO25,15^A0N,27,27^FDFILAMENT INFO^FS"
);
// Print the filament weight
zebra.print("^FO25,55^A0N,35,35^FD");
zebra.print(weightBuffer);
zebra.println(" g^FS");
// Print the filament material (currently hardcoded as PLA)
zebra.print("^FO25,100^A0N,25,25^FD");
zebra.print("PLA");
zebra.println("^FS");
// Print the selected spool holder type
//Asked ChatGPT-6 Instant on Nov 3rd 2026:
//What does Serial.flush() actually do on an Arduino Uno? Should I use it after sending a complete ZPL label to the printer
zebra.print("^FO25,130^A0N,20,20^FD");
zebra.print(holderNames[selectedHolder]);
zebra.println("^FS");
// Print the date
zebra.print("^FO25,155^A0N,20,20^FD");
zebra.print(dateBuffer);
zebra.println("^FS");
// Print the time
zebra.print("^FO25,178^A0N,20,20^FD");
zebra.print(timeBuffer);
zebra.println("^FS");
zebra.println("^XZ");
zebra.flush();
// Print the filament weight to the Arduino Serial Monitor for debugging
Serial.print("Printed filament weight: ");
Serial.print(filamentWeight, 1);
Serial.println(" g");
// Display a confirmation message on the LCD screen
showMessage(
"LABEL SENT!",
"Printing..."
);
// Wait half a second before continuing
delay(500);
// Turn off the status LED
digitalWrite(ledPin, LOW);
// LCD Message Helper
// This shiws a two-line message on the LCD screen.
void showMessage(
const char* line1, // Text on the first row of the LCD
const char* line2 // Text on the second row of the LCD
) {
// top row
printLCDLine(0, line1);
// bottom row
printLCDLine(1, line2);
delay(1200);
}
/*
Asked ChatGPT-6 Instant on Nov 3rd 2026:
Attatched is the final code for the sticker printer and filament scale project. Please tell me any logic errors or issues and how to fix them?
*/
Fusion Link