Software apps and online services
Hand tools and fabrication machines
The Smart Tea Machine is a simple demonstration of how IOTA can be integrated into a device especially devices like Bolt IoT. It shows the relative ease and simple code that can be used to have basic functionality in a standard machine without display.
The main idea of this project is to make a machine that can be used with IOTA.
The Existing old tea machine is used to prove the concept.***
A standard old tea machine has been modified to be controlled by a Bolt IoT WiFi Module with a 5v Relay. The Bolt IoT WiFi Module can directly on the dispensing 5V DC Pump inside the Tea machine for a Tea. The Bolt IoT WiFi Module connects over WiFi to a Bolt Cloud and a python program with an IOTA node and checks regularly to see if a new transaction has appeared at the address. When it finds one, it wakes the Tea machine and dispenses a Tea.
Buy electronic components with free shipping on utsource.net
Now that the machine is open we are going to solder 2 wire to the DV Pump. As you can see in the image above.
The connections between the Relay and BoltIoT are:
- Bolt IoT PIN0: Relay IN
- Bolt IoT 5v: Relay Vcc
- Bolt IoT Gnd: Relay Gnd
- Bolt IoT 5v: Relay Com
- Relay NO: DC Pump(+)
- Bolt IoT Gnd: DC Pump(-)
The final wiring for the project looks a bit messy but worked just fine.
After it was all wired up, We just test it out with a basic on-off program and then proceeded to check that the relay was firing.
The first open-source distributed ledger that is being built to power the future of the Internet of Things with feeless microtransactions and data integrity for machines.
Read More - https://www.iota.org/get-started/what-is-iota
What is the Trinity?
Trinity is a mobile and desktop application with a user interface that allows you to transfer data and IOTA tokens. Trinity allows you to encrypt and store multiple seeds, where each seed has its own account, transaction history, and settings.
To see how to create an account in Trinity, go to https://docs.iota.org/docs/wallets/0.1/trinity/how-to-guides/create-an-account
In order to test this Machine, you will also need a personal wallet. I had used devnet for testing. To collect free IOTA tokens for your personal devnet wallet, I recommend checking these links:
- How to get free IOTA for Devnet (Faucet #1)
- How to get free IOTA for Devnet (Faucet #2)
- How to get your IOTA receiving address
Pyota is the official Python library for the IOTA Core. It was used to implement a python script that validates the payments made by the clients.
1. Install PyOTA using pip:
pip install pyota
2. Install Bolt Python library using pip:
pip install boltiot
3. Run this python code.
from iota import Iota, Address
from boltiot import Bolt
api_key = "xxxxxxxx-xxxx-xxxxx-xxxxx-xxxxxxxxxx" # Your Bolt Cloud API key
device_id = "BOLTxxxxxx" # Bolt device id that you want to control
# Put your address iota here
my_address = Address(b'KNHINKOATRLLMZTJXCRZQKKMVLHQELNFD9MOMYCMWTIQPIXTEYBEEN9UGWUXZJQHSWH9JACBWZACBTOUA9BZWL9GGC')
# Declare an API object
# DevNet - https://nodes.devnet.thetangle.org:443
# MainNet - https://nodes.thetangle.org:443
api = Iota(adapter='https://nodes.devnet.thetangle.org:443', testnet=True)
success = False
preBal = 0
# Script actually runs continuously with 5 sec intervel
# API method to check balance
response = api.get_balances(addresses=[my_address])
# response['balances'] is a list!
#print('Found the following information for address ' + str(my_address) + ':')
#print('Balance: ' + str(response['balances']) + 'i')
current_balance = response['balances']
print('Balance: ' + str(current_balance) + 'i')
if current_balance == preBal+10:
print("Recived 10i, processing in 1 seconds...")
preBal = current_balance
mybolt = Bolt(api_key, device_id)
response = mybolt.digitalWrite('1', 'HIGH')
sleep(15) # Wait for 15 seconds
response = mybolt.digitalWrite('1', 'LOW')
success = True
preBal = current_balance
print('Zero balance found, retrying in 30 seconds...')
time.sleep(30) # Pause for 30 sec.
After the client has transferred the IOTA tokens, and if its get Confirmed by the network. It will automatically check for the amount received and will on the DC pump for the fixed time to dispense the Tea.
You can see the source code on google collab-
Finally, it was time to power on the Bolt IoT WiFi Module and check all the routines are working as per plan.
**Validating the IOTA takes a couple of seconds**.
You can see the transaction on tangle - https://devnet.thetangle.org/transaction/FHLPKHZQKZU9XACLKOGWN9XNBTFVYWDMYIKTVCFVKEJHAJ9AHYOIOWHJCXBNJNIMIKQWZRNUHYL9A9999
We are done!
I hope this gives you an idea of how you might go about integrating IOTA with Bolt IoT WiFi Module.
Let me know if you have any questions!!