EdOliver
Created February 11, 2020 © MIT

AgroJetson: Urban Agriculture AIoT solution.

Sustainable sensing and automated irrigation platform with predictive analysis via the Nvidia Jetson Nano.

AdvancedFull instructions provided18 hours395

Things used in this project

Hardware components

NVIDIA Jetson Nano Developer Kit
NVIDIA Jetson Nano Developer Kit
×1
Argon
Particle Argon
×1
Grove Starter Kit for Particle Mesh
Seeed Studio Grove Starter Kit for Particle Mesh
×1
Hose
×1
Seeed solar Panel
×1
Solenoid Valve, 2 Way
Solenoid Valve, 2 Way
×1
Darlington High Power Transistor
Darlington High Power Transistor
×1
Seeed Lipo rider Pro
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×1
Resistor 1k ohm
Resistor 1k ohm
×3
Resistor 4.75k ohm
Resistor 4.75k ohm
×1
Plumbing adapters
×1
Webcam, Logitech® HD Pro
Webcam, Logitech® HD Pro
×1
Photon
Particle Photon
×1

Software apps and online services

Node-RED
Node-RED
Openweathermap
Nvidia Jetson SDK
Jupyter Notebook
Jupyter Notebook
TensorFlow
TensorFlow
OpenCV
OpenCV

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Soldering Tools

Story

Read more

Custom parts and enclosures

Agrojetson Sensor hub

This is the 3D CAD file for the top of the sensor hub.

Agrojetson sensor Hub 2

This is the bottom 3D CAD file.

Jetson Case top by Ecoiras on thingiverse

NanoBox -- Connectors' Edition by ecoiras

A remix of the NanoBox Case for the Nvidia Jetson Nano Developer Kit with more precut slots for connecting stuff.

Apart from the slot for the expansion header already in the original NanoBox, this version includes precut openings for:

Serial port header,
Camera connector,
Fan header,
SMA antennas.
I didn't add a specific opening for the button header because their cables can easily fit through the adjacent serial or camera slots, and 6mm toggle switches and buttons can be mounted on the SMA openings.

Several configurations are possible for the antennas, see the photos for some potential arrangements. The antennas shown are from the Intel 8265 Desktop Wireless M.2 Kit.

The model shown in the photos was printed on a PRUSA I3 MK3 using 0.2mm layers. Filaments are PLA Bq grey and Winbo orange. Prints without supports.

https://www.thingiverse.com/thing:3603594

Jetson Case botton by Ecoiras

https://www.thingiverse.com/thing:3603594/files

Schematics

Automated Irrigation System

These are the schematics for the irrigation part of the system.

System Architecture

system Architecture

Code

Particle Photon Code

C/C++
This code is to activate the irrigation system whenever the conditions of the Node-RED flow are met. In fact whenever the platform detects that there will be no rain and the sensors indicate that the soil is dry, it will send a signal to the Valve portion and it will activate.
// -----------------------------------
// Controlling Aggrofox's irrigation over the Internet
// -----------------------------------

// First, let's create our "shorthand" for the pins
// Same as in the Blink an LED example:
// led1 is D0, led2 is D7

int led1 = D0;
int led2 = D7;

// Last time, we only needed to declare pins in the setup function.
// This time, we are also going to register our Particle function

void setup()
{

   // Here's the pin configuration, same as last time
   pinMode(led1, OUTPUT);
   pinMode(led2, OUTPUT);

   // We are also going to declare a Particle.function so that we can turn the LED on and off from the cloud.
   Particle.function("led",ledToggle);
   // This is saying that when we ask the cloud for the function "led", it will employ the function ledToggle() from this app.

   // For good measure, let's also make sure both LEDs are off when we start:
   digitalWrite(led1, LOW);
   digitalWrite(led2, LOW);

}


// Last time, we wanted to continously blink the LED on and off
// Since we're waiting for input through the cloud this time,
// we don't actually need to put anything in the loop

void loop()
{
   // Nothing to do here
}

// We're going to have a super cool function now that gets called when a matching API request is sent
// This is the ledToggle function we registered to the "led" Particle.function earlier.


int ledToggle(String command) {
    /* Particle.functions always take a string as an argument and return an integer.
    Since we can pass a string, it means that we can give the program commands on how the function should be used.
    In this case, telling the function "on" will turn the LED on and telling it "off" will turn the LED off.
    Then, the function returns a value to us to let us know what happened.
    In this case, it will return 1 for the LEDs turning on, 0 for the LEDs turning off,
    and -1 if we received a totally bogus command that didn't do anything to the LEDs.
    */

    if (command=="on") {
        
        digitalWrite(led1,HIGH);
        digitalWrite(led2,HIGH);
        delay(30000);
        digitalWrite(led1,LOW);
        digitalWrite(led2,LOW);
        return 1;
        
    }
    /*Well we are going to irrigate them plants for 30 seconds each time we need
    */
    else if (command=="off") {
        digitalWrite(led1,LOW);
        digitalWrite(led2,LOW);
        return 0;
    }
    else {
        return -1;
    }
}

Node RED flow example

JavaScript
Note: You have to input your credentials!
[{"id":"d54f704.bf0ee9","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"b71e9be9.a530e8","type":"ui_gauge","z":"d54f704.bf0ee9","name":"Tempamb","group":"da917d62.21223","order":1,"width":0,"height":0,"gtype":"gage","title":"","label":"°C","format":"{{value}}","min":0,"max":"55","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":849,"y":51,"wires":[]},{"id":"c2ed1e76.6c3a3","type":"inject","z":"d54f704.bf0ee9","name":"","topic":"","payload":"","payloadType":"date","repeat":"180","crontab":"","once":false,"onceDelay":0.1,"x":256,"y":155.5,"wires":[["cc28bd73.e9db8","3fea0ab7.5fdbb6"]]},{"id":"cc28bd73.e9db8","type":"http request","z":"d54f704.bf0ee9","name":"letempambchannel","method":"GET","ret":"obj","paytoqs":false,"url":"","tls":"","proxy":"","authType":"","x":430,"y":183.8000030517578,"wires":[["bc683765.9ebe28","b55ba38a.80c78","33503075.93f02","dd55dab6.debea8","75a7f137.cf319"]]},{"id":"bc683765.9ebe28","type":"function","z":"d54f704.bf0ee9","name":"Field1","func":"if (msg.topic= '/TTemp'){\n    return msg\n}\nelse null","outputs":1,"noerr":0,"x":628,"y":164.8000030517578,"wires":[["b71e9be9.a530e8","bc639e29.675ff","5ea9f2f3.eacbcc"]]},{"id":"b55ba38a.80c78","type":"function","z":"d54f704.bf0ee9","name":"Field 2","func":"if (msg.topic= 'THumd'){\n    return msg\n}\nelse null","outputs":1,"noerr":0,"x":637.0000076293945,"y":228.8000032901764,"wires":[["2bbd01c5.c6571e","68ab5dff.826884","d82d8369.04b55"]]},{"id":"33503075.93f02","type":"function","z":"d54f704.bf0ee9","name":"Field 3","func":"if (msg.topic= '/Hi'){\n    return msg\n}\nelse null","outputs":1,"noerr":0,"x":631,"y":295.79998779296875,"wires":[["d8453f36.ce3ff","9a9d3455.4b8078","2db10adf.a490d6"]]},{"id":"dd55dab6.debea8","type":"function","z":"d54f704.bf0ee9","name":"Field 4","func":"if (msg.topic= '/Temp'){\n    return msg\n}\nelse null","outputs":1,"noerr":0,"x":770,"y":488.7999572753906,"wires":[["69e52fbe.28b02","5f3a9c37.7dfc24"]]},{"id":"75a7f137.cf319","type":"function","z":"d54f704.bf0ee9","name":"Field 5","func":"if (msg.topic= '/Humd'){\n    return msg\n}\nelse null","outputs":1,"noerr":0,"x":724,"y":586.7999267578125,"wires":[["138d670.cdc4599","659d0c77.d93544"]]},{"id":"bc639e29.675ff","type":"ui_chart","z":"d54f704.bf0ee9","name":"","group":"da917d62.21223","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"604800","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":868,"y":179,"wires":[[]]},{"id":"2bbd01c5.c6571e","type":"ui_gauge","z":"d54f704.bf0ee9","name":"","group":"943d39a6.673eb8","order":1,"width":0,"height":0,"gtype":"gage","title":"","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":883,"y":246,"wires":[]},{"id":"68ab5dff.826884","type":"ui_chart","z":"d54f704.bf0ee9","name":"","group":"943d39a6.673eb8","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0f","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":879,"y":286,"wires":[[]]},{"id":"d8453f36.ce3ff","type":"ui_text","z":"d54f704.bf0ee9","group":"fa354d69.38286","order":1,"width":0,"height":0,"name":"","label":"32.2 °C es un indice óptimo","format":"{{msg.payload}}","layout":"row-spread","x":949,"y":339,"wires":[]},{"id":"9a9d3455.4b8078","type":"ui_chart","z":"d54f704.bf0ee9","name":"","group":"fa354d69.38286","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9367bc","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":870,"y":382,"wires":[[]]},{"id":"2db10adf.a490d6","type":"ui_gauge","z":"d54f704.bf0ee9","name":"","group":"fa354d69.38286","order":3,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"°C","format":"{{value}}","min":"15","max":"44.4","colors":["#fff647","#0fe600","#ca3838"],"seg1":"","seg2":"","x":878,"y":426,"wires":[]},{"id":"69e52fbe.28b02","type":"ui_gauge","z":"d54f704.bf0ee9","name":"","group":"1eea84e2.a6a39b","order":1,"width":0,"height":0,"gtype":"gage","title":"","label":"°C","format":"{{value}}","min":0,"max":"55","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":953,"y":476.99993896484375,"wires":[]},{"id":"5f3a9c37.7dfc24","type":"ui_chart","z":"d54f704.bf0ee9","name":"","group":"1eea84e2.a6a39b","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#99df8b","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":2,"x":950,"y":516.9999389648438,"wires":[[],[]]},{"id":"138d670.cdc4599","type":"ui_gauge","z":"d54f704.bf0ee9","name":"","group":"ac4dfa91.7834e8","order":1,"width":0,"height":0,"gtype":"gage","title":"gauge","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":926,"y":565.9999389648438,"wires":[]},{"id":"659d0c77.d93544","type":"ui_chart","z":"d54f704.bf0ee9","name":"","group":"ac4dfa91.7834e8","order":2,"width":0,"height":0,"label":"","chartType":"line","legend":"false","xformat":"dd HH:mm","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9367bc","#c5b0d5"],"useOldStyle":false,"outputs":2,"x":930,"y":603.9999389648438,"wires":[[],[]]},{"id":"3fea0ab7.5fdbb6","type":"openweathermap","z":"d54f704.bf0ee9","name":"le weather","wtype":"forecast","lon":"-111.6252","lat":"28.6208","city":"","country":"","language":"en","x":294,"y":328.54998779296875,"wires":[["57629c1a.d40d34","f5161b3b.485d68"]]},{"id":"57629c1a.d40d34","type":"debug","z":"d54f704.bf0ee9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":426,"y":247.64999389648438,"wires":[]},{"id":"f5161b3b.485d68","type":"function","z":"d54f704.bf0ee9","name":"","func":"msg.payload= msg.payload[0].weather[0].main\nmsg.count = msg.payload\nreturn msg;","outputs":1,"noerr":0,"x":432,"y":386.79998779296875,"wires":[["d138d2e6.c6d0b","7c117a1c.e964c4","d7c75f54.44c41"]]},{"id":"d138d2e6.c6d0b","type":"ui_text","z":"d54f704.bf0ee9","group":"a0b15c24.8c44f","order":1,"width":0,"height":0,"name":"","label":"Weather forecast next 5hr:","format":"{{msg.payload}}","layout":"row-spread","x":417,"y":568.9999694824219,"wires":[]},{"id":"a6824305.b2afb","type":"inject","z":"d54f704.bf0ee9","name":"","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":277,"y":636.4999694824219,"wires":[["7b14c92c.984058"]]},{"id":"b75ebb82.10c468","type":"debug","z":"d54f704.bf0ee9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1061,"y":727.6499938964844,"wires":[]},{"id":"db1d7f95.a8022","type":"inject","z":"d54f704.bf0ee9","name":"","topic":"","payload":"off","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":246,"y":682.4999694824219,"wires":[["7b14c92c.984058"]]},{"id":"d82d8369.04b55","type":"link out","z":"d54f704.bf0ee9","name":"","links":["a5e4a74e.02cf88"],"x":866,"y":114.65000915527344,"wires":[]},{"id":"a5e4a74e.02cf88","type":"link in","z":"d54f704.bf0ee9","name":"","links":["d82d8369.04b55"],"x":164,"y":751.4999694824219,"wires":[["d7c75f54.44c41"]]},{"id":"d7c75f54.44c41","type":"function","z":"d54f704.bf0ee9","name":"","func":"if (msg.topic<=10 && msg.count != 'Rain' && msg.count !=null){\n    msg.payload= 'on'\n}\nelse{\n    msg.payload= 'off'\n}\nreturn msg;","outputs":1,"noerr":0,"x":507,"y":712.8000183105469,"wires":[["7b14c92c.984058"]]},{"id":"7c117a1c.e964c4","type":"debug","z":"d54f704.bf0ee9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"count","x":534,"y":795.6499938964844,"wires":[]},{"id":"92230e74.58da8","type":"inject","z":"d54f704.bf0ee9","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":198,"y":416.5,"wires":[["17e473f4.94fccc"]]},{"id":"17e473f4.94fccc","type":"function","z":"d54f704.bf0ee9","name":"","func":"msg.count = 'Arid'\nreturn msg;","outputs":1,"noerr":0,"x":227,"y":470.79998779296875,"wires":[["d7c75f54.44c41"]]},{"id":"faf966fe.81b9c8","type":"inject","z":"d54f704.bf0ee9","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":317,"y":839.4999694824219,"wires":[["d7c75f54.44c41"]]},{"id":"7b14c92c.984058","type":"particle-func","z":"d54f704.bf0ee9","pcloud":"","devid":"","fname":"led","param":"","productIdOrSlug":"","repeat":0,"once":false,"x":690.6000366210938,"y":684,"wires":[["b75ebb82.10c468"]]},{"id":"41630b81.dc6664","type":"mqtt out","z":"d54f704.bf0ee9","name":"","topic":"trololo","qos":"","retain":"","broker":"3d531172.90ad8e","x":609.2000350952148,"y":95,"wires":[]},{"id":"834f5172.edce9","type":"inject","z":"d54f704.bf0ee9","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":408.2000045776367,"y":101,"wires":[["41630b81.dc6664"]]},{"id":"a4420acd.382008","type":"mqtt in","z":"d54f704.bf0ee9","name":"","topic":"/TTemp","qos":"2","datatype":"auto","broker":"3d531172.90ad8e","x":412.2000045776367,"y":40,"wires":[["bc683765.9ebe28","310e6798.9ab728"]]},{"id":"5ea9f2f3.eacbcc","type":"debug","z":"d54f704.bf0ee9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":767.2000122070312,"y":92.60000610351562,"wires":[]},{"id":"310e6798.9ab728","type":"debug","z":"d54f704.bf0ee9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":574.2000350952148,"y":31.599998474121094,"wires":[]},{"id":"3d6ed8a6.558558","type":"mqtt in","z":"d54f704.bf0ee9","name":"","topic":"/THumd","qos":"2","datatype":"auto","broker":"3d531172.90ad8e","x":448.6000518798828,"y":142.00000190734863,"wires":[["b55ba38a.80c78"]]},{"id":"c10cf99b.177428","type":"ui_template","z":"d54f704.bf0ee9","group":"2940f35.d8d240c","name":"","order":1,"width":0,"height":0,"format":"<html>\n<header><title>This is title</title></header>\n<body>\n    <iframe width=\"1069\" height=\"446.5\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/spreadsheets/d/e/2PACX-1vQBt0I9iXxAO153xp-T_Y3AGqmvmt9b4N1buaUZczVZDK6fRn6ogxORRZV2ksr4eHo85yr_6L1OY0Kq/pubchart?oid=935060044&amp;format=interactive\"></iframe>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":719.0001106262207,"y":862.0000123977661,"wires":[[]]},{"id":"7a84350e.52502c","type":"mqtt in","z":"d54f704.bf0ee9","name":"","topic":"/Temp","qos":"2","datatype":"auto","broker":"3d531172.90ad8e","x":460.60003662109375,"y":340,"wires":[["dd55dab6.debea8"]]},{"id":"a0232e37.b75bc","type":"mqtt in","z":"d54f704.bf0ee9","name":"","topic":"/Humd","qos":"2","datatype":"auto","broker":"3d531172.90ad8e","x":415.60003662109375,"y":516,"wires":[["75a7f137.cf319"]]},{"id":"98ee5684.f95328","type":"mqtt in","z":"d54f704.bf0ee9","name":"","topic":"/Hi","qos":"2","datatype":"auto","broker":"3d531172.90ad8e","x":450.60003662109375,"y":291,"wires":[["33503075.93f02"]]},{"id":"9f300d50.5ba36","type":"ui_template","z":"d54f704.bf0ee9","group":"3bbc941d.0f26ac","name":"","order":1,"width":0,"height":0,"format":"<html>\n<header><title>This is title</title></header>\n<body>\n   <iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/spreadsheets/d/e/2PACX-1vQBt0I9iXxAO153xp-T_Y3AGqmvmt9b4N1buaUZczVZDK6fRn6ogxORRZV2ksr4eHo85yr_6L1OY0Kq/pubchart?oid=329475502&amp;format=interactive\"></iframe>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":815.6000595092773,"y":899.8000135421753,"wires":[[]]},{"id":"1f719032.401ed","type":"ui_template","z":"d54f704.bf0ee9","group":"de9fe46d.6ef1e8","name":"","order":1,"width":0,"height":0,"format":"<html>\n<header><title>This is title</title></header>\n<body>\n    <iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/spreadsheets/d/e/2PACX-1vQBt0I9iXxAO153xp-T_Y3AGqmvmt9b4N1buaUZczVZDK6fRn6ogxORRZV2ksr4eHo85yr_6L1OY0Kq/pubchart?oid=239510864&amp;format=interactive\"></iframe>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":888.6000137329102,"y":863.0000123977661,"wires":[[]]},{"id":"da5e18b4.652db8","type":"comment","z":"d54f704.bf0ee9","name":"Corn Historics","info":"\n","x":809.6000366210938,"y":824,"wires":[]},{"id":"55b53593.1c2f0c","type":"comment","z":"d54f704.bf0ee9","name":"Wheat Historics","info":"","x":820.6000366210938,"y":957,"wires":[]},{"id":"98137703.4780b8","type":"comment","z":"d54f704.bf0ee9","name":"Tomato Historics","info":"","x":425.60005950927734,"y":912.0000171661377,"wires":[]},{"id":"24ad6bd2.f1f1f4","type":"ui_template","z":"d54f704.bf0ee9","group":"e8d3af85.b2848","name":"","order":1,"width":0,"height":0,"format":"<html>\n<header><title>This is title</title></header>\n<body>\n    <iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/spreadsheets/d/e/2PACX-1vQBt0I9iXxAO153xp-T_Y3AGqmvmt9b4N1buaUZczVZDK6fRn6ogxORRZV2ksr4eHo85yr_6L1OY0Kq/pubchart?oid=419017878&amp;format=interactive\"></iframe>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":685.6000366210938,"y":1009,"wires":[[]]},{"id":"4ffa8be7.399834","type":"ui_template","z":"d54f704.bf0ee9","group":"838c1d4a.34ff5","name":"","order":1,"width":0,"height":0,"format":"<html>\n<header><title>This is title</title></header>\n<body>\n    <iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/spreadsheets/d/e/2PACX-1vQBt0I9iXxAO153xp-T_Y3AGqmvmt9b4N1buaUZczVZDK6fRn6ogxORRZV2ksr4eHo85yr_6L1OY0Kq/pubchart?oid=240193536&amp;format=interactive\"></iframe>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":823.6000366210938,"y":1009,"wires":[[]]},{"id":"e9e5a105.7b037","type":"ui_template","z":"d54f704.bf0ee9","group":"12e7ee6f.cd9d62","name":"","order":1,"width":0,"height":0,"format":"<html>\n<header><title>This is title</title></header>\n<body>\n    <iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/spreadsheets/d/e/2PACX-1vQBt0I9iXxAO153xp-T_Y3AGqmvmt9b4N1buaUZczVZDK6fRn6ogxORRZV2ksr4eHo85yr_6L1OY0Kq/pubchart?oid=1503080058&amp;format=interactive\"></iframe>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":736.6000366210938,"y":1060,"wires":[[]]},{"id":"6c90c595.b2e7bc","type":"ui_template","z":"d54f704.bf0ee9","group":"6650034d.326bdc","name":"","order":1,"width":0,"height":0,"format":"<html>\n<header><title>This is title</title></header>\n<body>\n    <iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/spreadsheets/d/e/2PACX-1vQBt0I9iXxAO153xp-T_Y3AGqmvmt9b4N1buaUZczVZDK6fRn6ogxORRZV2ksr4eHo85yr_6L1OY0Kq/pubchart?oid=1674563645&amp;format=interactive\"></iframe>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":337.6000061035156,"y":954,"wires":[[]]},{"id":"9839ba3b.00fe58","type":"ui_template","z":"d54f704.bf0ee9","group":"cf91e364.e8a0f","name":"","order":1,"width":0,"height":0,"format":"<html>\n<header><title>This is title</title></header>\n<body>\n    <iframe width=\"600\" height=\"371\" seamless frameborder=\"0\" scrolling=\"no\" src=\"https://docs.google.com/spreadsheets/d/e/2PACX-1vQBt0I9iXxAO153xp-T_Y3AGqmvmt9b4N1buaUZczVZDK6fRn6ogxORRZV2ksr4eHo85yr_6L1OY0Kq/pubchart?oid=77549386&amp;format=interactive\"></iframe>\n</body>\n</html>","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":472.6000061035156,"y":954,"wires":[[]]},{"id":"3cece591.4ed3aa","type":"ui_text","z":"d54f704.bf0ee9","group":"b71602f7.89cbc","order":0,"width":0,"height":0,"name":"","label":"Tendency: Strong Sell","format":"{{msg.payload}}","layout":"row-spread","x":995.6000137329102,"y":897.0000095367432,"wires":[]},{"id":"cc849ed0.d6a19","type":"ui_text","z":"d54f704.bf0ee9","group":"ab3d5fbb.a8cff","order":0,"width":0,"height":0,"name":"","label":"Tendency: Strong Sell","format":"{{msg.payload}}","layout":"row-spread","x":925.6000366210938,"y":1056,"wires":[]},{"id":"f6acf20d.9335a","type":"ui_text","z":"d54f704.bf0ee9","group":"475df64c.fb8418","order":1,"width":0,"height":0,"name":"","label":"253 m2/ha per month","format":"{{msg.payload}}","layout":"row-spread","x":1082.5999755859375,"y":836,"wires":[]},{"id":"5d4af0cf.67b78","type":"mqtt in","z":"d54f704.bf0ee9","name":"","topic":"/AgroJetson","qos":"2","datatype":"auto","broker":"3d531172.90ad8e","x":416.5,"y":431,"wires":[["ea57f083.78f75","59b7bb1a.5780a4"]]},{"id":"ea57f083.78f75","type":"function","z":"d54f704.bf0ee9","name":"Jetson feed","func":"if (msg.topic= '/AgroJetson'){\n    return msg\n}\nelse null\n","outputs":1,"noerr":0,"x":672.5,"y":380,"wires":[["3f38bd11.0c9512"]]},{"id":"3f38bd11.0c9512","type":"ui_text","z":"d54f704.bf0ee9","group":"1bff5372.0ef22d","order":4,"width":0,"height":0,"name":"","label":"Ripeness detector:","format":"{{msg.payload}}","layout":"row-spread","x":1122.5,"y":408,"wires":[]},{"id":"59b7bb1a.5780a4","type":"debug","z":"d54f704.bf0ee9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":582.5,"y":474,"wires":[]},{"id":"da917d62.21223","type":"ui_group","z":"","name":"Soil Temperature","tab":"ff7289e7.1cdf78","disp":true,"width":"6","collapse":false},{"id":"943d39a6.673eb8","type":"ui_group","z":"","name":"Soil Humidity","tab":"ff7289e7.1cdf78","disp":true,"width":"6","collapse":false},{"id":"fa354d69.38286","type":"ui_group","z":"","name":"Heat index","tab":"ff7289e7.1cdf78","disp":true,"width":"6","collapse":false},{"id":"1eea84e2.a6a39b","type":"ui_group","z":"","name":"Ambient Temperature","tab":"ff7289e7.1cdf78","disp":true,"width":"6","collapse":false},{"id":"ac4dfa91.7834e8","type":"ui_group","z":"","name":"Humidity","tab":"ff7289e7.1cdf78","disp":true,"width":"6","collapse":false},{"id":"a0b15c24.8c44f","type":"ui_group","z":"","name":"Weather Forecast","tab":"ff7289e7.1cdf78","disp":true,"width":"6","collapse":false},{"id":"3d531172.90ad8e","type":"mqtt-broker","z":"","name":"cloudmqtt","broker":"","port":"13853","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"2940f35.d8d240c","type":"ui_group","z":"","name":"Sembrado, cosechado, obtenido","tab":"145dad5c.d9e343","disp":true,"width":21,"collapse":false},{"id":"3bbc941d.0f26ac","type":"ui_group","z":"","name":"Productividad","tab":"145dad5c.d9e343","disp":true,"width":"12","collapse":false},{"id":"de9fe46d.6ef1e8","type":"ui_group","z":"","name":"Precio","tab":"145dad5c.d9e343","disp":true,"width":12,"collapse":false},{"id":"e8d3af85.b2848","type":"ui_group","z":"","name":"Tendencia general","tab":"8e80e1c.5bcb22","disp":true,"width":12,"collapse":false},{"id":"838c1d4a.34ff5","type":"ui_group","z":"","name":"Productividad trigo","tab":"8e80e1c.5bcb22","disp":true,"width":12,"collapse":false},{"id":"12e7ee6f.cd9d62","type":"ui_group","z":"","name":"Precio","tab":"8e80e1c.5bcb22","disp":true,"width":12,"collapse":false},{"id":"6650034d.326bdc","type":"ui_group","z":"","name":"Tendencia Jitomate","tab":"c76e23e3.dfa49","disp":true,"width":12,"collapse":false},{"id":"cf91e364.e8a0f","type":"ui_group","z":"","name":"Productividad ","tab":"c76e23e3.dfa49","disp":true,"width":12,"collapse":false},{"id":"b71602f7.89cbc","type":"ui_group","z":"","name":"Pronóstico","tab":"145dad5c.d9e343","disp":true,"width":"6","collapse":false},{"id":"ab3d5fbb.a8cff","type":"ui_group","z":"","name":"Pronóstico trigo","tab":"8e80e1c.5bcb22","disp":true,"width":"6","collapse":false},{"id":"475df64c.fb8418","type":"ui_group","z":"","name":"Water Consumption","tab":"ff7289e7.1cdf78","disp":true,"width":"6","collapse":false},{"id":"1bff5372.0ef22d","type":"ui_group","z":"","name":"Ripeness","tab":"ff7289e7.1cdf78","disp":true,"width":"6","collapse":false},{"id":"ff7289e7.1cdf78","type":"ui_tab","z":"","name":"AgroFox","icon":"dashboard","disabled":false,"hidden":false},{"id":"145dad5c.d9e343","type":"ui_tab","z":"","name":"Historicos Maiz","icon":"dashboard","order":2,"disabled":false,"hidden":false},{"id":"8e80e1c.5bcb22","type":"ui_tab","z":"","name":"Históricos Trigo","icon":"dashboard","disabled":false,"hidden":false},{"id":"c76e23e3.dfa49","type":"ui_tab","z":"","name":"Históricos Jitomate","icon":"dashboard","disabled":false,"hidden":false}]

Argon Code

C/C++
This is the Argon code, just input credentials for the MQTT.
#include <OneWire.h>
#include <Adafruit_DHT.h>
#include "DS18.h"
#include "MQTT.h"
#include "Adafruit_DHT.h"

#define DHTPIN 2     // what pin we're connected to
#define DHTTYPE DHT11    // DHT 11 

void callback(char* topic, byte* payload, unsigned int length);

DS18 sensor(5);
MQTT client("m12.cloudmqtt.com", YOURPORT, callback);
DHT dht(DHTPIN, DHTTYPE);

char* string2char(String command){
    if(command.length()!=0){
        char *p = const_cast<char*>(command.c_str());
        return p;
    }
}

// recieve message
void callback(char* topic, byte* payload, unsigned int length) {
    delay(1000);
}


void setup() {
    dht.begin();
    delay(5000);

    // connect to the server
    client.connect("Particle","YOUR_USER","YOUR_PASSWORD");

    // publish/subscribe
    if (client.isConnected()) {
        //client.publish("outTopic/message","hello world");
        //client.subscribe("inTopic/message");
    }
}

void loop() {
    if (client.isConnected())
    {
        client.loop();
    }
    float h = dht.getHumidity();
  float t = dht.getTempCelcius();
  float hi = dht.getHeatIndex();
  if (sensor.read()) {
    // Do something cool with the temperature
    float sensorValue = 0.04098360*analogRead(A0)-4.5081967;
    client.publish("/TTemp",string2char(String(round(sensor.celsius()))));
    client.publish("/THumd",string2char(String(round(sensorValue))));
    client.publish("/Humd",string2char(String(round(h))));
  client.publish("/Temp",string2char(String(round(t))));
  client.publish("/Hi",string2char(String(round(hi))));
  delay(5000);
  }

}

AgroJetson Github

the project github with the full documantation and code.

Credits

EdOliver

EdOliver

38 projects • 73 followers
Engineer, Scientist, Maker. Entrepreneur and Futurist.
Thanks to Victor Altamirano.

Comments