My Arduino fun projects: Part5: Arduino based Bitcoin vending machine

in #arduino8 years ago

I recently came across this Arduino based Bitcoin vending machine by fluentart on Github and I decided to design try it out. I have met him in person and he is a "genius" I tell you the guy is a geek.

Unfortunately the original example did not work, so I had to do some modifications on the coding to get it to work...he also did not explain properly how it was designed.

The design uses BitX which is a South African based wallet for converting Rands (ZAR) into Bitcoins.

I have been using BitX to use a portion of my Bitcoins to mainly buy mobile airtime and data but it can also be used to BUY or SELL Bitcoins.


Image credit


I will breakdown the project into fewer parts and conclude by combining all the parts as a final design.

Parts to be discussed:

  • Node.js
  • Arduino

Download Node.js

Install Node.js

Then download fluentart orininal code from Github

I then extracted the downloaded file and then used Node.js command prompt to go to the folder server

Under Node.js command prompt install the following:

You will now have a folder node_modules with all the modules installed.


Node.js code modifications

From the original server code: BitRobot.js:

Note it accepts two different payments of different amounts into two different Bitcoin account, then change them to your own account addresses you need to receive the funds into (very important):

ws.send('{"op":"addr_sub", "addr":"17Zu18pDzCneyt5Q7rFC3hjA6ysVoDGX6p"}');
ws.send('{"op":"addr_sub", "addr":"1DNhNdGxZrnjDR6ydxWqm2Qe52NDVuk2QX"}');

Note the original code:

if (ports[num].serialNumber == '754393336353517030D1') {
        console.log(moment().format()+" Arduino detected on "+ports[num].comName)
        arduino = new SerialPort.SerialPort(ports[num].comName, {baudrate: 9600}); //you must set the port and baudrate
        arduConnect(arduino);
    }

I changed it to my Arduino connected port (mine was serial port 3):

arduino = new SerialPort('COM3', {baudrate: 9600}); //you must set the port and baudrate
arduConnect(arduino);

Arduino connection and sketch

I still used the original Arduino sketch: bitcoinMachineServo.ino it works. You will still need to dowmload JSON library for Arduino and put it under Arduino libraries.
Note I used a continuous rotation servo motor well even stepper motor should work and its connected to pin 9

You can use almost any Arduino you prefer.

You can also test the motors or simulate a purchase without BitX wallet just to see if the project works. On the serial monitor of the Arduino IDE just send JSON:

{ "buy" : "1.0" }

The motor will start turning as if dropping an item.


QR code generator for items sold

I used this Bitcoin QR Code Generator because you add the amount of the item been purchased.


Future modifications:

My plan it to upgrade my design to using Steem...well if possible.


Final design:

Credit goes to fluentart for doing all the heavy lifting for us.

The modified Arduino sketch I uploaded on Github

Kindly upvote and follow me: @mokluc….I will upload another project soon: My Arduino fun projects

Sort:  

seems to be an awesome project ......... thanks for sharing :D
upvoted

This blog was listed by @curie. Project Curie is a community project run by several Steemit authors. Our mission is to help reward new content creators who are posting all sorts of original content, and give them the exposure that they need. https://steemit.com/curation/@curie/the-daily-curie-22nd-nov-to-23rd-nov-2016
Thank you for the recognition.

Coin Marketplace

STEEM 0.19
TRX 0.14
JST 0.030
BTC 60115.50
ETH 3192.77
USDT 1.00
SBD 2.45