The demo application I will be using for the GUI might look familiar to DMS members
@wandrson Just curious if you know… Why didn’t the old tally system utilize a paypal card swipe and actually do the transactions with real money?
Best to ask the creator of that system, @Brandon_Green
I just liked the idea and thought it would make a good example app to demonstrate for this presentation and make use of the new official Raspberry Pi 7" touch screen.
This presentation was originally supposed to be performed by another person, but they had to drop out so I stepped in and prepared the presentation and code last weekend.
Basically, the idea was to demonstrate how to use the Raspberry Pi with a GUI interface to something ‘physical’ (or why use the Pi at all).
The goal of old tally system was to replace the sheet of paper tracking credits in the simplest possible way, I would not want to support a POS system.
BTW, I would really appreciate if we had something like this for the 3D fab room so people could keep track of their filament usage, and possibly tie into a USB scale and RFID reader. I’m not a Python coder but it would be nice if we had a simple interface.
Found some cool info on interfacing python with a USB scale: https://www.raspberrypi.org/forums/viewtopic.php?f=44&t=53437
The RFID aspect is straight forward, but the scale is a potential problem.
The scales mentioned on that thread are all only accurate to +/- 0.1 ounces, so about +/- 3 grams or +/- $1.00 inour cost.
We would need a scale with about ten times more accuracy and digital output.
I’ll look into it.
Also a queue scheduler would be nice as well, so people can sign up for a time and have it notify when a printer is ready. I’m not sure if people will use it at all but might be a nice kiosk mode for 3D fab.
For what it’s worth, I have experience collecting data from Mettler-Toledo scales (and many many other similar devices).
What price range are these available for with 0.1gram precision?
That seems to be the problem I am finding.
Uh, well, I guess I should have included more detail in my post.
I have a few Delphi (similar to C++) variations of code that work well with the Mettler-Toledo protocol. I am willing to try recoding / developing any similar protocol for any platform. In a previous life I developed drivers for all sorts of equipment. So I’m very familiar with that sort of work.
Mettler-Toledo scales are very expensive (but also extremely good quality). For 0.1 g I suspect something used from about 20 years ago may be a reasonable choice. I doubt anything new would be affordable.
So, I can help with the software and I can help preparing the hardware. For purchasing, I can easily provide a thumbs-up / thumbs-down for interfacing to a computer. But, for selecting the actual scale, you and I are starting from essentially the same spot.
What is currently used?
There is a scale listed here…
https://dallasmakerspace.org/wiki/BIO_Lab_Equipment#List_of_lab_equipment_we_have
Is it in use?
FWIW, I think Brandon’s RFID tally system is a good reference for minimalist design and simplicity in a lot of ways.
- It didn’t require any external databases to try and figure out who you were
- It didn’t try to figure out if you were even a member as part of its function
- It sure as hell didn’t do any payment processing, it just kept a tally for you
- It allowed you to be honest and keep track of purchases (if that was your goal)
- It was a much more convenient way to track it all versus a piece of paper
We can all get zealous about the platform he used etc. (M$ blah blah blah, why you no Linux!?), but at the end of the day it did what it was designed to do and NOTHING more. I’m jealous of its lack of feature creep and design by committee in many ways and in a weird way I think it was one of the coolest things made at the space.
I agree, that is why I shamelessly stole the concept to use as an instruction tool when I needed to throw together a lecture on Python GUI for the Raspberry Pi group.
Yeh, this is the crux of my concern. Scales with the needed accuracy and communications port seem to start at about $200. And in my experience quality scales are a delicate tool. Something that is not good for long term use at the space.
Yeah I was looking as well just for curiosity and I find a few scales that look good for around $165 ( http://www.affordablescales.com/shopping/ohaus/scout-pro/sp401.asp ), but to then buy the USB or RS485 to connect it to a computer is another $100-$150!
They are really proud of that little circuit board and cable.
While not wholly inaccurate, the way you stated the possible error is misleading, in my opinion, since plus 3 grams means it will cost you an extra $0.30 for a print job, while minus 3 grams means it would cost the 'space $0.30 for a print job. That’s only a $0.60 range, not +/- $0.60 which I’m guessing was rounded to $1.00 in your statement.
In the end, I think you’re being really picky about weight. What scale is used now? What’s the stated accuracy on it? Have you checked the accuracy? I’ll bet the answers for most of us is: The one in the 3d fab room, i don’t know, and no I haven’t, respectively. Most of us aren’t THAT worried about it. We piss away 4 times that for a 20oz. soda (or a 2-litre if we’re frugal).
I believe the current scale provides a 0.1gram readout, which is 10 times more precise then the cheap scales that provide a digital output.
Also the rules posted say to weight all of the ‘waste’ print material which can easily be only a few tenths of a gram.
If we charge by the gram, we need to measure closer then +/- 3 grams, which is what a scale that only provides a readout to a 1/10 of an ounce.
I looked at load cells for making my own powder despenser. Not cheap at all. I took one of my frankford arsenal scales apart & checked the load cells on them. They had a range of .01 MVDC to 1.25 MVDC. I was surprised they were using millivolt with that tight of a range.
Okay, I don’t think it is worth while to try and tie the weighing of the filament into the application so I am going to follow @Brandon_Green excellent example and keep the kiosk as simple as possible.
Here is my current idea for the touch screen interface:
and here is the python code if anyone wants to play around with the interface
#!/usr/bin/python3
# Created by Walter Anderson
# October 15, 2015
#import shelve # DB Statement
from re import sub
import tkinter as tk
from tkinter import ttk
class User:
def __init__(self,rfid, balance):
self.rfid = rfid
self.balance = balance
def get_rfid(self):
return self.rfid
def get_balance(self):
return self.balance
def set_balance(self, value):
self.balance = value
class ThreeDfab(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
self.geometry("800x480")
#self.overrideredirect(1)
self.title("3D Fabrication Payment Kiosk")
self.resizable(width=tk.FALSE, height=tk.FALSE)
self.baseStyle = ttk.Style()
self.baseStyle.configure('TButton', font="sans 14")
self.baseStyle.configure('TLabel', font="sans 16")
self.baseStyle.configure('TEntry', font="sans 14")
container = tk.Frame(self)
container.pack(side="top", fill="both", expand=True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
for F in (RFIDSim, Kiosk):
frame = F(container, self)
self.frames[F] = frame
frame.grid(row=0, column=0, sticky="nsew")
self.show_frame(RFIDSim)
def show_frame(self, c):
frame = self.frames[c]
frame.tkraise()
class RFIDSim(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
button1 = ttk.Button(self, text="Swipe RFID on pad at right",command=lambda: controller.show_frame(Kiosk))
button1.pack(fill=tk.BOTH, expand=1)
class Kiosk(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.grid(column=0, row=0, sticky=(tk.N, tk.W, tk.E, tk.S))
self.columnconfigure(0, weight=1)
self.columnconfigure(1, weight=1)
self.columnconfigure(2, weight=1)
self.columnconfigure(3, weight=1)
self.rowconfigure(1,weight=1)
self.rowconfigure(2,weight=1)
self.rowconfigure(4,weight=1)
self.rowconfigure(5,weight=1)
ttk.Label(self, text="Debit Account").grid(row=0,columnspan=5,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="1 gram",command=lambda: self.updateWeight(1)).grid(row=1,column=0,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="5 gram",command=lambda: self.updateWeight(5)).grid(row=1,column=1,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="10 gram",command=lambda: self.updateWeight(10)).grid(row=1,column=2,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Label(self, text="Weight\n (g)").grid(row=1,column=3,stick=tk.S)
ttk.Label(self, text="Balance").grid(row=1,column=4,stick=tk.S)
self.iFilament = tk.IntVar()
filaments = tk.Frame(self)
filaments.grid(row=2,columnspan=2,sticky=(tk.W))
ttk.Radiobutton(filaments, text="ABS Filament ($0.10/gram)", variable=self.iFilament, value=1).pack(fill=tk.X)
ttk.Radiobutton(filaments, text="NinjaFlex Filament ($0.30/gram)", variable=self.iFilament, value=2).pack(fill=tk.X)
ttk.Radiobutton(filaments, text="Other ($0.30/gram)", variable=self.iFilament, value=3).pack(fill=tk.X)
ttk.Button(self, text="Clear\nWeight", command=self.clearWeight).grid(row=2,column=2,sticky=(tk.W,tk.E,tk.N,tk.S))
self.weight = tk.StringVar()
self.weightDisplay = ttk.Entry(self, width=10, textvariable=self.weight)
self.weightDisplay.grid(row=2, column=3, sticky=(tk.N), padx=10, pady=10)
self.balance = tk.StringVar()
self.balanceDisplay = ttk.Entry(self, width=10, textvariable=self.balance)
self.balanceDisplay.grid(row=2,column=4,sticky=(tk.N), padx=10, pady=10)
ttk.Label(self, text="Credit Account").grid(row=3,columnspan=5,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="$0.01",command=lambda: self.addMoney(0.01)).grid(row=4,column=0,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="$0.05",command=lambda: self.addMoney(0.05)).grid(row=4,column=1,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="$0.10",command=lambda: self.addMoney(0.10)).grid(row=4,column=2,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="$0.25",command=lambda: self.addMoney(0.25)).grid(row=4,column=3,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="Accept", command=lambda: self.close(controller)).grid(row=4,column=4,stick=(tk.S),pady=10)
ttk.Button(self, text="$1.00",command=lambda: self.addMoney(1.00)).grid(row=5,column=0,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="$5.00",command=lambda: self.addMoney(5.00)).grid(row=5,column=1,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="$10.00",command=lambda: self.addMoney(10.00)).grid(row=5,column=2,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="$20.00",command=lambda: self.addMoney(20.00)).grid(row=5,column=3,sticky=(tk.W,tk.E,tk.N,tk.S))
ttk.Button(self, text="Cancel", command=self.quit).grid(row=5,column=4,stick=(tk.N),pady=10)
self.balance.set("$10.00")
self.weight.set("0")
self.iFilament.set(1)
#self.db = shelve.open('rfid.dat', writeback=True) # DB Statement
#self.user = self.db['0'] # DB Statement
#self.addMoney(self.user.get_balance()) # DB Statement
def addMoney(self,value):
tmp = float(sub(r'[$,]', '', self.balance.get()))
tmp = tmp + value
self.balance.set("${:,.2f}".format(tmp))
def clearWeight(self):
self.weight.set("0")
def updateWeight(self,value):
tmp = int(self.weight.get()) + value
self.weight.set(str(tmp))
def close(self, controller):
tmp = float(sub(r'[$,]', '', self.balance.get()))
rate = 0.0
if self.iFilament.get() == 1:
rate = 0.1
if self.iFilament.get() == 2:
rate = 0.3
if self.iFilament.get() == 3:
rate = 0.3
tmp = tmp - (rate * float(self.weight.get()))
self.balance.set("${:,.2f}".format(tmp))
self.weight.set("0")
#self.user.set_balance(tmp) # DB Statement
#self.db.close() # DB Statement
controller.show_frame(RFIDSim)
if __name__ == "__main__":
app = ThreeDfab() # Create basic Tk application frame (root)
app.mainloop() # Enter into event driven loop
Has anyone actually put several known weights (things weighed on another scale of known accuracy/calibrated that is accurate on the scale to to see what the accuracy actually is? The actual weights aren’t important just that you know what it is taken by an instrument of known accuracy) I assume the accuracy of ± 3 grams has come from a manufacturers specifications, but that does not mean it is that inaccurate over its full range or that the accuracy at the lower ranges typically used are close to ±3 grams, could be less that 1 gram in for weights under several hundred grams, It is more likely at maximum capacity it becomes most inaccurate as the load cell/strain gauge approaches its limits.
It may not be a problem or one of much lesser magnitude since we round up to the nearest gram anyway.