SlideShare a Scribd company logo
1 of 26
© All rights reserved 2022 2
SucculentPi
An IoT Panopticon
for a House Plant
© All rights reserved 2022
Cloudreach Service Lines
Cloudreach
Services
Advisory
Software Platform
Data & Analytics
Platform Development
Application Modernisation
Security Transformation
Migration
Management & Resale
© All rights reserved 2022
Our Cloud Partnerships
UK&I Consulting Partner
of the Year 2022
900+ Certifications
15 Competency
Specializations
Data Analytics - Services Specialisation
GCP Security Partner
of the Year 2021
100+ Certifications
12 Competency
Specializations
Gold Data Analytics Competency
Gold Data Platform Competency
Microsoft UK Partner
of the Year 2020
500+ Certifications
12 Gold Certifications
15 Competency
Specializations
© All rights reserved 2022
Dead Plant + Boredom + Raspberry Pi
=
Internet-of-Things!
In The Beginning…
© All rights reserved 2022
Because we usually can’t tell the stories from
our real, customer projects! ☹
But Why?
© All rights reserved 2022
Part 1: The Thing Bit
© All rights reserved 2022
The Hardware
© All rights reserved 2022
The GrovePi+ software is years out of date, and uses an imperative deployment script!
I never managed to escape dependency hell with that outdated script
Did get it working just enough though!
Why, oh why, are we still using imperative deployment scripts in 2022 ?!?
Challenge 1: Imperative Deployment Woes
© All rights reserved 2022
If you can engineer consistency into your data at the point
of generation/capture, you’ll save yourself a ton of hassle
down the line!
Plus I had nowhere to put to the IR camera
Solution: Hacking, of the IKEA variety!
So I built a rig to hold the plant in a consistent position
relative to the camera and other sensors
Challenge 2: Building in Consistency
© All rights reserved 2022
The Awair device provides environmental and air quality data
for the room
It has a handy local network API…
… which seems to be in perpetual beta, and of very beta quality!
Randomly returns HTTP 200 with no data
Had to check actual content of the response on every API call,
instead of just checking the return code
Challenge 3: Beta APIs
© All rights reserved 2022
From the Raspberry Pi Sensors:
1. Infrared image of the plant’s leaves
2. Visible light level
3. Ultraviolet light level
4. Infrared light level
5. Soil moisture level (top of pot)
6. Soil moisture level (middle of pot)
7. Soil moisture level (bottom of pot)
From the Awair Sensors:
1. Room air temperature
2. Dew point for the room
3. Relative humidity level
4. Absolute humidity level
5. Carbon Dioxide (CO2) level
6. Air Volatile Organic Compounds (VOC) level
7. Air hydrogen (H2) level
8. Air ethanol level
9. Airborne particulate matter (PM2.5) level
The Final Data Points
All collected on the following schedule:
*/5 * * * *
© All rights reserved 2022
Part 2: The Internet Bit
© All rights reserved 2022
© All rights reserved 2022
The IR image is uploaded to an S3 bucket
A JSON payload is generated containing all the
sensor readings, plus the S3 URL of the associated
IR image
The payload is sent as a message to an MQTT topic
in AWS IoT Core
{
"timestamp": "2022-01-01-000000",
"plant": {
"pot": {
"soil": {
"moisture_top_a0": 87,
"moisture_middle_a1": 31,
"moisture_bottom_a2": 49
}
},
"env": {
"visible_light": 278,
"uv_light": 0.11,
"ir_light": 349
},
"images": {
"infrared": "https://bucket.s3.region.amazonaws.com/infrared/2022-01-01-000000.png"
}
},
"room": {
"env": {
"dew_point": 16.66,
"temp": 28.34,
"rel_humid": 49.17,
"abs_humid": 13.6,
"co2": 471,
"voc_total": 40,
"voc_h2": 26,
"voc_ethanol": 36,
"pm25": 8
}
}
}
Data Acquisition
© All rights reserved 2022
An AWS IoT Core message routing rule routes the
payload’s contents to AWS Timestream
Message routing rules are just SQL
Here we flatten the hierarchy in the JSON message,
To give a flat structure in Timestream for ease of
future analytics
SELECT
plant.pot.soil.moisture_top_a0 AS plant_pot_soil_moisture_top,
plant.pot.soil.moisture_middle_a1 AS plant_pot_soil_moisture_middle,
plant.pot.soil.moisture_bottom_a2 AS plant_pot_soil_moisture_bottom,
plant.env.visible_light AS plant_env_visiblelight,
plant.env.uv_light AS plant_env_uvlight,
plant.env.ir_light AS plant_env_irlight,
plant.images.infrared AS plant_image_infrared,
room.env.dew_point AS room_env_dewpoint,
room.env.temp AS room_env_temperature,
room.env.rel_humid AS room_env_relativehumidity,
room.env.abs_humid AS room_env_absolutehumidty,
room.env.co2 AS room_env_co2,
room.env.voc_total AS room_env_voctotal,
room.env.voc_h2 AS room_env_voch2,
room.env.voc_ethanol AS room_env_vocethanol,
room.env.pm25 AS room_env_pm25
FROM
'succulentpi/readings'
MQTT Message Routing
© All rights reserved 2022
© All rights reserved 2022
Part 3: The Bit Where it all goes Wrong
© All rights reserved 2022
© All rights reserved 2022
The GrovePi+ board had crapped out… naturally,
right after I stopped manually checking the data flow
regularly!
All the sensors returned data only intermittently, and
all of the readings were garbage - null, 0, or 65536
It took a hard reboot - physically removing power for
a while - to revive it!!!
So…
Beware Hobby IoT Hardware
© All rights reserved 2022
So I need to physically disconnect the power regularly,
automatically, and reliably…
Sooo… robots?!?
I drastically over thought this for a while, until a light bulb
moment came…
Literally - a light bulb came on! I have an IKEA Smart Home
system, which has scheduled actions, and they sell a smart plug
So IKEA to the rescue!
Challenge 4: Automating Hard Power Cycles
© All rights reserved 2022
I don’t want to loose weeks of data if this happens again, therefore I need monitoring!
Monitoring for successfully published MQTT messages won’t fully capture this situation
Instead; the actual values of the sensor readings committed to the Timestream table need to be checked for
sanity
Handily, AWS have a blog post on exactly how to do this with Lambda
I went with checking the one soil moisture sensor reading, as these sensors have a well documented definition
of valid readings:
Challenge 5: What if it Happens Again?
elif result > 0 and (int(response['Rows'][0]['Data'][4]['ScalarValue']) < 0 or
int(response['Rows'][0]['Data'][4]['ScalarValue']) > 950):
logger.info("Sending Data Out Of Range SNS Message...")
sns.publish(TopicArn=SNS_TOPIC, Message=f"ALERT: The SucculentPi sensor data is out of range", Subject="Alert:
Sensor Data Out of Range")
© All rights reserved 2022
© All rights reserved 2022
Keep an eye on the Cloudreach Tech Blog for more of the continuing SucculentPi adventures!
Definitely planning more for this project, once enough (non-garbage) data has been collected
Ideas for future parts include (in no particular order):
● Dashboarding and visualisation of the time-series data with AWS QuickSight
● Can we detect useful/interesting things in the IR images using computer vision ML with AWS
SageMaker and/or Rekognition?
● Can we forecast watering needs using AWS Forecast?
● Can we discover any interesting correlations between watering needs and environmental
factors using AWS Lookout and/or SageMaker?
Watch this Space…
© All rights reserved 2022 25
Questions?
Perhaps Answers
© All rights reserved 2022 26
Thank you
Cloudreach Tech Blog: https://www.cloudreach.com/en/technical-blog
Blog Part 1: https://bit.ly/3T7IFob
Blog Part 2: https://bit.ly/3TtazL0
Sample Code: https://github.com/binghamchris/succulentpi

More Related Content

Similar to SucculentPi [AWS Basel Meetup - Oct 2022].pdf

End-to-End Cloud: Oracle Java Cloud, Oracle Mobile Cloud Service, Oracle MAF,...
End-to-End Cloud: Oracle Java Cloud, Oracle Mobile Cloud Service, Oracle MAF,...End-to-End Cloud: Oracle Java Cloud, Oracle Mobile Cloud Service, Oracle MAF,...
End-to-End Cloud: Oracle Java Cloud, Oracle Mobile Cloud Service, Oracle MAF,...
andrejusb
 
devworkshop-10_28_1015-amazon-conference-presentation
devworkshop-10_28_1015-amazon-conference-presentationdevworkshop-10_28_1015-amazon-conference-presentation
devworkshop-10_28_1015-amazon-conference-presentation
Alex Wu
 
Leveraging the strength of OSGi to deliver a convergent IoT Ecosystem - O Log...
Leveraging the strength of OSGi to deliver a convergent IoT Ecosystem - O Log...Leveraging the strength of OSGi to deliver a convergent IoT Ecosystem - O Log...
Leveraging the strength of OSGi to deliver a convergent IoT Ecosystem - O Log...
mfrancis
 

Similar to SucculentPi [AWS Basel Meetup - Oct 2022].pdf (20)

AWS Startup Insights Kuala Lumpur
AWS Startup Insights Kuala LumpurAWS Startup Insights Kuala Lumpur
AWS Startup Insights Kuala Lumpur
 
AWS IoT 및 Mobile Hub 서비스 소개 (김일호) :: re:Invent re:Cap Webinar 2015
AWS IoT 및 Mobile Hub 서비스 소개 (김일호) :: re:Invent re:Cap Webinar 2015AWS IoT 및 Mobile Hub 서비스 소개 (김일호) :: re:Invent re:Cap Webinar 2015
AWS IoT 및 Mobile Hub 서비스 소개 (김일호) :: re:Invent re:Cap Webinar 2015
 
End-to-End Cloud: Oracle Java Cloud, Oracle Mobile Cloud Service, Oracle MAF,...
End-to-End Cloud: Oracle Java Cloud, Oracle Mobile Cloud Service, Oracle MAF,...End-to-End Cloud: Oracle Java Cloud, Oracle Mobile Cloud Service, Oracle MAF,...
End-to-End Cloud: Oracle Java Cloud, Oracle Mobile Cloud Service, Oracle MAF,...
 
devworkshop-10_28_1015-amazon-conference-presentation
devworkshop-10_28_1015-amazon-conference-presentationdevworkshop-10_28_1015-amazon-conference-presentation
devworkshop-10_28_1015-amazon-conference-presentation
 
AWS Startup Insights Singapore
AWS Startup Insights SingaporeAWS Startup Insights Singapore
AWS Startup Insights Singapore
 
Global Azure Bootcamp 2016 - Real-world Internet of Things Backend with Azure...
Global Azure Bootcamp 2016 - Real-world Internet of Things Backend with Azure...Global Azure Bootcamp 2016 - Real-world Internet of Things Backend with Azure...
Global Azure Bootcamp 2016 - Real-world Internet of Things Backend with Azure...
 
Reply Netcamp PoliTo - AWS IoT - Grohe and Caleffi Case Studies
Reply Netcamp PoliTo - AWS IoT - Grohe and Caleffi Case StudiesReply Netcamp PoliTo - AWS IoT - Grohe and Caleffi Case Studies
Reply Netcamp PoliTo - AWS IoT - Grohe and Caleffi Case Studies
 
Uncover the Root Cause of Kafka Performance Anomalies, Daniel Kim & Antón Rod...
Uncover the Root Cause of Kafka Performance Anomalies, Daniel Kim & Antón Rod...Uncover the Root Cause of Kafka Performance Anomalies, Daniel Kim & Antón Rod...
Uncover the Root Cause of Kafka Performance Anomalies, Daniel Kim & Antón Rod...
 
SRV304 IoT Building Blocks From Edge Devices to Analytics in the Cloud
SRV304 IoT Building Blocks From Edge Devices to Analytics in the Cloud SRV304 IoT Building Blocks From Edge Devices to Analytics in the Cloud
SRV304 IoT Building Blocks From Edge Devices to Analytics in the Cloud
 
Industrial Hazard Monitoring using IOT
Industrial Hazard Monitoring using IOTIndustrial Hazard Monitoring using IOT
Industrial Hazard Monitoring using IOT
 
Leveraging the strength of OSGi to deliver a convergent IoT Ecosystem - O Log...
Leveraging the strength of OSGi to deliver a convergent IoT Ecosystem - O Log...Leveraging the strength of OSGi to deliver a convergent IoT Ecosystem - O Log...
Leveraging the strength of OSGi to deliver a convergent IoT Ecosystem - O Log...
 
Overview of IoT Infrastructure and Connectivity at AWS & Getting Started with...
Overview of IoT Infrastructure and Connectivity at AWS & Getting Started with...Overview of IoT Infrastructure and Connectivity at AWS & Getting Started with...
Overview of IoT Infrastructure and Connectivity at AWS & Getting Started with...
 
Cloud Monitoring System Using Internet of Things
Cloud Monitoring System Using Internet of ThingsCloud Monitoring System Using Internet of Things
Cloud Monitoring System Using Internet of Things
 
IOT Based Low Cost Irrigation Model
IOT Based Low Cost Irrigation ModelIOT Based Low Cost Irrigation Model
IOT Based Low Cost Irrigation Model
 
Using Grid Technologies in the Cloud for High Scalability
Using Grid Technologies in the Cloud for High ScalabilityUsing Grid Technologies in the Cloud for High Scalability
Using Grid Technologies in the Cloud for High Scalability
 
DWX2018 IoT lecture
DWX2018 IoT lectureDWX2018 IoT lecture
DWX2018 IoT lecture
 
AWS re:Invent 2016: Internet of Things (IoT) Edge and Device Services (IOT202)
AWS re:Invent 2016: Internet of Things (IoT) Edge and Device Services (IOT202)AWS re:Invent 2016: Internet of Things (IoT) Edge and Device Services (IOT202)
AWS re:Invent 2016: Internet of Things (IoT) Edge and Device Services (IOT202)
 
Smart parking system using IOT
Smart parking system using IOTSmart parking system using IOT
Smart parking system using IOT
 
Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...
Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...
Distributed Solar Systems at EDF Renewables and AWS IoT: A Natural Fit (PUT30...
 
Aquarius_IJARCCE
Aquarius_IJARCCEAquarius_IJARCCE
Aquarius_IJARCCE
 

Recently uploaded

obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
yulianti213969
 
原件一样伦敦国王学院毕业证成绩单留信学历认证
原件一样伦敦国王学院毕业证成绩单留信学历认证原件一样伦敦国王学院毕业证成绩单留信学历认证
原件一样伦敦国王学院毕业证成绩单留信学历认证
pwgnohujw
 
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotecAbortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
q6pzkpark
 
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
acoha1
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
jk0tkvfv
 
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
aqpto5bt
 
Jual Obat Aborsi Lhokseumawe ( Asli No.1 ) 088980685493 Obat Penggugur Kandun...
Jual Obat Aborsi Lhokseumawe ( Asli No.1 ) 088980685493 Obat Penggugur Kandun...Jual Obat Aborsi Lhokseumawe ( Asli No.1 ) 088980685493 Obat Penggugur Kandun...
Jual Obat Aborsi Lhokseumawe ( Asli No.1 ) 088980685493 Obat Penggugur Kandun...
Obat Aborsi 088980685493 Jual Obat Aborsi
 
sourabh vyas1222222222222222222244444444
sourabh vyas1222222222222222222244444444sourabh vyas1222222222222222222244444444
sourabh vyas1222222222222222222244444444
saurabvyas476
 

Recently uploaded (20)

obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
 
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
 
Formulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdfFormulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdf
 
原件一样伦敦国王学院毕业证成绩单留信学历认证
原件一样伦敦国王学院毕业证成绩单留信学历认证原件一样伦敦国王学院毕业证成绩单留信学历认证
原件一样伦敦国王学院毕业证成绩单留信学历认证
 
Predictive Precipitation: Advanced Rain Forecasting Techniques
Predictive Precipitation: Advanced Rain Forecasting TechniquesPredictive Precipitation: Advanced Rain Forecasting Techniques
Predictive Precipitation: Advanced Rain Forecasting Techniques
 
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotecAbortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
一比一原版(曼大毕业证书)曼尼托巴大学毕业证成绩单留信学历认证一手价格
 
NOAM AAUG Adobe Summit 2024: Summit Slam Dunks
NOAM AAUG Adobe Summit 2024: Summit Slam DunksNOAM AAUG Adobe Summit 2024: Summit Slam Dunks
NOAM AAUG Adobe Summit 2024: Summit Slam Dunks
 
Fuel Efficiency Forecast: Predictive Analytics for a Greener Automotive Future
Fuel Efficiency Forecast: Predictive Analytics for a Greener Automotive FutureFuel Efficiency Forecast: Predictive Analytics for a Greener Automotive Future
Fuel Efficiency Forecast: Predictive Analytics for a Greener Automotive Future
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"
 
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
 
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
 
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
 
Jual Obat Aborsi Lhokseumawe ( Asli No.1 ) 088980685493 Obat Penggugur Kandun...
Jual Obat Aborsi Lhokseumawe ( Asli No.1 ) 088980685493 Obat Penggugur Kandun...Jual Obat Aborsi Lhokseumawe ( Asli No.1 ) 088980685493 Obat Penggugur Kandun...
Jual Obat Aborsi Lhokseumawe ( Asli No.1 ) 088980685493 Obat Penggugur Kandun...
 
Bios of leading Astrologers & Researchers
Bios of leading Astrologers & ResearchersBios of leading Astrologers & Researchers
Bios of leading Astrologers & Researchers
 
Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024Northern New England Tableau User Group (TUG) May 2024
Northern New England Tableau User Group (TUG) May 2024
 
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
Jual Obat Aborsi Bandung (Asli No.1) Wa 082134680322 Klinik Obat Penggugur Ka...
 
sourabh vyas1222222222222222222244444444
sourabh vyas1222222222222222222244444444sourabh vyas1222222222222222222244444444
sourabh vyas1222222222222222222244444444
 

SucculentPi [AWS Basel Meetup - Oct 2022].pdf

  • 1.
  • 2. © All rights reserved 2022 2 SucculentPi An IoT Panopticon for a House Plant
  • 3. © All rights reserved 2022 Cloudreach Service Lines Cloudreach Services Advisory Software Platform Data & Analytics Platform Development Application Modernisation Security Transformation Migration Management & Resale
  • 4. © All rights reserved 2022 Our Cloud Partnerships UK&I Consulting Partner of the Year 2022 900+ Certifications 15 Competency Specializations Data Analytics - Services Specialisation GCP Security Partner of the Year 2021 100+ Certifications 12 Competency Specializations Gold Data Analytics Competency Gold Data Platform Competency Microsoft UK Partner of the Year 2020 500+ Certifications 12 Gold Certifications 15 Competency Specializations
  • 5. © All rights reserved 2022 Dead Plant + Boredom + Raspberry Pi = Internet-of-Things! In The Beginning…
  • 6. © All rights reserved 2022 Because we usually can’t tell the stories from our real, customer projects! ☹ But Why?
  • 7. © All rights reserved 2022 Part 1: The Thing Bit
  • 8. © All rights reserved 2022 The Hardware
  • 9. © All rights reserved 2022 The GrovePi+ software is years out of date, and uses an imperative deployment script! I never managed to escape dependency hell with that outdated script Did get it working just enough though! Why, oh why, are we still using imperative deployment scripts in 2022 ?!? Challenge 1: Imperative Deployment Woes
  • 10. © All rights reserved 2022 If you can engineer consistency into your data at the point of generation/capture, you’ll save yourself a ton of hassle down the line! Plus I had nowhere to put to the IR camera Solution: Hacking, of the IKEA variety! So I built a rig to hold the plant in a consistent position relative to the camera and other sensors Challenge 2: Building in Consistency
  • 11. © All rights reserved 2022 The Awair device provides environmental and air quality data for the room It has a handy local network API… … which seems to be in perpetual beta, and of very beta quality! Randomly returns HTTP 200 with no data Had to check actual content of the response on every API call, instead of just checking the return code Challenge 3: Beta APIs
  • 12. © All rights reserved 2022 From the Raspberry Pi Sensors: 1. Infrared image of the plant’s leaves 2. Visible light level 3. Ultraviolet light level 4. Infrared light level 5. Soil moisture level (top of pot) 6. Soil moisture level (middle of pot) 7. Soil moisture level (bottom of pot) From the Awair Sensors: 1. Room air temperature 2. Dew point for the room 3. Relative humidity level 4. Absolute humidity level 5. Carbon Dioxide (CO2) level 6. Air Volatile Organic Compounds (VOC) level 7. Air hydrogen (H2) level 8. Air ethanol level 9. Airborne particulate matter (PM2.5) level The Final Data Points All collected on the following schedule: */5 * * * *
  • 13. © All rights reserved 2022 Part 2: The Internet Bit
  • 14. © All rights reserved 2022
  • 15. © All rights reserved 2022 The IR image is uploaded to an S3 bucket A JSON payload is generated containing all the sensor readings, plus the S3 URL of the associated IR image The payload is sent as a message to an MQTT topic in AWS IoT Core { "timestamp": "2022-01-01-000000", "plant": { "pot": { "soil": { "moisture_top_a0": 87, "moisture_middle_a1": 31, "moisture_bottom_a2": 49 } }, "env": { "visible_light": 278, "uv_light": 0.11, "ir_light": 349 }, "images": { "infrared": "https://bucket.s3.region.amazonaws.com/infrared/2022-01-01-000000.png" } }, "room": { "env": { "dew_point": 16.66, "temp": 28.34, "rel_humid": 49.17, "abs_humid": 13.6, "co2": 471, "voc_total": 40, "voc_h2": 26, "voc_ethanol": 36, "pm25": 8 } } } Data Acquisition
  • 16. © All rights reserved 2022 An AWS IoT Core message routing rule routes the payload’s contents to AWS Timestream Message routing rules are just SQL Here we flatten the hierarchy in the JSON message, To give a flat structure in Timestream for ease of future analytics SELECT plant.pot.soil.moisture_top_a0 AS plant_pot_soil_moisture_top, plant.pot.soil.moisture_middle_a1 AS plant_pot_soil_moisture_middle, plant.pot.soil.moisture_bottom_a2 AS plant_pot_soil_moisture_bottom, plant.env.visible_light AS plant_env_visiblelight, plant.env.uv_light AS plant_env_uvlight, plant.env.ir_light AS plant_env_irlight, plant.images.infrared AS plant_image_infrared, room.env.dew_point AS room_env_dewpoint, room.env.temp AS room_env_temperature, room.env.rel_humid AS room_env_relativehumidity, room.env.abs_humid AS room_env_absolutehumidty, room.env.co2 AS room_env_co2, room.env.voc_total AS room_env_voctotal, room.env.voc_h2 AS room_env_voch2, room.env.voc_ethanol AS room_env_vocethanol, room.env.pm25 AS room_env_pm25 FROM 'succulentpi/readings' MQTT Message Routing
  • 17. © All rights reserved 2022
  • 18. © All rights reserved 2022 Part 3: The Bit Where it all goes Wrong
  • 19. © All rights reserved 2022
  • 20. © All rights reserved 2022 The GrovePi+ board had crapped out… naturally, right after I stopped manually checking the data flow regularly! All the sensors returned data only intermittently, and all of the readings were garbage - null, 0, or 65536 It took a hard reboot - physically removing power for a while - to revive it!!! So… Beware Hobby IoT Hardware
  • 21. © All rights reserved 2022 So I need to physically disconnect the power regularly, automatically, and reliably… Sooo… robots?!? I drastically over thought this for a while, until a light bulb moment came… Literally - a light bulb came on! I have an IKEA Smart Home system, which has scheduled actions, and they sell a smart plug So IKEA to the rescue! Challenge 4: Automating Hard Power Cycles
  • 22. © All rights reserved 2022 I don’t want to loose weeks of data if this happens again, therefore I need monitoring! Monitoring for successfully published MQTT messages won’t fully capture this situation Instead; the actual values of the sensor readings committed to the Timestream table need to be checked for sanity Handily, AWS have a blog post on exactly how to do this with Lambda I went with checking the one soil moisture sensor reading, as these sensors have a well documented definition of valid readings: Challenge 5: What if it Happens Again? elif result > 0 and (int(response['Rows'][0]['Data'][4]['ScalarValue']) < 0 or int(response['Rows'][0]['Data'][4]['ScalarValue']) > 950): logger.info("Sending Data Out Of Range SNS Message...") sns.publish(TopicArn=SNS_TOPIC, Message=f"ALERT: The SucculentPi sensor data is out of range", Subject="Alert: Sensor Data Out of Range")
  • 23. © All rights reserved 2022
  • 24. © All rights reserved 2022 Keep an eye on the Cloudreach Tech Blog for more of the continuing SucculentPi adventures! Definitely planning more for this project, once enough (non-garbage) data has been collected Ideas for future parts include (in no particular order): ● Dashboarding and visualisation of the time-series data with AWS QuickSight ● Can we detect useful/interesting things in the IR images using computer vision ML with AWS SageMaker and/or Rekognition? ● Can we forecast watering needs using AWS Forecast? ● Can we discover any interesting correlations between watering needs and environmental factors using AWS Lookout and/or SageMaker? Watch this Space…
  • 25. © All rights reserved 2022 25 Questions? Perhaps Answers
  • 26. © All rights reserved 2022 26 Thank you Cloudreach Tech Blog: https://www.cloudreach.com/en/technical-blog Blog Part 1: https://bit.ly/3T7IFob Blog Part 2: https://bit.ly/3TtazL0 Sample Code: https://github.com/binghamchris/succulentpi