Hardware: The Space Bucket
Referred to as Space Buckets, these indoor horticulture kits are usually made from a 5 gallon plastic bucket. Every year the technique gains popularity and has created a large community of DIY indoor gardeners and tinkerers. The buckets can be used to grow a variety of vegetables and herbs, but most commonly it is used for Cannabis growth. With the popularity of CBD (medicinal) strains rising, and prohibition slowly fading, many people are turning to Cannabis as an alternative to expensive pharmaceutical drugs. Maintaining a stable environment inside the bucket for the plant's health makes Space Buckets an ideal project for automation and control over the Internet, using sensors and relays to control the lights, fans, and watering system.
This Space Bucket minimizes space and energy by using a COB (Chip On Board) LED. New to the market, these COB LEDs are gaining popularity in the horticulture community for their small size, low price, low energy usage, and high coverage of the light spectrum. One of the few disadvantages of COB LEDs is the heat they generate from the chip surface, so the LED will usually be paired with a large heatsink. This bucket uses a 133mm Pin Fin heatsink cut into the plastic lid of the bucket and powered with a 36V 1.67A (60W) power supply. Attached to the sides of the bucket are 80mm PC fans to help regulate air flow and temperature. One fan is an intake to help create air flow which improves plant health. The second fan is for exhaust, to remove stagnant air and also heat generated from the light. To aid in the automation process, a water tank with water pump is added to the bucket for an automatic watering system. The system takes advantage of low powered water pump (12V 0.5A) and hydro halo system to water the plant at its base inside the bucket. The fans, light, and water pump are connected to a relay board which is controlled by an Internet enabled Raspberry Pi running embedded Linux. The bucket environment is monitored with an Arduino microcontroller, which uses a DHT11 sensor to monitor temperature & humidity, an FC-28 soil sensor to measure soil moisture, and an analog photocell to detect light intensity.
Software: Why Use the Blockchain?
We want to securely monitor & control the bucket from remote locations, but we don't want to use a centralized server and we don't want to open any ports on the bucket's (Raspberry Pi) firewall. Regarding the latter, many users access their Internet through residential ISP services, which are subject to dynamic (changing) IP addresses and strict firewall rules. Commercial IoT devices, such as wifi enabled thermostats, now rely on centralized cloud servers to relay messages between the device and a customer's mobile smartphone app. There are many DIY examples of using a cloud server backend for an IoT application, typically with AWS. While AWS is a great & reliable service, these backend systems can be time consuming, pricey, and complicated to setup. Centralized servers in general are prone to many infrastructure and security risks. Corrupt administrators, denial of service attacks, ransom & malware, and single point of failure events. If the physical server loses power or network connection (e.g. during an extreme weather event) then all the services connected to the server are lost also. New to that, the security of IoT devices has been under increased scrutiny lately. Botnet attacks have shown that current IoT devices still rely on antiquated methods for firmware authentication and communication, such as telnet and FTP.
Blockchain technology relies on a decentralized model. This model is similar to other peer to peer (P2P) networks, such as Bittorent, or a wireless mesh network. Blockchains use this communication system to transmit and store cryptocurrency financial transactions. Each peer in the network validates these transactions & stores the data on a "ledger", and these transactions are extremely hard to forge because they are signed by public/private key encryption system. These measures make blockchain networks more secure than past centralized systems. There are many types of blockchain networks, differing in how the peers validate & store the data, and type of cryptocurrency they use. The majority of these networks only transmit financial information, however a few networks allow other data to be stored and transmitted.
The Ethereum blockchain network allows users to also store executable bytecode onto its ledger. This bytecode is called a "smart contract", and once stored, can be executed by other users with access to the network. Within the contract, variables can be created to store information such as sensor data. "If/then" statements allow the contract to perform automated tasks, such as changing the state of variables (e.g. lightOn) when certain conditions are met (e.g. temperature < 65F). This smart contract not only acts as our automation control, but also as our database, storing historical data of the bucket's environment. Users can easily retrieve this data from the ledger and start building machine learning datasets, eventually creating an autonomous AI system that can read & edit the ledger to predict plant health, predictive maintenance, and identify unique phenotypes, such as plant varieties that consume less water.
A cross compiled version of Geth is run locally on the RasPi/Bucket, synced to the Rinkeby test network in full node mode. The executable and data are stored/run on an external USB thumb drive to help preserve the RasPi's system SD card. A background program, written in NodeJS, uses the web3 JS library to interact with a smart contract that reflects the state of the buckets environment. The user can also use a mobile app, written with React and requiring a web3 infused browser (Metamask, Cipher Wallet) to edit the contract which will in turn change the state of the bucket, such as turning the light on.
Future Goals: Autonomous IoT Sensor Testnet
Creating an autonomous network that uses AI algorithms first needs historical sensor data for training. The Ethereum open source software allows users to create private networks where no currency value is involved. A network such as this could be used to connect IoT enabled Space Buckets from various locations, using the ledger to store & analyze sensor data, not financial transactions. The security of this network increases as more buckets are added, and the AI improves as more plant environment data is added to this private ledger, a ledger/blockchain that is exclusive to the IoT horticulture & Space Bucket community.