BAO
Kenneth Yu
Kenneth Yu
Birds eye view of Bao with a sample message.
Bao is a gadget that lives on your door and prints a message from your loved ones before you start your day. It uses a Laser Distance Sensor to detect if you are at your door, and a Real Time Clock to ensure it only prints one time a day.
In this video, I plug the power into the gadget and wave in front of the proximity sensor. It responds by printing out a message from my mom.
Front view of the 3D printed enclosure. It is designed to fit the thermal printer and leave room for additional wiring. The small circle reserves room for the laser distance sensor. I had to do some additional sanding to remove the support.
Back side of the enclosure. The model reserves a resting stand for the printer, and it has screw receivers for the final cap. In addition, the angle of where the receipt comes out is sharpened to easily rip the paper.
Arduino prototype with Breadboard
Installation of the components. The printer sits on the stand with the soldered components at the top.
"How does it door mount? Can you power it without a cable so you don’t have a cable running from the door?" This is a good point. I wanted it to include a stand/hook that has adhesives in the back. I will definitely be working on this after the project. I think that the cable is necessary in this case. When I talked to Zach, he mentioned how a battery would need to be frequently replaced if it needed to power the receipt printer. But it is something that I will look into.
"Having an easier way (maybe a door) to reload paper would be nice." I will definitely refine the form so that it can be easier to take out the receipt printer.
Overall, I am satisfied with how this project turned out. This is my first time manufacturing a function project, and I learned a lot about the compromises we have to make to our design choices when our ideas are realized. I also learned a lot about the intricacy that goes behind what we don't see, such as how wires live inside of a product and how we can close a cap. In my case, due to the large size of the thermal printer, I needed to modify the form a lot and create stands in the file to lock the components in place.
It was surprisingly difficult to attach the back part to the main body. In the beginning, I was envisioning a 3D printed snap fit, but that would not be sufficient to support the product's own weight. Later, Zach suggested using screws, which is how most real product pieces are put together. Next time, I will definitely try to keep my 3D print model clean because it is pretty dirty near the end due to me squeezing the electronics in.
I am planning to create a hook/ledge that is attached to the door in order for the gadget to live vertically. In addition, I plan to create renderings so this can be part of my portfolio.
/*
Project 1: BAO -- a warm start to your day
60-223 Intro to Physical Computing
Description: Bao is a gadget that lives on your door and prints a message from your loved ones before you start your day.
In this code, the Laser Distance Sensor sends the distance to the arduino. When it senses a human or object moving close,
it will send a signal to the Thermal Printer to print the message. The Real Time Clock data is used in the variable "canPrint"
to ensure that the printer will only print once every morning.
Pin mapping:
Arduino pin | role | description
-------------------------------------
SCL + SDA input Laser Distance Sensor
SCL + SDA input Real Time Clock
TX + RX output Thermal Printer
Code by Kenneth Yu
*/
#include "Adafruit_VL53L0X.h"
#include <DS3231.h>
#include <string.h>
DS3231 rtc(SDA, SCL);
#include "Adafruit_Thermal.h"
#include "SoftwareSerial.h"
#define TX_PIN 7
#define RX_PIN 6
SoftwareSerial printer_connection(RX_PIN, TX_PIN);
Adafruit_Thermal printer(&printer_connection);
Adafruit_VL53L0X lox = Adafruit_VL53L0X();
bool canPrint;
int randomNumber;
void setup() {
Serial.begin(19200);
rtc.begin();
// wait until serial port opens for native USB devices
while (! Serial) {
delay(1);
}
printer_connection.begin(19200);
delay(100);
printer.begin();
Serial.println(" VL53L0X test");
if (!lox.begin()) {
Serial.println(F("Failed to boot VL53L0X"));
while(1);
}
// power
Serial.println(F("VL53L0X API Simple Ranging example\n\n"));
canPrint = true;
//rtc.setDOW(TUESDAY); // Set Day-of-Week to SUNDAY
//rtc.setTime(14, 30, 15); // Set the time to 12:00:00 (24hr format)
//rtc.setDate(18, 2, 2025); // Set the date to January 1st, 2014 date, month, year
}
void loop() {
long randomNumber = (millis() % 3) + 1;
Serial.println(millis());
Serial.println(randomNumber);
VL53L0X_RangingMeasurementData_t measure;
Serial.print("Reading a measurement... ");
lox.rangingTest(&measure, false); // pass in 'true' to get debug data printout!
updateAndDriveBack();
delay(5);
}
void printMessage1(){
printer.wake();
printer.println("");
delay(800);
printer.println("October 31, 2024");
printer.feed(5);
printer.println("Aww Kenneth you're actually");
printer.println("the funniest person in");
printer.println("the world!");
printer.feed(5);
printer.println("From Ella");
printer.feed(5);
}
void printMessage2(){
printer.wake();
printer.println("");
delay(800);
printer.println("September 23, 2024");
printer.feed(5);
printer.println("I'm proud of you!");
printer.println("Make sure you get");
printer.println("lots of rest");
printer.feed(5);
printer.println("From Mom");
printer.feed(5);
}
void printMessage3(){
printer.wake();
printer.println("");
delay(800);
printer.println("January 24, 2025");
printer.feed(5);
printer.println("Did you eat well today?");
printer.println("I bought lots of groceries");
printer.println("for when you come back");
printer.println("for break!");
printer.feed(5);
printer.println("From Mom");
printer.feed(5);
}
void updateAndDriveBack(){
if (strcmp(rtc.getTimeStr(), "4:00:00") == 0) {
canPrint = true;
}
if (measure.RangeStatus != 4) { // phase failures have incorrect data
Serial.print("Distance (mm): "); Serial.println(measure.RangeMilliMeter);
if(canPrint == true){
if(measure.RangeMilliMeter <= 100){
Serial.println(" Printing Receipt ");
if (randomNumber == 1){
printMessage1();
}
else if (randomNumber == 2){
printMessage2();
}
else{
printMessage3();
}
canPrint = false;
}
}
}
else{
Serial.println(" out of range ");
}
// Send date
Serial.print(rtc.getDateStr());
Serial.print(" -- ");
// Send time
Serial.println(rtc.getTimeStr());
// Wait one second before repeating :)
delay(1000);
}