[Dev] OpenFeathercoinATM
-
OPEN FEATHERCOIN ATM
Open Fethercoin ATM is an open-source automated teller machine for education and experimentation. Based on John Mayo Smith’s OpenBitcoinATM which can be seen in action here
A voucher is printed containing a private key QR Code that has been pre-loaded with the correct value of Feathercoin for the denomination deposited during the setup stages.
Designed to work with any currency taken note or coin that outputs a number of pulses per denomination deposited.
The original development thread can be found here on the Feathercoin forum
Components
Where possible links are to retail type stores and not to eBay as listings come and go, but don’t be scared to get out there and hunt these things down, eBay is a great place to start and as projects move on for me check out the Feathercoin Market Place as I will be listing old hardware on there from time to time. I have no affiliation with any of these stores, but I have tried to use the fewest amount possible to reduce postage costs if you just want a point and click solution.
- Arduino Uno
- Arduino SD Shield with Real Time Clock (RTC is used for transaction logging)
- A2 Micro Panel Thermal Printer DC5-9v 1.5A
- CH-926 Coin Acceptor
- Matrix Board - A small section of this was used to mount the components on, and the diagram for such is in with circuits section of the project
- Relay - Unlike the original design the CH-926 doesn’t have an enable pin, so a relay was added to control the power to the CG-926 when the card was empty of QR Codes
- Diode - To provide a reverse bias across the relay coin to protect the Arduino from back EMF. This diode is probably total over kill for what it’s being used for, but it was all I could get my hands on a short notice as I was trying to complete the build
- Power Connector - I used this as it provided some polarity check on the input from the PSU, get it the wrong way round and all of a sudden the magic smoke will come out of a lot of the components as your giving them +12v instead of +5v you can use the normal pins listed below if you like, but make sure that you connect the FDD connector the right way round or the smoke will be out and things will never work again!
- 2.54mm Pin Strip - Used to enable the reuse of a lot of the components, also handy for adding to the RTC Shield to avoid direct solder connections.
- Jumper Cables Female/Female - Used with the above pins to remove the need for direct solder connections to components that maybe re-used at a later date
- PC Power Supply - The reason for using this is you’re going to need +5v and +12v for the project, I had a old 300W PSU in the house, also they are standard fitment the world over so the CAD files will work no matter where you are in the world. I utilised the FDD connector as I could get a pin connector that would stop the connector being put on the wrong way round, therefore making sure +5v was not +12v
- SD Card - Anything will do here, it doesn’t have to be fast and the size depends on how many QR Codes you want to store on it without topping it back up again.
- Miscellaneous bits of wire, heat shrink sleeving, soldering iron, solder, etc…
The casing was custom built for the project, designed to be reasonably secure when closed, but also able to be run open so people can see whats going on if your doing demo’s etc… But I’m sure there are many weird and wonderful ideas for cases that will spawn from this. If you’re interested in having one of the cases built by us drop me a PM via the Feathercoin forum
Software
There are a few software components needed to get everything up and running, again I will use external links where possible but please be wary of software version numbers as a few of the problems caused during testing where caused by incompatibility between versions.
Arduino - http://arduino.cc/en/Main/Software#.UyWNcvl_sbg at the heart of the ATM is an Arduino, I used version 1.0.5-r2 for the testing and setup.
QR Code Maker - https://github.com/mayosmith/BitcoinQRMaker further work from John Mayo Smith, provides the correct size QR Code output for the ATM
OpenFeathercoinATM on github - https://github.com/uncle-muddy/openfeathercoinatm the final version used for the project at launch, I’m not going to say that the code is tidy, infact I would go as far as to say it’s a mess. But it does work.
The following links are provided for reference
openbitcoinatm on github - https://github.com/mayosmith/openbitcoinatm the work of John Mayo Smith and where it all started.
The original openfeathercoinatm on github - https://github.com/spynappels/openfeathercoinatm the original work carried out by spynappels to get the project off the ground and fork the ATM from Bitcoin to Feathercoin.
Assembly
Step 1 - Build the circuit board
You’re going to need basic soldering skills for this. It’s not difficult take your time and double check everything! My original interest in electronics came from my grandfather, god rest his soul, he taught me a few things along the way and I’ would like to share a couple of them with you now.
After you think you have finished soldering it all together, don’t get excited and plug it in straight away. Go and do something else for 10 minutes, come back and check it again.
If you’re working with matrix board, strip board, vero board (or whatever it’s called in your country) take a small flat bladed screwdriver and run it up and down between the tracks of the board before you connect anything, after doing this, check track to track that you don’t have a connection with a meter.
There are now two tracks next to each other in this layout that will meter out as a short circuit, so for the sake of a couple of minuets test all the tracks, a short in the wrong place will dump +12v into a +5v component and the smoke will come out! If you look at the revisions of the code you will notice that a Pin number changes and stays changed, the reason for that is +12v down a +5v output track on the Arduino, lucky escape on my part as it only fried that Pin and not the complete board, but consider yourself warned!
circuit_diagram.png show the schematic layout of what should be going on, again all of the Pins are configurable in the code, so anything on the Digital I/O side of things can be changed if needed for your implementation.
circuit_layout.jpg shows the component layout on the matrix board, this is looking down from above with the copper tracks on the underside of the board, and the components being placed on the upper side. As you can see I used a 16x17 section of board, it could be condensed into something a little smaller, but it just gets to fiddly for me to deal with.
Item Value
D1 1.5KE12A 200A Unidirectional Transient Voltage Suppressor Diode
J1 Printer Power
Pin 1 - +5v
Pin 2 - GND
J2 Printer Signal
Pin 1 - GND
Pin 2 - Data TX (Yellow)
Pin 3 - Data RX (Green)
J3 Power In
Pin 1 - +12v
Pin 2 - GND
Pin 3 - GND
Pin 4 - +5v
P1 Arduino +5vin
P2 Arduino GND
P3 Arduino Pin 6
P4 Arduino Pin 5
P5 0v Coin Taker (Black)
P6 Coin Taker Pulse (White)
P7 Arduino Pin 2
P8 Arduino Pin 7
P9 +12v Coin Taker (Red)
Relay1 LU-5 Relay**The completed circuit board **
Topside of the circuit board
Underside of the circuit board, notice the two broken tracks
A couple of pointers
Solder the link cables in 1st, it’s so much easier if you put all of these in first before you have other components in the way stopping you from laying the board flat.
Pin 1 of the multi pin connectors is designated by the square on the layout diagram, and in my layout they are always to the north edge of the board.
If you get D1 in the wrong way round all that happens is the relay does not switch when you run out of QR Codes, so if this is your problem investigate the orientation of D1 1st.
The two “X†on the diagram dictate that you need to cut the tracks at this point, I find a 3mm drill bit takes care of this. You’re not aiming to drill though the board just to cut away the copper connector, once done check with a meter either side of the break to make sure the track is open circuit across the break.
Step 2 - Setup the Arduino
Take the RTC sleeve, the one I purchased required you to solder on the pin strips to allow connection to the Uno, as you can see from the photos, we added additional pins to the sleeve for the connection of the circuit board.
Underside of the sleeve, all pins soldered in as per the supplied instructions
Topside of the sleeve, showing the additional pins soldered in place to allow reusable connections
Push the sleeve onto the Uno and install the battery in the RTC if required, as I discovered the RTC on the board I purchased did not function without the battery being installed.
The Arduino and Sleeve together
Make the required connections to the Arduino/Sleeve setup as per the circuit diagram, if you’re following the deisgn we have you should have six cables between the circuit board you made in step 1 and the Arduino/Sleeve setup.
The circuit board connected to the Arduino
Download and install the Arduino environment from here - http://arduino.cc/en/Main/Software#.UyXVftxGhg0
Download the latest version of the OpenFeathercoinATM
Connect the circuit board to the PSU 1st and then connect the Arduino to the USB port, do it in this order to avoid damaging the USB port on your computer by drawing too much current from it. Remember that once the sketch is uploaded the USB connection to the computer is no longer required.
Open the openfeathercoinatm.ino sketch and edit the lines mentioned in the Quick Config section below as a minimum to get you up and running
Step 3 - CH-926 Coin Acceptor
This stage is gong to be different if you’re using something other than the CH-926 Coin Acceptor, so I’m not going to write a step by step guide for it here just talk about the concept of how it works. The info for the configuration is widely available on the net and it was a very simple setup.
We want the correct number of pulses to come from what ever is taking the FIAT for the number of coins pre loaded onto the private keys. In our case we where using £1 coins for about 5/6 FTC at the time.
The number of pulses is counted by the Arduino through pin 2 on the board, when the number of pulses received in a 2000ms period equals that configured within the sketch then the magic happens and a voucher is printed.
All of the above is configurable within the sketch, there is info in the Quick Config section below giving you the details on which lines control this, so any FIAT taken should be configurable to work with the ATM providing it has a pulse output.
Step 4 - Generating QR Codes
You’re going to need 1 QR Code for each vend, each QR Code represents the private key for the public address. I haven’t got round to writing the shell script to do this yet, but it’s on my list of things to do.
Until I get around to writing the script to generate the codes for you, here’s a little guide.
Get yourself an air gapped wallet, use something like virtualbox remember not to add a network card to the virtual machine as you’re not going to need it and also this way it’ll stay totally air gapped. Download thefethercoin wallet application and the BitcoinQRMaker to a USB key, then mount that USB to the virtual machine.
Install the Feathercoin wallet on the virtual machine, and launch it when complete, it’s not going to sync as you’re not connected to the network. Don’t worry about it this is fine.
Options within the application are distinguished by " " keyboard input or mouse click are distinguished by ’ ’ so when typing, type what between the ’ ’ and not the ’ itself :)
Go to the debug window, via the task bar menu option “Help” and selecting “Debug Window” from the drop down list when the window opens click on the “Console” tab.
You can get a full list of the commands that are available by typing ‘help’ and pressing ‘enter’
To create the key pairs needed for the ATM we are going to use two commands- getnewaddress ‘account’ - does just that, creates a new address in the wallet.
- dumpprivkey ‘address’- dumps the private key for an address, the bit we need to make the QR Code.
When creating the key pairs I always added an account to help me keep track of the numbers etc… so onto the console window to make a new key pair
type ‘getnewaddress 001’ and press “enter” the output looks something like this
As you can see the address generated is 6qdPkHyN7bjxwbU2JQgTjbCArNTeKAY9FU we use this output in the next command to get the private key
type ‘dumpprivkey 6qdPkHyN7bjxwbU2JQgTjbCArNTeKAY9FU’ and press “enter” the out put looks something like this
As you can see the private key for the address is N62kBJctv9hzQbKHVnEkHovPJKjYKPW6kmPTG9R9y3ja7rRwBCFF and it is this output that we use to generate the QR Code.
Now go to the the folder you downloaded the BitcoinQRMaker to and open BTCQRMaker,html, you will see a screen similar to this one
Paste the private key from above into the first box on the webpage, and enter the required file name in the second box. File names need to be formatted ‘FTC_#.ftc’ where the # is an incrementing number starting at 0, as I had already generated address 000 and it’s QRCode before writing this we are using address 001 so our file name is going to be ‘FTC_1.ftc’
Press the “Make QR Code and Thermal Printer File” button, the magic happens and the file is downloaded to the “Downloads” folder on your machine :)
Repeat the above for as many keys as you want at the time, and remember that you need to add funds to the public address for the private keys, so that when your “customers” scan their vouchers from the printer, the funds are on the blockchain waiting for them.
Step 5 - Provision the SD Card
Format the SD card using FAT, or FAT32
Copy over logo.ofa to the root of the SD card
Copy the QR Codes generated in Step 4 above
If you’re testing if things work, you can copy and paste a single QR Code just incrementing the file name each time.
Quick Config
The following lines of code in the sketch are the very minimum you should consider changing before putting your ATM into action.
line 14 number of pulses required to indicate correct denomination of FIAT.
line 15 pulse time out, this should be aligned with your FIAT taken documentation.
line 16 number of keys on a card, set this to equal the number of codes you want to print from your card before stopping, it should never be higher than the number of codes on the actual card.
line 33 defines the pin number used to provide a signal the the coin control relay.
line 178 prints the value in FTC that has been added to the voucher, either change the value or comment out the line.
line 190 - 204 print the time, date, and file name on to the bottom of the voucher, added during the testing phase but could be removed now if you like.Thats it!
If you have done all of the above you should be ready to go!!! Deposit a pound and watch the magic happen :) theres a couple of things left for me to say below, but before I do…
If you’re stuck and need a little help or guidance get yourself over to the Feathercoin forum, I’m logged in most days and will do anything I can to help you out, and to keep you going a couple of photos of the finished item.
uncle_muddy
Thanks
Massive thanks have to go to the following people who helped during this projectK - for her love and support no matter what I’m doing.
Kevlar - for providing the link to the initial code and idea to port to Feathercoin.
spynappels - for providing the 1st fork, and encouraging me that coding isn’t so bad.
MrWyrm - for his ongoing encouragement and support throughout the life of the project.
motherlode1 - for spotting the stupid mistake in the code allowing the crossing of the finishing line.
Ruthie - for her editorial role on the above document.
toftat - my brother for answering stupid questions at silly times of the day and night.
toftdp - my farther, my mentor and my business partner for working on the case design and manufacture for me.
And a lot of other people over at the Feathercoin forum, for ideas and support, I feel this won’t be the last version and it will be revisited many a time.Disclaimer
While every care has been taken in compilation of this information, I will not be held responsible for any loss, damage, injury or inconvenience caused as a result of inaccuracy or error within this information. Any views or opinions presented in this information are solely mine and do not necessarily represent those of feathercoin.com or other individuals. -
Wow that is amazing feat of engineering, ingenuity and perseverance.
Thank you for showing what can be done if you have the determination to follow things through.
-
Wow, look at that shiny box! It’s awesome!
And your devotion is incredible.
-
OMG that is sexy.
-
I love the ATM, I’m jealous tbh :D
But is there any way you can add a credit card reader and net access?
You know, so when you combine one of those in a town centre with https://forum.feathercoin.com/index.php?/topic/7206-dev-introducing-featherpay-point-of-sales-device/ (sorry, forgot the html command to shorten it :P )
Would there be any reason for a business not to seriously consider taking FTC as a method of payment?
Thoughts?
-
I love the ATM, I’m jealous tbh :D
But is there any way you can add a credit card reader and net access?
You know, so when you combine one of those in a town centre with https://forum.feathercoin.com/index.php?/topic/7206-dev-introducing-featherpay-point-of-sales-device/
I think that is the idea… but I’m not sure what UM is up to… he is quite silet lately so I’m sure he has a “bomb” hidden and he’s waiting the right timing to throw it! :)
Would there be any reason for a business not to seriously consider taking FTC as a method of payment?
The more I think about this issue the more I believe that:
-
price volatilty is a big deterrent when you still buy your things in fiat
-
innovation is not that easy to be digested by the average (typically conservative) small shop owner.
IMHO the first still remains the biggest deterrent… but I’m going OT…
-
-
This topic is also being discussed on bitcointalk here.
-
I like the idea but how do we automate it to do the private key hashing auto magically? Dollar bill readers anyone? Credit cards? I think we need to commercialize on this fact that cryptocurrencies arent going away anytime soon.Allowing purchase in Feathercoins at same location helps. And then theres the funding of the ATM. Does it come from personal wallets or is there some magic wallet holding all the FTC? I can see a disadvantage in personal wallets.
-
@uncle_muddy Great work, deserves a bump.