Skip to content

Commit

Permalink
Add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
angelod1as committed Feb 23, 2022
1 parent 1d50699 commit ec189cf
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 66 deletions.
59 changes: 59 additions & 0 deletions BUILD_YOUR_OWN.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
Recibo, the Poem Printer
============================================

Build your own
==============

- Raspberry Pi 3 Model B + 16gb card
- POS-5890C printer
- Sandisk 16gb flash drive
- Zero Delay card + nylon arcade buttons

The Zero Delay card, connected to the buttons, feeds controller information through USB to the Raspberry Pi. It, running my program, reads the according file and sends its content to the printer.

Flash drive
-----------

You must have, inside the flash drive, the following file structure:

- a ``DO_NOT_DELETE.txt`` empty file
- a ``poem-printer`` folder with this script
- a ``files`` folder with your text/images folders
- The working version has four folders: comics, poems, short-stories and kids.
- In order to add more folders, you need to edit the code in ``__init__.py``.


Zero Delay card
---------------

The Zero Delay card is self-configurable. The only necessary part is knowing which button triggers each event.

Sadly, this can only be done by trial-and-error (connect a button, press it, see if anything happens, note it down) or by changing the code in ``__init__.py`` that receives the button inputs (around the end of the file).

Raspberry Pi
------------

It's easier to flash an existing Poem Printer card, but if not found, you need to do the following manually to a fresh Raspbian install.

Copy the ``flash_drive.sh`` to your Raspbian home folder, then edit ``/etc/rc.local`` file at Raspbian like this:

::

# Mounts the flash drive and copies the files to your Pi
sudo sh /home/flash_drive.sh
# Runs the script
sudo python3 /home/pi/poem-printer/poem-printer/src/__init__.py &

exit 0

- The ``/dev/sda1`` can change, depending on your system.

The only downside is that it takes a few seconds to boot completely.

(If you know a way to run the script ONLY after the USB drives were mounted succesfully, please let me know. All my attempts failed)

to watch rc.local after boot: ``grep rc.local /var/log/syslog``

To test without rebooting, run ``sude /etc/rc.local`` on your Pi. If it complains about ``resource busy``, restart your printer.

There is a ``kill button`` implemented in this version. It's a button that, when clicked, quits the process and allows you to restart it.
70 changes: 4 additions & 66 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,84 +3,22 @@ Recibo, the Poem Printer

*This is a program created in collaboration with Casa1, a LGBTQ+ housing program in Brazil.*

`**Read more about the development here** <https://www.angelodias.com.br/projects/recibo>`_

Print from ``.txt`` files into a ``POS-5890C`` Thermal Printer.

.. image:: https://i.imgur.com/17bwnwP.png
:width: 400
:alt: Picture of POS-5890C thermal printer with printed poem

Before anything
---------------

This is my very first python script. This project is open-source and built for free, but I'd love to be referenced if you fork it/use it anywhere else.

I'd love to see my work being used in other places.

Roadmap
=======

The software development has the following roadmap:

Proof of concept
----------------

1. [DONE] The printer should succesfully print a accented string (``latin-1``) after a program command.

Custom text
-----------

1. [DONE] The program should read from a ``.txt`` file
2. [DONE] The program should format the result from ``read`` accordingly.
3. [DONE] The printer should print succesfully the generated string by the program.

More folders, more texts
------------------------

1. [DONE] The program should read from two folders: ``short-stories`` and ``poems``
2. [DONE] The program should format each file accordingly.
3. [DONE] The printer should print a random text from a single folder after a command.
4. [DONE] The printer should print a random text from a single folder after a key press.

Images
------

1. [DONE] The program should read a ``bitmap`` image.
2. [DONE] The program should format the image accordingly (Maybe here I'll simplify the process by creating mandatory image pre-formatting rules)
3. [DONE] The program should print the image after a command or key press (as it should be already implemented as seen above)
4. [DONE] The program should read, format and print a random image from the ``images`` folder succesfully

Hardware
========

- Raspberry Pi 3 Model B + 16gb card
- POS-5890C printer
- Sandisk 16gb flash drive
- Zero Delay card + nylon arcade buttons

The Zero Delay card, connected to the buttons, feeds controller information through USB to the Raspberry Pi. It, running my program, reads the according file and sends its content to the printer.

**Important**: In order to make the files easily updateable, I did a somewhat hack:

- I have a flash drive connected with a set folder structure
- I edited ``/etc/rc.local`` file at Raspbian like this:

::

sudo mount /dev/sda1 /mnt
sudo cp -r /mnt/ /home/pi/poem-printer/files/
sudo python3 /home/pi/poem-printer/src/__init__.py &

exit 0

The first line mounts the flash drive, the second copies the files to the local drive and the third starts the script.

The only downside is that it takes a few seconds to boot completely.

(If you know a way to run the script ONLY after the USB drives were mounted succesfully, please let me know. All my attempts failed)

to watch rc.local after boot: ``grep rc.local /var/log/syslog``
- `Read more about the development here <https://www.angelodias.com.br/projects/recibo>`_
- `Project Roadmap <./ROADMAP.rst>`_
- `Build your own <./BUILD_YOUR_OWN.rst>`_

Thanks
======
Expand Down
35 changes: 35 additions & 0 deletions ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
Recibo, the Poem Printer
============================================

Roadmap
=======

The software development has the following roadmap:

Proof of concept
----------------

1. [DONE] The printer should succesfully print a accented string (``latin-1``) after a program command.

Custom text
-----------

1. [DONE] The program should read from a ``.txt`` file
2. [DONE] The program should format the result from ``read`` accordingly.
3. [DONE] The printer should print succesfully the generated string by the program.

More folders, more texts
------------------------

1. [DONE] The program should read from two folders: ``short-stories`` and ``poems``
2. [DONE] The program should format each file accordingly.
3. [DONE] The printer should print a random text from a single folder after a command.
4. [DONE] The printer should print a random text from a single folder after a key press.

Images
------

1. [DONE] The program should read a ``bitmap`` image.
2. [DONE] The program should format the image accordingly (Maybe here I'll simplify the process by creating mandatory image pre-formatting rules)
3. [DONE] The program should print the image after a command or key press (as it should be already implemented as seen above)
4. [DONE] The program should read, format and print a random image from the ``images`` folder succesfully

0 comments on commit ec189cf

Please sign in to comment.