You are here

THS Membership Box - Project planning

Today's task is to start planning out the project, how it should function and to get a rough idea of what the hardware will look like.

This will be a long blog (wall of text alert) so settle in with a drink and some tunes and take your time with it. I am sorry to say that I have not prepared any images to accompany this one, but may add some in later.

I will cover three major topics here. First and foremost, we need to plan what the machine will look like and how the machine should operate. Within that scope, we need to know what the various modes are, and how it will operate within each one. Secondly, we need to start planning out our hardware and make some pin assignments for the Arduino. It is much better to discover early on that you may not have enough IO to finish the project. Finally, we should consider the major software routines necessary to complete the project. There is a lot to do, so lets get cracking!


Appearance and Functionality

I already built a wooden case, secured with a lock, and mounted the bill mouth in it. The box will also include an LCD screen on the outside (likely a 2x20 charactor display). In addition, there will be just two user interface buttons:

  • MEMBERSHIP - When pressing this button, 5000 yen is deducted from the balance inserted
  • DONATE - When pressing this button, 1000 yen is deducted from the balance inserted

There will be LEDs to illuminate each, which indicate when said buttons are active. We would like to ignore a membership button press when there is only 3000 yen on the ballance, for example.

Inside the machine, there will be one additional button, which activates an accounting mode.

Sitting beside the machine will be a thermal printer, which will print out recepits and order slips. When the user opts to pay a membership, two slips are printed. The first instructs the user to write their name on the slip and deposit it into either a slot placed on the machine (such that bills and slips fall into the same space), or a seperate box near the machine. The administrators use these slips to update membership accounting data. The second slip serves as their receipt.

A matching transaction number is printed on both slips.


The various machine modes

Attract Mode

This mode should be fairly obvious. The LCD will show messages encouraging members to pay their dues and visitors to make donations. Hopefully it will feature both English and Japanese. In addition, the button LEDs will sometimes flash, as well as the BA mouth.

A user presses one of the buttons

In the case in which the user has not inserted bills, but just presses a button, we want the attract mode to respond, encouraging them to insert bills to complete the transaction

A bill is inserted

The machine is now in an active payment mode, and should not exit back to the attract mode without completing a transactions to bring the ballance to zero. In the case that the ballance is between 1000 and 4000 yen, only the donate button is lit and able to respond for the user. In the case that the ballance is 5000 yen or more, both the membership and donate buttons are functional.

A ballance is available and the donate button is pressed

The machine deducts 1000 yen from the ballance and thanks the user. It keeps a running total of the donations made (in 1000 yen increments) until the ballance reaches zero. At this point, the machine will ask if they would like a printed receipt of their total donations, and instruct them to press any button, before a timer runs out. If they opt for a receipt, it will be printed.

It is important to note that the running donation tally remains in effect until the ballance reaches zero. If the user were to insert 10000 yen, then select two donations followed by a membership payment, and finally three more donations, the donation tally should read 5000 yen when it asks if they would like a receipt.

A ballance is available of 5000 yen or more, and the membership button is pressed

The display thanks them for their membership payment and instructs them through the following process (dring this time, the BA will be disabled, and the front buttons temporarily serve new purpose):

  1. A receipt is printed, containing a transaction number, the word MEMBERSHIP, the date and time, and a space to write a name.
  2. The user is asked to tear off the receipt and write their name on it, then insert it into a slot
  3. When the user confirms this is complete (by pressing the membership button once more), the machine prints a second receipt
  4. The user is asked to retain this receipt for their records, and strike the membership button once again
  5. The machine then returns to a previous mode:
    1. If a ballance remains, it returns to the place transaction mode
    2. I no ballance remains, but the user also made a donation, it returns to the donation receipt mode
    3. If no ballance remains and the user did not make a donation, it returns to the attract mode

The audit button is pressed

The display guides the user through the the audits. By pressing the membership button, the user can step through:

  • Total amount of money expected in the box
  • Number of memberships paid
  • Number of 1000 yen donations paid
  • Set Time and Date
  • Reset the audits

Resetting the audits does NOT reset the transaction numbers in eeprom. It only resets the cash amounts to zero. This is so that when the administrators remove the cash to take to the bank, the box starts counting cash from zero again. The administrator should record the data and verifying against the actual cash count before resetting the data.


Counting Pins

The Arduino is limited on pins, and this project will use nearly all of them. Lets review some of the items on the list, before making pin assignments. I at some point mentioned that the receipt printer should show the time and date. While this COULD be a 'code only' clock, those tend to drift out of time quick. Especially when we may not always have complete control of incrementing the tick. I would rather use a battery backed real time clock. Thus, we need to keep I2C pins available.

The other big pin hog is the LCD screen. Consider that the LCD in 4 bit mode needs four data pins, as well as two control pins (RS and E). Here is my pin chart:

  • D0 - N/A - serial terminal debug
  • D1 - N/A - serial terminal debug
  • D2 - NV10USB pulse output
  • D3 - NV10USB channel enable
  • D4 - Membership button
  • D5 - Donate button
  • D6 - Membership LED
  • D7 - Donate LED
  • D8 - Audit button
  • D9 - LCD R/S
  • D10 - Software serial Rx for printer
  • D11 - Software serial Tx for printer
  • D12 - LCD E
  • D13 - N/A (LED -  may be used for status?)
  • A0 - LCD D4
  • A1 - LCD D5
  • A2 - LCD D6
  • A3 - LCD D7
  • A4 - Real Time Clock I2C
  • A5 - Real Time Clock I2C


Code Functions

In order to realize the complete functionality of this project, we will need to explore several topics on the Arduino platform (some of which even I may not be immediately familar with). Key libraries include Wire, the appropriate RTC library, LiquidCrystal, EEPROM, and the Adafruit thermal printer library.

The following list is neither complete nor set in stone, but covers a few of the more critical functional blocks I belive we will need in order to build a working system:

  • Fetching/updating accounting and transaction number variables from EEPROM
  • Writing the new data back to the EEPROM
  • Subtracting a transaction from the ballance and then making next mode determination
  • printing receipts
  • Reading the RTC



Project reference: 

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer