Close
0%
0%

Calendar Printer - Useless Edition

thermal receipt printer to print out your day's calendar - just not in a very useful order

Similar projects worth following
This project uses an ESP32 and UART Thermal Printer to fetch a google calendar from the web and print it out on receipt paper.

This project is an entry to the MacroFab Design Contest: Useless Machine. As such, it is not entirely useful. Aside from being rather less convenient that using a computer or phone to check your calendar, all event data is shuffled randomly before being printed. If if you have no events for the day, it'll kindly give you something to do by feeding the entire roll of paper out at you!

The more useful code is also available in the master branch on GitHub for those more seriously inclined.

The Calendar Printer has several components which have the following functions:

ESP32 (EzSBC ESP32_ANT-01):

An ESP32 microcontroller is used as the main processor for this project. Firmware was written in Visual Studio Code with the PlatformIO extension (see GitHub). When powered on, the ESP32 connects to WiFi, choosing the first available network from a list. It then sends a HTTP GET request to a Google Apps Script (see below). The execute link to the Google Apps Script issues a redirect notice which is decoded and followed. The redirected address returns formatted text containing the events from the calendar specified in the script for only the current day. The text also contains the current date to eliminate the need for the ESP32 to fetch time from a NTP server.

First the date is pulled from the returned text and stored as an Arduino String for printing later. Then each line of the text is used as the initialising argument to a calEvent class object which decodes the line and stores event name, location, time etc. in separate Arduino String variables.

With all calendar events in calEvent objects, each piece of information is then pulled back out and stored in separate Arduino String arrays. The random_shuffle() function is then used to shuffle the information randomly before it is assigned back to the calEvent objects.

Using the Adafruit Thermal library to interact with the thermal receipt printer, a logo is first printed, then the date. Each event is then iterated through to print a formatted summary of the less than useful event. An all day event will be displayed with only title and location. Likewise, an event with no location or guests will not display that field on the printout.

If there are no events in a given day, to give you something to do, the logo and date will print and then feed the remainder of the paper roll out at you.

No Event Paper Feed
If there are no events, the printer feeds the entire roll of paper out at you!

Google Apps Script (Google Apps)

The Google Apps Script is largely based off the work of MickMake's Project-mmClock (available on GitHub). The script is called when a HTTP GET request is received for the execute URL of the script. This URL contains a long random 'key' making it "secure" through obscurity. Do be aware that the information that is returned from the script should not be sensitive as this is not good security. The Google Apps Script being within the Google eco-system is able to be authorised to have access to Google Calendars, so access between the app and calendar is secure. Perhaps consider the script an API to your calendar, dependent on what you program.

The script first connects to the calendar specified by name in the script. A string is initialised which will be built up with the information to be returned. The current day is added as the first line of the string, formatted in human readable text. A variable is populated with all events for the current day, which are then written in a CSV type format. The guests of an event are also added, separated by colons if there are any.

The string is then returned at the end of the function. This string is read as plain text when received by the ESP32.

Thermal Printer

The thermal printer is controlled by a 9600 baud serial connection to the ESP32. The Adafruit Thermal library was used to facilitate simple communication with the printer. The bitmapImageConvert Processing utility included in the Adafruit Thermal library was used to generate an array containing the logo image.

Wiring and Power

The Calendar Printer is powered from a nifty switched 2.1mm barrel jack. This feeds a cheap 5V 3A regulator to power the thermal printer and the VIN of the ESP32. The ground of the thermal printer, ESP32 and voltage regulator are all connected. When developing, I found it useful to disconnect the 5V supply from the ESP32...

Read more »

  • 1 × EzSBC ESP32_ANT-01 Breakout and Development Board
  • 1 × Thermal Printer 5V Serial Communication
  • 1 × 12V to 5V 3A Regulator
  • 1 × Logic Level Converter (2 channel) Between 5V and 3.3V
  • 1 × Switched 2.1mm Barrel Socket

  • 1
    Assemble Electronics

    Follow the diagram below to connect the EzSBC ESP32_ANT-01, Logic Level Converter, Thermal Printer and Power.

    <image coming>

    <better instructions coming>

  • 2
    3D Print Enclosure

    Using your preferred method (yourself, a friend or online service), print the enclosure (available in GitHub hardware folder). Clean up support material.

    <image coming>

  • 3
    Assemble

    Slide breadboard in to enclosure, glue in switched power jack and power converter. Slide in and fasten thermal printer. Connect power and communication to all devices.

    <image coming>

    <better instructions coming>

View all 6 instructions

Enjoy this project?

Share

Discussions

John Anderson wrote 11/30/2020 at 04:24 point

I especially like the case you designed. Very cool project.

  Are you sure? yes | no

Ken Yap wrote 05/20/2020 at 05:03 point

Hahaha cute. Reminds me of all those ancient sci-fi films where they ask the computer (with banks of flashing lights) a question and they get the answer from a small printer. 

There was a joke of that era where a general asks the computer if he should do X or Y. The computer prints just one word: Yes. Yes what, asks the exasperated general. Yes, sir, answers the computer.

  Are you sure? yes | no

lokthelok wrote 05/22/2020 at 11:35 point

Haha. I like that.

  Are you sure? yes | no

Michael wrote 05/20/2020 at 00:09 point

Would you need the logic level converter to use the printer with an ESP32?  It seems like the description here: https://www.adafruit.com/product/597 says that it will take anything from 3.3-5.0?  Great project!

  Are you sure? yes | no

lokthelok wrote 05/22/2020 at 11:37 point

That's a fair point actually. I supplied the printer with 5V so wanted to make sure that I at least stepped down the TX of the printer so I didn't have 5V signal into the ESP32. I suppose the TX of the ESP didn't need to have a converter.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates