Sustainability Of Supermarket Plants

Where to supermarket herbs come from…

Most supermarkets buy their herbs from abroad and ship them over to the UK to then be sold on to individuals. This uses a huge amount of energy and increases the carbon footprint of the herbs that you buy. The GrowStations aim is to bring attention to the carbon footprint of the products that are used everyday in the kitchen.

Sainsbury’s

Image for Sainsbury's Fresh Packed Bunch Coriander 30g from Sainsbury's

Fresh Packed Bunch Coriander 30g – 70p

Country of Origin:
Packed in Cyprus, Ethiopia, Germany, Italy, Kenya, Morocco, Portugal, South Africa, Spain, United Kingdom

 

Image for Sainsbury's Fresh Living Basil Pot from Sainsbury's

Sainsbury’s Fresh Living Basil Pot – 1.25

Country of Origin:
Packed in Cyprus, Ethiopia, Germany, Italy, Kenya, Morocco, Portugal, South Africa, Spain.

 

I used a carbon footprint calculator to work out on average how much CO2 is produced by a single pot of basil being transported from Ethiopia to the UK by Plane.

Capture

I then worked out what the cost of transporting that to a Bristol based supermarket was for a 120 mile Journey in a 3.5 tonne van;

Capture1234

In Total, from door to door a single basil plants Carbon footprint is roughly 2.43 metric tons of CO2e.

In order to work out the benefits of using the Grow Station I’ve calculated the amount of energy used in terms of electricity based on the time it takes for a basil plant to grow from a cutting to a full plant.

“Basil seeds take between eight and 14 days to germinate and emerge from the soil. After germination, look for the first set of true leaves two to three weeks later. Then, two to three weeks after the first set of true leaves emerge, basil plants should be about 6 inches tall, once grown to this point your basil plant will continue to sprout leave continuously if you give it enough water, light and the right temperature”

The calculation below shows the amount of energy used by the Grow Station over 24 Hours , and is broken down into the costs to run it for a week, month and year.

Capture213

It would cost the user $1.44 to grow up to 8 separate basil plants, where as it would cost $1.25 to buy a plant from Sainsbury’s. The carbon footprint of the Grow Station is shown below.

Capture12344

One thing to factor into this calculation is that plants absorb roughly 25% of the CO2 that we as humans produce, therefore it is possible that the Grow Station could be considered carbon neutral.

Changing Attitudes

There is a huge amount of research out there on the effects of smart home devices , specifically smart meters, that suggests that there is an effect on the way that people behave based on the information that they are given by the meters. According to a study by the Department of Energy & Climate change shows that people are much more receptive to the effects of energy usage when it is make clear how it effects their wallets. By using this research and adapting it to the idea of growing your own food/herbs people should be much more receptive to the idea of changing their habits.

Other examples of this can be seen in product such as the FitBit, which get peoples attention and help them make a change by giving specific quantitative feedback, This is being applied to The Grow Station by showing the user the amount that they are saving cost wise by using the product.

HTTPS Requests with Arduino MKR1000

Introduction

My full code: https://create.arduino.cc/editor/bd2-holt/10727619-6096-42a2-b08e-a9ca055ba597/preview

Capture.PNG

To replace Alexa, we are using IF This Then That (IFTTT). This service allows you to easily use applets for different platforms such as: YoutTube, Spotify, eMail, and SMS, among others. It works by reviving a trigger; ‘this’, then processing an output applet; ‘That’.

For our ‘This’ trigger we used the Webhooks applet. This applet allows you to send a HTTPS request (More specifically a POST or GET request, explained later) to webhooks, which will then trigger the output event. The easiest way to trigger webhooks is to copy and paste the unique URL into your browser and hit enter, however we needed to trigger it using Arduino…

Arduino MKR1000

The Arduino we are using for the internet connectivity is the Arduino MKR1000, a board specifically designed for Internet of Things (IoT) projects. The board uses a WiFi101 module which required the installation of libraries to use.

Setting up the MKR1000: To use the MKR1000, you must install the board type into arduino under Boards Manager. Install the SAMD 32bit ARM-cortex boards.

Next the firmware should be updated on your board, and any SSL (Secure Sockets Layer, used for encrypted HTTPS connections) certificates for web hosts should be added to the board. To do this you need to go to WiFi101 file>example sketches>Wifi101 and run the FirmwareUpdater sketch. Once this sketch is loaded go to tools, and run the firmware updater tool.

In this you should update your module to the newest version (See the text on your board’s WiFi101 module for whether you should use A or B version).

And also add SSL certificates for any website your connecting to, do this at the bottom by typing in the host address, e.g. http://www.google.co.uk.

WiFi 101

Using WiFi101 is relatively easy, however is a little more complex that ESP2866; the most common network module for Arduino.

WiFi101.h
WiFiClient.h
WiFiSSLClient.h
WiFiUdp.h
SPI.h

Include the above libraries.

//WiFi router setup
char ssid[] = "Bob's iPhone"; //network SSID (aka WiFi name)
char pass[] = "password123"; //network password
int status = WL_IDLE_STATUS;
const char* host = "maker.ifttt.com";
WiFiSSLClient sslClient;
WiFiClient client;

Setting up the router connection and defining the host we will connect to later: maker.ifttt.com.

void wifiSetup() {
// Check for the presence of the shield
Serial.print("WiFi101 shield: ");
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("NOT PRESENT");
return; // don't continue
}
Serial.println("DETECTED");
// attempt to connect to Wifi network:
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to Network named: ");
Serial.println(ssid); // print the network name (SSID);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
// wait 10 seconds for connection:
delay(10000);
}
printWifiStatus(); // you're connected now, so print out the status
}

Call this function using wifiSetup()'. WiFi.status() returns true if the module is connected properly. WiFi.begin(ssid, pass) initialises the connection.

The printWifiStatus() is a separate function, which prints to the serial connection information:

void printWifiStatus() {
// print the SSID of the network:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());

// print WiFi shield's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);

// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
Serial.println(ip);
}

After this is done your ready to start (trying) to send POST requests to IFTTT…

HTTPS with WiFi101

To do this you’ll need to use the following code:

void sendMessage() {
if (sslClient.connectSSL(host, 443)) { //also try .connectSSL
Serial.println("IFTTT request in Progress");
//change this to your Maker setting from //https://ifttt.com/services/maker/settings
String data = "randomdata";
sslClient.println("POST /trigger/tank_empty/with/key/bxazzvKgX-iohEv3KRPOr3 HTTP/1.1");
sslClient.println("Host: ");
sslClient.println(host);
sslClient.println("Content-Type: application/text/plain"); //originally //application/json
sslClient.print("Content-Length: ");
sslClient.println(data.length());
sslClient.println();
sslClient.print(data);
sslClient.stop();
Serial.println("IFTTT request Sucessful");
}
else {
Serial.println("IFTTT request failed");
}
}

sslClient.connectSSL(host, port) returns true if it can connect to the host (the port should be 80 or 443, default open networking ports): When I used maker.ifttt.com it failed at this point.

sslClient.println("POST /uniqueURL HTTP/1.1"); tells the host what request type your using; ‘POST’, followed by the specific domain’s url you want to access, followed by HTTP/1.1, the networking protocol used: This is where WiFi101 gets it’s name.

sslClient.println("Content-Type: application/text/plain"); tells the host what format the data you are sending it is. If you want to send extra conditions to IFTTT, this should be application/json.

The lines of code after this are saying that I’m about to send data, the length of the data, and the data itself.
sslClient.stop(); ends the POST request.

Conclusion

If this worked correctly your custom IFTTT applet should have triggered. Unfortunately I didn’t have the time to fully troubleshoot the problem. However I am fairly convinced it is in the formatting of my HTTP request. The formatting is very important and is occasionally server host specific. Alternatively it is because maker.ifttt.com is denying access for my specific Arduino MAC address, however this is very unlikely.

Using this code I successfully connected to and received data from google.co.uk, but it didn’t seem to work with maker.ifttt.com, but did work with zapier.com (an IFTTT alternative which seemed to have website flaws stopping me from using it). It also worked with ifttt.com

For our hand in we will be using a LCD screen to provide feedback instead.

(Bob & Alex) Alexa -> Arduino MKR1000

Introduction

Following on from last week where I setup a custom Alexa skill… The next stage is to get the Arduino setup with WiFi and communicating through Shiftr.io ( https://shiftr.io/bobIOT/project-arduino ). Shiftr.io is a IoT prototyping service which makes the connection of simple data between devices more simple.

For my Arduino I am using the MKR1000, a board with WiFi built in (WiFi 101). It is smaller, a little slower and slightly less powerful: it’s based on the Arduino Zero.

Testing

With this skill I couldn’t figure our how to change the invocation name of the Alexa SmartHome skill template, so I was stuck with “Alexa, turn the kettle on”. I think it will mean diving into the Alexa javascript code, which I’ll do at another time.

For this prototype I unfortunately lost the code.

Conclusions

The Alexa skill could be a very cool addition to our product, but doing so would mean creating a fully custom skill from scratch, without templates for the JavaScript code for the Alexa. Communicating all the data required for user feedback would be a task too difficult for the time frame we have.

Next week

From this we have decided to use IFTTT to send a text notification to the user’s phone once the water tank is empty on the plant feeder.

Bob & Alex, Grow Station watering system.

For our grow station Bob and I needed to find a way to stem the flow of water when the main tank in the base is full. to do this we initially tried to use a servo with a 3D printed arm to ‘crimp’ the silicone tubing that we are using. As you can see in the video below this was not really an effective solution. So we’re moving on to a few different ways that we could stem the flow.

After a bit of research, I stumbled across an Instructables using 3D printed servo controlled valves designed to be used for artificial muscles. after reading through I realised that a few of the valves could be re-purposed to stem the flow in our gravity few watering systems.

There are a few different servo controlled systems that could be used. the first is a three valve system that we could use to not only supply water but things like plant food.

 

FO48P7LINKLPY6T.LARGE
Three-way valve system

This image shows the three-way system. it is actually three valves controlled by one servo. They can be all off or they can be opened one at a time. A cam that presses against a cam-follower is rotated to open the valves. The servo controlled valve can replace 3 conventional solenoid valves.

 

 

 

 

 

F08R5N6INKLQ1FF.LARGE
3D Printed Gate Valve

The image on the left shows the 3D printed gate valve system that is probably the simplest to use with the growing station. It consists of a housing with a slide bar that manually kinks and unkinks the silicone tubing, and can work up to and beyond 30PSI of pressure.

 

Alex & Bob Moisture Sensor for Grow Station

So for our grow station Bob and I decided to use a couple moisture sensors to see when plants in the station need more water.

Based on the research done by Liam earlier in the semester we looked at how we could integrate the moisture sensors into the station.

 

moisture-sensor
Moisture sensor YL-69

We used these Moisture sensors from Amazon, also know as Hygrometer modules. The soil moisture sensors are normally used to detect the humidity of soil, so is perfect for our purposes. The sensor comes in two parts; the electronics board (on the right of the image) and the probe (on the left) that detects the water level.

 

 

 

 

labeled-sensor
Moisture Sensor electronics board

Each sensor has a built-in potentiometer for adjusting the sensitivity of the digital output (D0), an LED to show that its receiving power and a digital output LED, shown in the image on the right.

 

 

The moisture sensors work by estimating the volumetric water content of the soil that they are placed in. The sensor then sends a voltage output dependent on the moisture content that it reads. When it senses moisture in the soil it sends a lower voltage output than when it doesn’t.

We mounted our moisture sensors in two places on our grow station. The first is mounted inside the main tank as seen in the left-hand image, the second is mounted inside the reserve tank (right-hand image). the probes are inside the tank and the connection pins are on the outside so they don’t mix with the water.

Bob & Alex Grow Station

The grow station is coming along nicely, together with Bob we have gotten the self-water feature of the station to read when it needs to be watered and when the reserve tank of water needs to be refilled. we did this using two moisture sensors to tell when the main tank is below a certain level, and when the reserve tank is low as you can see in the videos below.

The main issue that we currently have is that our servo used to control the flow of water is not powerful enough to crimp the tubing that we are using to stop the flow completely.

(Bob & Alex) Initial Alexa integration attempt

Introduction

For our smart growing station, we wanted to integrate analytics of our plants into an Alexa feedback system. It was initially quite confusing on how to achieve this, but the following is what I found…

Setting up a custom Alexa skill

Alexa Capture 1.PNG

Using the Amazon Web Developer service, you can create a custom skill. A skill is a programmed feedback protocol using Alexa. The tutorial I was trying to follow was to generate a random fact on request of the user.

To do this custom skill you need to set a few parameters:

•The invocation name: i.e. What Alexa responds to when you which to invoke your skill.

•Intents and slots: This is the Alexa equivalent of defining a function in the code, the ‘Intent’ being the function name e.g. tellMeFact, and the slot being arguments for that function. e.g. factName, factInfo, factTime, factFriend

•Samples (sample utterances) is a way to further define your interactions with Alexa. Such as “Alexa, tell me a fact”, followed by “Send this fact to {factFriend}”, which could message your friend the fact you found out.

•Endpoint: The endpoint is where you do the processing on the commands given to Alexa. The preferred method for this is using Amazon’s Lambda service. Which allows you to host an online computing function. In this case, it is to receive the request from Alexa and to return a space fact in the form of a string.

Testing

I did manage to get the Alexa skill working in the end, it retrieved the fact from my hosted Lambda computing service. The code for the lambda program is below:

code capture 1.PNGcode capture 2.PNG

code capture 3.PNG

Conclusion

Now I have learnt to create a custom Alexa skill I can edit this existing example to integrate with my Arduino over Wi-Fi. This will require changing the Invocation name, samples, intents and slots, as well as edit the lambda code.

(Bob & Alex) Project overview

Introduction

We (Bob Holt and Alex Newburg) are working together to produce the next part of our project; A smart home planter station, this is to fit the “For Effecting Behaviour Change” section of the brief. We believe by creating a salad leaf and herb growing station we can influence consumers thinking about what it takes to produce food, hopefully reducing the willingness to waste food. It will also have a direct environmental impact: Eliminating carbon emissions from transporting food, since it will be grown where it is to be cooked with.

Proposal

We propose to make a watering station with a variety of ‘smart’ features:

•Auto watering/watering reminder system: A moisture sensor combined with either a pump or a gravity/valve system.

•Tank refill notifications: This will be achieved using a water level sensor and a notification to Amazon Alexa, or via text message.

•A UV LED lighting system to increase growth speed of the plants: Put on a timer to allow the plants to grow at night as well as day.

•Notifications for fully grown plants: Using an IR emitter/receiver pair to detect once plants have reached a certain height, the user will be notified by Alexa.

•Progress reports from Alexa: Asking Alexa “How is my garden doing?” To bring up an audio overview of how many plants are fully grown, the water level, and any other diagnostics we feel necessary.